macula_group_opener (macula v13.4.0)
View SourceThe process that opens a sealed group's events for one subscription (plans/DESIGN_E2E_SEALED_PUBSUB.md §6, §7).
The pool hands it every event the subscription's ordering releases, in order, and it answers the subscriber:
- a sealed event under an epoch the keyring holds, or pulls by id, and that opens:
{macula_event, SubRef, Topic, Payload, Meta}withsealed => 1andseal_key_idin the meta; - a sealed event that cannot be opened:
{macula_event_unopened, SubRef, Topic, #{publisher, seal_key_id, reason}}once, and nothing of the payload.reasonisunknown_epoch,epoch_expired,not_a_member,membership_unknown,no_distributor,no_group(the group was left) ortag_invalid; - a clear event: delivered with
sealed => 0, unless this node holdsrequiredfor a prefix covering its topic, when it is refused, counted and logged naming its publisher.
It runs apart from the pool because opening may pull a missed epoch from the distributor, over the pool, for as long as that call's deadline: the pool never waits on it. It ends when the pool does, or when told to stop.
Summary
Functions
A clear event, as every subscription on this node takes it: handed to Deliver with sealed => 0, unless the node holds required for a prefix covering Topic, when it is refused, counted and logged naming its publisher. Reads the keyring's table only, so the pool calls it too.
Hand the opener one event the subscription's ordering released.
Start an opener; the caller monitors it.
Types
-type options() :: #{keyring := macula_group_keyring:keyring(), subscriber := pid(), sub_ref := reference(), realm := <<_:256>>, prefix := binary(), pool := pid()}.
Functions
-spec delivered(macula_group_keyring:keyring(), binary(), map(), fun((map()) -> term())) -> ok.
A clear event, as every subscription on this node takes it: handed to Deliver with sealed => 0, unless the node holds required for a prefix covering Topic, when it is refused, counted and logged naming its publisher. Reads the keyring's table only, so the pool calls it too.
Hand the opener one event the subscription's ordering released.
Start an opener; the caller monitors it.
-spec stop(pid()) -> ok.