Peta::LMDB::DB#

📦 std

A database handle: one database of an LMDB environment, as $txn->open_db returns it, to pass to the transaction’s and cursor’s methods.

A handle belongs to its environment, not to the transaction that opened it: once that transaction has committed, every later transaction of the environment can use it. Handles of one environment cannot be used with another’s transactions: that croaks Peta::LMDB: the database belongs to another environment.

A database keeps its keys in LMDB’s byte order (or integer order, with MDB_INTEGERKEY) unless given a sort sub with set_compare; an MDB_DUPSORT database orders a key’s values the same way, or by set_dupsort’s sub.

Functions#

Ordering#

set_compare#

Order the database’s keys by a sort sub of your own.

set_dupsort#

Order the values of each key of an MDB_DUPSORT database by a sort sub, called as set_compare’s is: $db->set_dupsort(sub { $a <=> $b }). Set it every time the environment is opened, before the first read or write.

Information#

dbi#

LMDB’s number for the database within its environment.