Lightweight ETS-backed storage adapter implementing both CommBus storage behaviours.
This adapter is useful for tests, prototyping, and consumers that do not yet have
a database wired up. Tables are created on demand and names can be customized via
the :entries_table and :conversations_table application env keys.
Summary
Functions
Removes an entry from the ETS table by ID.
Looks up a single entry by ID in the ETS table.
Lists all entries from the ETS table, applying optional keyword filters
for :enabled, :mode, and :keywords.
Looks up a conversation by ID in the ETS table.
Stores a conversation in the ETS table, auto-generating an ID if not present.
Stores an entry in the ETS table, auto-generating an ID if not present.
Updates an existing conversation in the ETS table, merging the given updates into the existing struct.
Functions
Removes an entry from the ETS table by ID.
Parameters
id— The entry identifier.
Returns
:ok.
Looks up a single entry by ID in the ETS table.
Parameters
id— The entry identifier.
Returns
{:ok, %CommBus.Entry{}} if found, or {:error, :not_found}.
Lists all entries from the ETS table, applying optional keyword filters
for :enabled, :mode, and :keywords.
Parameters
opts— Keyword filters.
Returns
{:ok, [%CommBus.Entry{}]}.
Looks up a conversation by ID in the ETS table.
Parameters
id— The conversation identifier.
Returns
{:ok, %CommBus.Conversation{}} if found, or {:error, :not_found}.
Stores a conversation in the ETS table, auto-generating an ID if not present.
Parameters
conversation— A%CommBus.Conversation{}struct.
Returns
{:ok, %CommBus.Conversation{}} with the (possibly auto-generated) ID.
Stores an entry in the ETS table, auto-generating an ID if not present.
Parameters
entry— A%CommBus.Entry{}struct.
Returns
{:ok, %CommBus.Entry{}} with the (possibly auto-generated) ID.
Updates an existing conversation in the ETS table, merging the given updates into the existing struct.
Parameters
id— The conversation identifier.updates— A map of fields to update.
Returns
{:ok, %CommBus.Conversation{}} on success, or {:error, :not_found}.