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

@brief 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. @param[in] env An environment handle returned by #mdb_env_create() @param[in] parent If this parameter is non-NULL, the new transaction will be a nested transaction, with the transaction indicated by \b 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. @param[in] flags 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.
@param[out] txn Address where the new #MDB_txn handle will be stored @return 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.