seeder

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRateLimit = errors.New("rate limited")

Functions

func Run

func Run(ctx context.Context, s Seeder, onUpdate func([]entity.Entity))

Run polls a seeder and calls onUpdate with fresh entities on success. Implements exponential backoff on rate limit or error, with max 60s delay.

Types

type AISSeeder

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

AISSeeder streams live maritime data from aisstream.io.

func NewAISSeeder

func NewAISSeeder() *AISSeeder

NewAISSeeder creates a new AIS seeder using AISSTREAM_TOKEN env var.

func (*AISSeeder) Fetch

func (s *AISSeeder) Fetch(ctx context.Context) ([]entity.Entity, error)

Fetch handles the connection and stream ingestion. Note: As designed in seeder.Run(), Fetch() is called periodically. For a persistent stream, this implementation connects, reads, and returns the latest batch of entities available within a short timeout.

func (*AISSeeder) Interval

func (s *AISSeeder) Interval() time.Duration

func (*AISSeeder) Name

func (s *AISSeeder) Name() string

type OpenSkySeeder

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

OpenSkySeeder fetches live aircraft data from OpenSky Network.

func NewOpenSkySeeder

func NewOpenSkySeeder() *OpenSkySeeder

NewOpenSkySeeder creates a new OpenSky seeder. Reads OPENSKY_USER and OPENSKY_PASS env vars for authentication.

func (*OpenSkySeeder) Fetch

func (s *OpenSkySeeder) Fetch(ctx context.Context) ([]entity.Entity, error)

Fetch retrieves aircraft states from OpenSky Network API. Field indices in state vector: 0: icao24 (aircraft identifier) 1: callsign (flight callsign) 5: longitude 6: latitude 7: altitude 9: velocity (ground speed) 10: heading

func (*OpenSkySeeder) Interval

func (s *OpenSkySeeder) Interval() time.Duration

func (*OpenSkySeeder) Name

func (s *OpenSkySeeder) Name() string

type RateLimitError

type RateLimitError struct {
	Err        error
	RetryAfter time.Duration
}

RateLimitError wraps rate limiting errors for exponential backoff handling.

func (*RateLimitError) Error

func (e *RateLimitError) Error() string

func (*RateLimitError) Unwrap

func (e *RateLimitError) Unwrap() error

type Seeder

type Seeder interface {
	Name() string
	Fetch(ctx context.Context) ([]entity.Entity, error)
	Interval() time.Duration
}

Seeder fetches entities from a data source.

Jump to

Keyboard shortcuts

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