evoq_adapter behaviour (evoq v1.23.0)
View SourceEvent store adapter behavior for evoq
Defines the interface for event store operations. Implementations provide the actual connection to an event store backend.
Implementing an Adapter
-module(my_adapter).
-behaviour(evoq_adapter).
append(StoreId, StreamId, ExpectedVersion, Events) ->
%% Implementation here
{ok, NewVersion}.Configuration
Set the adapter in application config:
{evoq, [
{event_store_adapter, my_adapter}
]}
Summary
Callbacks
-callback ccc_read_by_payload(StoreId :: atom(), Key :: binary(), Value :: binary(), BatchSize :: pos_integer()) -> {ok, [evoq_event()]} | {error, term()}.
-callback ccc_read_by_payload_hash(StoreId :: atom(), Keys :: [binary()], Values :: [binary()], BatchSize :: pos_integer()) -> {ok, [evoq_event()]} | {error, term()}.
-callback read(StoreId :: atom(), StreamId :: binary(), StartVersion :: non_neg_integer(), Count :: pos_integer(), Direction :: forward | backward) -> {ok, [evoq_event()]} | {error, term()}.
-callback read_all_global(StoreId :: atom(), Offset :: non_neg_integer(), BatchSize :: pos_integer()) -> {ok, [evoq_event()]} | {error, term()}.
-callback read_by_event_types(StoreId :: atom(), EventTypes :: [binary()], BatchSize :: pos_integer()) -> {ok, [evoq_event()]} | {error, term()}.