Mnesia implementation of Kathikon.Storage.
Tables:
:kathikon_jobs— job payloads:kathikon_history— durable lifecycle events:kathikon_batches— batch coordination records:kathikon_schedules— built-in scheduler registrations
All state transitions use Mnesia transactions.
Summary
Functions
Atomically claims and starts up to limit jobs from queue.
Defers a running job to :scheduled with a durable history event.
Atomically updates batch counters for a finished child and returns completion intent.
Atomically transitions a parent to :waiting_for_children, inserts child jobs,
and writes the batch record.
Functions
@spec claim_and_start_available_jobs(atom(), pos_integer(), map()) :: {:ok, [Kathikon.Job.t()]} | {:error, term()}
Atomically claims and starts up to limit jobs from queue.
Returns running jobs so callers never observe a stranded :claimed state.
@spec defer_job(String.t(), DateTime.t(), map()) :: {:ok, Kathikon.Job.t()} | {:error, term()}
Defers a running job to :scheduled with a durable history event.
@spec record_batch_child_finished(Kathikon.Job.t()) :: {:ok, :pending, map()} | {:ok, :complete, map(), Kathikon.Job.t()} | {:ok, :fail, map(), Kathikon.Job.t()} | {:error, term()}
Atomically updates batch counters for a finished child and returns completion intent.
@spec start_batch(String.t(), [Kathikon.Job.t()], map()) :: {:ok, map()} | {:error, term()}
Atomically transitions a parent to :waiting_for_children, inserts child jobs,
and writes the batch record.