Spectre.Receipt.Envelope (Spectre v0.3.3)

Copy Markdown View Source

Portable evidence for one nondeterministic or canonical boundary.

The envelope wraps existing typed receipt payloads; it does not replace their domain-specific validation. Identity is deterministic, so a sink can make append retries idempotent after an acknowledgement is lost.

Summary

Functions

Returns the deterministic digest of the complete portable envelope.

Returns kinds defined by the core receipt schema.

Builds and validates a deterministic receipt envelope.

Builds an envelope or raises with the stable validation reason.

Returns portable canonical data suitable for an external sink.

Types

kind()

@type kind() :: atom()

privacy()

@type privacy() :: :public | :internal | :confidential | :restricted

t()

@type t() :: %Spectre.Receipt.Envelope{
  attempt_id: term(),
  canonical_revision: term(),
  causation_id: term(),
  closure_digest: term(),
  control_revision: term(),
  correlation_id: term(),
  definition_ref: term(),
  id: term(),
  inference_id: term(),
  instance_ref: term(),
  invocation_id: term(),
  kind: term(),
  manifest_digest: term(),
  metadata: term(),
  payload: term(),
  payload_digest: term(),
  payload_ref: term(),
  payload_schema_ref: term(),
  post_state_digest: term(),
  pre_state_digest: term(),
  privacy: term(),
  recorded_at: term(),
  run_id: term(),
  run_revision: term(),
  schema_version: term(),
  stream_epoch: term()
}

Functions

digest(envelope)

@spec digest(t()) :: String.t()

Returns the deterministic digest of the complete portable envelope.

kinds()

@spec kinds() :: [kind()]

Returns kinds defined by the core receipt schema.

new(envelope)

@spec new(map() | keyword() | t()) :: {:ok, t()} | {:error, term()}

Builds and validates a deterministic receipt envelope.

new!(attrs)

@spec new!(map() | keyword() | t()) :: t()

Builds an envelope or raises with the stable validation reason.

to_data(envelope)

@spec to_data(t()) :: map()

Returns portable canonical data suitable for an external sink.