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
impl ReadTx
Sourcepub fn get(
&self,
collection: &str,
key: &[u8],
) -> Result<Option<Vec<u8>>, NookError>
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.
Sourcepub fn list_collection(&self, collection: &str) -> Result<Vec<Entry>, NookError>
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.
Sourcepub fn list_entries_raw(&self) -> Result<Vec<Entry>, NookError>
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.
Sourcepub fn index_range_values(
&self,
lo: &[u8],
hi: &[u8],
) -> Result<Vec<Vec<u8>>, NookError>
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.