Struct nebari::TransactionTree 
source · [−]pub struct TransactionTree<Root: Root, File: ManagedFile> { /* private fields */ }Expand description
A tree that is modifiable during a transaction.
Implementations
sourceimpl<File: ManagedFile, Index> TransactionTree<VersionedTreeRoot<Index>, File> where
    Index: Clone + EmbeddedIndex + Debug + 'static, 
 
impl<File: ManagedFile, Index> TransactionTree<VersionedTreeRoot<Index>, File> where
    Index: Clone + EmbeddedIndex + Debug + 'static, 
sourcepub fn current_sequence_id(&self) -> SequenceId
 
pub fn current_sequence_id(&self) -> SequenceId
Returns the latest sequence id.
sourcepub 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: RangeBounds<SequenceId> + Debug + 'static,
    KeyEvaluator: FnMut(KeySequence<Index>) -> ScanEvaluation,
    DataCallback: FnMut(KeySequence<Index>, 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: RangeBounds<SequenceId> + Debug + 'static,
    KeyEvaluator: FnMut(KeySequence<Index>) -> ScanEvaluation,
    DataCallback: FnMut(KeySequence<Index>, 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 ScanEvaluation::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.
sourcepub fn get_multiple_by_sequence<Sequences>(
    &mut self, 
    sequences: Sequences
) -> Result<HashMap<SequenceId, (ArcBytes<'static>, Option<ArcBytes<'static>>)>, Error> where
    Sequences: Iterator<Item = SequenceId>, 
 
pub fn get_multiple_by_sequence<Sequences>(
    &mut self, 
    sequences: Sequences
) -> Result<HashMap<SequenceId, (ArcBytes<'static>, Option<ArcBytes<'static>>)>, Error> where
    Sequences: Iterator<Item = SequenceId>, 
Retrieves the keys and values associated with one or more sequences.
The value retrieved is the value of the key at the given SequenceId.
If a sequence is not found, it will not appear in the result map. If
the value was removed, None is returned for the value.
sourcepub fn get_multiple_indexes_by_sequence<Sequences>(
    &mut self, 
    sequences: Sequences
) -> Result<Vec<SequenceIndex<Index>>, Error> where
    Sequences: Iterator<Item = SequenceId>, 
 
pub fn get_multiple_indexes_by_sequence<Sequences>(
    &mut self, 
    sequences: Sequences
) -> Result<Vec<SequenceIndex<Index>>, Error> where
    Sequences: Iterator<Item = SequenceId>, 
Retrieves the keys and indexes associated with one or more sequences.
The value retrieved is the value of the key at the given SequenceId.
If a sequence is not found, it will not appear in the result list.
sourcepub fn get_multiple_with_indexes_by_sequence<Sequences>(
    &mut self, 
    sequences: Sequences
) -> Result<HashMap<SequenceId, SequenceEntry<Index>>, Error> where
    Sequences: Iterator<Item = SequenceId>, 
 
pub fn get_multiple_with_indexes_by_sequence<Sequences>(
    &mut self, 
    sequences: Sequences
) -> Result<HashMap<SequenceId, SequenceEntry<Index>>, Error> where
    Sequences: Iterator<Item = SequenceId>, 
Retrieves the keys, values, and indexes associated with one or more
sequences. The value retrieved is the value of the key at the given
SequenceId. If a sequence is not found, it will not appear in the
result list.
sourceimpl<Root: Root, File: ManagedFile> TransactionTree<Root, File>
 
impl<Root: Root, File: ManagedFile> TransactionTree<Root, File>
sourcepub fn set(
    &mut self, 
    key: impl Into<ArcBytes<'static>>, 
    value: impl Into<ArcBytes<'static>>
) -> Result<Root::Index, Error>
 
pub fn set(
    &mut self, 
    key: impl Into<ArcBytes<'static>>, 
    value: impl Into<ArcBytes<'static>>
) -> Result<Root::Index, Error>
Sets key to value. Returns the newly created index for this key.
sourcepub fn modify<'a>(
    &mut self, 
    keys: Vec<ArcBytes<'a>>, 
    operation: Operation<'a, ArcBytes<'static>, Root::Index>
) -> Result<Vec<ModificationResult<Root::Index>>, Error>
 
pub fn modify<'a>(
    &mut self, 
    keys: Vec<ArcBytes<'a>>, 
    operation: Operation<'a, ArcBytes<'static>, Root::Index>
) -> Result<Vec<ModificationResult<Root::Index>>, Error>
Executes a modification. Returns a list of all changed keys.
sourcepub fn replace(
    &mut self, 
    key: impl Into<ArcBytes<'static>>, 
    value: impl Into<ArcBytes<'static>>
) -> Result<(Option<ArcBytes<'static>>, Root::Index), Error>
 
pub fn replace(
    &mut self, 
    key: impl Into<ArcBytes<'static>>, 
    value: impl Into<ArcBytes<'static>>
) -> Result<(Option<ArcBytes<'static>>, Root::Index), Error>
Sets key to value. Returns a tuple containing two elements:
- The previously stored value, if a value was already present.
- The new/updated index for this key.
sourcepub fn get(&mut self, key: &[u8]) -> Result<Option<ArcBytes<'static>>, Error>
 
pub fn get(&mut self, key: &[u8]) -> Result<Option<ArcBytes<'static>>, Error>
Returns the current value of key. This will return updated information
if it has been previously updated within this transaction.
sourcepub fn get_index(&mut self, key: &[u8]) -> Result<Option<Root::Index>, Error>
 
pub fn get_index(&mut self, key: &[u8]) -> Result<Option<Root::Index>, Error>
Returns the current index of key. This will return updated information
if it has been previously updated within this transaction.
sourcepub fn get_with_index(
    &mut self, 
    key: &[u8]
) -> Result<Option<(ArcBytes<'static>, Root::Index)>, Error>
 
pub fn get_with_index(
    &mut self, 
    key: &[u8]
) -> Result<Option<(ArcBytes<'static>, Root::Index)>, Error>
Returns the current value and index of key. This will return updated
information if it has been previously updated within this transaction.
sourcepub fn remove(
    &mut self, 
    key: &[u8]
) -> Result<Option<(ArcBytes<'static>, Root::Index)>, Error>
 
pub fn remove(
    &mut self, 
    key: &[u8]
) -> Result<Option<(ArcBytes<'static>, Root::Index)>, Error>
Removes key and returns the existing value amd index, if present.
sourcepub fn compare_and_swap(
    &mut self, 
    key: &[u8], 
    old: Option<&[u8]>, 
    new: Option<ArcBytes<'_>>
) -> Result<(), CompareAndSwapError>
 
pub fn compare_and_swap(
    &mut self, 
    key: &[u8], 
    old: Option<&[u8]>, 
    new: Option<ArcBytes<'_>>
) -> Result<(), CompareAndSwapError>
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.
sourcepub fn get_multiple<'keys, KeysIntoIter, KeysIter>(
    &mut self, 
    keys: KeysIntoIter
) -> Result<Vec<(ArcBytes<'static>, ArcBytes<'static>)>, Error> where
    KeysIntoIter: IntoIterator<Item = &'keys [u8], IntoIter = KeysIter>,
    KeysIter: Iterator<Item = &'keys [u8]> + ExactSizeIterator, 
 
pub fn get_multiple<'keys, KeysIntoIter, KeysIter>(
    &mut self, 
    keys: KeysIntoIter
) -> Result<Vec<(ArcBytes<'static>, ArcBytes<'static>)>, Error> where
    KeysIntoIter: IntoIterator<Item = &'keys [u8], IntoIter = KeysIter>,
    KeysIter: Iterator<Item = &'keys [u8]> + ExactSizeIterator, 
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.
sourcepub fn get_multiple_indexes<'keys, KeysIntoIter, KeysIter>(
    &mut self, 
    keys: KeysIntoIter
) -> Result<Vec<(ArcBytes<'static>, Root::Index)>, Error> where
    KeysIntoIter: IntoIterator<Item = &'keys [u8], IntoIter = KeysIter>,
    KeysIter: Iterator<Item = &'keys [u8]> + ExactSizeIterator, 
 
pub fn get_multiple_indexes<'keys, KeysIntoIter, KeysIter>(
    &mut self, 
    keys: KeysIntoIter
) -> Result<Vec<(ArcBytes<'static>, Root::Index)>, Error> where
    KeysIntoIter: IntoIterator<Item = &'keys [u8], IntoIter = KeysIter>,
    KeysIter: Iterator<Item = &'keys [u8]> + ExactSizeIterator, 
Retrieves the indexes of keys. If any keys are not found, they will be
omitted from the results. Keys are required to be pre-sorted.
sourcepub fn get_multiple_with_indexes<'keys, KeysIntoIter, KeysIter>(
    &mut self, 
    keys: KeysIntoIter
) -> Result<Vec<(ArcBytes<'static>, ArcBytes<'static>, Root::Index)>, Error> where
    KeysIntoIter: IntoIterator<Item = &'keys [u8], IntoIter = KeysIter>,
    KeysIter: Iterator<Item = &'keys [u8]> + ExactSizeIterator, 
 
pub fn get_multiple_with_indexes<'keys, KeysIntoIter, KeysIter>(
    &mut self, 
    keys: KeysIntoIter
) -> Result<Vec<(ArcBytes<'static>, ArcBytes<'static>, Root::Index)>, Error> where
    KeysIntoIter: IntoIterator<Item = &'keys [u8], IntoIter = KeysIter>,
    KeysIter: Iterator<Item = &'keys [u8]> + ExactSizeIterator, 
Retrieves the values and indexes of keys. If any keys are not found,
they will be omitted from the results. Keys are required to be
pre-sorted.
sourcepub fn get_range<'keys, KeyRangeBounds>(
    &mut self, 
    range: &'keys KeyRangeBounds
) -> Result<Vec<(ArcBytes<'static>, ArcBytes<'static>)>, Error> where
    KeyRangeBounds: RangeBounds<&'keys [u8]> + Debug + ?Sized, 
 
pub fn get_range<'keys, KeyRangeBounds>(
    &mut self, 
    range: &'keys KeyRangeBounds
) -> Result<Vec<(ArcBytes<'static>, ArcBytes<'static>)>, Error> where
    KeyRangeBounds: RangeBounds<&'keys [u8]> + Debug + ?Sized, 
