mem_evoq (mem_evoq v0.1.1)
View SourceFacade for the mem_evoq package.
Manages lifecycle of in-memory event stores intended for tests, demos, and reference use. Pairs with mem_evoq_adapter as an implementation of the evoq_event_store adapter behaviour.
Quick start
application:ensure_all_started(mem_evoq).
application:set_env(evoq, event_store_adapter, mem_evoq_adapter).
{ok, _} = mem_evoq:start_store(my_test_store).
%% Now any evoq dispatch targets the in-memory store.With integrity
Key = crypto:strong_rand_bytes(32),
{ok, _} = mem_evoq:start_store(my_test_store, #{
integrity => #{enabled => true, key => Key}
}).Integrity-enabled in-memory stores mirror reckon-db's behaviour (HMAC + chain hash on write, verify on read, snapshot anchors) so downstream consumers can test their integrity-violation handling without spinning up Khepri.
Summary
Functions
List all running in-memory stores.
Start an in-memory store with default options (no integrity).
Start an in-memory store with explicit options.
Stop an in-memory store and remove its child spec.
Types
-type store_opts() :: #{integrity => disabled | #{enabled := true, key := binary()}}.
Functions
List all running in-memory stores.
Start an in-memory store with default options (no integrity).
-spec start_store(atom(), store_opts()) -> {ok, pid()} | {error, term()}.
Start an in-memory store with explicit options.
On error returns one of:
{error, {already_started, Pid}}if the store already exists{error, {integrity_key_invalid_size, N}}if the key is not 32 bytes{error, integrity_config_invalid}if the integrity map is malformed
Stop an in-memory store and remove its child spec.
Idempotent: returns ok even if the store was not running.