internal/

directory
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0

Directories

Path Synopsis
adapter
pgstore
Package pgstore holds every SQL statement of Foreman (pgx v5): inserts (multi-row and COPY), the fetch queries with SKIP LOCKED, fairness and per-key limits, batched completions and heartbeats under the completion guard, leases, maintenance, admin operations and the LISTEN connection.
Package pgstore holds every SQL statement of Foreman (pgx v5): inserts (multi-row and COPY), the fetch queries with SKIP LOCKED, fairness and per-key limits, batched completions and heartbeats under the completion guard, leases, maintenance, admin operations and the LISTEN connection.
app
completer
Package completer batches job state updates and heartbeats.
Package completer batches job state updates and heartbeats.
elector
Package elector elects one leader per cluster with a lease row whose times come from the client clock.
Package elector elects one leader per cluster with a lease row whose times come from the client clock.
executor
Package executor runs one attempt of a job: it applies the job, kind or client timeout, recovers panics with their stack, consults the error handler, honours cancel requests, and maps the result to a completion.
Package executor runs one attempt of a job: it applies the job, kind or client timeout, recovers panics with their stack, consults the error handler, honours cancel requests, and maps the result to a completion.
maintenance
Package maintenance holds the leader-only services (scheduler, rescuer, cleaner, reindexer, periodic enqueuer, queue-depth sampler) and the PollOnly cancel poller.
Package maintenance holds the leader-only services (scheduler, rescuer, cleaner, reindexer, periodic enqueuer, queue-depth sampler) and the PollOnly cancel poller.
notifier
Package notifier multiplexes a single Postgres LISTEN connection to the producers, the cancel handler and the elector, and reconnects with jittered backoff when the connection is lost.
Package notifier multiplexes a single Postgres LISTEN connection to the producers, the cancel handler and the elector, and reconnects with jittered backoff when the connection is lost.
producer
Package producer runs the fetch loop of one queue: it wakes on NOTIFY, on finished jobs and on a poll interval, fetches up to its free capacity (honouring pause, per-key limits and fairness) and runs each job on its own goroutine with a cancellable job context.
Package producer runs the fetch loop of one queue: it wakes on NOTIFY, on finished jobs and on a poll interval, fetches up to its free capacity (honouring pause, per-key limits and fairness) and runs each job on its own goroutine with a cancellable job context.
Package cli implements the foreman admin CLI: migrate, jobs, queues, leader, periodic, stats, config and version commands.
Package cli implements the foreman admin CLI: migrate, jobs, queues, leader, periodic, stats, config and version commands.
Package config loads and validates the configuration of the foreman CLI: defaults, a YAML file, FOREMAN_* environment variables and flags, in increasing precedence.
Package config loads and validates the configuration of the foreman CLI: defaults, a YAML file, FOREMAN_* environment variables and flags, in increasing precedence.
domain
backoff
Package backoff provides retry delay policies: exponential with full jitter (the default, base 1s, cap 24h), constant, and custom functions.
Package backoff provides retry delay policies: exponential with full jitter (the default, base 1s, cap 24h), constant, and custom functions.
fairness
Package fairness decides how a fetch of k jobs is split between concurrency keys: by fetch order with per-key headroom, or fairly by least recently served key within each priority level.
Package fairness decides how a fetch of k jobs is split between concurrency keys: by fetch order with per-key headroom, or fairly by least recently served key within each priority level.
job
Package job defines the job row, its state machine and the mapping from the result of Work to the state update written to the database.
Package job defines the job row, its state machine and the mapping from the result of Work to the state update written to the database.
schedule
Package schedule wraps the cron parser, provides epoch-aligned Every schedules, and computes which periodic ticks are due after a leader gap (catch-up window) and which are skipped.
Package schedule wraps the cron parser, provides epoch-aligned Every schedules, and computes which periodic ticks are due after a leader gap (catch-up window) and which are skipped.
unique
Package unique validates unique-job options, selects the identifying argument fields and computes the period bucket.
Package unique validates unique-job options, selects the identifying argument fields and computes the period bucket.
platform
clock
Package clock provides the injectable time source used by app and adapter code: Real for production and Fake for tests and simulations driven by a manually advanced clock.
Package clock provides the injectable time source used by app and adapter code: Real for production and Fake for tests and simulations driven by a manually advanced clock.
metrics
Package metrics defines the Prometheus collectors of a Foreman client, the shared histogram buckets, and label capping for values derived from user data.
Package metrics defines the Prometheus collectors of a Foreman client, the shared histogram buckets, and label capping for values derived from user data.
tracing
Package tracing creates OpenTelemetry spans for job work and inserts: "foreman.work <kind>" with job id, kind, queue and attempt attributes.
Package tracing creates OpenTelemetry spans for job work and inserts: "foreman.work <kind>" with job id, kind, queue and attempt attributes.
Package testutil holds helpers shared by tests only: polling assertions, in-memory fakes of domain ports and Postgres test containers.
Package testutil holds helpers shared by tests only: polling assertions, in-memory fakes of domain ports and Postgres test containers.
pgtest
Package pgtest provides Postgres for integration tests: a Testcontainers server per test package (or FOREMAN_TEST_DATABASE_URL) and a freshly migrated schema per test.
Package pgtest provides Postgres for integration tests: a Testcontainers server per test package (or FOREMAN_TEST_DATABASE_URL) and a freshly migrated schema per test.

Jump to

Keyboard shortcuts

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