View Source partisan_plumtree_broadcast (partisan v5.0.0-beta.13)
Link to this section Summary
Types
Lazy messages that have not been acked. Messages are added to this set when a node is sent a lazy message (or when it should be sent one sometime in the future). Messages are removed when the lazy pushes are acknowleged via graft or ignores. Entries are keyed by their destination These are stored in the ?PLUMTREE_OUTSTANDING ets table under using nodename as key. PLUMTREE_OUTSTANDING is created and owned by partisan_sup
Functions
Broadcasts a message originating from this node. The message will be delivered to each node at least once. The
Mod
passed is responsible for handling the message on remote nodes as well as providing some other information both locally and and on other nodes. Mod
must be loaded on all members of the clusters and implement the partisan_plumtree_broadcast_handler
behaviour.Returns the broadcast servers view of full cluster membership. Wait indefinitely for a response is returned from the process.
Returns the broadcast servers view of full cluster membership. Waits
Timeout
ms for a response from the server.cancel exchanges started by this node.
return the peers for
Node
for the tree rooted at Root
. Wait indefinitely for a response is returned from the processreturn the peers for
Node
for the tree rooted at Root
. Waits Timeout
ms for a response from the serverreturn peers for all
Nodes
for tree rooted at Root
Wait indefinitely for a response is returned from the processreturn a list of exchanges, started by broadcast on thisnode, that are running.
returns a list of exchanges, started by broadcast on
Node
, that are running.Starts the broadcast server on this node. The initial membership list is fetched from the ring. If the node is a singleton then the initial eager and lazy sets are empty. If there are two nodes, each will be in the others eager set and the lazy sets will be empty. When number of members is less than 5, each node will initially have one other node in its eager set and lazy set. If there are more than five nodes each node will have at most two other nodes in its eager set and one in its lazy set, initially. In addition, after the broadcast server is started, a callback is registered with ring_events to generate membership updates as the ring changes.
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)
Notifies broadcast server of membership update
Link to this section Types
-type exchange() :: {module(), node(), reference(), pid()}.
-type exchanges() :: [exchange()].
-type message() :: term().
-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.
Mod
passed is responsible for handling the message on remote nodes as well as providing some other information both locally and and on other nodes. Mod
must be loaded on all members of the clusters and implement the partisan_plumtree_broadcast_handler
behaviour.
-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
, that are running.
-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()}.
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)
-spec terminate(term(), state()) -> term().
-spec update([node()]) -> ok.