Spectre.GAM.Domain.Projection (Spectre v0.4.0)

Copy Markdown View Source

Domain-facing driver and query API for disposable governed state.

A projection is rebuilt from the canonical ledger and can always be thrown away. Structural snapshot verification belongs here; transition semantics live in Spectre.GAM.GovernedAct.Fold, while derived reads live in Spectre.GAM.GovernedAct.View. None of these modules is an authority store.

Summary

Functions

Applies one timestamped payload batch to disposable governed state.

Returns the immutable authority facts consumed by the pure kernel.

Looks up the durable Decision selected by a Candidate identity key.

Looks up the Act paired with a durable Decision.

Looks up one immutable governed Definition by exact reference.

Looks up a Duty by stable cause key or durable reference.

Resolves an exact Evidence set from disposable state.

Returns physical Meter accounts for a logical Mandate revision.

Creates empty disposable state for a Domain.

Verifies a ledger snapshot and folds its canonical governed history.

Checks an authenticated context against its durable Scope opening.

Types

dispatch_cancellation()

@type dispatch_cancellation() :: Spectre.GAM.GovernedAct.State.dispatch_cancellation()

meter_recontainment()

@type meter_recontainment() :: Spectre.GAM.GovernedAct.State.meter_recontainment()

meter_reservation()

@type meter_reservation() :: Spectre.GAM.GovernedAct.State.meter_reservation()

reservation_status()

@type reservation_status() :: Spectre.GAM.GovernedAct.State.reservation_status()

t()

Functions

apply_payloads(projection, payloads, recorded_at)

@spec apply_payloads(t(), [map()], non_neg_integer()) :: {:ok, t()} | {:error, term()}

Applies one timestamped payload batch to disposable governed state.

authority_view(projection)

@spec authority_view(t()) :: Spectre.GAM.Kernel.Authority.Facts.t()

Returns the immutable authority facts consumed by the pure kernel.

candidate_decision(projection, identity_key)

@spec candidate_decision(t(), String.t()) ::
  {:ok, Spectre.GAM.Decision.t()} | :not_found | {:error, term()}

Looks up the durable Decision selected by a Candidate identity key.

decision_act(projection, decision)

@spec decision_act(t(), Spectre.GAM.Decision.t()) ::
  {:ok, Spectre.GAM.Act.t() | nil} | {:error, term()}

Looks up the Act paired with a durable Decision.

definition(projection, ref)

@spec definition(t(), String.t()) ::
  {:ok, Spectre.GAM.Definition.t()} | {:error, term()}

Looks up one immutable governed Definition by exact reference.

duty(projection, lookup)

@spec duty(t(), {:cause_key, term()} | {:ref, String.t()}) ::
  {:ok, Spectre.GAM.Duty.t()} | :not_found | {:error, :invalid_duty_lookup}

Looks up a Duty by stable cause key or durable reference.

evidence_set(projection, refs)

@spec evidence_set(t(), [String.t()]) :: {:ok, [term()]} | {:error, term()}

Resolves an exact Evidence set from disposable state.

meter_accounts(projection, mandate_ref)

@spec meter_accounts(t(), String.t()) :: {:ok, map()} | {:error, term()}

Returns physical Meter accounts for a logical Mandate revision.

new(domain_ref, constitution \\ %{})

@spec new(String.t(), map()) :: t()

Creates empty disposable state for a Domain.

replay(snapshot, constitution \\ %{})

@spec replay(Spectre.GAM.Ledger.snapshot(), map()) :: {:ok, t()} | {:error, term()}

Verifies a ledger snapshot and folds its canonical governed history.

scope_context(projection, context)

@spec scope_context(t(), Spectre.GAM.SubmissionContext.t()) ::
  {:ok, Spectre.GAM.Scope.Opening.t()} | {:error, term()}

Checks an authenticated context against its durable Scope opening.