Jido.Signal.Journal.Adapters.ETS (Jido Signal v1.0.0)
View SourceETS-based implementation of the Journal persistence behavior. Uses separate ETS tables for signals, causes, effects, and conversations.
Configuration
The adapter requires a prefix for table names to allow multiple instances:
{:ok, _pid} = Jido.Signal.Journal.Adapters.ETS.start_link("my_journal_")
{:ok, journal} = Jido.Signal.Journal.new(Jido.Signal.Journal.Adapters.ETS)
This will create tables with names:
- :my_journal_signals
- :my_journal_causes
- :my_journal_effects
- :my_journal_conversations
Summary
Functions
Returns a specification to start this module under a supervisor.
Cleans up all ETS tables used by this adapter instance.
Gets all signals in the journal.
Handles GenServer calls for signal operations.
Initializes the ETS adapter with the given table name prefix.
Starts the ETS adapter with the given table name prefix.
Types
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Cleans up all ETS tables used by this adapter instance.
Gets all signals in the journal.
Handles GenServer calls for signal operations.
Parameters
{:put_signal, signal}
- Stores a signal in the journal{:get_signal, signal_id}
- Retrieves a signal by ID{:put_cause, cause_id, effect_id}
- Records a cause-effect relationship{:get_effects, signal_id}
- Gets all effects for a signal{:get_cause, signal_id}
- Gets the cause for a signal{:put_conversation, conversation_id, signal_id}
- Adds a signal to a conversation{:get_conversation, conversation_id}
- Gets all signals in a conversation:get_all_signals
- Gets all signals in the journal:cleanup
- Cleans up all ETS tables
Returns
{:reply, result, adapter}
for successful operations{:reply, {:error, reason}, adapter}
for failed operations
Initializes the ETS adapter with the given table name prefix.
Parameters
prefix
: The prefix to use for table names
Returns
{:ok, adapter}
if initialization succeeds{:error, reason}
if initialization fails
Examples
iex> {:ok, adapter} = Jido.Signal.Journal.Adapters.ETS.init("my_journal_")
iex> adapter.signals_table
:my_journal_signals_...
Starts the ETS adapter with the given table name prefix.