Spectre.GAM.Payload.Store behaviour (Spectre v0.4.0)

Copy Markdown View Source

Host boundary for content-addressed payloads kept outside the Domain ledger.

A configured adapter must verify both presence and digest correspondence for the supplied payload:<sha256> reference. Spectre.GAM verifies all live references during cold recovery, the introduced references during incremental recovery, and the pertinent references again before use. Historical payloads are not polled on unrelated writes; hosts should independently monitor storage health. A durable erasure Attempt is the only reason a referenced payload may be absent; its ledger tombstone remains.

Summary

Functions

Returns external payload refs which must be usable before an Attempt is recorded.

Checks the host adapter configuration and callback; does not contact payload storage.

Returns payload refs still needed after an Attempt has made its target mutable.

Calls the configured adapter to verify one payload's presence and digest without returning its contents.

Verifies every payload which the durable projection still classifies as live.

Verifies a newly introduced ref and prevents resurrection after an erasure Attempt.

Verifies refs at their point of use and reports causal unavailability explicitly.

Types

config()

@type config() :: module() | {module(), keyword()}

ref()

@type ref() :: String.t()

Callbacks

verify(ref, keyword)

@callback verify(
  ref(),
  keyword()
) :: :ok | {:error, :not_found | term()}

Functions

act_payload_refs(state, act)

@spec act_payload_refs(Spectre.GAM.GovernedAct.State.t(), Spectre.GAM.Act.t()) :: [
  ref()
]

Returns external payload refs which must be usable before an Attempt is recorded.

normalize(module)

@spec normalize(config() | nil) ::
  {:ok, {module(), keyword()} | nil} | {:error, term()}

Checks the host adapter configuration and callback; does not contact payload storage.

post_attempt_payload_refs(state, act)

@spec post_attempt_payload_refs(
  Spectre.GAM.GovernedAct.State.t(),
  Spectre.GAM.Act.t()
) :: [ref()]

Returns payload refs still needed after an Attempt has made its target mutable.

verify(config, ref)

@spec verify(config() | nil, ref()) :: :ok | {:error, term()}

Calls the configured adapter to verify one payload's presence and digest without returning its contents.

verify_live_references(config, state)

@spec verify_live_references(config() | nil, Spectre.GAM.GovernedAct.State.t()) ::
  :ok | {:error, term()}

Verifies every payload which the durable projection still classifies as live.

verify_new_references(config, state, refs)

@spec verify_new_references(config() | nil, Spectre.GAM.GovernedAct.State.t(), [ref()]) ::
  :ok | {:error, term()}

Verifies a newly introduced ref and prevents resurrection after an erasure Attempt.

verify_usable(config, state, refs)

@spec verify_usable(config() | nil, Spectre.GAM.GovernedAct.State.t(), [ref()]) ::
  :ok | {:error, term()}

Verifies refs at their point of use and reports causal unavailability explicitly.