reckon_db_store (reckon_db v5.7.0)
View SourceKhepri store lifecycle management for reckon-db
Manages the Khepri store instance, including: - Starting and stopping the store - Cluster formation (in cluster mode) - Health checks
Summary
Functions
Idempotently (re)start this store's local Khepri/Ra server.
Get the current leader node for the store
Get the store name (for use with khepri operations)
Check if the store is ready
Start the store worker IMPORTANT: We use store_worker_name/1 for gen_server registration to avoid conflicting with Khepri's internal naming. Khepri uses the StoreId for its Ra cluster and process registration.
Types
-type integrity_config() :: disabled | #{enabled := true, key_source := integrity_key_source()}.
-type integrity_key_source() :: {env_var, EnvName :: binary()} | {sealed_file, Path :: file:filename()}.
-type store_config() :: #store_config{store_id :: atom(), data_dir :: string(), mode :: single | cluster, timeout :: pos_integer(), writer_pool_size :: pos_integer(), reader_pool_size :: pos_integer(), gateway_pool_size :: pos_integer(), options :: map(), integrity :: integrity_config(), indexes :: [index_decl()]}.
Functions
Idempotently (re)start this store's local Khepri/Ra server.
The cluster coordinator calls this to self-heal a local store that was torn down by a reset-during-join: khepri_cluster:join resets the local store as part of joining, so a join interrupted mid-reset (e.g. the coordinator's timeout guard killed it) can leave the local Ra server gone — with the coordinator then looping forever on "not registered". A no-op when the server is already registered.
Get the current leader node for the store
Get the store name (for use with khepri operations)
Check if the store is ready
-spec start_link(store_config()) -> {ok, pid()} | {error, term()}.
Start the store worker IMPORTANT: We use store_worker_name/1 for gen_server registration to avoid conflicting with Khepri's internal naming. Khepri uses the StoreId for its Ra cluster and process registration.