ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/MP/Global.pm
Revision: 1.1
Committed: Sat Aug 15 02:36:03 2009 UTC (14 years, 9 months ago) by root
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 =head1 NAME
2    
3     AnyEvent::MP::Global - some network-global services
4    
5     =head1 SYNOPSIS
6    
7     use AnyEvent::MP::Global;
8     # -OR-
9     aemp addservice AnyEvent::MP::Global::
10    
11     =head1 DESCRIPTION
12    
13     This module provides an assortment of network-global functions: group name
14     registration and non-local locks.
15    
16     It will also try to build and maintain a full mesh of all network nodes.
17    
18     =head1 GLOBALS AND FUNCTIONS
19    
20     =over 4
21    
22     =cut
23    
24     package AnyEvent::MP::Global;
25    
26     use common::sense;
27     use Carp ();
28     use MIME::Base64 ();
29    
30     use AnyEvent::MP;
31     use AnyEvent::MP::Kernel;
32    
33     our $VERSION = $AnyEvent::MP::VERSION;
34    
35     our $port = port;
36    
37     # in response to up_nodes request
38     rcv $port, connect_nodes => sub {
39     connect_node $_ for @_;
40     };
41    
42     sub mon_node {
43     my ($noderef, $is_up) = @_;
44    
45     if ($is_up) {
46     # request any other nodes possibly known to us
47     snd $noderef, up_nodes => $port, "connect_nodes";
48     }
49     #warn "node<$noderef,$is_up>\n";#d#
50     }
51    
52     mon_node $_, 1
53     for up_nodes;
54    
55     mon_nodes \&mon_node;
56    
57     =back
58    
59     =head1 SEE ALSO
60    
61     L<AnyEvent::MP>.
62    
63     =head1 AUTHOR
64    
65     Marc Lehmann <schmorp@schmorp.de>
66     http://home.schmorp.de/
67    
68     =cut
69    
70     1
71