ExGAM.Attempt.Executor behaviour (ExGAM v0.1.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 ExGAM.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 ExGAM.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.

Invokes the admitted Act using its Attempt and scoped capability, then reports the observed result.

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: ExGAM.Evidence.t() | [ExGAM.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(ExGAM.Act.t(), ExGAM.Attempt.t(), term(), keyword()) :: result()

Invokes the admitted Act using its Attempt and scoped capability, then reports the observed 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(ExGAM.Act.t(), ExGAM.Attempt.t(), integer(), map() | keyword()) ::
  {:ok, ExGAM.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(
  ExGAM.Act.t(),
  ExGAM.Attempt.t(),
  ExGAM.Outcome.status(),
  integer(),
  map() | keyword()
) :: {:ok, ExGAM.Evidence.t()} | {:error, term()}

Builds a final Evidence attestation for one exact Outcome classification.