pub trait Root: Debug + Send + Sync + Clone + 'static {
    type Index: Clone + Debug + 'static;
    type ReducedIndex: Clone + Debug + 'static;
    type Reducer: Reducer<Self::Index, Self::ReducedIndex> + 'static;

    const HEADER: PageHeader;
Show 15 methods fn default_with(reducer: Self::Reducer) -> Self;
fn reducer(&self) -> &Self::Reducer;
fn count(&self) -> u64;
fn dirty(&self) -> bool;
fn initialized(&self) -> bool;
fn initialize_default(&mut self);
fn serialize(
        &mut self,
        paged_writer: &mut PagedWriter<'_>,
        output: &mut Vec<u8>
    ) -> Result<(), Error>;
fn deserialize(
        bytes: ArcBytes<'_>,
        reducer: Self::Reducer
    ) -> Result<Self, Error>;
fn transaction_id(&self) -> TransactionId;
fn modify<'a, 'w>(
        &'a mut self,
        modification: Modification<'_, ArcBytes<'static>, Self::Index>,
        writer: &'a mut PagedWriter<'w>,
        max_order: Option<usize>
    ) -> Result<Vec<ModificationResult<Self::Index>>, Error>;
fn get_multiple<'keys, KeyEvaluator, KeyReader, Keys>(
        &self,
        keys: &mut Keys,
        key_evaluator: &mut KeyEvaluator,
        key_reader: &mut KeyReader,
        file: &mut dyn File,
        vault: Option<&dyn AnyVault>,
        cache: Option<&ChunkCache>
    ) -> Result<(), Error>
    where
        KeyEvaluator: FnMut(&ArcBytes<'static>, &Self::Index) -> ScanEvaluation,
        KeyReader: FnMut(ArcBytes<'static>, ArcBytes<'static>, Self::Index) -> Result<(), Error>,
        Keys: Iterator<Item = &'keys [u8]>
;
fn scan<'keys, CallerError: Display + Debug, NodeEvaluator, KeyRangeBounds, KeyEvaluator, ScanDataCallback>(
        &self,
        range: &'keys KeyRangeBounds,
        args: &mut ScanArgs<Self::Index, Self::ReducedIndex, CallerError, NodeEvaluator, KeyEvaluator, ScanDataCallback>,
        file: &mut dyn File,
        vault: Option<&dyn AnyVault>,
        cache: Option<&ChunkCache>
    ) -> Result<bool, AbortError<CallerError>>
    where
        NodeEvaluator: FnMut(&ArcBytes<'static>, &Self::ReducedIndex, usize) -> ScanEvaluation,
        KeyEvaluator: FnMut(&ArcBytes<'static>, &Self::Index) -> ScanEvaluation,
        KeyRangeBounds: RangeBounds<&'keys [u8]> + Debug + ?Sized,
        ScanDataCallback: FnMut(ArcBytes<'static>, &Self::Index, ArcBytes<'static>) -> Result<(), AbortError<CallerError>>
;
fn copy_data_to(
        &mut self,
        include_nodes: bool,
        file: &mut dyn File,
        copied_chunks: &mut HashMap<u64, u64>,
        writer: &mut PagedWriter<'_>,
        vault: Option<&dyn AnyVault>
    ) -> Result<(), Error>; fn tree<File: ManagedFile>(
        name: impl Into<Cow<'static, str>>
    ) -> TreeRoot<Self, File>
    where
        Self::Reducer: Default
, { ... }
fn tree_with_reducer<File: ManagedFile>(
        name: impl Into<Cow<'static, str>>,
        reducer: Self::Reducer
    ) -> TreeRoot<Self, File> { ... }
}
Expand description

A B-Tree root implementation.

Associated Types

The primary index type contained within this root.

The primary index type contained within this root.

The reducer that reduces Indexes and re-reduces ReducedIndexes.

Associated Constants

The unique header byte for this root.

Required methods

Returns a new instance with the provided reducer.

Returns the instance’s reducer.

Returns the number of values contained in this tree, not including deleted records.

Returns true if the root needs to be saved.

Returns true if the tree is initialized.

Resets the state to the default, initialized state. After calling this, Self::initialized() will return true.

Serialize the root and return the bytes. Writes any additional data to paged_writer in the process of serialization.

Deserializes the root from bytes.

Returns the current transaction id.

Modifies the tree. Returns a list of modified keys and their updated indexes, if the keys are still present.

Iterates over the tree looking for keys. keys must be sorted. key_evaluator is invoked for each key as it is found, allowing for decisions on how to handle each key. key_reader will be invoked for each key that is requested to be read, but it might be invoked at a later time and in a different order.

Scans the tree over range. args.key_evaluator is invoked for each key as it is found, allowing for decisions on how to handle each key. args.key_reader will be invoked for each key that is requested to be read, but it might be invoked at a later time and in a different order.

Copies all data from file into writer, updating self with the new file positions.

Provided methods

Returns a reference to a named tree that contains this type of root.

Returns a reference to a named tree that contains this type of root.

Implementors