Skip to main content

TableHandle

Enum TableHandle 

Source
pub enum TableHandle<'a, K: Key + 'static, V: Value + 'static> {
    Write(Table<'a, K, V>),
    Read(ReadOnlyTable<K, V>),
}
Expand description

Exposes get/iter/range as plain inherent methods, not a full redb::ReadableTable trait impl — matching the whole trait (first/ last/…) would be boilerplate for methods nothing calls. range was deliberately left out until a real call site needed it; v2’s composite-key adjacency (prefix scans over ADJ_OUT/ADJ_IN) is that call site.

Variants§

§

Write(Table<'a, K, V>)

§

Read(ReadOnlyTable<K, V>)

Implementations§

Source§

impl<'a, K: Key + 'static, V: Value + 'static> TableHandle<'a, K, V>

Source

pub fn get<'k>( &self, key: impl Borrow<K::SelfType<'k>>, ) -> Result<Option<AccessGuard<'_, V>>, StorageError>

Source

pub fn iter(&self) -> Result<Range<'_, K, V>, StorageError>

Source

pub fn len(&self) -> Result<u64, StorageError>

Total entry count — O(1), redb tracks it per table. Added for the planner’s start-point cardinality comparisons (an AllNodesScan candidate’s cost is exactly this count for NODES), same “cheap count, never walk the entries” contract as MultimapValue::len() in index::match_count.

Source

pub fn range<'k, KR: Borrow<K::SelfType<'k>> + 'k>( &self, range: impl RangeBounds<KR> + 'k, ) -> Result<Range<'_, K, V>, StorageError>

Key-ordered scan over a sub-range — the primitive behind composite- key prefix reads (ADJ_OUT/ADJ_IN’s node ++ label expansion) and, eventually, indexed range predicates over PROPERTY_INDEX (whose order-preserving value encoding has been range-ready since it was written).

Auto Trait Implementations§

§

impl<'a, K, V> !RefUnwindSafe for TableHandle<'a, K, V>

§

impl<'a, K, V> !UnwindSafe for TableHandle<'a, K, V>

§

impl<'a, K, V> Freeze for TableHandle<'a, K, V>

§

impl<'a, K, V> Send for TableHandle<'a, K, V>
where K: Send, V: Send,

§

impl<'a, K, V> Sync for TableHandle<'a, K, V>
where K: Sync, V: Sync,

§

impl<'a, K, V> Unpin for TableHandle<'a, K, V>
where K: Unpin, V: Unpin,

§

impl<'a, K, V> UnsafeUnpin for TableHandle<'a, K, V>

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.