AnyEvent::MP::Kernel - the actual message passing kernel
This module is mainly of interest when knowledge about connectivity, connected nodes etc. is sought.
This value is called with an error or warning message, when e.g. a connection could not be created, authorisation failed and so on.
It must not block or send messages -queue it and use an idle watcher if you need to do any of these things.
$level should be
0 for messages to be logged always,
1 for unexpected messages and errors,
2 for warnings,
7 for messages about node connectivity and services,
8 for debugging messages and
9 for tracing messages.
The default simply logs the message to STDERR.
All code references in this array are called for every log message, from the default
$WARN handler. This is an easy way to tie into the log messages without disturbing others.
The maximum level at which warning messages will be printed to STDERR by the default warn handler.
Returns true iff the port is a local port.
Expects a node ID and a name of a function. Asynchronously tries to call this function with the given arguments on that node.
This function can be used to implement
snd with the given
@msg (which must include the destination port) on the given node.
Evaluates the given string as Perl expression on the given node. When @reply is specified, then it is used to construct a reply message with
"$@" and any results from the eval appended.
Returns true iff the given node is currently known to the system. The only time a node is known but not up currently is when a conenction request is pending.
Returns true if the given node is "up", that is, the kernel thinks it has a working connection to it.
If the node is known but not currently connected, returns
0. If the node is not known, returns
Returns the node IDs of all nodes currently known to this node, including itself and nodes not currently connected.
Return the node IDs of all nodes that are currently connected (excluding the node itself).
Registers a callback that is called each time a node goes up (a connection is established) or down (the connection is lost).
Node up messages can only be followed by node down messages for the same node, and vice versa.
Note that monitoring a node is usually better done by monitoring it's node port. This function is mainly of interest to modules that are concerned about the network topology and low-level connection handling.
Callbacks must not block and should not send any messages.
The function returns an optional guard which can be used to unregister the monitoring callback again.
Example: make sure you call function
newnode for all nodes that are up or go up (and down).
newnode $_, 1 for up_nodes; mon_nodes \&newnode;
Marc Lehmann <email@example.com> http://home.schmorp.de/