One immutable record in a Domain ledger.
Entries are numbered from one and form a SHA-256 chain. The digest covers
the Domain, revision, batch coordinates, trusted recording time, previous
digest, and payload. The
payload must be a plain portable map; executable values and structs are
rejected by Spectre.GAM.Canonical.Value.
Entry structs are an in-memory convenience only. The durable form returned
by to_data/1 is a plain map with string keys.
Summary
Functions
Computes the stable identity of a logical batch request.
Builds a new Entry and computes its canonical digest.
Builds a complete linked batch after validating its portable payloads.
Decodes and verifies canonical Entry bytes.
Encodes an Entry with the canonical value codec.
Restores and verifies an Entry from its plain-map durable form.
Returns the fixed predecessor digest used by revision one.
Returns the maximum number of entries accepted in one atomic batch.
Builds and validates an Entry from its complete durable fields.
Returns the durable Entry schema version.
Returns the plain-map durable representation of an Entry.
Verifies that an Entry digest exactly matches its durable contents.
Verifies a contiguous chain without consulting a projection or store.
Types
@type digest() :: <<_::512>>
@type t() :: %Spectre.GAM.Ledger.Entry{ batch_id: String.t(), batch_index: non_neg_integer(), batch_size: pos_integer(), digest: digest(), domain_ref: String.t(), payload: map(), prev_digest: digest(), recorded_at: non_neg_integer(), revision: pos_integer(), schema_version: pos_integer() }
Functions
@spec batch_identity(String.t(), String.t(), [map()], non_neg_integer()) :: {:ok, digest()} | {:error, term()}
Computes the stable identity of a logical batch request.
@spec build( String.t(), pos_integer(), String.t(), non_neg_integer(), pos_integer(), non_neg_integer(), digest(), map() ) :: {:ok, t()} | {:error, term()}
Builds a new Entry and computes its canonical digest.
@spec build_batch( String.t(), String.t(), [map()], non_neg_integer(), non_neg_integer(), digest() ) :: {:ok, [t()]} | {:error, term()}
Builds a complete linked batch after validating its portable payloads.
Decodes and verifies canonical Entry bytes.
Encodes an Entry with the canonical value codec.
Restores and verifies an Entry from its plain-map durable form.
@spec genesis_digest() :: digest()
Returns the fixed predecessor digest used by revision one.
@spec max_batch_entries() :: pos_integer()
Returns the maximum number of entries accepted in one atomic batch.
Builds and validates an Entry from its complete durable fields.
@spec schema_version() :: pos_integer()
Returns the durable Entry schema version.
Returns the plain-map durable representation of an Entry.
Verifies that an Entry digest exactly matches its durable contents.
Verifies a contiguous chain without consulting a projection or store.