partisan_broadcast (partisan v6.0.0)
View SourcePublic API for Partisan's epidemic-broadcast groups.
A broadcast group is a supervised process that owns a complete, private
epidemic-broadcast context — its own mailbox, spanning-tree state and
outstanding-lazy table — reading membership from the shared, lock-free
partisan_membership snapshot. Group identity is the handler module: each
broadcast handler runs in its own group, so independent gossip streams never
share a tree or a mailbox.
Groups are declared by the broadcast_mods and broadcast_groups configuration
keys and started at boot, and can also be created or retired at runtime.
Entry points
broadcast/2— disseminate a message to the group that hosts a handler module.start_group/1,stop_group/1— create or retire a group at runtime.groups/0— list the running groups.
Summary
Functions
Disseminates Broadcast through the broadcast group that hosts handler Mod.
Returns the child specs for the broadcast groups declared by configuration.
Returns the registered name of the broadcast group that hosts handler Mod.
Returns the registered names of the currently running broadcast groups.
Starts a broadcast group at runtime.
Stops and removes the broadcast group for Arg.
Functions
Disseminates Broadcast through the broadcast group that hosts handler Mod.
Mod names the handler module — which is also the group's identity — and the
payload sent to peers is derived from Broadcast by that handler's
broadcast_data/1 callback. Returns ok once the broadcast has been handed to
the group; dissemination itself is asynchronous.
-spec child_specs() -> [supervisor:child_spec()].
Returns the child specs for the broadcast groups declared by configuration.
partisan_broadcast_group_sup uses these to start the configured groups at boot.
Returns the registered name of the broadcast group that hosts handler Mod.
The name is a deterministic function of Mod and is identical on every node, so
a group can be addressed cluster-wide without a registry lookup.
-spec groups() -> [atom()].
Returns the registered names of the currently running broadcast groups.
Starts a broadcast group at runtime.
Arg is either a handler module or a spec map:
#{mods := [module()],
name => atom(),
engine => module(),
lazy_tick_period => integer(),
exchange_tick_period => integer()}engine selects the tree engine (defaults to partisan_plumtree_engine; see
partisan_broadcast_engine). The call is idempotent: if the group is already
running it returns the existing process rather than starting a second one.
Stops and removes the broadcast group for Arg.
Arg is a handler module or a spec map (only the group name is read). Returns
ok whether or not a group was running under that name.