Skip to main content

ReadTx

Struct ReadTx 

Source
pub struct ReadTx { /* private fields */ }
Expand description

Handle exposed to read transaction callbacks. MVCC snapshot.

No lifetime parameter: redb::ReadOnlyTable is Arc<TransactionGuard>-backed and fully owns its data. The read-side table does not borrow the ReadTransaction.

Implementations§

Source§

impl ReadTx

Source

pub fn get( &self, collection: &str, key: &[u8], ) -> Result<Option<Vec<u8>>, NookError>

Returns the value stored under (collection, key), or None.

§Errors

Returns NookError::InvalidArg if collection is empty or contains a null byte. Returns NookError::Storage or NookError::Corruption on underlying storage failure.

Source

pub fn list_collection(&self, collection: &str) -> Result<Vec<Entry>, NookError>

Returns all (key, value) pairs in the named collection, in lexicographic key order. May be empty.

§Errors

Returns NookError::InvalidArg if collection is empty or contains a null byte. Returns NookError::Storage or NookError::Corruption on underlying storage failure.

Source

pub fn list_entries_raw(&self) -> Result<Vec<Entry>, NookError>

Returns every (composite_key, value) pair across the entire entries table, in key order. Used by crate::backup::write_backup to stream a full DB snapshot. The composite key encoding is opaque here — the backup format does not decompose it (restore writes the same composite keys back).

§Errors

Returns NookError::Storage or NookError::Corruption on underlying storage failure.

Source

pub fn index_range_values( &self, lo: &[u8], hi: &[u8], ) -> Result<Vec<Vec<u8>>, NookError>

Returns every value stored under index keys in the half-open range [lo, hi) of the secondary-index table, in key order.

Returns an empty vector when the index table has never been written (no index maintenance has occurred yet). Used by the index engine for equality lookups; collection/key routing is encoded into lo/hi by crate::index::engine.

§Errors

Returns NookError::Storage or NookError::Corruption on underlying storage failure.

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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.