Local durable Tasks store backed by one DETS table.
Every task aggregate is persisted as one versioned JSON binary. Applied transitions, claims, renewals, releases, creation, and reaping are synced to disk before their callers are acknowledged. A stable store UUID survives reopen, while a persisted boot epoch advances on every open. Consequently, leases from a prior store process are fenced immediately and their claims can be recovered without waiting for the old lease deadline. Exact and recovery claims also enforce persisted retry availability against this adapter's clock.
:path is required. :table must be a caller-supplied atom when more than
one adapter is open in the same BEAM; it defaults to this module name, which
deliberately permits only one default-named table at a time. The required
:scope option (see Snodo.Extensions.Tasks.Store.scope_option/2) must
return a JSON-safe value because its result is part of the durable
authorization record.
DETS is a local reference adapter, not a distributed database. The GenServer
serializes operations in one BEAM, and DETS itself has a 2 GB file limit.
Its costs grow with the table. Every claim, renewal, release, and applied
transition rewrites and syncs the task's whole record, including its event
history, so each heartbeat of a running task rewrites that record. Every
recovery claim (claim_next/3) and every reap decodes every record in the
table.
create/4 refuses a task with {:error, {:capacity_exceeded, limit}} when
the table already holds :max_tasks tasks (default 10,000) or the caller's
scope already has :max_active_tasks_per_scope working or input-required
tasks (default 100). Either may be :infinity. The store keeps an in-memory
index of active tasks by scope, rebuilt from the table on every open, so the
counts hold after a restart. An expired task counts until it is reaped.
Summary
Functions
Returns a specification to start this module under a supervisor.
Types
@type history_entry() :: %{ event: Snodo.Extensions.Tasks.Event.t(), committed_at: String.t(), revision: pos_integer() }
@type server() :: GenServer.server()
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec start_link(keyword()) :: GenServer.on_start()