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

Comparing cvsroot/AnyEvent-MP/MP.pm (file contents):
Revision 1.140 by root, Thu Mar 22 23:47:01 2012 UTC vs.
Revision 1.143 by root, Fri Mar 23 17:54:36 2012 UTC

46 46
47 # execute callbacks in $SELF port context 47 # execute callbacks in $SELF port context
48 my $timer = AE::timer 1, 0, psub { 48 my $timer = AE::timer 1, 0, psub {
49 die "kill the port, delayed"; 49 die "kill the port, delayed";
50 }; 50 };
51
52 # distributed database - modification
53 db_set $family => $subkey [=> $value] # add a subkey
54 db_del $family => $subkey... # delete one or more subkeys
55 db_reg $family => $port [=> $value] # register a port
56
57 # distributed database - queries
58 db_family $family => $cb->(\%familyhash)
59 db_keys $family => $cb->(\@keys)
60 db_values $family => $cb->(\@values)
61
62 # distributed database - monitoring a family
63 db_mon $family => $cb->(\%familyhash, \@added, \@changed, \@deleted)
51 64
52=head1 DESCRIPTION 65=head1 DESCRIPTION
53 66
54This module (-family) implements a simple message passing framework. 67This module (-family) implements a simple message passing framework.
55 68
176 189
177use common::sense; 190use common::sense;
178 191
179use Carp (); 192use Carp ();
180 193
181use AE (); 194use AnyEvent ();
182use Guard (); 195use Guard ();
183 196
184use base "Exporter"; 197use base "Exporter";
185 198
186our $VERSION = $AnyEvent::MP::Config::VERSION; 199our $VERSION = $AnyEvent::MP::Config::VERSION;
238=item force => $boolean (default false) 251=item force => $boolean (default false)
239 252
240IF true, then the values specified in the C<configure> will take 253IF true, then the values specified in the C<configure> will take
241precedence over any values configured via the rc file. The default is for 254precedence over any values configured via the rc file. The default is for
242the rc file to override any options specified in the program. 255the rc file to override any options specified in the program.
243
244=item secure => $pass->(@msg)
245
246In addition to specifying a boolean, you can specify a code reference that
247is called for every code execution attempt - the execution request is
248granted iff the callback returns a true value.
249
250Most of the time the callback should look only at
251C<$AnyEvent::MP::Kernel::SRCNODE> to make a decision, and not at the
252actual message (which can be about anything, and is mostly provided for
253diagnostic purposes).
254
255See F<semp setsecure> for more info.
256 256
257=back 257=back
258 258
259=over 4 259=over 4
260 260
1033=item db_values $family => $cb->(\@values) 1033=item db_values $family => $cb->(\@values)
1034 1034
1035Same as C<db_family>, except it only queries the family I<values> and passes them 1035Same as C<db_family>, except it only queries the family I<values> and passes them
1036as array reference to the callback. 1036as array reference to the callback.
1037 1037
1038=item $guard = db_mon $family => $cb->($familyhash, \@added, \@changed, \@deleted) 1038=item $guard = db_mon $family => $cb->(\%familyhash, \@added, \@changed, \@deleted)
1039 1039
1040Creates a monitor on the given database family. Each time a key is set 1040Creates a monitor on the given database family. Each time a key is set
1041or or is deleted the callback is called with a hash containing the 1041or or is deleted the callback is called with a hash containing the
1042database family and three lists of added, changed and deleted subkeys, 1042database family and three lists of added, changed and deleted subkeys,
1043respectively. If no keys have changed then the array reference might be 1043respectively. If no keys have changed then the array reference might be

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines