View Source partisan_plumtree_broadcast (partisan v5.0.0-beta.24)
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 processNodes for tree rooted at Root Wait indefinitely for a response is returned from the processNode.Node.Starts the broadcast server on this node.
Starts the broadcast server on this node. Members must be a list of all members known to this node when starting the broadcast server. Eagers are the initial peers of this node for all broadcast trees. Lazys is a list of random peers not in Eagers 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, Lazys should be an empty list. Eagers and Lazys must also be subsets of Members. 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 opts_list() :: [{lazy_tick_period, non_neg_integer()} | {exchange_tick_period, non_neg_integer()}].
-type opts_map() :: #{lazy_tick_period => non_neg_integer(), exchange_tick_period => non_neg_integer()}.
-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
-spec debug_get_peers(node(), node(), infinity | pos_integer()) -> {nodeset(), nodeset()} | no_return().
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
Nodes for tree rooted at Root Wait indefinitely for a response is returned from the process
-spec exchanges() -> {ok, exchanges()}.
-spec exchanges(node()) -> {ok, exchanges()} | {error, {badrpc, Reason :: any()}}.
Node.
-spec exchanges(node(), timeout()) -> {ok, exchanges()} | {error, {badrpc, Reason :: any()}}.
Node.
-spec get_eager_peers(Root :: node()) -> list().
-spec get_lazy_peers(Root :: node()) -> list().
-spec get_peers(Root :: node()) -> list().
-spec init(list()) -> {ok, state()}.
-spec start_link() -> {ok, pid()} | ignore | {error, term()}.
Starts the broadcast server on this node.
The initial membership list is fetched from the configured {link partisan_peer_service}.
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, all callbacks defined in the configuration optionbroadcast_mods are registered. By default the list of callbacks includes the module partisan_plumtree_backend which is used by to generate membership updates as the ring changes.
-spec start_link(Members :: [node()], Eagers :: [node()], Lazys :: [node()], Mods :: [module()], Opts :: opts()) -> {ok, pid()} | ignore | {error, term()}.
Starts the broadcast server on this node. Members must be a list of all members known to this node when starting the broadcast server. Eagers are the initial peers of this node for all broadcast trees. Lazys is a list of random peers not in Eagers 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, Lazys should be an empty list. Eagers and Lazys must also be subsets of Members. 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.