Trait lmdb::Transaction [] [src]

pub trait Transaction: Sized {
    fn txn(&self) -> *mut MDB_txn;

    fn commit(self) -> Result<()> { ... }
    fn abort(self) { ... }
    unsafe fn open_db(&self, name: Option<&str>) -> Result<Database> { ... }
    fn get<'txn, K>(
        &'txn self,
        database: Database,
        key: &K
    ) -> Result<&'txn [u8]>
    where
        K: AsRef<[u8]>
, { ... } fn open_ro_cursor<'txn>(&'txn self, db: Database) -> Result<RoCursor<'txn>> { ... } fn db_flags(&self, db: Database) -> Result<DatabaseFlags> { ... } }

An LMDB transaction.

All database operations require a transaction.

Required Methods

Returns a raw pointer to the underlying LMDB transaction.

The caller must ensure that the pointer is not used after the lifetime of the transaction.

Provided Methods

Commits the transaction.

Any pending operations will be saved.

Aborts the transaction.

Any pending operations will not be saved.

Opens a database in the transaction.

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::open_db.

Safety

This function (as well as Environment::open_db, Environment::create_db, and Database::create) 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.

Gets an item from a database.

This function retrieves the data associated with the given key in the database. If the database supports duplicate keys (DatabaseFlags::DUP_SORT) then the first data item for the key will be returned. Retrieval of other items requires the use of Transaction::cursor_get. If the item is not in the database, then Error::NotFound will be returned.

Open a new read-only cursor on the given database.

Gets the option flags for the given database in the transaction.

Implementors