reckon_db_emitter_pool (reckon_db v1.2.7)

View Source

Emitter pool supervisor for reckon-db

Supervises a pool of emitter workers for a single subscription. Each subscription can have multiple emitter workers for load distribution.

Summary

Functions

Generate the name for an emitter pool

Start an emitter pool for a subscription

Start the emitter pool supervisor

Stop an emitter pool by key (deprecated, use stop_emitter/2)

Stop an emitter pool for a subscription

Update an emitter pool configuration

Types

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.

Functions

init(_)

name(StoreId, SubscriptionKey)

-spec name(atom(), binary()) -> atom().

Generate the name for an emitter pool

start_emitter(StoreId, Subscription)

-spec start_emitter(atom(), subscription()) -> {ok, pid()} | {error, term()}.

Start an emitter pool for a subscription

start_link(StoreId, Subscription)

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

Start the emitter pool supervisor

stop(StoreId, SubscriptionKey)

-spec stop(atom(), binary()) -> ok | {error, term()}.

Stop an emitter pool by key (deprecated, use stop_emitter/2)

stop_emitter(StoreId, Subscription)

-spec stop_emitter(atom(), subscription()) -> ok | {error, term()}.

Stop an emitter pool for a subscription

update_emitter(StoreId, Subscription)

-spec update_emitter(atom(), subscription()) -> ok | {error, term()}.

Update an emitter pool configuration