reckon_db_index_config (reckon_db v5.0.0)
View SourcePer-store secondary-index declaration registry.
A store declares which secondary indexes it maintains in #store_config.indexes (none by default). This module installs that declared list into persistent_term at store startup so the append hot path can read it without process-state coupling — exactly the pattern reckon_db_integrity_key uses for the HMAC key.
Storage
The declared index list is placed in persistent_term under {reckon_db, indexes, StoreId}. Callers read it via declared/1 on every append; the lookup is sub-microsecond.
Index kinds
tags— index every tag in#event.tags.event_type— index#event.event_type.{meta, Key}— indexmaps:get(Key, metadata)when present.
See plans/DESIGN_SECONDARY_INDEX.md.
Summary
Functions
Remove a store's index declaration from persistent_term (shutdown / test isolation).
The declared index list for a store ([] if none / not loaded).
Whether a given index kind is declared for a store. Kind is an index_decl() (tags, event_type, or {meta, Key}). Drives the read-path "use index vs scan-and-warn" decision.
Install a store's declared index list into persistent_term at startup. Idempotent: re-loading overwrites the previous declaration.
Types
-type index_decl() :: tags | event_type | {meta, Key :: binary()}.
-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
-spec clear(StoreId :: atom()) -> ok.
Remove a store's index declaration from persistent_term (shutdown / test isolation).
-spec declared(StoreId :: atom()) -> [index_decl()].
The declared index list for a store ([] if none / not loaded).
-spec is_indexed(StoreId :: atom(), Kind :: index_decl()) -> boolean().
Whether a given index kind is declared for a store. Kind is an index_decl() (tags, event_type, or {meta, Key}). Drives the read-path "use index vs scan-and-warn" decision.
-spec load(store_config()) -> ok.
Install a store's declared index list into persistent_term at startup. Idempotent: re-loading overwrites the previous declaration.