ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/BDB/BDB.pm
(Generate patch)

Comparing BDB/BDB.pm (file contents):
Revision 1.2 by root, Mon Feb 5 20:21:38 2007 UTC vs.
Revision 1.6 by root, Sun Feb 11 22:07:23 2007 UTC

65use base 'Exporter'; 65use base 'Exporter';
66 66
67BEGIN { 67BEGIN {
68 our $VERSION = '0.1'; 68 our $VERSION = '0.1';
69 69
70 our @BDB_REQ = qw(); 70 our @BDB_REQ = qw(
71 db_env_open db_env_close db_env_txn_checkpoint db_env_lock_detect
72 db_env_memp_sync db_env_memp_trickle
73 db_open db_close db_compact db_sync db_put db_get db_pget db_del db_key_range
74 db_txn_commit db_txn_abort
75 db_c_close db_c_count db_c_put db_c_get db_c_pget db_c_del
76 db_sequence_open db_sequence_close
77 db_sequence_get db_sequence_remove
78 );
79 our @EXPORT = (@BDB_REQ, qw(dbreq_pri dbreq_nice db_env_create db_create));
80 our @EXPORT_OK = qw(
71 our @EXPORT_OK = qw(poll_fileno poll_cb poll_wait flush 81 poll_fileno poll_cb poll_wait flush
72 min_parallel max_parallel max_idle 82 min_parallel max_parallel max_idle
73 nreqs nready npending nthreads 83 nreqs nready npending nthreads
74 max_poll_time max_poll_reqs); 84 max_poll_time max_poll_reqs
85 );
75 86
76 require XSLoader; 87 require XSLoader;
77 XSLoader::load ("BDB", $VERSION); 88 XSLoader::load ("BDB", $VERSION);
78} 89}
79 90
236 247
237You can still queue as many requests as you want. Therefore, 248You can still queue as many requests as you want. Therefore,
238C<max_oustsanding> is mainly useful in simple scripts (with low values) or 249C<max_oustsanding> is mainly useful in simple scripts (with low values) or
239as a stop gap to shield against fatal memory overflow (with large values). 250as a stop gap to shield against fatal memory overflow (with large values).
240 251
252=item BDB::set_sync_prepare $cb
253
254Sets a callback that is called whenever a request is created without an
255explicit callback. It has to return two code references. The first is used
256as the request callback, and the second is called to wait until the first
257callback has been called. The default implementation works like this:
258
259 sub {
260 my $status;
261 (
262 sub { $status = $! },
263 sub { BDB::poll while !defined $status; $! = $status },
264 )
265 }
266
267=back
268
241=head3 STATISTICAL INFORMATION 269=head3 STATISTICAL INFORMATION
270
271=over 4
242 272
243=item BDB::nreqs 273=item BDB::nreqs
244 274
245Returns the number of requests currently in the ready, execute or pending 275Returns the number of requests currently in the ready, execute or pending
246states (i.e. for which their callback has not been invoked yet). 276states (i.e. for which their callback has not been invoked yet).
261but not yet processed by poll_cb). 291but not yet processed by poll_cb).
262 292
263=back 293=back
264 294
265=cut 295=cut
296
297set_sync_prepare {
298 my $status;
299 (
300 sub {
301 $status = $!;
302 },
303 sub {
304 BDB::poll while !defined $status;
305 $! = $status;
306 },
307 )
308};
266 309
267min_parallel 8; 310min_parallel 8;
268 311
269END { flush } 312END { flush }
270 313

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines