Packages
reckon_db
5.9.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_app.erl
%% @doc Application behaviour for reckon-db
%% @author rgfaber
-module(reckon_db_app).
-behaviour(application).
-include("reckon_db.hrl").
-include("reckon_db_telemetry.hrl").
%% Application callbacks
-export([start/2, stop/1]).
%% API
-export([
start/0,
stop/0
]).
%%====================================================================
%% API
%%====================================================================
%% @doc Start the reckon_db application
-spec start() -> {ok, pid()} | {error, term()}.
start() ->
application:ensure_all_started(reckon_db).
%% @doc Stop the reckon_db application
-spec stop() -> ok | {error, term()}.
stop() ->
application:stop(reckon_db).
%%====================================================================
%% Application callbacks
%%====================================================================
%% @private
-spec start(application:start_type(), term()) -> {ok, pid()} | {error, term()}.
start(_StartType, _StartArgs) ->
%% Start telemetry handlers
ok = start_telemetry_handlers(),
%% Start top-level supervisor
case reckon_db_sup:start_link() of
{ok, Pid} ->
logger:info("reckon-db v~s started", [?RECKON_DB_VERSION]),
{ok, Pid};
{error, Reason} = Error ->
logger:error("Failed to start reckon-db: ~p", [Reason]),
Error
end.
%% @private
-spec stop(term()) -> ok.
stop(_State) ->
logger:info("reckon-db stopped"),
ok.
%%====================================================================
%% Internal functions
%%====================================================================
%% @private
-spec start_telemetry_handlers() -> ok.
start_telemetry_handlers() ->
Handlers = application:get_env(reckon_db, telemetry_handlers, [logger]),
lists:foreach(fun attach_handler/1, Handlers),
ok.
%% @private
-spec attach_handler(atom()) -> ok.
attach_handler(logger) ->
%% Basic logger handler for telemetry events
Events = [
?STREAM_WRITE_STOP,
?STREAM_WRITE_ERROR,
?STREAM_READ_STOP,
?SUBSCRIPTION_CREATED,
?SUBSCRIPTION_DELETED,
?CLUSTER_NODE_UP,
?CLUSTER_NODE_DOWN,
?CLUSTER_LEADER_ELECTED,
?STORE_STARTED,
?STORE_STOPPED
],
telemetry:attach_many(
reckon_db_logger_handler,
Events,
fun reckon_db_telemetry:handle_event/4,
#{}
),
ok;
attach_handler(opentelemetry) ->
%% OpenTelemetry handler - optional, for datacenter deployments
%% This would be implemented in reckon_db_telemetry_otel module
logger:info("OpenTelemetry handler requested but not yet implemented"),
ok;
attach_handler(Handler) ->
logger:warning("Unknown telemetry handler: ~p", [Handler]),
ok.