polling

package
v0.29.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package polling is the worker's side of the poll stage. The scheduler queues a poll task each time a poll connector falls due, and a worker that holds the source's poller claims it. The poller reads the source past the connector's cursor and answers what it found, which serve lands in the write that ends the lease. A source names its poller in its one registration with the sources package, which opens it for a worker from the source's [source.<name>] table.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(source string, p Poller, log *slog.Logger) worker.Handler

Handler is the worker handler that runs source's poll tasks through p.

Types

type Outcome

type Outcome struct {
	// Arrivals are what the poll found, in the order they land. Cursor is the
	// connector's next position, and nil keeps the one it has.
	Arrivals []server.ReportArrival
	Cursor   *string
	// Error is why the poll read nothing, and nil where it ended done.
	Error *string
	// RetryAfter is how long the source asked the same poll to wait before it
	// tries again, such as until its day's quota resets. Zero fails the poll,
	// and the connector's backoff makes it due again.
	RetryAfter time.Duration
	// Counts are what the poll passed over, by reason, such as unavailable
	// videos. The handler logs them beside the task.
	Counts map[string]int
	// Warnings are what a person should know about a poll that ended done,
	// such as a read that stopped short of where the last one ended. The
	// handler logs each as a warning.
	Warnings []string
}

Outcome is how one poll ended.

type Poll

type Poll struct {
	Connector connectors.Connector
	Cursor    *string
}

Poll is one poll a poller runs: its connector as the set in force declares it, and the position an earlier poll left, nil before the first.

type Poller

type Poller interface {
	Poll(ctx context.Context, p Poll) Outcome
}

Poller reads one source for its connectors.

Jump to

Keyboard shortcuts

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