barrel_sub (barrel_docdb v1.1.1)
View Sourcebarrel_sub - Path subscription manager for barrel_docdb
Manages MQTT-style path subscriptions for document changes. Subscribers receive notifications when documents matching their patterns are modified.
Pattern examples:
"users/+/profile" - matches users/123/profile, users/abc/profile
"orders/#" - matches orders/123, orders/123/items/1
"config" - matches exactly configSubscriptions are ephemeral - tied to subscriber process lifetime.
Summary
Functions
List all subscriptions for a database (for debugging)
Find all subscriber PIDs matching the given paths. Paths should be slash-separated binaries like "users/123/name".
Start the subscription manager
Stop the subscription manager
Subscribe to document changes matching a pattern Returns a subscription reference that can be used to unsubscribe
Unsubscribe using the subscription reference
Types
-type att_info() :: #{name := binary(), content_type := binary(), length := non_neg_integer(), digest := binary(), chunked => boolean(), chunk_size => pos_integer(), chunk_count => pos_integer()}.
-type change() :: map().
-type db_name() :: binary().
-type docid() :: binary().
-type revid() :: binary().
-type seq() :: barrel_hlc:timestamp().
-type seq_string() :: binary().
-type view_name() :: binary().
Functions
List all subscriptions for a database (for debugging)
Find all subscriber PIDs matching the given paths. Paths should be slash-separated binaries like "users/123/name".
Start the subscription manager
-spec stop() -> ok.
Stop the subscription manager
Subscribe to document changes matching a pattern Returns a subscription reference that can be used to unsubscribe
Unsubscribe using the subscription reference