Struct nebari::tree::UnversionedTreeRoot
source · [−]pub struct UnversionedTreeRoot<Index> where
Index: Clone + EmbeddedIndex + Debug + 'static, {
pub transaction_id: Option<TransactionId>,
pub by_id_root: BTreeEntry<UnversionedByIdIndex<Index>, ByIdStats<Index::Reduced>>,
/* private fields */
}
Expand description
A versioned B-Tree root. This tree root internally uses two btrees, one to keep track of all writes using a unique “sequence” ID, and one that keeps track of all key-value pairs.
Fields
transaction_id: Option<TransactionId>
The transaction ID of the tree root. If this transaction ID isn’t present in the transaction log, this root should not be trusted.
by_id_root: BTreeEntry<UnversionedByIdIndex<Index>, ByIdStats<Index::Reduced>>
The by-id B-Tree.
Trait Implementations
sourceimpl<Index: Clone> Clone for UnversionedTreeRoot<Index> where
Index: Clone + EmbeddedIndex + Debug + 'static,
Index::Reduced: Clone,
impl<Index: Clone> Clone for UnversionedTreeRoot<Index> where
Index: Clone + EmbeddedIndex + Debug + 'static,
Index::Reduced: Clone,
sourcefn clone(&self) -> UnversionedTreeRoot<Index>
fn clone(&self) -> UnversionedTreeRoot<Index>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<Index: Debug> Debug for UnversionedTreeRoot<Index> where
Index: Clone + EmbeddedIndex + Debug + 'static,
Index::Reduced: Debug,
impl<Index: Debug> Debug for UnversionedTreeRoot<Index> where
Index: Clone + EmbeddedIndex + Debug + 'static,
Index::Reduced: Debug,
sourceimpl<Index> Default for UnversionedTreeRoot<Index> where
Index: Clone + EmbeddedIndex + Debug + 'static,
<Self as Root>::Reducer: Default,
impl<Index> Default for UnversionedTreeRoot<Index> where
Index: Clone + EmbeddedIndex + Debug + 'static,
<Self as Root>::Reducer: Default,
sourceimpl<EmbeddedIndex> Root for UnversionedTreeRoot<EmbeddedIndex> where
EmbeddedIndex: Clone + EmbeddedIndex + 'static,
impl<EmbeddedIndex> Root for UnversionedTreeRoot<EmbeddedIndex> where
EmbeddedIndex: Clone + EmbeddedIndex + 'static,
sourceconst HEADER: PageHeader
const HEADER: PageHeader
The unique header byte for this root.
type Index = UnversionedByIdIndex<EmbeddedIndex>
type Index = UnversionedByIdIndex<EmbeddedIndex>
The primary index type contained within this root.
type ReducedIndex = ByIdStats<EmbeddedIndex::Reduced>
type ReducedIndex = ByIdStats<EmbeddedIndex::Reduced>
The primary index type contained within this root.
type Reducer = ByIdIndexer<EmbeddedIndex::Indexer>
type Reducer = ByIdIndexer<EmbeddedIndex::Indexer>
The reducer that reduces Index
es and re-reduces ReducedIndex
es.
sourcefn default_with(reducer: Self::Reducer) -> Self
fn default_with(reducer: Self::Reducer) -> Self
Returns a new instance with the provided reducer.
sourcefn count(&self) -> u64
fn count(&self) -> u64
Returns the number of values contained in this tree, not including deleted records. Read more
sourcefn initialized(&self) -> bool
fn initialized(&self) -> bool
Returns true if the tree is initialized.
sourcefn initialize_default(&mut self)
fn initialize_default(&mut self)
Resets the state to the default, initialized state. After calling this,
Self::initialized()
will return true. Read more
sourcefn deserialize(
bytes: ArcBytes<'_>,
reducer: Self::Reducer
) -> Result<Self, Error>
fn deserialize(
bytes: ArcBytes<'_>,
reducer: Self::Reducer
) -> Result<Self, Error>
Deserializes the root from bytes
.
sourcefn serialize(
&mut self,
paged_writer: &mut PagedWriter<'_>,
output: &mut Vec<u8>
) -> Result<(), Error>
fn serialize(
&mut self,
paged_writer: &mut PagedWriter<'_>,
output: &mut Vec<u8>
) -> Result<(), Error>
Serialize the root and return the bytes. Writes any additional data to
paged_writer
in the process of serialization. Read more
sourcefn transaction_id(&self) -> TransactionId
fn transaction_id(&self) -> TransactionId
Returns the current transaction id.
sourcefn modify(
&mut self,
modification: Modification<'_, ArcBytes<'static>, Self::Index>,
writer: &mut PagedWriter<'_>,
max_order: Option<usize>
) -> Result<Vec<ModificationResult<Self::Index>>, Error>
fn modify(
&mut self,
modification: Modification<'_, ArcBytes<'static>, Self::Index>,
writer: &mut PagedWriter<'_>,
max_order: Option<usize>
) -> Result<Vec<ModificationResult<Self::Index>>, Error>
Modifies the tree. Returns a list of modified keys and their updated indexes, if the keys are still present. Read more
sourcefn 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 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]>,
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. Read more
sourcefn scan<'keys, CallerError: Display + Debug, NodeEvaluator, KeyRangeBounds, KeyEvaluator, DataCallback>(
&self,
range: &'keys KeyRangeBounds,
args: &mut ScanArgs<Self::Index, Self::ReducedIndex, CallerError, NodeEvaluator, KeyEvaluator, DataCallback>,
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,
DataCallback: FnMut(ArcBytes<'static>, &Self::Index, ArcBytes<'static>) -> Result<(), AbortError<CallerError>>,
fn scan<'keys, CallerError: Display + Debug, NodeEvaluator, KeyRangeBounds, KeyEvaluator, DataCallback>(
&self,
range: &'keys KeyRangeBounds,
args: &mut ScanArgs<Self::Index, Self::ReducedIndex, CallerError, NodeEvaluator, KeyEvaluator, DataCallback>,
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,
DataCallback: FnMut(ArcBytes<'static>, &Self::Index, ArcBytes<'static>) -> Result<(), AbortError<CallerError>>,
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. Read more
sourcefn 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 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>
Copies all data from file
into writer
, updating self
with the new
file positions. Read more
sourcefn tree<File: ManagedFile>(
name: impl Into<Cow<'static, str>>
) -> TreeRoot<Self, File> where
Self::Reducer: Default,
fn tree<File: ManagedFile>(
name: impl Into<Cow<'static, str>>
) -> TreeRoot<Self, File> where
Self::Reducer: Default,
Returns a reference to a named tree that contains this type of root.
sourcefn tree_with_reducer<File: ManagedFile>(
name: impl Into<Cow<'static, str>>,
reducer: Self::Reducer
) -> TreeRoot<Self, File>
fn tree_with_reducer<File: ManagedFile>(
name: impl Into<Cow<'static, str>>,
reducer: Self::Reducer
) -> TreeRoot<Self, File>
Returns a reference to a named tree that contains this type of root.
Auto Trait Implementations
impl<Index> RefUnwindSafe for UnversionedTreeRoot<Index> where
Index: RefUnwindSafe,
<Index as EmbeddedIndex>::Indexer: RefUnwindSafe,
<Index as EmbeddedIndex>::Reduced: RefUnwindSafe,
impl<Index> Send for UnversionedTreeRoot<Index>
impl<Index> Sync for UnversionedTreeRoot<Index>
impl<Index> Unpin for UnversionedTreeRoot<Index> where
Index: Unpin,
<Index as EmbeddedIndex>::Indexer: Unpin,
<Index as EmbeddedIndex>::Reduced: Unpin,
impl<Index> UnwindSafe for UnversionedTreeRoot<Index> where
Index: UnwindSafe,
<Index as EmbeddedIndex>::Indexer: UnwindSafe,
<Index as EmbeddedIndex>::Reduced: UnwindSafe,
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> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
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