# `Spectre.GAM.Domain.Projection.Store`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/gam/domain/projection/store.ex#L1)

Durable, disposable Domain read model beside the canonical ledger.

A generation is rebuilt by a trusted Domain from verified ledger batches.
`commit/5` atomically applies row changes and advances its exact predecessor
cursor. Readers specify that cursor: stale pages are errors, never mixed
revisions. A persisted projection is not authenticated by its head digest;
cold recovery must rebuild it from the ledger before using it for authority.

Keys are `{collection, identity}`. Writes receive typed values; adapters encode
them through `Rows`. Reads return canonical bytes, not a serialized process or
a full-state snapshot. No PID, timer,
capability, execution secret or callback belongs here. Implementations must
distinguish absence from storage failure and support indexed bounded reads.

# `change`

```elixir
@type change() :: {:put, key(), term()} | {:delete, key()}
```

# `config`

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

# `cursor`

```elixir
@type cursor() :: Spectre.GAM.Ledger.cursor()
```

# `handle`

```elixir
@type handle() :: %{domain: String.t(), generation: String.t()}
```

# `key`

```elixir
@type key() :: {atom(), term()}
```

# `commit`

```elixir
@callback commit(handle(), cursor(), cursor(), Enumerable.t(), keyword()) ::
  :ok | {:error, term()}
```

# `fetch`

```elixir
@callback fetch(handle(), cursor(), [key()], keyword()) ::
  {:ok, %{optional(key()) =&gt; binary()}} | {:error, term()}
```

# `head`

```elixir
@callback head(
  String.t(),
  keyword()
) ::
  {:ok, %{handle: handle(), cursor: cursor()}} | :not_found | {:error, term()}
```

# `open`

```elixir
@callback open(
  String.t(),
  keyword()
) :: {:ok, handle()} | {:error, term()}
```

# `page`

```elixir
@callback page(handle(), cursor(), atom(), keyword()) ::
  {:ok, [{key(), binary()}], term() | nil} | {:error, term()}
```

# `select`

```elixir
@callback select(handle(), cursor(), atom(), keyword(), keyword()) ::
  {:ok, [{key(), binary()}], term() | nil} | {:error, term()}
```

# `commit`

# `fetch`

# `head`

# `open`

# `page`

---

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