# gen_durable v0.1.8 - Table of Contents

> Postgres-backed durable execution for Elixir: declare an FSM, the engine commits its state before each step proceeds, so instances survive process and node death and resume where they left off.

## Pages

- [gen_durable](readme.md)
- [Performance](performance.md)
- [Changelog](changelog.md)

- Guides
  - [Jobs](jobs.md)
  - [State machines](machines.md)
  - [Signals &amp; await](signals.md)
  - [Child fan-out](children.md)
  - [Rate limiting](rate_limiting.md)
  - [Concurrency keys](concurrency.md)
  - [Instance identity](identity.md)
  - [Scheduling &amp; queues](scheduling.md)
  - [Operations](operations.md)

## Modules

- [GenDurable.GC](GenDurable.GC.md): Periodically deletes terminal (`done`/`failed`) instances older than the
retention window — the engine's built-in pruner.

- Public API
  - [GenDurable](GenDurable.md): 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.
  - [GenDurable.FSM](GenDurable.FSM.md): Behaviour for a durable FSM — or, in its degenerate one-step form, a durable job.
  - [GenDurable.Migration](GenDurable.Migration.md): Library-owned schema migration (Oban-style).
  - [GenDurable.State](GenDurable.State.md): 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`)

- Runtime
  - [GenDurable.Executor](GenDurable.Executor.md): Runs one picked instance to a committed outcome.
  - [GenDurable.Reaper](GenDurable.Reaper.md): 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.

  - [GenDurable.Registry](GenDurable.Registry.md): Resolves `{fsm_name, fsm_version}` to an FSM module.
  - [GenDurable.Scheduler](GenDurable.Scheduler.md): 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.
  - [GenDurable.Supervisor](GenDurable.Supervisor.md): Top-level engine supervisor. Started by the host (Oban-style) as
`{GenDurable, opts}` in their own supervision tree.

- Internals
  - [GenDurable.Context](GenDurable.Context.md): The context handed to `c:GenDurable.FSM.step/2` and `c:GenDurable.FSM.handle/2`.
  - [GenDurable.Outcome](GenDurable.Outcome.md): The step/handle outcomes, with shape validation.
  - [GenDurable.Queries](GenDurable.Queries.md): Every database statement, one function each, as raw SQL.

- Exceptions
  - [GenDurable.Registry.NotFound](GenDurable.Registry.NotFound.md)

