View Source Eventize.Persistence.EventStore behaviour (eventize v0.2.0)
EventStore is a GenServer
process used to store
events for Eventize.EventSourcedProcess
instances.
Link to this section Summary
Types
A map containing all data needed to append events to the event store.
A map containing all data needed to append a snapshot to the event store.
A map containing all data needed to delete events from the event store.
Represents the response a caller will receive when deleting events or snapshots.
A map containing all data needed to delete snapshots from the event store.
Represents the response that a caller will receive when reading or appending events.
A map containing all data needed to get events from the event store.
A map containing all data needed to load a snapshot from the event store.
Represents the response that a caller will receive when reading or appending a snapshot.
Link to this section Types
@type append_events_command() :: %{ stream_name: String.t(), events: [{term(), map()}], expected_version: :any | :empty | non_neg_integer() }
A map containing all data needed to append events to the event store.
@type append_snapshot_command() :: %{ stream_name: String.t(), snapshot: {term(), map()}, version: non_neg_integer() }
A map containing all data needed to append a snapshot to the event store.
@type delete_events_command() :: %{ stream_name: String.t(), version: non_neg_integer() | :all }
A map containing all data needed to delete events from the event store.
@type delete_response() :: :ok | {:error, term()}
Represents the response a caller will receive when deleting events or snapshots.
@type delete_snapshots_command() :: %{ stream_name: String.t(), version: non_neg_integer() | :all }
A map containing all data needed to delete snapshots from the event store.
@type event_bus() :: %{ load_events: (String.t(), :start | non_neg_integer(), :all | non_neg_integer() -> events_response()), append_events: (String.t(), [{term(), map()}], :any | :empty | non_neg_integer() -> events_response()), delete_events: (String.t(), non_neg_integer() -> delete_response()), load_snapshot: (String.t(), :max | non_neg_integer() -> snapshot_response()), append_snapshot: (String.t(), {term(), map()}, non_neg_integer() -> snapshot_response()), delete_snapshots: (String.t(), non_neg_integer() -> delete_response()) }
@type events_response() :: {:ok, [Eventize.Persistence.EventStore.EventData], :empty | non_neg_integer()} | {:error, term()}
Represents the response that a caller will receive when reading or appending events.
@type load_events_query() :: %{ stream_name: String.t(), start: :start | non_neg_integer(), max_count: :all | non_neg_integer() }
A map containing all data needed to get events from the event store.
@type load_snapshot_query() :: %{ stream_name: String.t(), max_version: :max | non_neg_integer() }
A map containing all data needed to load a snapshot from the event store.
@type snapshot_response() :: {:ok, %Eventize.Persistence.EventStore.SnapshotData{ meta_data: term(), payload: term(), version: term() } | nil} | {:error, term()}
Represents the response that a caller will receive when reading or appending a snapshot.
Link to this section Callbacks
@callback append_events(append_events_command(), GenServer.from(), term()) :: {:reply, events_response(), term()} | {:reply, events_response(), term(), timeout() | :hibernate | {:continue, continue_arg :: term()}} | {:stop, term(), term(), term()} | {:stop, term(), term()}
@callback append_snapshot(append_snapshot_command(), GenServer.from(), term()) :: {:reply, snapshot_response(), term()} | {:reply, snapshot_response(), term(), timeout() | :hibernate | {:continue, continue_arg :: term()}} | {:stop, term(), term(), term()} | {:stop, term(), term()}
@callback delete_events(delete_events_command(), GenServer.from(), term()) :: {:reply, delete_response(), term()} | {:reply, delete_response(), term(), timeout() | :hibernate | {:continue, continue_arg :: term()}} | {:stop, term(), term(), term()} | {:stop, term(), term()}
@callback delete_snapshots(delete_snapshots_command(), GenServer.from(), term()) :: {:reply, delete_response(), term()} | {:reply, delete_response(), term(), timeout() | :hibernate | {:continue, continue_arg :: term()}} | {:stop, term(), term(), term()} | {:stop, term(), term()}
@callback load_events(load_events_query(), GenServer.from(), term()) :: {:reply, events_response(), term()} | {:reply, events_response(), term(), timeout() | :hibernate | {:continue, continue_arg :: term()}} | {:stop, term(), term(), term()} | {:stop, term(), term()}
@callback load_snapshot(load_snapshot_query(), GenServer.from(), term()) :: {:reply, snapshot_response(), term()} | {:reply, snapshot_response(), term(), timeout() | :hibernate | {:continue, continue_arg :: term()}} | {:stop, term(), term(), term()} | {:stop, term(), term()}