Skip to main content

ReadTransaction

Trait ReadTransaction 

Source
pub trait ReadTransaction<'db>: Sized {
    type Cursor<'txn, T: Table>: ReadCursor<'txn, T>
       where Self: 'txn;
    type DupCursor<'txn, T: DupTable>: ReadCursor<'txn, T> + DupReadCursor<'txn, T>
       where Self: 'txn;

    // Required methods
    fn get<T: Table>(&self, table: &T, key: &T::Key) -> Option<T::Value>;
    fn cursor<'txn, T: RegularTable>(
        &'txn self,
        table: &T,
    ) -> Self::Cursor<'txn, T>;
    fn dup_cursor<'txn, T: DupTable>(
        &'txn self,
        table: &T,
    ) -> Self::DupCursor<'txn, T>;

    // Provided method
    fn close(self) { ... }
}
Expand description

Read-transactions can only perform read operations on a database.

Required Associated Types§

Source

type Cursor<'txn, T: Table>: ReadCursor<'txn, T> where Self: 'txn

Source

type DupCursor<'txn, T: DupTable>: ReadCursor<'txn, T> + DupReadCursor<'txn, T> where Self: 'txn

Required Methods§

Source

fn get<T: Table>(&self, table: &T, key: &T::Key) -> Option<T::Value>

Gets the value at a given key.

Source

fn cursor<'txn, T: RegularTable>(&'txn self, table: &T) -> Self::Cursor<'txn, T>

Creates a cursor for iterating over the table.

Source

fn dup_cursor<'txn, T: DupTable>( &'txn self, table: &T, ) -> Self::DupCursor<'txn, T>

Creates a cursor for iterating over the table with duplicate keys.

Provided Methods§

Source

fn close(self)

Close the transaction, releasing any resources it holds.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'db> ReadTransaction<'db> for MdbxReadTransaction<'db>

Source§

type Cursor<'txn, T: Table> = CursorProxy<'txn, T> where Self: 'txn

Source§

type DupCursor<'txn, T: DupTable> = CursorProxy<'txn, T> where Self: 'txn

Source§

impl<'db> ReadTransaction<'db> for MdbxWriteTransaction<'db>

Source§

type Cursor<'txn, T: Table> = CursorProxy<'txn, T> where Self: 'txn

Source§

type DupCursor<'txn, T: DupTable> = CursorProxy<'txn, T> where Self: 'txn

Source§

impl<'db, 'inner> ReadTransaction<'db> for TransactionProxy<'db, 'inner>
where 'db: 'inner,

Source§

type Cursor<'txn, T: Table> = CursorProxy<'txn, T> where 'inner: 'txn

Source§

type DupCursor<'txn, T: DupTable> = CursorProxy<'txn, T> where 'inner: 'txn

Source§

impl<'db, Kind> ReadTransaction<'db> for MdbxTransaction<'db, Kind>
where Kind: TransactionKind,

Source§

type Cursor<'txn, T: Table> = MdbxCursor<'txn, Kind, T> where 'db: 'txn

Source§

type DupCursor<'txn, T: DupTable> = MdbxCursor<'txn, Kind, T> where 'db: 'txn