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>
impl<'a, K: Key + 'static, V: Value + 'static> TableHandle<'a, K, V>
pub fn get<'k>( &self, key: impl Borrow<K::SelfType<'k>>, ) -> Result<Option<AccessGuard<'_, V>>, StorageError>
pub fn iter(&self) -> Result<Range<'_, K, V>, StorageError>
Sourcepub fn len(&self) -> Result<u64, StorageError>
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.
Sourcepub fn range<'k, KR: Borrow<K::SelfType<'k>> + 'k>(
&self,
range: impl RangeBounds<KR> + 'k,
) -> Result<Range<'_, K, V>, StorageError>
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).