ETS-backed store implementing both ExAthena.Sessions.Store (event-log)
and ExAthena.Sessions.SchemaStore (row-shaped sessions / messages /
snapshots).
Tables
| Name | Type | Key |
|---|---|---|
:ex_athena_session_rows | :set | session_id |
:ex_athena_message_rows | :ordered_set | {session_id, seq, message_id} |
:ex_athena_snapshot_rows | :ordered_set | {session_id, message_id, snapshot_id} |
:ex_athena_snapshot_index | :set | snapshot_id |
:ex_athena_session_events | :ordered_set | {session_id, monotonic_time} |
:ex_athena_snapshot_index is an internal inverse index maintained by
put_snapshot/1 and cleared by delete_snapshots_for_session/1. It enables
O(1) lookup in get_snapshot/1 without scanning :ex_athena_snapshot_rows.
The GenServer owns table creation. All public CRUD operations work without the GenServer's pid — reads are lock-free.
Durability
ETS is in-memory; data survives process crashes (tables are public) but
not BEAM restarts. Call migrate_jsonl/1 at boot to replay an existing
JSONL store into the row tables.
Summary
Functions
Returns a specification to start this module under a supervisor.
Import sessions from a JSONL root directory into the ETS row tables.
Test helper: wipe all tables. Not part of the Store contract.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec migrate_jsonl(keyword()) :: {:ok, %{sessions: non_neg_integer(), messages: non_neg_integer()}}
Import sessions from a JSONL root directory into the ETS row tables.
Options:
:root— directory of<sid>.jsonlfiles. Defaults toPath.join(File.cwd!(), ".exathena/sessions").:overwrite— whentrue(default), existing rows for a session are wiped before re-importing. Whenfalse, sessions already present in the store are skipped entirely.
Returns {:ok, %{sessions: n, messages: m}}.
@spec reset() :: :ok
Test helper: wipe all tables. Not part of the Store contract.