Spectre.GAM.GovernedAct.Commit (Spectre v0.4.0)

Copy Markdown View Source

One prepared governed transaction, before its durability acknowledgement.

The existing pure fold validates the exact canonical records once, including their real batch identity, acquisition time and predecessor. state is the proposed result, not committed authority. A persistence driver may publish it only after confirming receipt exactly; uncertainty must recover the actual committed records instead. No capability is created by preparation.

This separates the semantic transaction from its physical storage. A ledger driver persists payloads; a state-oriented driver can additionally publish the resulting current facts in the same storage transaction. Neither driver gets to reimplement the governed transitions or change the accepted records. The current representation still contains a full State: this is not a bounded read-model implementation or a persisted checkpoint format.

Summary

Functions

Checks an exact durable acknowledgement; numeric coercion is never allowed.

Folds an exact proposed batch and builds its expected durability receipt.

Types

t()

@type t() :: %Spectre.GAM.GovernedAct.Commit{
  payloads: [map()],
  prefix: Spectre.GAM.Ledger.cursor(),
  receipt: Spectre.GAM.Ledger.batch_info(),
  recorded_at: non_neg_integer(),
  state: Spectre.GAM.GovernedAct.State.t()
}

Functions

confirmed?(commit, actual)

@spec confirmed?(t(), term()) :: boolean()

Checks an exact durable acknowledgement; numeric coercion is never allowed.

prepare(prefix, id, payloads, recorded_at)

@spec prepare(
  Spectre.GAM.GovernedAct.State.t(),
  String.t(),
  [map()],
  non_neg_integer()
) ::
  {:ok, t()} | {:error, term()}

Folds an exact proposed batch and builds its expected durability receipt.

Entries use the real predecessor and batch coordinates so confirmation can reuse the checked State without another semantic fold. Neither the entries nor state prove persistence: the storage driver must match the receipt or recover the actual durable prefix before adopting this result.