API Reference gen_durable v#0.1.8

Copy Markdown View Source

Modules

Postgres-backed durable execution: an FSM whose state is committed to Postgres before each step proceeds, so instances survive process and node death and resume where they left off.

Runs one picked instance to a committed outcome.

Behaviour for a durable FSM — or, in its degenerate one-step form, a durable job.

Periodically deletes terminal (done/failed) instances older than the retention window — the engine's built-in pruner.

Library-owned schema migration (Oban-style).

The step/handle outcomes, with shape validation.

Every database statement, one function each, as raw SQL.

Periodically returns executing rows with an expired lease to runnable, bumping attempt. This is the at-least-once safety floor for worker crashes; handle/2 is intentionally not involved.

Resolves {fsm_name, fsm_version} to an FSM module.

Per-queue feeder + executor loop. Backpressure-driven: it claims work from the database into a small in-memory buffer, then spawns at most concurrency supervised Tasks at a time, draining the buffer as slots free.

Typed FSM state: an Ecto embedded schema per FSM, encoded to/from jsonb. Typically defined as a nested State module inside the FSM, where it is adopted by convention (see GenDurable.FSM)

Top-level engine supervisor. Started by the host (Oban-style) as {GenDurable, opts} in their own supervision tree.