Sourced.Operation (sourced v0.1.0)

Copy Markdown View Source

The value threaded through an event store's middleware pipeline.

Analogous to a Plug.Conn: each Sourced.Middleware receives an operation, may transform it on the way in (e.g. encode events, resolve query types in opts), calls the next layer, and may transform result on the way out (e.g. decode stored events). The innermost terminal calls the adapter and populates result.

Summary

Types

The result an append operation carries once the terminal has run.

The result a query operation carries once the terminal has run.

t()

Types

action()

@type action() :: :append | :query | :subscribe | :notify

append_result()

@type append_result() ::
  {:ok, non_neg_integer()}
  | {:error, Sourced.EventStore.Behaviour.append_error() | term()}

The result an append operation carries once the terminal has run.

query_result()

@type query_result() ::
  {:ok, Sourced.EventStore.Behaviour.query_result()} | {:error, term()}

The result a query operation carries once the terminal has run.

t()

@type t() :: %Sourced.Operation{
  action: action(),
  events: [Sourced.EventStore.Behaviour.event() | struct()] | nil,
  opts: keyword(),
  result: {:ok, term()} | {:error, term()} | nil,
  store: Sourced.EventStore.Behaviour.store()
}