Expand description
Catalog-backed startup API for keeping handlers, job definitions, schedules, and workflow steps aligned.
JobCatalog is the primary facade. Applications register handlers once,
sync the catalog’s definition defaults to PostgreSQL, and use the catalog
helpers to build enqueue, schedule, and workflow inputs with job-type
validation at the call site.
Catalog defaults apply to every registered entry unless a job is registered with job-specific definition overrides.
§Schedule APIs
Choose a schedule API by who owns the schedule definition:
- Use
JobCatalog::scheduleplusJobCatalog::sync_schedulesfor static schedules registered in the worker catalog next to their handler. - Use
JobCatalog::sync_schedules_withfor schedule specs assembled at startup from config, feature flags, tenants, or another source outside the builder chain. - Use
JobCatalog::sync_schedules_exactorJobCatalog::sync_schedules_exact_withwhen this deployment owns a bounded schedule-name scope and missing schedules in that scope should be deactivated. Exact sync takes a bounded table lock so overlapping startup syncs do not interleave their active sets; scheduler claims and fire-cursor updates can briefly wait behind the same lock. During rolling deploys, keep scopes narrow enough that old and new workers do not deactivate each other’s schedules unintentionally, and keep owned scopes deployment-stable. Feature-flagged schedules should usually remain registered withis_active: falserather than disappear from the scope. - Use
JobCatalog::job_scheduleplusrunledger_postgres::jobs::upsert_job_schedulefor one-off setup, migrations, admin tools, or schedules that should not be catalog-owned. Callrunledger_postgres::jobs::set_job_schedule_activeseparately to change active state on an existing lower-level schedule.
JobCatalog::schedule_sync_scope derives an exact-sync scope from
schedules registered on the catalog, so startup code does not need to repeat
those names. If a deployment needs both registered schedules and dynamic
startup specs in one exact source-of-truth set, build one explicit spec list
and scope for JobCatalog::sync_schedules_exact_with; Runledger does not
provide an implicit union helper because that can hide ownership mistakes.
Structs§
- Catalog
JobEnqueue Input - Input for building a
JobEnqueuefrom a catalog-backed job type. - Catalog
JobSchedule Input - Input for building a one-off
JobScheduleUpsertfrom a catalog-backed job type. - Catalog
JobSchedule Spec - Catalog-owned cron schedule definition synced to
job_schedulesat startup. - Catalog
Workflow DagBuilder - Workflow DAG builder that validates job types against a
JobCatalog. - JobCatalog
- Single-source registry of job handlers, definition defaults, schedules, and enqueue helpers.
- JobCatalog
Defaults - Default values applied when syncing catalog jobs to
job_definitions. - JobCatalog
Definition Overrides - Per-job definition values that override
JobCatalogDefaults. - JobCatalog
Exact Sync Report - Result returned by
JobCatalog::sync_definitions_exact. - JobCatalog
Schedule Sync Report - Result returned by catalog schedule sync methods.
- JobCatalog
Schedule Sync Scope - Explicit owned schedule-name scope used by exact catalog schedule sync.
- JobCatalog
Sync Report - Result returned by
JobCatalog::sync_definitions. - JobCatalog
Sync Scope - Explicit owned job-type scope used by
JobCatalog::sync_definitions_exact.
Enums§
- Catalog
Error - Error returned by
super::JobCatalogvalidation, sync, and helper methods.