Default session store: an ETS table held by a supervised owner process.
The table is owned by this process rather than by a session, so sequence state survives a session-process crash and reconnect, and a replacement session resumes where the dead one stopped instead of restarting at sequence 1. It is not crash durable: the table dies with its owner and with the VM.
Store operations take the table itself as the store_ref and run in the
calling session's process; the owner is only consulted for table/1 and
dump/2.
Options
:name— the table name,FIX.Session.Store.ETSby default, which also serves as thestore_ref. Passnilfor an unnamed table (isolated, so safe forasync: truetests) and usetable/1as thestore_ref.:file— snapshot path. When set, a snapshot is restored at start-up if the file exists and dumped on graceful shutdown. This is best-effort only: after a hard crash the snapshot on disk is stale, and restoring it would resume at sequence numbers already sent. A file that exists but cannot be verified fails start-up rather than silently resetting sequences to 1.
Error semantics
load/2, save_inbound/3, and commit_outbound/5 report a missing
table as {:error, :store_unavailable}. get_outbound/3 instead raises
when the table is gone: its :error return must mean "never stored" and
nothing else, because the resend path answers it with a
SequenceReset-GapFill.
Summary
Functions
Returns a specification to start this module under a supervisor.
Writes a snapshot of the current table contents to path.
Returns the owner's table, for use as a session's store_ref.
Types
@type store_ref() :: :ets.table()
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec dump(GenServer.server(), Path.t()) :: :ok | {:error, term()}
Writes a snapshot of the current table contents to path.
@spec start_link(keyword()) :: GenServer.on_start()
@spec table(GenServer.server()) :: store_ref()
Returns the owner's table, for use as a session's store_ref.