pub struct Tree<Root: Root, File: ManagedFile> { /* private fields */ }Expand description
A named collection of keys and values.
Implementations
Returns the number of keys stored in the tree. Does not include deleted keys.
Sets key to value. This is executed within its own transaction.
Retrieves the current value of key, if present. Does not reflect any
changes in pending transactions.
Sets key to value. If a value already exists, it will be returned.
Executes a modification.
Removes key and returns the existing value, if present. This is executed within its own transaction.
Compares the value of key against old. If the values match, key will
be set to the new value if new is Some or removed if new is
None. This is executed within its own transaction.
Retrieves the values of keys. If any keys are not found, they will be
omitted from the results. Keys are required to be pre-sorted.
Retrieves all of the values of keys within range.
pub fn scan<'keys, CallerError, KeyRangeBounds, NodeEvaluator, KeyEvaluator, DataCallback>(
&self,
range: &'keys KeyRangeBounds,
forwards: bool,
node_evaluator: NodeEvaluator,
key_evaluator: KeyEvaluator,
callback: DataCallback
) -> Result<(), AbortError<CallerError>> where
KeyRangeBounds: RangeBounds<&'keys [u8]> + Debug + Clone + ?Sized,
NodeEvaluator: FnMut(&ArcBytes<'static>, &Root::ReducedIndex, usize) -> bool,
KeyEvaluator: FnMut(&ArcBytes<'static>, &Root::Index) -> KeyEvaluation,
DataCallback: FnMut(ArcBytes<'static>, &Root::Index, ArcBytes<'static>) -> Result<(), AbortError<CallerError>>,
CallerError: Display + Debug,
pub fn scan<'keys, CallerError, KeyRangeBounds, NodeEvaluator, KeyEvaluator, DataCallback>(
&self,
range: &'keys KeyRangeBounds,
forwards: bool,
node_evaluator: NodeEvaluator,
key_evaluator: KeyEvaluator,
callback: DataCallback
) -> Result<(), AbortError<CallerError>> where
KeyRangeBounds: RangeBounds<&'keys [u8]> + Debug + Clone + ?Sized,
NodeEvaluator: FnMut(&ArcBytes<'static>, &Root::ReducedIndex, usize) -> bool,
KeyEvaluator: FnMut(&ArcBytes<'static>, &Root::Index) -> KeyEvaluation,
DataCallback: FnMut(ArcBytes<'static>, &Root::Index, ArcBytes<'static>) -> Result<(), AbortError<CallerError>>,
CallerError: Display + Debug,
Scans the tree. Each key that is contained range will be passed to
key_evaluator, which can opt to read the data for the key, skip, or
stop scanning. If KeyEvaluation::ReadData is returned, callback will
be invoked with the key and stored value. The order in which callback
is invoked is not necessarily the same order in which the keys are
found.
Returns the last key of the tree.
Returns the last key and value of the tree.
impl<File: ManagedFile, Index> Tree<VersionedTreeRoot<Index>, File> where
Index: EmbeddedIndex + Reducer<Index> + Clone + Debug + 'static,
impl<File: ManagedFile, Index> Tree<VersionedTreeRoot<Index>, File> where
Index: EmbeddedIndex + Reducer<Index> + Clone + Debug + 'static,
pub fn scan_sequences<CallerError, Range, KeyEvaluator, DataCallback>(
&mut self,
range: Range,
forwards: bool,
key_evaluator: &mut KeyEvaluator,
data_callback: &mut DataCallback
) -> Result<(), AbortError<CallerError>> where
Range: Clone + RangeBounds<u64> + Debug + 'static,
KeyEvaluator: FnMut(KeySequence) -> KeyEvaluation,
DataCallback: FnMut(KeySequence, ArcBytes<'static>) -> Result<(), AbortError<CallerError>>,
CallerError: Display + Debug,
pub fn scan_sequences<CallerError, Range, KeyEvaluator, DataCallback>(
&mut self,
range: Range,
forwards: bool,
key_evaluator: &mut KeyEvaluator,
data_callback: &mut DataCallback
) -> Result<(), AbortError<CallerError>> where
Range: Clone + RangeBounds<u64> + Debug + 'static,
KeyEvaluator: FnMut(KeySequence) -> KeyEvaluation,
DataCallback: FnMut(KeySequence, ArcBytes<'static>) -> Result<(), AbortError<CallerError>>,
CallerError: Display + Debug,
Scans the tree for keys that are contained within range. If forwards
is true, scanning starts at the lowest sort-order key and scans forward.
Otherwise, scanning starts at the highest sort-order key and scans
backwards. key_evaluator is invoked for each key as it is encountered.
For all KeyEvaluation::ReadData results returned, callback will be
invoked with the key and values. The callback may not be invoked in the
same order as the keys are scanned.
Trait Implementations
The default state for the underlying root type.
Auto Trait Implementations
impl<Root, File> !RefUnwindSafe for Tree<Root, File>
impl<Root, File> !UnwindSafe for Tree<Root, File>
Blanket Implementations
Mutably borrows from an owned value. Read more