# `ExGram.FSM.Storage.ETS`
[🔗](https://github.com/rockneurotiko/ex_gram_fsm/blob/v0.1.0/lib/ex_gram/fsm/storage/ets.ex#L1)

Default in-memory FSM storage using ETS.

Suitable for development and single-node deployments.
**State is lost on application restart.**

## Bot-scoped tables

Each bot gets its own ETS table, named `:"ex_gram_fsm_{bot_name}"` by default.
This ensures multiple bots running in the same node do not share FSM state.
Override the table name via the `:ets_table` option:

    use ExGram.FSM, storage: ExGram.FSM.Storage.ETS, ets_table: :my_custom_table

## Concurrency

Single-key ETS operations (`get_state`, `set_state`, `clear`) are atomic.
However, `update_data/3` and `set_data/3` are read-modify-write operations
and are **not atomic**. If you need atomicity for concurrent updates to the
same key, use a storage backend with proper transactions (Postgres, Mnesia, etc.).

## Table ownership

The ETS table is created as `:public` and `:named_table` in `init/2`.
The table is owned by the process that first calls `init/2`.
If that process dies, the table is destroyed.

For production use, consider wrapping the table in a GenServer in your
supervision tree to ensure stable ownership.

---

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