reckon_db_emitter (reckon_db v1.2.7)

View Source

Emitter worker for reckon-db

A gen_server that handles event broadcasting for subscriptions. Each subscription has a pool of emitter workers that receive events from Khepri triggers and forward them to subscribers.

Message types handled: - {broadcast, Topic, Event}: Broadcast event to all subscribers on topic - {forward_to_local, Topic, Event}: Forward event locally (optimization) - {events, [Event]}: Direct event delivery to subscriber pid

Summary

Types

event/0

-type event() ::
          #event{event_id :: binary(),
                 event_type :: binary(),
                 stream_id :: binary(),
                 version :: non_neg_integer(),
                 data :: map() | binary(),
                 metadata :: map(),
                 tags :: [binary()] | undefined,
                 timestamp :: integer(),
                 epoch_us :: integer(),
                 data_content_type :: binary(),
                 metadata_content_type :: binary()}.

Functions

child_spec(StoreId, SubscriptionKey, Subscriber, EmitterName)

-spec child_spec(atom(), binary(), pid() | undefined, atom()) -> supervisor:child_spec().

Create a child spec for the emitter worker

code_change(OldVsn, State, Extra)

handle_call(Request, From, State)

handle_cast(Msg, State)

handle_info(Info, State)

init(_)

start_link(StoreId, SubscriptionKey, Subscriber, EmitterName)

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

Start an emitter worker

terminate(Reason, State)

update_subscriber(Emitter, NewSubscriber)

-spec update_subscriber(pid() | atom(), pid()) -> ok.

Update the subscriber pid