eidetic v0.2.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)

aggregate =
  aggregate
  |> Eidetic.save!()

Summary

Functions

Add a subscriber so that they receive notifications whenever an event is written to the EventStore

Load events from the EventStore and produce a aggregate

Load events 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

Functions

add_subscriber(subscriber)

Add a subscriber so that they receive notifications whenever an event is written to the EventStore

load(type, identifier)

Load events from the EventStore and produce a aggregate

load!(type, identifier)

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

save(aggregate)

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

save!(aggregate)

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.

Callbacks

handle_call({}, pid, atom)
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}]}