Function lmdb_master_sys::mdb_txn_begin
source · pub unsafe extern "C" fn mdb_txn_begin(
env: *mut MDB_env,
parent: *mut MDB_txn,
flags: c_uint,
txn: *mut *mut MDB_txn,
) -> c_int
Expand description
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. Note: Cursors may not span transactions.
§Arguments
env
(direction in) - An environment handle returned by #mdb_env_create()parent
(direction in) - 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.flags
(direction in) - 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.
- #MDB_NOSYNC Don't flush system buffers to disk when committing this transaction.
- #MDB_NOMETASYNC Flush system buffers but omit metadata flush when committing this transaction.
A non-zero error value on failure and 0 on success. Some possible errors are:
- #MDB_PANIC - a fatal error occurred earlier and the environment must be shut down.
- #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().
- #MDB_READERS_FULL - a read-only transaction was requested and the reader lock table is full. See #mdb_env_set_maxreaders().
- ENOMEM - out of memory.