Spectre.Instance.Owner.Conformance (Spectre v0.3.4)

Copy Markdown View Source

Executable conformance checks for Instance ownership adapters.

The :local profile verifies the portable lease boundary used together with the unique local Instance Registry. It deliberately makes no claim about cross-node supersession. The :distributed profile additionally requires monotonic fencing, supersession, cross-Ref isolation, and a single current lease after concurrent claims. When an adapter exports release/3, the gate also proves immediate invalidation and a strictly newer post-release claim.

The runner has no ExUnit dependency. Adapter authors can call it from their own test suites with fresh, isolated Instance references.

Summary

Functions

Returns the ownership conformance contract version.

Runs one ownership profile against a fresh Instance reference.

Types

profile()

@type profile() :: :local | :distributed

report()

@type report() :: %{
  contract_version: pos_integer(),
  profile: profile(),
  lease: :portable,
  ref_binding: :verified,
  fencing_floor: :verified,
  validation: :verified,
  release: :verified | :optional_noop | :registry_scoped,
  supersession: :verified | :registry_scoped,
  concurrent_claims: :single_current | :not_applicable
}

Functions

contract_version()

@spec contract_version() :: pos_integer()

Returns the ownership conformance contract version.

run(owner, ref, opts \\ [])

@spec run(Spectre.Instance.Owner.config(), Spectre.Instance.Ref.t(), keyword()) ::
  {:ok, report()} | {:error, term()}

Runs one ownership profile against a fresh Instance reference.

Options:

  • :profile - :local by default, or :distributed;
  • :minimum_fencing_token - non-negative floor supplied to the first claim;
  • :concurrent_claims - number of contenders for the distributed race;
  • :timeout - timeout for every contender in milliseconds;
  • :alternate_ref - optional distinct Ref used to prove Ref isolation.