transit

package
v0.0.0-...-bb3eb04 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrStopNotFound is returned if the queried stop isn't found
	ErrStopNotFound = status.New(codes.NotFound, "stop not found")
	// ErrStopCutoffInvalid is returned if the stop cutoff is invalid
	ErrStopCutoffInvalid = status.New(codes.InvalidArgument, "stop cutoff not a valid time")
)

Functions

This section is empty.

Types

type Feed

type Feed struct {
	// contains filtered or unexported fields
}

Feed represents a single feed, potentially encapsulating both static and real-time elements.

func NewFeed

func NewFeed(logger *zap.Logger, dataset *gtfs.Dataset, realtimePath string) *Feed

NewFeed creates a new feed from the supplied dataset and the realtime path.

func (*Feed) GetRealtimeFeed

func (f *Feed) GetRealtimeFeed(ctx context.Context) (*gtfs_realtime.FeedMessage, error)

GetRealtimeFeed retrieves the GTFS realtime data.

func (*Feed) MonitorRealtimeFeed

func (f *Feed) MonitorRealtimeFeed(ctx context.Context)

MonitorRealtimeFeed periodically polls the realtime feed endpoint and updates the times for the trips.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is a really simple service that retrieves a transit feed

func NewService

func NewService(logger *zap.Logger) *Service

NewService creates a new service

func (*Service) AddFeed

func (s *Service) AddFeed(feed *Feed)

AddFeed adds a GTFS dataset to this transit instance.

func (*Service) GetStopArrivals

func (s *Service) GetStopArrivals(ctx context.Context, req *GetStopArrivalsRequest) (*GetStopArrivalsResponse, error)

GetStopArrivals returns the arrival info for the specified stop.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL