reckon_db_tracker_group (reckon_db v1.6.0)

View Source

Tracker group management for reckon-db

Uses pg (process groups) for managing tracker processes. Trackers receive notifications about subscription lifecycle events.

This module provides: - Process group management for tracker processes - Notification broadcasting for created/deleted/updated events

Features that can be tracked: - subscriptions: Subscription lifecycle - streams: Stream lifecycle - snapshots: Snapshot lifecycle

Summary

Functions

Generate the group key for a feature's trackers

Join one or more processes to the tracker group for a feature

Remove one or more processes from the tracker group

Get all member processes tracking a feature

Notify all trackers that a feature instance was created

Notify all trackers that a feature instance was deleted

Notify all trackers that a feature instance was updated

Types

feature/0

-type feature() :: subscriptions | streams | snapshots | atom().

store_id/0

-type store_id() :: atom().

Functions

group_key(StoreId, Feature)

-spec group_key(store_id(), feature()) -> integer().

Generate the group key for a feature's trackers

join(StoreId, Feature, PidOrPids)

-spec join(store_id(), feature(), pid() | [pid()]) -> ok.

Join one or more processes to the tracker group for a feature

leave(StoreId, Feature, PidOrPids)

-spec leave(store_id(), feature(), pid() | [pid()]) -> ok.

Remove one or more processes from the tracker group

members(StoreId, Feature)

-spec members(store_id(), feature()) -> [pid()].

Get all member processes tracking a feature

notify_created(StoreId, Feature, Data)

-spec notify_created(store_id(), feature(), term()) -> ok.

Notify all trackers that a feature instance was created

notify_deleted(StoreId, Feature, Data)

-spec notify_deleted(store_id(), feature(), term()) -> ok.

Notify all trackers that a feature instance was deleted

notify_updated(StoreId, Feature, Data)

-spec notify_updated(store_id(), feature(), term()) -> ok.

Notify all trackers that a feature instance was updated