Retrieves all of the values of keys within range.
sourcepub fn get_range_indexes<'keys, KeyRangeBounds>(
    &mut self, 
    range: &'keys KeyRangeBounds
) -> Result<Vec<(ArcBytes<'static>, Root::Index)>, Error> where
    KeyRangeBounds: RangeBounds<&'keys [u8]> + Debug + ?Sized, 
 
pub fn get_range_indexes<'keys, KeyRangeBounds>(
    &mut self, 
    range: &'keys KeyRangeBounds
) -> Result<Vec<(ArcBytes<'static>, Root::Index)>, Error> where
    KeyRangeBounds: RangeBounds<&'keys [u8]> + Debug + ?Sized, 
Retrieves all of the indexes of keys within range.
sourcepub fn get_range_with_indexes<'keys, KeyRangeBounds>(
    &mut self, 
    range: &'keys KeyRangeBounds
) -> Result<Vec<(ArcBytes<'static>, ArcBytes<'static>, Root::Index)>, Error> where
    KeyRangeBounds: RangeBounds<&'keys [u8]> + Debug + ?Sized, 
 
pub fn get_range_with_indexes<'keys, KeyRangeBounds>(
    &mut self, 
    range: &'keys KeyRangeBounds
) -> Result<Vec<(ArcBytes<'static>, ArcBytes<'static>, Root::Index)>, Error> where
    KeyRangeBounds: RangeBounds<&'keys [u8]> + Debug + ?Sized, 
