ExESDB.EventStore (ex_esdb v0.0.8-alpha)
A GenServer wrapper around :khepri to act as an event store. Inspired by EventStoreDB's API.
Summary
Functions
Append events to a stream.
Returns a specification to start this module under a supervisor.
Get the current state of the store.
Get the list of streams in the store.
Read events from a stream.
Functions
Append events to a stream.
Parameters
stream_id: The id of the stream to append to.expected_version: The expected version of the stream (for optimistic concurrency).events: A list of events to append.
Returns
{:ok, new_stream_version}if successful.{:error, reason}if unsuccessful.
Returns a specification to start this module under a supervisor.
See Supervisor.
Get the current state of the store.
Parameters
store: The store to get the state of.
Returns
- `{:ok, state}` if successful.
- `{:error, reason}` if unsuccessful.
Get the list of streams in the store.
Parameters
store: The store to get the streams from.
Returns
{:ok, streams}if successful.
Read events from a stream.
Parameters
stream_name: The name of the stream to read from.start_version: The version to start reading from.count: The number of events to read.
Returns
{:ok, events}if successful.{:error, reason}if unsuccessful.