Canonical snapshot binding one Instance to an active Definition.
Activation is mutable only through generation-fenced compare-and-swap. The snapshot records the Candidate and publication that were re-read from a trusted Definition Store, the observed authority epoch, execution closure, state bindings, owner fencing token, timestamp, and provenance.
Summary
Functions
Returns 0 when no Activation exists.
Builds and validates an Activation from normalized attributes.
Applies an activation generation compare-and-swap.
Decodes and verifies portable Activation bytes.
Encodes the Activation into portable canonical bytes.
Restores and verifies an Activation from decoded canonical data.
Returns 0 when no Activation exists.
Builds a prospective Activation from a Candidate and verified resolution.
Returns the Activation snapshot schema version.
Returns portable canonical data.
Types
@type t() :: %Spectre.Instance.Activation{ activated_at: non_neg_integer(), activation_receipt: String.t(), authority_epoch: non_neg_integer(), candidate_ref: Spectre.Definition.Candidate.Ref.t(), closure_digest: String.t(), definition_ref: Spectre.Definition.Ref.t(), generation: pos_integer(), manifest_digest: String.t(), owner_fencing_token: pos_integer(), provenance: map(), publication_id: String.t(), schema_version: pos_integer(), state_bindings: map() }
Functions
@spec authority_epoch(t() | nil) :: non_neg_integer()
Returns 0 when no Activation exists.
Builds and validates an Activation from normalized attributes.
@spec compare_and_swap(t() | nil, non_neg_integer(), t()) :: {:ok, t()} | {:error, term()}
Applies an activation generation compare-and-swap.
expected_generation is 0 before the first activation. Authority epochs
may stay equal or increase; they can never move backwards.
Decodes and verifies portable Activation bytes.
Encodes the Activation into portable canonical bytes.
Restores and verifies an Activation from decoded canonical data.
@spec generation(t() | nil) :: non_neg_integer()
Returns 0 when no Activation exists.
@spec new(Spectre.Definition.Candidate.t(), map(), keyword()) :: {:ok, t()} | {:error, term()}
Builds a prospective Activation from a Candidate and verified resolution.
This function does not commit the snapshot. Callers must pass it through
compare_and_swap/3 on the Instance sequencer.
@spec schema_version() :: pos_integer()
Returns the Activation snapshot schema version.
Returns portable canonical data.