Packages
reckon_db
5.7.0
5.11.0
5.10.4
5.10.3
5.10.1
5.10.0
5.9.1
5.9.0
5.8.3
5.8.2
5.8.1
5.8.0
5.7.0
5.6.1
5.6.0
5.5.5
5.5.4
5.5.3
5.5.2
5.5.1
5.5.0
5.4.0
5.2.2
5.2.1
5.2.0
5.1.0
5.0.0
4.0.0
3.1.2
3.1.1
3.0.0
2.3.7
2.3.6
2.3.5
2.3.4
2.3.3
2.3.2
2.3.1
2.3.0
2.2.2
2.2.0
2.1.4
2.1.3
2.1.2
2.1.1
2.1.0
2.0.0
1.7.7
1.7.6
1.7.5
1.7.4
1.7.3
1.7.2
1.7.1
1.7.0
1.6.3
1.6.2
1.6.1
1.6.0
1.5.1
1.5.0
1.4.5
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.3
1.3.2
1.3.1
1.3.0
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.1
1.1.0
1.0.3
1.0.2
1.0.1
1.0.0
BEAM-native Event Store built on Khepri/Ra with Raft consensus. Event sourcing, persistent subscriptions, snapshots, and automatic cluster formation via UDP multicast discovery. Ships embedded Rust NIFs for 3-15x acceleration of crypto, hashing, compression, aggregation, filter matching, and grap...
Current section
Files
Jump to
Current section
Files
src/reckon_db_store_mgr.erl
%% @doc Store manager for reckon-db
%%
%% Coordinates store lifecycle and provides store-level operations.
%%
%% @author rgfaber
-module(reckon_db_store_mgr).
-behaviour(gen_server).
-include("reckon_db.hrl").
%% API
-export([start_link/1]).
-export([get_info/1]).
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2]).
-record(state, {
store_id :: atom(),
config :: store_config()
}).
%%====================================================================
%% API
%%====================================================================
%% @doc Start the store manager
-spec start_link(store_config()) -> {ok, pid()} | {error, term()}.
start_link(#store_config{store_id = StoreId} = Config) ->
Name = reckon_db_naming:store_mgr_name(StoreId),
gen_server:start_link({local, Name}, ?MODULE, Config, []).
%% @doc Get store information
-spec get_info(atom()) -> {ok, map()} | {error, term()}.
get_info(StoreId) ->
Name = reckon_db_naming:store_mgr_name(StoreId),
gen_server:call(Name, get_info).
%%====================================================================
%% gen_server callbacks
%%====================================================================
%% @private
init(#store_config{store_id = StoreId} = Config) ->
logger:debug("Starting store manager for ~p", [StoreId]),
State = #state{
store_id = StoreId,
config = Config
},
{ok, State}.
%% @private
handle_call(get_info, _From, #state{store_id = StoreId, config = Config} = State) ->
Info = #{
store_id => StoreId,
mode => Config#store_config.mode,
data_dir => Config#store_config.data_dir,
ready => reckon_db_store:is_ready(StoreId)
},
{reply, {ok, Info}, State};
handle_call(_Request, _From, State) ->
{reply, {error, unknown_request}, State}.
%% @private
handle_cast(_Msg, State) ->
{noreply, State}.
%% @private
handle_info(_Info, State) ->
{noreply, State}.
%% @private
terminate(_Reason, _State) ->
ok.