NAME
AnyEvent::MP::Kernel - the actual message passing kernel
SYNOPSIS
use AnyEvent::MP::Kernel;
DESCRIPTION
This module provides most of the basic functionality of AnyEvent::MP, exposed through higher level interfaces such as AnyEvent::MP and Coro::MP.
This module is mainly of interest when knowledge about connectivity, connected nodes etc. are needed.
GLOBALS AND FUNCTIONS
- $AnyEvent::MP::Kernel::WARN->($level, $msg)
-
This value is called with an error or warning message, when e.g. a connection could not be created, authorisation failed and so on.
$level
sould be0
for messages ot be logged always,1
for unexpected messages and errors,2
for warnings,7
for messages about node connectivity and services,8
for debugging messages and9
for tracing messages.The default simply logs the message to STDERR.
- $AnyEvent::MP::Kernel::PUBLIC
-
A boolean indicating whether this is a full/public node, which can create and accept direct connections form othe rnodes.
- $AnyEvent::MP::Kernel::SLAVE
-
A boolean indicating whether this node is a slave node, i.e. does most of it's message sending/receiving through some master node.
- $AnyEvent::MP::Kernel::MASTER
-
Defined only in slave mode, in which cas eit contains the noderef of the master node.
- $is_local = port_is_local $port
-
Returns true iff the port is a local port.
- snd_to_func $node, $func, @args
-
Expects a noderef and a name of a function. Asynchronously tries to call this function with the given arguments on that node.
This fucntion can be used to implement
spawn
-like interfaces. - snd_on $node, @msg
-
Executes
snd
with the given@msg
(which must include the destination port) on the given node. - eval_on $node, $string
-
Evaluates the given string as Perl expression on the given node.
- node_is_known $noderef
-
Returns true iff the given node is currently known to the system.
- node_is_up $noderef
-
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, returnsundef
. - known_nodes
-
Returns the noderefs of all nodes connected to this node, including itself.
- up_nodes
-
Return the noderefs of all nodes that are currently connected (excluding the node itself).
- $guard = mon_nodes $callback->($noderef, $is_up, @reason)
-
Registers a callback that is called each time a node goes up (connection is established) or down (connection is lost).
Node up messages can only be followed by node down messages for the same node, and vice versa.
The function returns an optional guard which can be used to de-register the monitoring callback again.
SEE ALSO
AUTHOR
Marc Lehmann <schmorp@schmorp.de>
http://home.schmorp.de/