Persistence behavior for Thread storage.
Store operations return updated store state to preserve purity for adapters that don't use external processes.
Example
{:ok, store} = Thread.Store.new()
thread = Thread.new(id: "t1")
{:ok, store} = Thread.Store.save(store, thread)
{:ok, store, loaded} = Thread.Store.load(store, "t1")
Summary
Functions
Append entries to thread in store
Delete thread from store
List all thread IDs in store
Load thread from store
Create new store with adapter
Save thread to store
Types
@type adapter_state() :: term()
@type t() :: %Jido.Thread.Store{adapter: module(), adapter_state: adapter_state()}
Callbacks
@callback append(adapter_state(), thread_id :: String.t(), [Jido.Thread.Entry.t()]) :: {:ok, adapter_state(), Jido.Thread.t()} | {:error, adapter_state(), term()}
Append entries to thread
@callback init(opts :: keyword()) :: {:ok, adapter_state()} | {:error, term()}
Initialize adapter state
@callback load(adapter_state(), thread_id :: String.t()) :: {:ok, adapter_state(), Jido.Thread.t()} | {:error, adapter_state(), :not_found | term()}
Load thread by ID
@callback save(adapter_state(), Jido.Thread.t()) :: {:ok, adapter_state()} | {:error, adapter_state(), term()}
Save thread
Functions
@spec append(t(), String.t(), Jido.Thread.Entry.t() | [Jido.Thread.Entry.t()]) :: {:ok, t(), Jido.Thread.t()} | {:error, t(), term()}
Append entries to thread in store
Delete thread from store
List all thread IDs in store
Load thread from store
Create new store with adapter
@spec save(t(), Jido.Thread.t()) :: {:ok, t()} | {:error, t(), term()}
Save thread to store