Documentation
¶
Index ¶
- func FormatAgencyPlaces(places []builders.AgencyPlace) string
- func GeneratedOperatorOnestopID(feedOnestopID, agencyName string) string
- func HideUnseedFeeds(ctx context.Context, atx tldb.Adapter, found []int) (int, error)
- func HideUnseedOperators(atx tldb.Adapter, found []int) (int, error)
- func UpdateFeed(ctx context.Context, atx tldb.Adapter, rfeed dmfr.Feed, setPublic *bool) (int, bool, bool, error)
- func UpdateFeedGeneratedOperators(ctx context.Context, atx tldb.Adapter, found []int) error
- func UpdateOperator(ctx context.Context, atx tldb.Adapter, operator dmfr.Operator) (int, bool, bool, error)
- type FeedAgencies
- type FeedAgency
- type OifPlan
- type OifRow
- type Options
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatAgencyPlaces ¶ added in v1.4.1
func FormatAgencyPlaces(places []builders.AgencyPlace) string
FormatAgencyPlaces returns the resolved places of an operator-in-feed row from its agency's places.
It lists the places ranked over 0.2, highest rank first, each once, joined with " / ". Places that tie in rank keep their order in places.
func GeneratedOperatorOnestopID ¶ added in v1.4.1
GeneratedOperatorOnestopID is the onestop id sync gives the operator it generates for an agency that has no onestop id of its own.
func HideUnseedFeeds ¶
HideUnseedFeeds .
func HideUnseedOperators ¶
HideUnseedOperators .
func UpdateFeed ¶
func UpdateFeed(ctx context.Context, atx tldb.Adapter, rfeed dmfr.Feed, setPublic *bool) (int, bool, bool, error)
UpdateFeed .
func UpdateFeedGeneratedOperators ¶
UpdateFeedGeneratedOperators creates OperatorInFeed records for agencies that are not associated with an operator
Types ¶
type FeedAgencies ¶ added in v1.4.1
type FeedAgencies struct {
FeedID int
Agencies []FeedAgency
}
FeedAgencies is a feed's id and the agencies of its active version.
type FeedAgency ¶ added in v1.4.1
FeedAgency is an agency of a feed's active version, and the onestop id from its feed version's stats, when there is one.
type OifPlan ¶ added in v1.4.1
OifPlan is how sync changes operator-in-feed rows: refreshes, then inserts, then deletes.
Refreshes set the resolved fields of the rows their ids name. Inserts are new rows, in the order sync resolves them. Deletes are the ids of rows to remove.
func PlanFeedOifs ¶ added in v1.4.1
func PlanFeedOifs(feedID int, feedOnestopID string, existing []dmfr.OperatorAssociatedFeed, agencies []FeedAgency, deletedOperators []int) OifPlan
PlanFeedOifs generates an operator for each agency of a feed's active version that no row claims, and deletes the generated rows of agencies the version no longer has.
existing holds the feed's current rows, matched to agencies by resolved agency_id, and deletedOperators the ids of soft-deleted operators. An Atlas operator's row owns its agency and is never deleted here, unless its operator is deleted: then the row is deleted and claims no agency. A generated row for an agency an Atlas row owns is deleted, and of generated rows that share an agency, the lowest id is kept. Agencies that share an agency_id get one generated row, and inserts follow the agencies' row ids. A generated operator takes the agency's onestop id, or else one made from the feed's onestop id and the agency's name.
func PlanOperatorOifs ¶ added in v1.4.1
func PlanOperatorOifs(operator dmfr.Operator, existing []dmfr.OperatorAssociatedFeed, feeds map[string]FeedAgencies) OifPlan
PlanOperatorOifs resolves an operator to the agency of each of its associated feeds' active versions: the feed's only agency, or the one the association's gtfs_agency_id names.
existing holds the operator's current rows, and feeds the associated feeds by onestop id; a feed missing from feeds is skipped. Each resolved row refreshes the existing row it matches, by feed and resolved agency_id, or else is inserted. Associations that resolve to the same match make one row, and of existing rows that share a match, only the lowest id can match. The plan deletes every existing row left unmatched.
type OifRow ¶ added in v1.4.1
type OifRow struct {
dmfr.OperatorAssociatedFeed
AgencyRowID int
}
OifRow is an operator-in-feed row a plan writes. AgencyRowID is the row id of its resolved agency, or 0 when it resolved none.
type Options ¶
type Options struct {
Filenames []string
Registries []*dmfr.Registry // Pre-parsed registries (e.g., from stdin)
HideUnseen bool
HideUnseenOperators bool
SetPublic *bool // nil=default (new feeds public, existing unchanged), true=force public, false=force private
}
Options sets options for a sync operation.