View Source partisan_monitor (partisan v5.0.0-rc.8)
This module is responsible for monitoring processes on remote nodes and implementing the monitoring API provided by the partisan
module which follows the API provided by the Erlang modules erlang
and net_kernel
.
YOU SHOULD NEVER USE the functions in this module directly. Use the related functions in partisan
instead.
NOTICE
At the moment this only works for partisan_pluggable_peer_service_manager
backend.
Also, certain partisan_peer_service_manager implementations might not support the partisan_peer_service_manager:on_up/2
and partisan_peer_service_manager:on_down/2
callbacks which we need for node monitoring, so in those cases this module will not work.
Summary
Functions
notalive
if the partisan_monitor process is not alive.not_implemented
if the partisan peer service manager does not support the required capabilities required for monitoring.badarg
if any of the arguments is invalid.
When you attempt to monitor a remote process, it is not guaranteed that you will receive the DOWN message. A few reasons for not receiving the message are message loss and tree reconfiguration. The monitor options Opts
are currently ignored.
Monitor the status of the node Node
. If Flag is true, monitoring is turned on. If Flag
is false
, monitoring is turned off.
The calling process subscribes or unsubscribes to node status change messages. A nodeup message is delivered to all subscribing processes when a new node is connected, and a nodedown message is delivered when a node is disconnected. If Flag is true, a new subscription is started. If Flag is false, all previous subscriptions started with the same Options are stopped. Two option lists are considered the same if they contain the same set of options.
Starts the partisan_monitor
server.
Types
-type node_mon() :: {node(), pid()}.
-type node_type_mon() :: #partisan_node_type_mon{}.
-type node_type_mon_opts() :: {Type :: all | visible | hidden, InclReason :: boolean()}.
-type proc_mon_in() :: #partisan_proc_mon_in{}.
-type proc_mon_in_idx() :: {node(), reference()}.
-type proc_mon_out() :: #partisan_proc_mon_out{}.
-type proc_mon_out_idx() :: {node(), partisan:remote_reference()}.
Functions
-spec demonitor(MonitoredRef :: partisan:remote_reference(), Opts :: [partisan:demonitor_opt()]) -> boolean() | no_return().
notalive
if the partisan_monitor process is not alive.not_implemented
if the partisan peer service manager does not support the required capabilities required for monitoring.badarg
if any of the arguments is invalid.
-spec monitor(Process :: partisan:remote_pid() | partisan:remote_name(), Opts :: [partisan:monitor_opt()]) -> partisan:remote_reference() | no_return().
When you attempt to monitor a remote process, it is not guaranteed that you will receive the DOWN message. A few reasons for not receiving the message are message loss and tree reconfiguration. The monitor options Opts
are currently ignored.
notalive
- If the partisan_monitor server process is not alive.
not_implemented
- If the partisan peer service manager in use doesn't support the capabilities required for monitoring.
badarg
- If any of the arguments are invalid.
-spec monitor_node(node() | partisan:node_spec(), boolean()) -> true.
Monitor the status of the node Node
. If Flag is true, monitoring is turned on. If Flag
is false
, monitoring is turned off.
Making several calls to monitor_node(Node, true)
for the same Node
is not an error; it results in as many independent monitoring instances as the number of different calling processes i.e. If a process has made two calls to monitor_node(Node, true)
and Node
terminates, only one nodedown
message is delivered to the process (this differs from erlang:monitor_node/2
).
If Node
fails or does not exist, the message {nodedown, Node}
is delivered to the calling process. If there is no connection to Node, a nodedown
message is delivered. As a result when using a membership strategy that uses a partial view, you cannot monitor nodes that are not members of the view.
notalive
if the partisan_monitor process is not alive.not_implemented
if the partisan peer service manager does not support the required capabilities required for monitoring.badarg
if any of the arguments is invalid.
-spec monitor_nodes(Flag :: boolean(), [partisan:monitor_nodes_opt()]) -> ok | error | {error, notalive | not_implemented | badarg}.
The calling process subscribes or unsubscribes to node status change messages. A nodeup message is delivered to all subscribing processes when a new node is connected, and a nodedown message is delivered when a node is disconnected. If Flag is true, a new subscription is started. If Flag is false, all previous subscriptions started with the same Options are stopped. Two option lists are considered the same if they contain the same set of options.
Notice that the following two disterl guarantees are NOT yet provided by Partisan:nodeup
messages are delivered before delivery of any message from the remote node passed through the newly established connection.nodedown
messages are not delivered until all messages from the remote node that have been passed through the connection have been delivered.
Starts the partisan_monitor
server.
partisan_monitor
server instance per node.