# `Mailglass.Adapters.Fake.Storage`
[🔗](https://github.com/szTheory/mailglass/blob/v0.1.0/lib/mailglass/adapters/fake/storage.ex#L1)

GenServer owning the `:mailglass_fake_mailbox` ETS table. Mirrors
`Swoosh.Adapters.Sandbox.Storage` pattern: the GenServer handles ownership
mutations (`checkout`, `checkin`, `allow`, `set_shared`, `find_owner`,
`{:DOWN, ...}`) but READS happen directly against ETS to bypass the mailbox.

## State

- `:owners` — MapSet of currently-checked-out owner pids.
- `:allowed` — map `allowed_pid => owner_pid` for allow-list delegation
  (LiveView, Playwright, Oban worker processes).
- `:shared` — single owner pid for global-mode tests (set via `set_shared/1`).
- `:monitors` — map `monitor_ref => pid` for auto-cleanup on DOWN.

## ETS table

`:mailglass_fake_mailbox` — `[:set, :named_table, :public, {:read_concurrency, true}]`.
Keys: owner pid. Values: list of records (prepended on each push, so newest is head).

## Divergences from `Swoosh.Adapters.Sandbox.Storage`

1. Table name: `:mailglass_fake_mailbox` (not `:swoosh_sandbox_emails`).
2. Stored value: `%{message: %Mailglass.Message{}, delivery_id: binary(),
   provider_message_id: binary(), recorded_at: DateTime.t()}` — not a bare email.
3. `send(owner_pid, {:mail, msg})` — not `{:email, email}`.
4. `push/2` accepts `owner_pid + record_map`; stores full record in ETS.

# `all`

Returns all records for the given owner pid. Newest first.

# `allow`

# `checkin`

# `checkout`

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `clear`

Removes the ETS entry for the given owner pid.

# `find_owner`

# `flush`

Removes all entries from the ETS table (used by `Fake.clear(:all)`).

# `get_shared`

# `push`

# `set_shared`

# `start_link`

---

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