importer

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: GPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivateFeedVersion

func ActivateFeedVersion(ctx context.Context, atx tldb.Adapter, fvid int) error

ActivateFeedVersion sets the feed version as active and refreshes materialized tables

func DeleteFeedVersion

func DeleteFeedVersion(ctx context.Context, atx tldb.Adapter, id int, extraTables []string) error

func RemoveOnestopIds added in v1.4.0

func RemoveOnestopIds(ctx context.Context, atx tldb.Adapter, id int) error

RemoveOnestopIds deletes the fetch-derived onestop_id rows (agency/route/stop) for a feed version. These only power AllowPrevious lookups; the feed version and its other data are unaffected. It deletes unconditionally: the caller selects which versions to remove (e.g. per the feed's onestop_id_retention_period) and must exclude the active and materialized versions.

func UnimportFeedVersion

func UnimportFeedVersion(ctx context.Context, atx tldb.Adapter, id int, extraTables []string) error

UnimportFeedVersion unimports a feed version and removes the feed_version_gtfs_import record.

func UnimportSchedule

func UnimportSchedule(ctx context.Context, atx tldb.Adapter, id int) error

UnimportSchedule removes schedule data for a feed version and updates the import record. stops, routes, agencies, pathways, levels are not affected. Note: calendars and calendar_dates MAY be deleted in future versions.

Types

type Options

type Options struct {
	FeedVersionID int
	Storage       string
	Activate      bool
	// ImportSource records whether the import was initiated automatically (by a
	// maintenance/queue process) or manually (by a user). See the
	// dmfr.ImportSource* constants. Defaults to "automatic" when empty.
	ImportSource string
	// ErrorThreshold sets the maximum error percentage (0-100) allowed per file.
	// The key is the filename (e.g., "stops.txt") or "*" for the default threshold.
	// If any file exceeds its threshold, the import is considered failed.
	// Example: {"*": 10, "stops.txt": 5} means 10% default, 5% for stops.txt.
	ErrorThreshold map[string]float64
	// AllowPartial imports partial feeds and skips the required minimum-entity check.
	AllowPartial bool
	copier.Options
}

Options sets various options for importing a feed.

type Result

type Result struct {
	FeedVersionImport dmfr.FeedVersionImport
}

Result contains the results of a feed import.

func ImportFeedVersion

func ImportFeedVersion(ctx context.Context, fm feedmanager.FeedManager, opts Options) (Result, error)

ImportFeedVersion creates the import record and runs the Copier. Pass feedmanager.NewDBFeedManager(adapter) for the database backend.

The copy is not transactional; a failure leaves the rows the copier wrote, hidden behind a failed import record. Activation, when requested, runs afterwards in its own transaction.

Jump to

Keyboard shortcuts

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