ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/MP.pm
(Generate patch)

Comparing AnyEvent-MP/MP.pm (file contents):
Revision 1.62 by root, Thu Aug 27 07:12:48 2009 UTC vs.
Revision 1.63 by root, Thu Aug 27 21:29:37 2009 UTC

11 NODE $port # returns the noderef of the port 11 NODE $port # returns the noderef of the port
12 12
13 $SELF # receiving/own port id in rcv callbacks 13 $SELF # receiving/own port id in rcv callbacks
14 14
15 # initialise the node so it can send/receive messages 15 # initialise the node so it can send/receive messages
16 initialise_node; # -OR- 16 initialise_node;
17 initialise_node "localhost:4040"; # -OR-
18 initialise_node "slave/", "localhost:4040"
19 17
20 # ports are message endpoints 18 # ports are message endpoints
21 19
22 # sending messages 20 # sending messages
23 snd $port, type => data...; 21 snd $port, type => data...;
72A port is something you can send messages to (with the C<snd> function). 70A port is something you can send messages to (with the C<snd> function).
73 71
74Ports allow you to register C<rcv> handlers that can match all or just 72Ports allow you to register C<rcv> handlers that can match all or just
75some messages. Messages will not be queued. 73some messages. Messages will not be queued.
76 74
77=item port id - C<noderef#portname> 75=item port ID - C<noderef#portname>
78 76
79A port ID is the concatenation of a noderef, a hash-mark (C<#>) as 77A port ID is the concatenation of a noderef, a hash-mark (C<#>) as
80separator, and a port name (a printable string of unspecified format). An 78separator, and a port name (a printable string of unspecified format). An
81exception is the the node port, whose ID is identical to its node 79exception is the the node port, whose ID is identical to its node
82reference. 80reference.
89 87
90Nodes are either private (single-process only), slaves (can only talk to 88Nodes are either private (single-process only), slaves (can only talk to
91public nodes, but do not need an open port) or public nodes (connectable 89public nodes, but do not need an open port) or public nodes (connectable
92from any other node). 90from any other node).
93 91
94=item noderef - C<host:port,host:port...>, C<id@noderef>, C<id> 92=item node ID - C<[a-za-Z0-9_\-.:]+>
95 93
96A node reference is a string that either simply identifies the node (for 94A node ID is a string that either simply identifies the node (for
97private and slave nodes), or contains a recipe on how to reach a given 95private and slave nodes), or contains a recipe on how to reach a given
98node (for public nodes). 96node (for public nodes).
99 97
100This recipe is simply a comma-separated list of C<address:port> pairs (for 98This recipe is simply a comma-separated list of C<address:port> pairs (for
101TCP/IP, other protocols might look different). 99TCP/IP, other protocols might look different).
144} 142}
145 143
146=item $thisnode = NODE / $NODE 144=item $thisnode = NODE / $NODE
147 145
148The C<NODE> function returns, and the C<$NODE> variable contains the 146The C<NODE> function returns, and the C<$NODE> variable contains the
149noderef of the local node. The value is initialised by a call to 147node id of the local node. The value is initialised by a call to
150C<initialise_node>. 148C<initialise_node>.
151 149
152=item $noderef = node_of $port 150=item $nodeid = node_of $port
153 151
154Extracts and returns the noderef from a port ID or a noderef. 152Extracts and returns the noderef from a port ID or a node ID.
155 153
156=item initialise_node $noderef, $seednode, $seednode... 154=item initialise_node $profile_name
157
158=item initialise_node "slave/", $master, $master...
159 155
160Before a node can talk to other nodes on the network it has to initialise 156Before a node can talk to other nodes on the network it has to initialise
161itself - the minimum a node needs to know is it's own name, and optionally 157itself - the minimum a node needs to know is it's own name, and optionally
162it should know the noderefs of some other nodes in the network. 158it should know the noderefs of some other nodes in the network.
163 159

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines