reckon_db_persistence_worker (reckon_db v1.6.0)
View SourcePersistence worker for reckon-db
A GenServer that handles periodic disk persistence operations. This worker batches and schedules flush operations to ensure data is persisted to disk without blocking event append operations.
Features: - Configurable persistence interval (default: 5 seconds) - Batching of flush operations to reduce disk I/O - Graceful shutdown with final persistence - Per-store persistence workers
NOTE: The actual flush operation is currently DISABLED as Khepri/Ra handles persistence internally via Raft consensus. This module exists for future optimization and to match the architecture of ex-esdb.
Summary
Functions
Force immediate persistence of all pending stores.
Request that a store's data be persisted to disk.
Start a persistence worker for a specific store.
Types
-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()}.
Functions
Force immediate persistence of all pending stores.
This is a synchronous call that blocks until persistence is complete.
-spec request_persistence(atom()) -> ok | {error, not_found}.
Request that a store's data be persisted to disk.
This is a non-blocking call that queues the store for persistence. Returns ok immediately; actual persistence happens asynchronously.
-spec start_link(store_config()) -> {ok, pid()} | {error, term()}.
Start a persistence worker for a specific store.