ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/MP/Global.pm
Revision: 1.2
Committed: Sat Aug 15 04:12:38 2009 UTC (14 years, 9 months ago) by root
Branch: MAIN
Changes since 1.1: +1 -0 lines
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 root 1.2 } else {
49 root 1.1 }
50     #warn "node<$noderef,$is_up>\n";#d#
51     }
52    
53     mon_node $_, 1
54     for up_nodes;
55    
56     mon_nodes \&mon_node;
57    
58     =back
59    
60     =head1 SEE ALSO
61    
62     L<AnyEvent::MP>.
63    
64     =head1 AUTHOR
65    
66     Marc Lehmann <schmorp@schmorp.de>
67     http://home.schmorp.de/
68    
69     =cut
70    
71     1
72