Retrieves all of the values and indexes of keys within range.
sourcepub fn scan<'b, 'keys, CallerError, KeyRangeBounds, NodeEvaluator, KeyEvaluator, DataCallback>(
    &mut self, 
    range: &'keys KeyRangeBounds, 
    forwards: bool, 
    node_evaluator: NodeEvaluator, 
    key_evaluator: KeyEvaluator, 
    callback: DataCallback
) -> Result<(), AbortError<CallerError>> where
    KeyRangeBounds: RangeBounds<&'keys [u8]> + Debug + ?Sized,
    NodeEvaluator: FnMut(&ArcBytes<'static>, &Root::ReducedIndex, usize) -> ScanEvaluation,
    KeyEvaluator: FnMut(&ArcBytes<'static>, &Root::Index) -> ScanEvaluation,
    DataCallback: FnMut(ArcBytes<'static>, &Root::Index, ArcBytes<'static>) -> Result<(), AbortError<CallerError>>,
    CallerError: Display + Debug, 
 
pub fn scan<'b, 'keys, CallerError, KeyRangeBounds, NodeEvaluator, KeyEvaluator, DataCallback>(
    &mut self, 
    range: &'keys KeyRangeBounds, 
    forwards: bool, 
    node_evaluator: NodeEvaluator, 
    key_evaluator: KeyEvaluator, 
    callback: DataCallback
) -> Result<(), AbortError<CallerError>> where
    KeyRangeBounds: RangeBounds<&'keys [u8]> + Debug + ?Sized,
    NodeEvaluator: FnMut(&ArcBytes<'static>, &Root::ReducedIndex, usize) -> ScanEvaluation,
    KeyEvaluator: FnMut(&ArcBytes<'static>, &Root::Index) -> ScanEvaluation,
    DataCallback: FnMut(ArcBytes<'static>, &Root::Index, ArcBytes<'static>) -> Result<(), AbortError<CallerError>>,
    CallerError: Display + Debug, 
Scans the tree across all nodes that might contain nodes within range.
If forwards is true, the tree is scanned in ascending order.
Otherwise, the tree is scanned in descending order.
node_evaluator is invoked for each Interior
node to determine if the node should be traversed. The parameters to the
callback are:
- &ArcBytes<'static>: The maximum key stored within the all children nodes.
- &Root::ReducedIndex: The reduced index value stored within the node.
- usize: The depth of the node. The root nodes are depth 0.
The result of the callback is a ScanEvaluation. To read children
nodes, return ScanEvaluation::ReadData.
key_evaluator is invoked for each key encountered that is contained
within range. For all ScanEvaluation::ReadData results returned,
callback will be invoked with the key and values. callback may not
be invoked in the same order as the keys are scanned.
sourcepub fn reduce<'keys, KeyRangeBounds>(
    &mut self, 
    range: &'keys KeyRangeBounds
) -> Result<Option<Root::ReducedIndex>, Error> where
    KeyRangeBounds: RangeBounds<&'keys [u8]> + Debug + Clone + ?Sized, 
 
pub fn reduce<'keys, KeyRangeBounds>(
    &mut self, 
    range: &'keys KeyRangeBounds
) -> Result<Option<Root::ReducedIndex>, Error> where
    KeyRangeBounds: RangeBounds<&'keys [u8]> + Debug + Clone + ?Sized, 
Returns the reduced index over the provided range. This is an
aggregation function that builds atop the scan() operation which calls
Reducer::reduce() and
Reducer::rereduce() on all matching
indexes stored within the nodes of this tree, producing a single
aggregated Root::ReducedIndex value.
If no keys match, the returned result is what
Reducer::rereduce() returns when an
empty slice is provided.
sourcepub fn first_key(&mut self) -> Result<Option<ArcBytes<'static>>, Error>
 
pub fn first_key(&mut self) -> Result<Option<ArcBytes<'static>>, Error>
Returns the first key of the tree.
sourcepub fn first(
    &mut self
) -> Result<Option<(ArcBytes<'static>, ArcBytes<'static>)>, Error>
 
pub fn first(
    &mut self
) -> Result<Option<(ArcBytes<'static>, ArcBytes<'static>)>, Error>
Returns the first key and value of the tree.
Auto Trait Implementations
impl<Root, File> !RefUnwindSafe for TransactionTree<Root, File>
impl<Root, File> Send for TransactionTree<Root, File>
impl<Root, File> Sync for TransactionTree<Root, File>
impl<Root, File> Unpin for TransactionTree<Root, File> where
    <<File as ManagedFile>::Manager as FileManager>::FileHandle: Unpin, 
impl<Root, File> !UnwindSafe for TransactionTree<Root, File>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
    T: ?Sized, 
 
impl<T> BorrowMut<T> for T where
    T: ?Sized, 
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
 
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
 
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
 
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
    S: Into<Dispatch>, 
 
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
    S: Into<Dispatch>, 
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
 
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more