commanded v0.10.0 Commanded.EventStore behaviour

Defines the behaviour to be implemented by an event store adapter to be used by Commanded.

Summary

Callbacks

Acknowledge receipt and successful processing of the given event received from a subscription to an event stream

Append one or more events to a stream atomically

Delete a previously recorded snapshop for a given source

Read a snapshot, if available, for a given source

Record a snapshot of the data and metadata for a given source

Streams events from the given stream, in the order in which they were originally written

Subscriber will be notified of every event persisted to any stream

Unsubscribe an existing subscriber from all event notifications

Types

reason()
reason() :: term
snapshot()
source_uuid()
source_uuid() :: String.t
start_from()
start_from() :: :origin | :current | integer
stream_uuid()
stream_uuid() :: String.t
stream_version()
stream_version() :: integer
subscription_name()
subscription_name() :: String.t

Callbacks

ack_event(pid, arg1)
ack_event(pid, Commanded.EventStore.RecordedEvent.t) :: any

Acknowledge receipt and successful processing of the given event received from a subscription to an event stream.

append_to_stream(stream_uuid, expected_version, events)
append_to_stream(stream_uuid, expected_version :: non_neg_integer, events :: [Commanded.EventStore.EventData.t]) ::
  {:ok, stream_version} |
  {:error, reason}

Append one or more events to a stream atomically.

delete_snapshot(source_uuid)
delete_snapshot(source_uuid) :: :ok | {:error, reason}

Delete a previously recorded snapshop for a given source

read_snapshot(source_uuid)
read_snapshot(source_uuid) ::
  {:ok, snapshot} |
  {:error, :snapshot_not_found}

Read a snapshot, if available, for a given source.

record_snapshot(snapshot)
record_snapshot(snapshot) :: :ok | {:error, reason}

Record a snapshot of the data and metadata for a given source

stream_forward(stream_uuid, start_version, read_batch_size)
stream_forward(stream_uuid, start_version :: non_neg_integer, read_batch_size :: non_neg_integer) ::
  Enumerable.t |
  {:error, reason}

Streams events from the given stream, in the order in which they were originally written.

subscribe_to_all_streams(subscription_name, subscriber, start_from)
subscribe_to_all_streams(subscription_name, subscriber :: pid, start_from) ::
  {:ok, subscription :: pid} |
  {:error, :subscription_already_exists} |
  {:error, reason}

Subscriber will be notified of every event persisted to any stream.

unsubscribe_from_all_streams(subscription_name)
unsubscribe_from_all_streams(subscription_name) :: :ok

Unsubscribe an existing subscriber from all event notifications.