… | |
… | |
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 | |
62 | This module (-family) implements a simple message passing framework. |
67 | This module (-family) implements a simple message passing framework. |
63 | |
68 | |
… | |
… | |
184 | |
189 | |
185 | use common::sense; |
190 | use common::sense; |
186 | |
191 | |
187 | use Carp (); |
192 | use Carp (); |
188 | |
193 | |
189 | use AE (); |
194 | use AnyEvent (); |
190 | use Guard (); |
195 | use Guard (); |
191 | |
196 | |
192 | use base "Exporter"; |
197 | use base "Exporter"; |
193 | |
198 | |
194 | our $VERSION = $AnyEvent::MP::Config::VERSION; |
199 | our $VERSION = $AnyEvent::MP::Config::VERSION; |
… | |
… | |
246 | =item force => $boolean (default false) |
251 | =item force => $boolean (default false) |
247 | |
252 | |
248 | IF true, then the values specified in the C<configure> will take |
253 | IF true, then the values specified in the C<configure> will take |
249 | precedence over any values configured via the rc file. The default is for |
254 | precedence over any values configured via the rc file. The default is for |
250 | the rc file to override any options specified in the program. |
255 | the rc file to override any options specified in the program. |
251 | |
|
|
252 | =item secure => $pass->(@msg) |
|
|
253 | |
|
|
254 | In addition to specifying a boolean, you can specify a code reference that |
|
|
255 | is called for every code execution attempt - the execution request is |
|
|
256 | granted iff the callback returns a true value. |
|
|
257 | |
|
|
258 | Most of the time the callback should look only at |
|
|
259 | C<$AnyEvent::MP::Kernel::SRCNODE> to make a decision, and not at the |
|
|
260 | actual message (which can be about anything, and is mostly provided for |
|
|
261 | diagnostic purposes). |
|
|
262 | |
|
|
263 | See 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 | |
1043 | Same as C<db_family>, except it only queries the family I<values> and passes them |
1035 | Same as C<db_family>, except it only queries the family I<values> and passes them |
1044 | as array reference to the callback. |
1036 | as 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 | |
1048 | Creates a monitor on the given database family. Each time a key is set |
1040 | Creates a monitor on the given database family. Each time a key is set |
1049 | or or is deleted the callback is called with a hash containing the |
1041 | or or is deleted the callback is called with a hash containing the |
1050 | database family and three lists of added, changed and deleted subkeys, |
1042 | database family and three lists of added, changed and deleted subkeys, |
1051 | respectively. If no keys have changed then the array reference might be |
1043 | respectively. 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 | |
|
|
1264 | At least not officially - the grp_* functions are still exported and might |
|
|
1265 | work, but they will be removed in some later release. |
|
|
1266 | |
1272 | AnyEvent::MP now comes with a distributed database that is more |
1267 | AnyEvent::MP now comes with a distributed database that is more |
1273 | powerful. Its database families map closely to port groups, but the API |
1268 | powerful. Its database families map closely to port groups, but the API |
1274 | has changed (the functions are also now exported by AnyEvent::MP). Here is |
1269 | has changed (the functions are also now exported by AnyEvent::MP). Here is |
1275 | a rough porting guide: |
1270 | a rough porting guide: |
1276 | |
1271 | |