… | |
… | |
25 | db_sync $db; |
25 | db_sync $db; |
26 | |
26 | |
27 | # when you also use Coro, management is easy: |
27 | # when you also use Coro, management is easy: |
28 | use Coro::BDB; |
28 | use Coro::BDB; |
29 | |
29 | |
30 | # automatic result processing with AnyEvent: |
30 | # automatic event loop intergration with AnyEvent: |
31 | our $FH; open $FH, "<&=" . BDB::poll_fileno; |
31 | use AnyEvent::BDB; |
32 | our $WATCHER = AnyEvent->io (fh => $FH, poll => 'r', cb => \&BDB::poll_cb); |
|
|
33 | |
32 | |
34 | # automatic result processing with EV: |
33 | # automatic result processing with EV: |
35 | my $WATCHER = EV::io BDB::poll_fileno, EV::READ, \&BDB::poll_cb; |
34 | my $WATCHER = EV::io BDB::poll_fileno, EV::READ, \&BDB::poll_cb; |
36 | |
35 | |
37 | # with Glib: |
36 | # with Glib: |
… | |
… | |
87 | Request has reached the end of its lifetime and holds no resources |
86 | Request has reached the end of its lifetime and holds no resources |
88 | anymore (except possibly for the Perl object, but its connection to |
87 | anymore (except possibly for the Perl object, but its connection to |
89 | the actual aio request is severed and calling its methods will |
88 | the actual aio request is severed and calling its methods will |
90 | either do nothing or result in a runtime error). |
89 | either do nothing or result in a runtime error). |
91 | |
90 | |
92 | FILENAMES/DATABASE NAMES |
91 | WIN32 FILENAMES/DATABASE NAME MESS |
93 | The BDB expects "binary" filenames (octet strings) for pathnames on |
92 | Perl on Win32 supports only ASCII filenames (the reason is that it |
94 | POSIX systems, and "unicode" filenames (strings with characters |
93 | abuses an internal flag to store wether a filename is Unicode or ANSI, |
95 | potentially >255) on Win32 (expecting a Unicode win32 build - win32 is a |
94 | but that flag is used for somethign else in the perl core, so there is |
96 | total mess). |
95 | no way to detect wether a filename is ANSI or Unicode-encoded). The BDB |
|
|
96 | module tries to work around this issue by assuming that the filename is |
|
|
97 | an ANSI filename and BDB was built for unicode support. |
97 | |
98 | |
98 | BERKELEYDB FUNCTIONS |
99 | BERKELEYDB FUNCTIONS |
99 | All of these are functions. The create functions simply return a new |
100 | All of these are functions. The create functions simply return a new |
100 | object and never block. All the remaining functions take an optional |
101 | object and never block. All the remaining functions take an optional |
101 | callback as last argument. If it is missing, then the function will be |
102 | callback as last argument. If it is missing, then the function will be |
… | |
… | |
608 | with an operating system error or DB_LOCK_NOTGRANTED, the internal |
609 | with an operating system error or DB_LOCK_NOTGRANTED, the internal |
609 | TXN_DEADLOCK flag will be set on the transaction. See C<db_txn_finish>, |
610 | TXN_DEADLOCK flag will be set on the transaction. See C<db_txn_finish>, |
610 | above. |
611 | above. |
611 | |
612 | |
612 | SEE ALSO |
613 | SEE ALSO |
613 | Coro::BDB, IO::AIO. |
614 | AnyEvent::BDB (event loop integration), Coro::BDB (more natural syntax), |
|
|
615 | IO::AIO (nice to have). |
614 | |
616 | |
615 | AUTHOR |
617 | AUTHOR |
616 | Marc Lehmann <schmorp@schmorp.de> |
618 | Marc Lehmann <schmorp@schmorp.de> |
617 | http://home.schmorp.de/ |
619 | http://home.schmorp.de/ |
618 | |
620 | |