Spectre.Execution.Migration (Spectre v0.3.0)

Copy Markdown View Source

Prepare/commit protocol for registered, pure Work state migrations.

Authored data selects only an operation ID already present in the Agent's reviewed registry. prepare/5 resolves and snapshots its portable contract; the host executes the returned request through its normal operation boundary; commit/3 re-resolves the contract and validates the migrated state before issuing an integrity receipt.

Summary

Functions

Commits an already executed migration after revalidating its exact contract.

Prepares one declared migration without executing its operation.

Returns privacy-safe migration lineage.

Verifies the prepared migration and request binding.

Types

t()

@type t() :: %Spectre.Execution.Migration{
  definition_ref: term(),
  digest: term(),
  materialization_digest: term(),
  operation_contract_digest: term(),
  operation_ref: term(),
  program: term(),
  request: term(),
  schema_version: term(),
  source_state: term(),
  source_state_digest: term(),
  source_version: term(),
  target_version: term()
}

Functions

commit(migration, execution, agent)

@spec commit(t(), Spectre.Operation.Execution.t(), module()) ::
  {:ok, term(), Spectre.Execution.Migration.Receipt.t()} | {:error, term()}

Commits an already executed migration after revalidating its exact contract.

prepare(program, source_version, source_state, agent, opts \\ [])

@spec prepare(Spectre.Execution.Program.t(), term(), term(), module(), keyword()) ::
  {:ok, t()} | {:error, term()}

Prepares one declared migration without executing its operation.

to_data(migration)

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

Returns privacy-safe migration lineage.

verify(migration)

@spec verify(t()) :: :ok | {:error, term()}

Verifies the prepared migration and request binding.