# `ExGAM.Ledger.Store.Mnesia`
[🔗](https://github.com/elchemista/ex_gam/blob/0.1.0/lib/ex_gam/ledger/store/mnesia.ex#L1)

Transactional Mnesia adapter for the append-only Domain ledger.

The host owns the Mnesia schema, directory and cluster membership.
`ensure_tables/1` is an explicit installation helper; normal ledger
operations never create schemas or tables. Every append uses one
synchronous Mnesia transaction and a write lock on the Domain head, so the
expected revision, batch idempotency record, entries and new head move
together. Tables must use durable copies and majority commits; volatile
deployments should use `ExGAM.Ledger.Store.ETS` instead.

The adapter stores canonical `ExGAM.Ledger.Entry` bytes rather than native
structs. Table names and replica type are explicit deployment configuration.
`compressed: true` stores entries in a bounded, lossless compression envelope;
it does not require changing the Mnesia schema or rewrite existing rows.
`:disc_copies` still holds table data in RAM; use `:disc_only_copies` when
that deployment tradeoff is desired. Native batch reads use revision keys.

# `ensure_tables`

```elixir
@spec ensure_tables(keyword()) :: :ok | {:error, term()}
```

Creates the three required tables in an already running Mnesia schema.

---

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