View Source partisan_plumtree_broadcast (partisan v5.0.0-beta.14)
Link to this section Summary
Types
Functions
Broadcasts a message originating from this node. The message will be delivered to each node at least once. The Mod
passed must be loaded on all members of the cluster and implement the partisan_plumtree_broadcast_handler
behaviour which is responsible for handling the message on remote nodes as well as providing some other information both locally and on other nodes.
Returns the channel to be used when sending broadcasting a message on behalf of module Mod
.
Timeout
ms for a response from the server.Node
for the tree rooted at Root
. Wait indefinitely for a response is returned from the processNode
for the tree rooted at Root
. Waits Timeout
ms for a response from the serverNodes
for tree rooted at Root
Wait indefinitely for a response is returned from the processNode
.Starts the broadcast server on this node. InitMembers
must be a list of all members known to this node when starting the broadcast server. InitEagers
are the initial peers of this node for all broadcast trees. InitLazys
is a list of random peers not in InitEagers
that will be used as the initial lazy peer shared by all trees for this node. If the number of nodes in the cluster is less than 3, InitLazys
should be an empty list. InitEagers
and InitLazys
must also be subsets of InitMembers
. Mods
is a list of modules that may be handlers for broadcasted messages. All modules in Mods
should implement the partisan_plumtree_broadcast_handler
behaviour.
Link to this section Types
-type exchange() :: {module(), node(), reference(), pid()}.
-type exchanges() :: [exchange()].
-type message_id() :: any().
-type message_round() :: non_neg_integer().
-type nodeset() :: ordsets:ordset(node()).
-type outstanding() :: {message_id(), module(), message_round(), node()}.
-type selector() :: all | {peer, node()} | {mod, module()} | reference() | pid().
-type state() :: #state{}.
Link to this section Functions
-spec broadcast(any(), module()) -> ok.
Broadcasts a message originating from this node. The message will be delivered to each node at least once. The Mod
passed must be loaded on all members of the cluster and implement the partisan_plumtree_broadcast_handler
behaviour which is responsible for handling the message on remote nodes as well as providing some other information both locally and on other nodes.
broadcast_channel/1
.
-spec broadcast_channel(Mod :: module()) -> partisan:channel().
Returns the channel to be used when sending broadcasting a message on behalf of module Mod
.
Mod:broadcast_channel()
or default channel i.e. partisan:default_channel/0
if the callback is not implemented.
-spec broadcast_members() -> nodeset().
-spec broadcast_members(infinity | pos_integer()) -> nodeset().
Timeout
ms for a response from the server.
Node
for the tree rooted at Root
. Wait indefinitely for a response is returned from the process
Node
for the tree rooted at Root
. Waits Timeout
ms for a response from the server
Nodes
for tree rooted at Root
Wait indefinitely for a response is returned from the process
-spec exchanges() -> exchanges().
-spec exchanges(node()) -> partisan_plumtree_broadcast:exchanges().
Node
.
-spec init([[any()], ...]) -> {ok, state()}.
-spec start_link() -> {ok, pid()} | ignore | {error, term()}.
-spec start_link(InitMembers :: [node()], InitEagers :: [node()], InitLazys :: [node()], Mods :: [module()], Opts :: proplists:proplist() | map()) -> {ok, pid()} | ignore | {error, term()}.
Starts the broadcast server on this node. InitMembers
must be a list of all members known to this node when starting the broadcast server. InitEagers
are the initial peers of this node for all broadcast trees. InitLazys
is a list of random peers not in InitEagers
that will be used as the initial lazy peer shared by all trees for this node. If the number of nodes in the cluster is less than 3, InitLazys
should be an empty list. InitEagers
and InitLazys
must also be subsets of InitMembers
. Mods
is a list of modules that may be handlers for broadcasted messages. All modules in Mods
should implement the partisan_plumtree_broadcast_handler
behaviour.
Opts
is a proplist or map with the following possible options:lazy_tick_period :: non_neg_integer()
- Flush all outstanding lazy pushes period (in milliseconds)exchange_tick_period :: non_neg_integer()
- Possibly perform an exchange period (in milliseconds)
start_link/0
.
-spec terminate(term(), state()) -> term().
-spec update([node()]) -> ok.