pub struct ReadSession<'manager, 'tree, S: Store> { /* private fields */ }Expand description
A reusable root-bound read context for one immutable tree.
The session retains the decoded root and a session-local recent leaf. It is
intended to be reused by one worker; methods that update traversal state
require &mut self.
Implementations§
Source§impl<'manager, 'tree, S: Store> ReadSession<'manager, 'tree, S>
impl<'manager, 'tree, S: Store> ReadSession<'manager, 'tree, S>
Sourcepub fn len(&self) -> Result<u64, Error>
pub fn len(&self) -> Result<u64, Error>
Return the number of logical entries using the retained root.
Sourcepub fn is_empty(&self) -> Result<bool, Error>
pub fn is_empty(&self) -> Result<bool, Error>
Return whether the bound tree contains no entries.
Sourcepub fn rank(&mut self, key: &[u8]) -> Result<u64, Error>
pub fn rank(&mut self, key: &[u8]) -> Result<u64, Error>
Return the number of keys strictly less than key.
Sourcepub fn get_with<R>(
&mut self,
key: &[u8],
read: impl FnOnce(&[u8]) -> R,
) -> Result<Option<R>, Error>
pub fn get_with<R>( &mut self, key: &[u8], read: impl FnOnce(&[u8]) -> R, ) -> Result<Option<R>, Error>
Read a value without copying it.
Sourcepub fn get_lease(
&mut self,
key: &[u8],
) -> Result<Option<OwnedValueLease>, Error>
pub fn get_lease( &mut self, key: &[u8], ) -> Result<Option<OwnedValueLease>, Error>
Retain the packed leaf containing a value beyond this borrowed session’s next traversal. Native adapters release the returned lease after their synchronous callback completes.
Sourcepub fn get_value_ref_with<R>(
&mut self,
key: &[u8],
read: impl for<'value> FnOnce(ValueRefView<'value>) -> R,
) -> Result<Option<R>, Error>
pub fn get_value_ref_with<R>( &mut self, key: &[u8], read: impl for<'value> FnOnce(ValueRefView<'value>) -> R, ) -> Result<Option<R>, Error>
Inspect a stored large-value envelope without copying inline bytes.
Sourcepub fn contains_key(&mut self, key: &[u8]) -> Result<bool, Error>
pub fn contains_key(&mut self, key: &[u8]) -> Result<bool, Error>
Check membership without copying the value.
Sourcepub fn get_many_with<K, F>(&mut self, keys: &[K], visit: F) -> Result<(), Error>
pub fn get_many_with<K, F>(&mut self, keys: &[K], visit: F) -> Result<(), Error>
Visit point-read results exactly once per input position and in order.
Sourcepub fn select_with<R>(
&mut self,
ordinal: u64,
read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R,
) -> Result<Option<R>, Error>
pub fn select_with<R>( &mut self, ordinal: u64, read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>
Visit the zero-based entry at ordinal without copying it.
Sourcepub fn first_entry_with<R>(
&mut self,
read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R,
) -> Result<Option<R>, Error>
pub fn first_entry_with<R>( &mut self, read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>
Visit the first entry in key order.
Sourcepub fn last_entry_with<R>(
&mut self,
read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R,
) -> Result<Option<R>, Error>
pub fn last_entry_with<R>( &mut self, read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>
Visit the last entry in key order.
Sourcepub fn lower_bound_with<R>(
&mut self,
key: &[u8],
read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R,
) -> Result<Option<R>, Error>
pub fn lower_bound_with<R>( &mut self, key: &[u8], read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>
Visit the first entry whose key is at least key.
Sourcepub fn upper_bound_with<R>(
&mut self,
key: &[u8],
read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R,
) -> Result<Option<R>, Error>
pub fn upper_bound_with<R>( &mut self, key: &[u8], read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>
Visit the first entry whose key is strictly greater than key.
Sourcepub fn scan_range(
&mut self,
start: &[u8],
end: Option<&[u8]>,
visit: impl for<'entry> FnMut(EntryRef<'entry>),
) -> Result<u64, Error>
pub fn scan_range( &mut self, start: &[u8], end: Option<&[u8]>, visit: impl for<'entry> FnMut(EntryRef<'entry>), ) -> Result<u64, Error>
Visit a half-open range in ascending order.
Sourcepub fn scan_range_until<B>(
&mut self,
start: &[u8],
end: Option<&[u8]>,
visit: impl for<'entry> FnMut(EntryRef<'entry>) -> ControlFlow<B>,
) -> Result<ScanOutcome<B>, Error>
pub fn scan_range_until<B>( &mut self, start: &[u8], end: Option<&[u8]>, visit: impl for<'entry> FnMut(EntryRef<'entry>) -> ControlFlow<B>, ) -> Result<ScanOutcome<B>, Error>
Visit a half-open range in ascending order with early termination.
Sourcepub fn scan_prefix(
&mut self,
prefix: &[u8],
visit: impl for<'entry> FnMut(EntryRef<'entry>),
) -> Result<u64, Error>
pub fn scan_prefix( &mut self, prefix: &[u8], visit: impl for<'entry> FnMut(EntryRef<'entry>), ) -> Result<u64, Error>
Visit all entries under prefix in ascending order.
Sourcepub fn scan_prefix_until<B>(
&mut self,
prefix: &[u8],
visit: impl for<'entry> FnMut(EntryRef<'entry>) -> ControlFlow<B>,
) -> Result<ScanOutcome<B>, Error>
pub fn scan_prefix_until<B>( &mut self, prefix: &[u8], visit: impl for<'entry> FnMut(EntryRef<'entry>) -> ControlFlow<B>, ) -> Result<ScanOutcome<B>, Error>
Visit all entries under prefix with early termination.
Sourcepub fn scan_range_reverse(
&mut self,
start: &[u8],
end: Option<&[u8]>,
visit: impl for<'entry> FnMut(EntryRef<'entry>),
) -> Result<u64, Error>
pub fn scan_range_reverse( &mut self, start: &[u8], end: Option<&[u8]>, visit: impl for<'entry> FnMut(EntryRef<'entry>), ) -> Result<u64, Error>
Visit a half-open range in descending order.
Sourcepub fn scan_range_reverse_until<B>(
&mut self,
start: &[u8],
end: Option<&[u8]>,
visit: impl for<'entry> FnMut(EntryRef<'entry>) -> ControlFlow<B>,
) -> Result<ScanOutcome<B>, Error>
pub fn scan_range_reverse_until<B>( &mut self, start: &[u8], end: Option<&[u8]>, visit: impl for<'entry> FnMut(EntryRef<'entry>) -> ControlFlow<B>, ) -> Result<ScanOutcome<B>, Error>
Visit a half-open range in descending order with early termination.
Sourcepub fn scan_prefix_reverse(
&mut self,
prefix: &[u8],
visit: impl for<'entry> FnMut(EntryRef<'entry>),
) -> Result<u64, Error>
pub fn scan_prefix_reverse( &mut self, prefix: &[u8], visit: impl for<'entry> FnMut(EntryRef<'entry>), ) -> Result<u64, Error>
Visit a prefix in descending order.
Sourcepub fn scan_prefix_reverse_until<B>(
&mut self,
prefix: &[u8],
visit: impl for<'entry> FnMut(EntryRef<'entry>) -> ControlFlow<B>,
) -> Result<ScanOutcome<B>, Error>
pub fn scan_prefix_reverse_until<B>( &mut self, prefix: &[u8], visit: impl for<'entry> FnMut(EntryRef<'entry>) -> ControlFlow<B>, ) -> Result<ScanOutcome<B>, Error>
Visit a prefix in descending order with early termination.
Auto Trait Implementations§
impl<'manager, 'tree, S> Freeze for ReadSession<'manager, 'tree, S>
impl<'manager, 'tree, S> RefUnwindSafe for ReadSession<'manager, 'tree, S>where
S: RefUnwindSafe,
impl<'manager, 'tree, S> Send for ReadSession<'manager, 'tree, S>
impl<'manager, 'tree, S> Sync for ReadSession<'manager, 'tree, S>
impl<'manager, 'tree, S> Unpin for ReadSession<'manager, 'tree, S>
impl<'manager, 'tree, S> UnsafeUnpin for ReadSession<'manager, 'tree, S>
impl<'manager, 'tree, S> UnwindSafe for ReadSession<'manager, 'tree, S>where
S: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more