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.139 by root, Thu Mar 22 20:07:31 2012 UTC vs.
Revision 1.143 by root, Fri Mar 23 17:54:36 2012 UTC

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 51
52=head1 CURRENT STATUS 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
53 56
54 bin/aemp - stable. 57 # distributed database - queries
55 AnyEvent::MP - stable API, should work. 58 db_family $family => $cb->(\%familyhash)
56 AnyEvent::MP::Intro - explains most concepts. 59 db_keys $family => $cb->(\@keys)
57 AnyEvent::MP::Kernel - mostly stable API. 60 db_values $family => $cb->(\@values)
58 AnyEvent::MP::Global - stable API. 61
62 # distributed database - monitoring a family
63 db_mon $family => $cb->(\%familyhash, \@added, \@changed, \@deleted)
59 64
60=head1 DESCRIPTION 65=head1 DESCRIPTION
61 66
62This module (-family) implements a simple message passing framework. 67This module (-family) implements a simple message passing framework.
63 68
184 189
185use common::sense; 190use common::sense;
186 191
187use Carp (); 192use Carp ();
188 193
189use AE (); 194use AnyEvent ();
190use Guard (); 195use Guard ();
191 196
192use base "Exporter"; 197use base "Exporter";
193 198
194our $VERSION = $AnyEvent::MP::Config::VERSION; 199our $VERSION = $AnyEvent::MP::Config::VERSION;
246=item force => $boolean (default false) 251=item force => $boolean (default false)
247 252
248IF true, then the values specified in the C<configure> will take 253IF true, then the values specified in the C<configure> will take
249precedence 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
250the rc file to override any options specified in the program. 255the rc file to override any options specified in the program.
251
252=item secure => $pass->(@msg)
253
254In addition to specifying a boolean, you can specify a code reference that
255is called for every code execution attempt - the execution request is
256granted iff the callback returns a true value.
257
258Most of the time the callback should look only at
259C<$AnyEvent::MP::Kernel::SRCNODE> to make a decision, and not at the
260actual message (which can be about anything, and is mostly provided for
261diagnostic purposes).
262
263See F<semp setsecure> for more info.
264 256
265=back 257=back
266 258
267=over 4 259=over 4
268 260
1041=item db_values $family => $cb->(\@values) 1033=item db_values $family => $cb->(\@values)
1042 1034
1043Same 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
1044as array reference to the callback. 1036as array reference to the callback.
1045 1037
1046=item $guard = db_mon $family => $cb->($familyhash, \@added, \@changed, \@deleted) 1038=item $guard = db_mon $family => $cb->(\%familyhash, \@added, \@changed, \@deleted)
1047 1039
1048Creates 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
1049or 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
1050database family and three lists of added, changed and deleted subkeys, 1042database family and three lists of added, changed and deleted subkeys,
1051respectively. If no keys have changed then the array reference might be 1043respectively. If no keys have changed then the array reference might be
1267 1259
1268=over 4 1260=over 4
1269 1261
1270=item AnyEvent::MP::Global no longer has group management functions. 1262=item AnyEvent::MP::Global no longer has group management functions.
1271 1263
1264At least not officially - the grp_* functions are still exported and might
1265work, but they will be removed in some later release.
1266
1272AnyEvent::MP now comes with a distributed database that is more 1267AnyEvent::MP now comes with a distributed database that is more
1273powerful. Its database families map closely to port groups, but the API 1268powerful. Its database families map closely to port groups, but the API
1274has changed (the functions are also now exported by AnyEvent::MP). Here is 1269has changed (the functions are also now exported by AnyEvent::MP). Here is
1275a rough porting guide: 1270a rough porting guide:
1276 1271

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines