Documentation ¶
Overview ¶
LDB - Live Departure Boards
Index ¶
- func DeleteSchedule(tx *bolt.Tx, rid []byte)
- func GetSchedule(tx *bolt.Tx, rid string) *darwind3.Schedule
- func PutSchedule(tx *bolt.Tx, sched *darwind3.Schedule) bool
- func RemoveSchedule(tx *bolt.Tx, rid []byte)
- type LDB
- func (d *LDB) DBStatus()
- func (d *LDB) GetSchedule(rid string) *darwind3.Schedule
- func (d *LDB) GetServices(s *Station, from *util.WorkingTime, to *util.WorkingTime) []ServiceEntry
- func (d *LDB) GetStationCrs(crs string) *Station
- func (d *LDB) GetStationTiploc(tiploc string) *Station
- func (d *LDB) Init(dbFile string) error
- func (d *LDB) PurgeOrphans()
- func (d *LDB) PurgeSchedules()
- func (d *LDB) PurgeServices()
- func (d *LDB) PutSchedule(s *darwind3.Schedule) error
- func (d *LDB) PutStation(s *Station)
- func (d *LDB) RefreshStations()
- func (d *LDB) RemoveSchedule(rid string)
- func (d *LDB) RequestStationMessages()
- func (d *LDB) Update(f func(tx *bolt.Tx) error) error
- func (d *LDB) View(f func(tx *bolt.Tx) error) error
- type Service
- type ServiceEntry
- type Station
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteSchedule ¶
func RemoveSchedule ¶
Types ¶
type LDB ¶
type LDB struct { Darwin string Reference string EventManager *darwind3.DarwinEventManager // contains filtered or unexported fields }
func (*LDB) GetServices ¶
func (d *LDB) GetServices(s *Station, from *util.WorkingTime, to *util.WorkingTime) []ServiceEntry
GetServices returns all Services that have not yet departed that are within the specified time range. If from is before to then it's resumed the time range crosses midnight.
func (*LDB) GetStationCrs ¶
GetStationCrs returns the Station instance by CRS or nil if not found Unlike GetStationTiploc this will not create a station if it's not found
func (*LDB) GetStationTiploc ¶
GetStationTiploc returns the Station instance by Tiploc or nil if not found. Note: If we don't have an entry then this will create one
func (*LDB) PurgeOrphans ¶
func (d *LDB) PurgeOrphans()
func (*LDB) PurgeSchedules ¶
func (d *LDB) PurgeSchedules()
func (*LDB) PurgeServices ¶
func (d *LDB) PurgeServices()
PurgeServices looks for any services who's schedule has been deleted
func (*LDB) PutStation ¶
func (*LDB) RefreshStations ¶
func (d *LDB) RefreshStations()
RefreshStations ensures we have all Public stations defined on startup. Not doing so incurs a performance hit when a train references it for the first time.
func (*LDB) RemoveSchedule ¶
func (*LDB) RequestStationMessages ¶
func (d *LDB) RequestStationMessages()
type Service ¶
type Service struct { // The RID of this service RID string `json:"rid"` // The destination - use this and not Dest.Tiploc as this can be overridden // if Location.FalseDestination is set Destination string `json:"destination"` // Origin Location of this service Origin darwind3.Location `json:"origin"` // Destination Location of this service Dest darwind3.Location `json:"dest"` // Where this train terminates Terminates darwind3.Location `json:"terminates"` // Service Start Date SSD util.SSD `json:"ssd"` // The trainId (headcode) TrainId string `json:"trainId"` // The operator of this service Toc string `json:"toc"` // Is a passenger service PassengerService bool `json:"passengerService,omitempty"` // Is a charter service Charter bool `json:"charter,omitempty"` // Cancel running reason for this service. The reason applies to all locations // of this service which are marked as cancelled CancelReason darwind3.DisruptionReason `json:"cancelReason"` // Late running reason for this service. The reason applies to all locations // of this service which are not marked as cancelled LateReason darwind3.DisruptionReason `json:"lateReason"` // The "time" for this service Location darwind3.Location `json:"location"` // The calling points from this location CallingPoints []darwind3.CallingPoint `json:"calling"` // The last report LastReport darwind3.CallingPoint `json:"lastReport,omitempty"` // The associations Associations []*darwind3.Association `json:"association"` // Formation data Formation darwind3.ScheduleFormation `json:"formation"` // The index within the schedule of this location LocationIndex int `json:"locind"` // The time this entry was set Date time.Time `json:"date,omitempty" xml:"date,attr,omitempty"` // contains filtered or unexported fields }
A representation of a service at a location
type ServiceEntry ¶
Entry in the DB, just the essential data
func ServiceEntryFromBytes ¶
func ServiceEntryFromBytes(b []byte) ServiceEntry
ScheduleFromBytes returns a schedule based on a slice or nil if none
func (*ServiceEntry) Bytes ¶
func (s *ServiceEntry) Bytes() ([]byte, error)
Bytes returns the message as an encoded byte slice
type Station ¶
type Station struct { // The location details for this station Locations []*darwinref.Location Crs string // This station is Public - i.e. has a CRS so can have departures Public bool // The Station message id's applicable to this station Messages []int64 }
The holder for a station's departure boards
func StationFromBytes ¶
ScheduleFromBytes returns a schedule based on a slice or nil if none
func (*Station) GetMessages ¶
func (s *Station) GetMessages(client *d3client.DarwinD3Client) []*darwind3.StationMessage
GetMessages returns all station Messages for this Station.