… | |
… | |
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 | |
54 | This module (-family) implements a simple message passing framework. |
67 | This module (-family) implements a simple message passing framework. |
55 | |
68 | |
… | |
… | |
1020 | =item db_values $family => $cb->(\@values) |
1033 | =item db_values $family => $cb->(\@values) |
1021 | |
1034 | |
1022 | 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 |
1023 | as array reference to the callback. |
1036 | as array reference to the callback. |
1024 | |
1037 | |
1025 | =item $guard = db_mon $family => $cb->($familyhash, \@added, \@changed, \@deleted) |
1038 | =item $guard = db_mon $family => $cb->(\%familyhash, \@added, \@changed, \@deleted) |
1026 | |
1039 | |
1027 | 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 |
1028 | 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 |
1029 | database family and three lists of added, changed and deleted subkeys, |
1042 | database family and three lists of added, changed and deleted subkeys, |
1030 | 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 |