reckon_db_subscription_health (reckon_db v1.6.0)

View Source

Subscription health monitor for reckon-db

Periodic health checks that detect and clean up: - Stale subscriptions: subscriber process is dead - Orphaned emitter pools: pool running without a subscription - Missing emitter pools: subscription exists but no pool on leader

Runs as a child of notification_sup (after leader_sup and emitter_sup). Only performs cleanup when this node is the Ra leader.

Summary

Types

store_config/0

-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()}.

subscription/0

-type subscription() ::
          #subscription{id :: binary(),
                        type :: subscription_type(),
                        selector :: binary() | map(),
                        subscription_name :: binary(),
                        subscriber_pid :: pid() | undefined,
                        created_at :: integer(),
                        pool_size :: pos_integer(),
                        checkpoint :: non_neg_integer() | undefined,
                        options :: map()}.

subscription_type/0

-type subscription_type() ::
          stream | event_type | event_pattern | event_payload | tags | by_stream | by_event_type |
          by_event_pattern | by_event_payload | by_tags.

Functions

handle_call(Request, From, State)

handle_cast(Msg, State)

handle_info(Info, State)

health_check(StoreId)

-spec health_check(atom()) -> {ok, map()} | {error, term()}.

Run an on-demand health check and return the report

init(Store_config)

start_link(Store_config)

-spec start_link(store_config()) -> {ok, pid()} | {error, term()}.

terminate(Reason, State)