Struct RoTransaction

Source
pub struct RoTransaction<'env> { /* private fields */ }
Expand description

An LMDB read-only transaction.

Implementations§

Source§

impl<'env> RoTransaction<'env>

Source

pub fn reset(self) -> InactiveTransaction<'env>

Resets the read-only transaction.

Abort the transaction like Transaction::abort, but keep the transaction handle. InactiveTransaction::renew may reuse the handle. This saves allocation overhead if the process will start a new read-only transaction soon, and also locking overhead if EnvironmentFlags::NO_TLS is in use. The reader table lock is released, but the table slot stays tied to its thread or transaction. Reader locks generally don’t interfere with writers, but they keep old versions of database pages allocated. Thus they prevent the old pages from being reused when writers commit new data, and so under heavy load the database size may grow much more rapidly than otherwise.

Trait Implementations§

Source§

impl<'env> Debug for RoTransaction<'env>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'env> Drop for RoTransaction<'env>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'env> Transaction for RoTransaction<'env>

Source§

fn txn(&self) -> *mut MDB_txn

Returns a raw pointer to the underlying LMDB transaction. Read more
Source§

fn commit(self) -> Result<()>

Commits the transaction. Read more
Source§

fn abort(self)

Aborts the transaction. Read more
Source§

unsafe fn open_db(&self, name: Option<&str>) -> Result<Database>

Opens a database in the transaction. Read more
Source§

fn get<'txn, K>(&'txn self, database: Database, key: &K) -> Result<&'txn [u8]>
where K: AsRef<[u8]>,

Gets an item from a database. Read more
Source§

fn open_ro_cursor<'txn>(&'txn self, db: Database) -> Result<RoCursor<'txn>>

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

fn db_flags(&self, db: Database) -> Result<DatabaseFlags>

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

fn stat(&self, db: Database) -> Result<Stat>

Retrieves database statistics.

Auto Trait Implementations§

§

impl<'env> Freeze for RoTransaction<'env>

§

impl<'env> RefUnwindSafe for RoTransaction<'env>

§

impl<'env> !Send for RoTransaction<'env>

§

impl<'env> !Sync for RoTransaction<'env>

§

impl<'env> Unpin for RoTransaction<'env>

§

impl<'env> UnwindSafe for RoTransaction<'env>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.