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.4 by root, Mon Feb 5 23:46:15 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_create db_env_open db_env_close
72 db_create db_open db_close db_compact db_sync db_put db_get db_pget
73 db_txn_commit db_txn_abort
74 );
75 our @EXPORT = (@BDB_REQ, qw(dbreq_pri dbreq_nice));
71 our @EXPORT_OK = qw(poll_fileno poll_cb poll_wait flush 76 our @EXPORT_OK = qw(poll_fileno poll_cb poll_wait flush
72 min_parallel max_parallel max_idle 77 min_parallel max_parallel max_idle
73 nreqs nready npending nthreads 78 nreqs nready npending nthreads
74 max_poll_time max_poll_reqs); 79 max_poll_time max_poll_reqs);
75 80
236 241
237You can still queue as many requests as you want. Therefore, 242You can still queue as many requests as you want. Therefore,
238C<max_oustsanding> is mainly useful in simple scripts (with low values) or 243C<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). 244as a stop gap to shield against fatal memory overflow (with large values).
240 245
246=item BDB::set_sync_prepare $cb
247
248Sets a callback that is called whenever a request is created without an
249explicit callback. It has to return two code references. The first is used
250as the request callback, and the second is called to wait until the first
251callback has been called. The default implementation works like this:
252
253 sub {
254 my $status;
255 (
256 sub { $status = $! },
257 sub { BDB::poll while !defined $status; $! = $status },
258 )
259 }
260
261=back
262
241=head3 STATISTICAL INFORMATION 263=head3 STATISTICAL INFORMATION
264
265=over 4
242 266
243=item BDB::nreqs 267=item BDB::nreqs
244 268
245Returns the number of requests currently in the ready, execute or pending 269Returns the number of requests currently in the ready, execute or pending
246states (i.e. for which their callback has not been invoked yet). 270states (i.e. for which their callback has not been invoked yet).
261but not yet processed by poll_cb). 285but not yet processed by poll_cb).
262 286
263=back 287=back
264 288
265=cut 289=cut
290
291set_sync_prepare {
292 my $status;
293 (
294 sub {
295 $status = $!;
296 },
297 sub {
298 BDB::poll while !defined $status;
299 $! = $status;
300 },
301 )
302};
266 303
267min_parallel 8; 304min_parallel 8;
268 305
269END { flush } 306END { flush }
270 307

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines