Connection-scoped runtime store with ETS-backed concurrent reads.
Summary
Functions
Returns a specification to start this module under a supervisor.
Deletes a key from the connection store.
Reads a value from the connection store via an ETS ref immediately.
Returns default if the key is not found or the ETS query fails.
Fetch an app state sync key by its base64-encoded key ID.
Fetch the LTHash sync version state for a collection.
Merges map updates into the connection's :auth_state, automatically computing
and saving the :creds view projection simultaneously.
Synchronously puts a key-value pair into the connection store.
Store an app state sync key by its base64-encoded key ID.
Persist the LTHash sync version state for a collection.
Retrieves a deep map snapshot of the entire ETS connection store contents.
Starts the GenServer that owns the connection ETS table.
Returns a Ref struct allowing safe, concurrent reads from the ETS table
owned by the Store server.
Types
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec delete(GenServer.server() | BaileysEx.Connection.Store.Ref.t(), key()) :: :ok
Deletes a key from the connection store.
@spec get(BaileysEx.Connection.Store.Ref.t(), key(), term()) :: term()
Reads a value from the connection store via an ETS ref immediately.
Returns default if the key is not found or the ETS query fails.
@spec get_app_state_sync_key( BaileysEx.Connection.Store.Ref.t() | GenServer.server(), String.t() ) :: {:ok, %{key_data: binary()}} | {:error, term()}
Fetch an app state sync key by its base64-encoded key ID.
Returns {:ok, %{key_data: binary()}} or {:error, {:key_not_found, key_id}}.
Keys are stored under {:app_state_sync_key, key_id} in the ETS table.
@spec get_app_state_sync_version( BaileysEx.Connection.Store.Ref.t() | GenServer.server(), atom() ) :: map() | nil
Fetch the LTHash sync version state for a collection.
Returns nil if the collection has not been synced yet.
@spec merge_creds(GenServer.server() | BaileysEx.Connection.Store.Ref.t(), map()) :: :ok
Merges map updates into the connection's :auth_state, automatically computing
and saving the :creds view projection simultaneously.
@spec put(GenServer.server() | BaileysEx.Connection.Store.Ref.t(), key(), term()) :: :ok
Synchronously puts a key-value pair into the connection store.
@spec put_app_state_sync_key( GenServer.server() | BaileysEx.Connection.Store.Ref.t(), String.t(), map() ) :: :ok
Store an app state sync key by its base64-encoded key ID.
@spec put_app_state_sync_version( GenServer.server() | BaileysEx.Connection.Store.Ref.t(), atom(), map() | nil ) :: :ok
Persist the LTHash sync version state for a collection.
@spec snapshot(GenServer.server() | BaileysEx.Connection.Store.Ref.t()) :: map()
Retrieves a deep map snapshot of the entire ETS connection store contents.
@spec start_link(keyword()) :: GenServer.on_start()
Starts the GenServer that owns the connection ETS table.
@spec wrap(GenServer.server()) :: BaileysEx.Connection.Store.Ref.t()
Returns a Ref struct allowing safe, concurrent reads from the ETS table
owned by the Store server.