mdb_txn_begin function
@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.
@paramin
env An environment handle returned by #mdb_env_create()
@paramin
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.
@paramin
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.
- #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.
- #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.
Implementation
@ffi.FfiNative<
ffi.Int Function(ffi.Pointer<MDB_env>, ffi.Pointer<MDB_txn>,
ffi.UnsignedInt, ffi.Pointer<ffi.Pointer<MDB_txn>>)>('mdb_txn_begin')
external int mdb_txn_begin(
ffi.Pointer<MDB_env> env,
ffi.Pointer<MDB_txn> parent,
int flags,
ffi.Pointer<ffi.Pointer<MDB_txn>> txn,
);