API Reference gen_durable v#0.1.2

Copy Markdown View Source

Modules

Durable FSM engine on top of Postgres + GenServer.

Runs one picked instance to a committed outcome (spec §3/§4).

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

Library-owned schema migration (Oban-style).

The five step/handle outcomes from the spec §3, with shape validation.

Every database statement from spec §10, one function each, as raw SQL.

Periodically returns executing rows with an expired lease to runnable, bumping attempt (spec §4.3 / §10). 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 (spec §6). 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.