partners

package
v0.0.0-...-543e6d5 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoPartner means there is no configured partner for this route
	ErrNoPartner = errors.New("no partner for this route")
)

Functions

This section is empty.

Types

type P

type P interface {
	// Precache is called by the precacher binary and saves raw bytes of
	// response into redis. Doing precache prevents clients from hammering
	// partner serves and also ensures our own responses are fast.
	// The precacher will call this function for every valid
	// agency / route / direction combo that returns a partner with
	// Find().
	Precache(agencyID, routeID string, directionID int) error

	// Live reads the data saved into redis by Precache, parses it and
	// returns any Departure and/or Vehicle info that can be appended
	// to the response.
	Live(agencyID, routeID, stopID string, directionID int) ([]*models.Departure, []models.Vehicle, error)

	IsLive() bool
}

P is an interface that can pull live info from partners

func Find

func Find(route models.Route) (P, error)

Find returns the correct partner for this route. If there is no partner, ErrNoPartner is returned

Directories

Path Synopsis
Package nyct_subway is a generated protocol buffer package.
Package nyct_subway is a generated protocol buffer package.
Package transit_realtime is a generated protocol buffer package.
Package transit_realtime is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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