Spectre.GAM.Attempt.Executor behaviour (Spectre v0.4.0)

Copy Markdown View Source

Executes one already-committed governed Act.

Implementations are Zone X adapters. They receive no authority to alter the Act; capability is the short-lived host handle released only after the corresponding Attempt has been committed.

Results cross back into the governed record layer, so they contain only validated Spectre.GAM.Evidence and an opaque, non-empty details_ref. Raw provider replies, exceptions, credentials and reusable bearer material are not valid result metadata. Evidence may be empty only for an ambiguous result.

use Spectre.GAM.Attempt.Executor, executor_ref: "executor:payments", contract_ref: "contract:payments:v1" declares the behaviour and overridable identity callbacks. Both references are explicit. It supplies no execute/4 implementation, credentials, retry policy or Outcome classification.

Summary

Callbacks

Returns the immutable contract revision implemented by this adapter.

Returns the stable executor identity accepted by this adapter.

Functions

Builds executor-attested Evidence with the Act and Attempt bindings forced.

Builds a final Evidence attestation for one exact Outcome classification.

Types

observation()

@type observation() :: %{
  evidence: Spectre.GAM.Evidence.t() | [Spectre.GAM.Evidence.t()],
  details_ref: String.t()
}

result()

@type result() ::
  {:ok, observation()}
  | {:error, :failed, observation()}
  | {:error, :definitive_no_effect, observation()}
  | {:error, :ambiguous, observation()}

Callbacks

contract_ref()

@callback contract_ref() :: String.t()

Returns the immutable contract revision implemented by this adapter.

execute(t, t, term, keyword)

@callback execute(Spectre.GAM.Act.t(), Spectre.GAM.Attempt.t(), term(), keyword()) ::
  result()

executor_ref()

@callback executor_ref() :: String.t()

Returns the stable executor identity accepted by this adapter.

Functions

evidence(act, attempt, observed_at, attrs)

@spec evidence(
  Spectre.GAM.Act.t(),
  Spectre.GAM.Attempt.t(),
  integer(),
  map() | keyword()
) ::
  {:ok, Spectre.GAM.Evidence.t()} | {:error, term()}

Builds executor-attested Evidence with the Act and Attempt bindings forced.

outcome_evidence(act, attempt, status, observed_at, attrs)

@spec outcome_evidence(
  Spectre.GAM.Act.t(),
  Spectre.GAM.Attempt.t(),
  Spectre.GAM.Outcome.status(),
  integer(),
  map() | keyword()
) :: {:ok, Spectre.GAM.Evidence.t()} | {:error, term()}

Builds a final Evidence attestation for one exact Outcome classification.