Struct lmdb::RwTransaction

source ·
pub struct RwTransaction<'env> { /* private fields */ }
Expand description

An LMDB read-write transaction.

Implementations§

Opens a database in the provided transaction, creating it if necessary.

If name is None, then the default database will be opened, otherwise a named database will be opened. The database handle will be private to the transaction until the transaction is successfully committed. If the transaction is aborted the returned database handle should no longer be used.

Prefer using Environment::create_db.

Safety

This function (as well as Environment::open_db, Environment::create_db, and Database::open) must not be called from multiple concurrent transactions in the same environment. A transaction which uses this function must finish (either commit or abort) before any other transaction may use this function.

Opens a new read-write cursor on the given database and transaction.

Stores an item into a database.

This function stores key/data pairs in the database. The default behavior is to enter the new key/data pair, replacing any previously existing key if duplicates are disallowed, or adding a duplicate data item if duplicates are allowed (DatabaseFlags::DUP_SORT).

Returns a buffer which can be used to write a value into the item at the given key and with the given length. The buffer must be completely filled by the caller.

Deletes an item from a database.

This function removes key/data pairs from the database. If the database does not support sorted duplicate data items (DatabaseFlags::DUP_SORT) the data parameter is ignored. If the database supports sorted duplicates and the data parameter is None, all of the duplicate data items for the key will be deleted. Otherwise, if the data parameter is Some only the matching data item will be deleted. This function will return Error::NotFound if the specified key/data pair is not in the database.

Empties the given database. All items will be removed.

Drops the database from the environment.

Safety

This method is unsafe in the same ways as Environment::close_db, and should be used accordingly.

Begins a new nested transaction inside of this transaction.

Trait Implementations§

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more
Returns a raw pointer to the underlying LMDB transaction. Read more
Commits the transaction. Read more
Aborts the transaction. Read more
Opens a database in the transaction. Read more
Gets an item from a database. Read more
Open a new read-only cursor on the given database.
Gets the option flags for the given database in the transaction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.