eidetic v0.5.0 Eidetic.EventStore behaviour

This module manages loading / saving from / to the EventStore.

Configuring:

confing :eidetic eventstore_adapter: Some.Adapter

Using:

{:ok, aggregate} = Eidetic.save(an_aggregate)

# or
aggregate = Eidetic.save!(aggregate)

Link to this section Summary

Functions

Load events from the EventStore and produce an aggregate

Load events, to a particular version, from the EventStore and produce an aggregate

Load events from the EventStore and produce a aggregate, only returning the aggregate

Load events, to a particular version, from the EventStore and produce a aggregate, only returning the aggregate

Save an %Eidetic.Aggregate{}’s uncommitted events to the EventStore

Save an %Eidetic.Aggregate{}’s uncommitted events to the EventStore, only returning the aggregate

Link to this section Functions

Link to this function add_subscriber(subscriber)
add_subscriber(atom) :: any
Link to this function load(type, identifier)
load(atom, binary) :: {:ok, map}

Load events from the EventStore and produce an aggregate

Link to this function load(type, identifier, list)

Load events, to a particular version, from the EventStore and produce an aggregate

Link to this function load!(type, identifier)
load!(atom, binary) :: map

Load events from the EventStore and produce a aggregate, only returning the aggregate.

Link to this function load!(type, identifier, list)

Load events, to a particular version, from the EventStore and produce a aggregate, only returning the aggregate.

Link to this function save(aggregate)
save(map) :: {:ok, map}

Save an %Eidetic.Aggregate{}’s uncommitted events to the EventStore

Link to this function save!(aggregate)
save!(map) :: map

Save an %Eidetic.Aggregate{}’s uncommitted events to the EventStore, only returning the aggregate.

Eventually this will raise an error when a write / transaction fails.

Link to this section Callbacks

Link to this callback handle_call({}, pid, atom)
handle_call({:fetch_until, String.t, pos_integer}, pid, Map) :: {:ok, [{:events, [%Eidetic.Event{datetime: term, identifier: term, metadata: term, payload: term, serial_number: term, type: term, version: term}]}]}
handle_call({:fetch, String.t}, pid, Map) :: {:ok, [{:events, [%Eidetic.Event{datetime: term, identifier: term, metadata: term, payload: term, serial_number: term, type: term, version: term}]}]}
handle_call({:record, %Eidetic.Event{datetime: term, identifier: term, metadata: term, payload: term, serial_number: term, type: term, version: term}}, pid, Map) :: {:ok, [{:object_identifier, String.t}]}