evoq_read_model_ets (evoq v1.14.1)

View Source

ETS-based read model store implementation.

Default in-memory implementation of evoq_read_model behavior. Suitable for development, testing, and small-scale deployments.

Configuration

- name: ETS table name (default: auto-generated) - type: ETS table type (default: set) - access: public | protected | private (default: public)

Named tables are shared by default: if the table already exists, new instances join it instead of crashing. This allows multiple projections to write to the same read model while each maintaining their own checkpoint.

Summary

Functions

Clear all data from the table.

Delete a key.

Get a value by key.

Initialize ETS-backed read model.

List all key-value pairs with matching prefix. For ETS, prefix matching works on tuple/list keys.

Store a key-value pair.

Functions

clear(State)

-spec clear(#state{table :: ets:tid()}) -> {ok, #state{table :: ets:tid()}}.

Clear all data from the table.

delete(Key, State)

-spec delete(term(), #state{table :: ets:tid()}) -> {ok, #state{table :: ets:tid()}}.

Delete a key.

get(Key, State)

-spec get(term(), #state{table :: ets:tid()}) -> {ok, term()} | {error, not_found}.

Get a value by key.

init(Config)

-spec init(map()) -> {ok, #state{table :: ets:tid()}} | {error, term()}.

Initialize ETS-backed read model.

list(Prefix, State)

-spec list(term(), #state{table :: ets:tid()}) -> {ok, [{term(), term()}]}.

List all key-value pairs with matching prefix. For ETS, prefix matching works on tuple/list keys.

put(Key, Value, State)

-spec put(term(), term(), #state{table :: ets:tid()}) -> {ok, #state{table :: ets:tid()}}.

Store a key-value pair.