# `Spectre.Instance.Owner`
[🔗](https://github.com/elchemista/spectre/blob/0.3.0/lib/spectre/instance/owner.ex#L1)

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.

# `config`

```elixir
@type config() :: module() | {module(), keyword()} | nil
```

# `claim`

```elixir
@callback claim(
  Spectre.Instance.Ref.t(),
  keyword()
) :: {:ok, Spectre.Instance.Owner.Lease.t()} | {:error, term()}
```

# `release`
*optional* 

```elixir
@callback release(Spectre.Instance.Ref.t(), Spectre.Instance.Owner.Lease.t(), keyword()) ::
  :ok | {:error, term()}
```

# `validate`

```elixir
@callback validate(Spectre.Instance.Ref.t(), Spectre.Instance.Owner.Lease.t(), keyword()) ::
  :ok | {:error, term()}
```

# `assert_current`

```elixir
@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.

# `claim`

```elixir
@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.

# `normalize`

```elixir
@spec normalize(config()) :: {:ok, {module(), keyword()}} | {:error, term()}
```

Normalizes an ownership adapter; `nil` selects the local-only adapter.

# `release`

```elixir
@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.

# `validate`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
