Host contract for canonical Instance ownership and monotonic fencing.
A local Registry is routing, not distributed ownership. Hosts that may run the same logical Instance on multiple nodes must supply an adapter backed by a linearizable lease or route all work to one canonical owner. Losing or superseding the lease blocks admission, activation commit, state commit, Effect dispatch, and retry before dispatch.
Summary
Functions
Validates a lease and classifies failure as an owner-fence loss for one concrete operation.
Claims ownership and validates the returned portable lease.
Normalizes an ownership adapter; nil selects the local-only adapter.
Releases an owned lease when the adapter implements the callback.
Validates that a lease remains current at a guarded boundary.
Types
Callbacks
@callback claim( Spectre.Instance.Ref.t(), keyword() ) :: {:ok, Spectre.Instance.Owner.Lease.t()} | {:error, term()}
@callback release(Spectre.Instance.Ref.t(), Spectre.Instance.Owner.Lease.t(), keyword()) :: :ok | {:error, term()}
@callback validate(Spectre.Instance.Ref.t(), Spectre.Instance.Owner.Lease.t(), keyword()) :: :ok | {:error, term()}
Functions
@spec assert_current( config(), Spectre.Instance.Ref.t(), Spectre.Instance.Owner.Lease.t(), atom(), keyword() ) :: :ok | {:error, term()}
Validates a lease and classifies failure as an owner-fence loss for one concrete operation.
@spec claim(config(), Spectre.Instance.Ref.t(), keyword()) :: {:ok, {module(), keyword()}, Spectre.Instance.Owner.Lease.t()} | {:error, term()}
Claims ownership and validates the returned portable lease.
Normalizes an ownership adapter; nil selects the local-only adapter.
@spec release( config(), Spectre.Instance.Ref.t(), Spectre.Instance.Owner.Lease.t(), keyword() ) :: :ok | {:error, term()}
Releases an owned lease when the adapter implements the callback.
@spec validate( config(), Spectre.Instance.Ref.t(), Spectre.Instance.Owner.Lease.t(), keyword() ) :: :ok | {:error, term()}
Validates that a lease remains current at a guarded boundary.