Documentation
¶
Overview ¶
Package durable is Harbor's StateStore-backed TaskRegistry driver. Task, group, and patch records are persisted through the runtime's state.StateStore — each in its own per-record slot — so they survive a runtime restart. On open the driver replays every record into the shared task engine and runs a recovery sweep over tasks left Running by a crash.
The driver wraps the same internal/tasks/engine state machine the in-process driver wraps; it differs only in its persistence backend (per-record, replayed on open) and the open-time recovery sweep. It is opt-in via tasks.driver: durable; the in-process driver remains the default.
Scope. The driver delivers single-instance restart-survival of task RECORDS. It recovers the record, not execution: a task left Running by a crash is transitioned to a terminal failed state, not re-driven (auto-re-drive of recovered work is a separate, deferred concern). Cross-process durability requires a durable StateStore (state.driver: sqlite | postgres); paired with an in-memory state store the records survive only an in-process driver reopen, not a process restart. Multi-instance coordination (two runtimes sharing one store) is out of scope.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(deps tasks.Dependencies) (tasks.TaskRegistry, error)
New constructs the durable TaskRegistry. It fails loudly when no StateStore is wired: an operator who selected tasks.driver: durable asked for durability and must get it, so the driver refuses to fall back to non-durable behavior (CLAUDE.md §13 "no silent stub default"). The runtime always wires its shared StateStore into tasks.Open, so this guard fires only on a mis-wired embedding.
After constructing the engine (which hydrates persisted records), New runs the open-time recovery sweep so tasks interrupted by a restart reach a terminal state before the registry serves any request.
Types ¶
This section is empty.