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.61 by root, Mon Aug 24 08:06:49 2009 UTC vs.
Revision 1.62 by root, Thu Aug 27 07:12:48 2009 UTC

85 85
86A node is a single process containing at least one port - the node port, 86A node is a single process containing at least one port - the node port,
87which provides nodes to manage each other remotely, and to create new 87which provides nodes to manage each other remotely, and to create new
88ports. 88ports.
89 89
90Nodes are either private (single-process only), slaves (connected to a 90Nodes are either private (single-process only), slaves (can only talk to
91master node only) or public nodes (connectable from unrelated nodes). 91public nodes, but do not need an open port) or public nodes (connectable
92from any other node).
92 93
93=item noderef - C<host:port,host:port...>, C<id@noderef>, C<id> 94=item noderef - C<host:port,host:port...>, C<id@noderef>, C<id>
94 95
95A node reference is a string that either simply identifies the node (for 96A node reference is a string that either simply identifies the node (for
96private and slave nodes), or contains a recipe on how to reach a given 97private and slave nodes), or contains a recipe on how to reach a given
180 181
181For public nodes, C<$noderef> (supplied either directly to 182For public nodes, C<$noderef> (supplied either directly to
182C<initialise_node> or indirectly via a profile or the nodename) must be a 183C<initialise_node> or indirectly via a profile or the nodename) must be a
183noderef (possibly unresolved, in which case it will be resolved). 184noderef (possibly unresolved, in which case it will be resolved).
184 185
185After resolving, the node will bind itself on all endpoints and try to 186After resolving, the node will bind itself on all endpoints.
186connect to all additional C<$seednodes> that are specified. Seednodes are 187
188=item slave nodes
189
190When the C<$noderef> (either as given or overriden by the config file)
191is the special string C<slave/>, then the node will become a slave
192node. Slave nodes cannot be contacted from outside, and cannot talk to
193each other (at least in this version of AnyEvent::MP).
194
195Slave nodes work by creating connections to all public nodes, using the
196L<AnyEvent::MP::Global> service.
197
198=back
199
200After initialising itself, the node will connect to all additional
201C<$seednodes> that are specified diretcly or via a profile. Seednodes are
187optional and can be used to quickly bootstrap the node into an existing 202optional and can be used to quickly bootstrap the node into an existing
188network. 203network.
189 204
190=item slave nodes
191
192When the C<$noderef> (either as given or overriden by the config file)
193is the special string C<slave/>, then the node will become a slave
194node. Slave nodes cannot be contacted from outside and will route most of
195their traffic to the master node that they attach to.
196
197At least one additional noderef is required (either by specifying it
198directly or because it is part of the configuration profile): The node
199will try to connect to all of them and will become a slave attached to the
200first node it can successfully connect to.
201
202Note that slave nodes cannot change their name, and consequently, their
203master, so if the master goes down, the slave node will not function well
204anymore until it can re-establish conenciton to its master. This makes
205slave nodes unsuitable for long-term nodes or fault-tolerant networks.
206
207=back
208
209This function will block until all nodes have been resolved and, for slave
210nodes, until it has successfully established a connection to a master
211server.
212
213All the seednodes will also be specially marked to automatically retry 205All the seednodes will also be specially marked to automatically retry
214connecting to them infinitely. 206connecting to them indefinitely, so make sure that seednodes are really
207reliable and up (this might also change in the future).
215 208
216Example: become a public node listening on the guessed noderef, or the one 209Example: become a public node listening on the guessed noderef, or the one
217specified via C<aemp> for the current node. This should be the most common 210specified via C<aemp> for the current node. This should be the most common
218form of invocation for "daemon"-type nodes. 211form of invocation for "daemon"-type nodes.
219 212
221 214
222Example: become a slave node to any of the the seednodes specified via 215Example: become a slave node to any of the the seednodes specified via
223C<aemp>. This form is often used for commandline clients. 216C<aemp>. This form is often used for commandline clients.
224 217
225 initialise_node "slave/"; 218 initialise_node "slave/";
226
227Example: become a slave node to any of the specified master servers. This
228form is also often used for commandline clients.
229
230 initialise_node "slave/", "master1", "192.168.13.17", "mp.example.net";
231 219
232Example: become a public node, and try to contact some well-known master 220Example: become a public node, and try to contact some well-known master
233servers to become part of the network. 221servers to become part of the network.
234 222
235 initialise_node undef, "master1", "master2"; 223 initialise_node undef, "master1", "master2";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines