chickadee » lmdb-lolevel » mdb-txn-begin

mdb-txn-begin env parent flagsprocedure

Create a transaction for use with the environment.

The transaction handle may be discarded using (mdb-txn-abort) or (mdb-txn-commit).

Note: A transaction and its cursors must only be used by a single thread, and a thread may only have a single transaction at a time. If MDB_NOTLS is in use, this does not apply to read-only transactions. Cursors may not span transactions.

An environment handle returned by (mdb-env-create)
If this parameter is non-NULL, the new transaction will be a nested transaction, with the transaction indicated by parent as its parent. Transactions may be nested to any level. A parent transaction and its cursors may not issue any other operations than mdb_txn_commit and mdb_txn_abort while it has active child transactions.
Special options for this transaction. This parameter must be set to 0 or by bitwise OR'ing together one or more of the values described here. MDB_RDONLY - This transaction will not perform any write operations.

Some possible error conditions:

(exn lmdb MDB_PANIC)
a fatal error occurred earlier and the environment must be shut down.
(exn lmdb MDB_MAP_RESIZED)
another process wrote data beyond this MDB_env's mapsize and this environment's map must be resized as well. See (mdb-env-set-mapsize).
a read-only transaction was requested and the reader lock table is full. See mdb_(env-set-maxreaders).
(exn lmdb ENOMEM)
out of memory.