Conservative recovery helpers for a governed Domain.
Recovery loads the canonical ledger, verifies its complete snapshot, and
rebuilds a disposable ExGAM.Domain.Projection. It never mints a Grant or
releases executor capability.
An ambiguous append is classified by recomputing the logical batch identity
and consulting the Store's durable identity index. :not_committed means
only that the identity was absent at that lookup instant; it is not an
eternal proof that the append can never appear. A sequencer must reload and
retry the same identity conservatively, and must not emit a Grant from that
result alone.
Summary
Functions
Classifies an ambiguous append using its stable batch identity.
Advances a verified prefix only after confirming the exact persisted batch.
Loads, verifies, and replays one Domain ledger without producing capabilities.
Loads and replays a Domain against the exact Constitution pinned by Genesis.
Resumes an in-memory verified prefix using only the newly committed batches.
Types
@type append_classification() :: {:committed, ExGAM.Ledger.batch_info()} | :not_committed
@type payload_check() :: (ExGAM.Domain.Projection.t(), [String.t()] -> :ok | {:error, term()}) | nil
Functions
@spec classify_ambiguous( ExGAM.Ledger.Store.config(), ExGAM.Ledger.domain_ref(), ExGAM.Ledger.batch_id(), [map()], non_neg_integer(), keyword() ) :: {:ok, append_classification()} | {:error, term()}
Classifies an ambiguous append using its stable batch identity.
A matching durable lookup returns {:ok, {:committed, info}}. An absent
lookup returns {:ok, :not_committed} with the temporal limitation described
in the module documentation. Any mismatched identity or revision metadata is
rejected rather than guessed.
@spec confirm_append( ExGAM.Ledger.Store.config(), ExGAM.Domain.Projection.t(), String.t(), [map()], non_neg_integer(), keyword(), payload_check() ) :: {:ok, ExGAM.Domain.Projection.t()} | {:error, term()}
Advances a verified prefix only after confirming the exact persisted batch.
The Store's durable index must match the reconstructed chain, including its predecessor and recording time through the head digest. This uses the same adapter trust boundary as append/ambiguity recovery; it does not prove that the host's storage is tamper-proof. Startup and independent audit still verify the full history, rather than trusting this disposable in-memory prefix.
An unavailable or inconsistent index falls back to a verified ledger read. In particular, an identical retry can have a different requested timestamp: the original committed timestamp wins and must never be rewritten.
@spec recover(ExGAM.Ledger.Store.config(), ExGAM.Ledger.domain_ref(), keyword()) :: :not_found | {:ok, ExGAM.Domain.Projection.t()} | {:error, term()}
Loads, verifies, and replays one Domain ledger without producing capabilities.
@spec recover( ExGAM.Ledger.Store.config(), ExGAM.Ledger.domain_ref(), map(), keyword() ) :: :not_found | {:ok, ExGAM.Domain.Projection.t()} | {:error, term()}
Loads and replays a Domain against the exact Constitution pinned by Genesis.
@spec resume( ExGAM.Ledger.Store.config(), ExGAM.Domain.Projection.t(), keyword(), payload_check() ) :: :not_found | {:ok, ExGAM.Domain.Projection.t()} | {:error, term()}
Resumes an in-memory verified prefix using only the newly committed batches.
A changed predecessor or a head behind the cursor is an error, never a reason
to silently replace the trusted prefix. Cold startup still uses recover/4.
An optional payload check receives the final verified projection and the distinct payload references introduced or affected by the recovered suffix. It cannot replace the projection. Checking at the final head matters when that suffix also contains a legitimate erasure of one of those payloads.