pub trait Reducer<Index, ReducedIndex = Index>: Debug + Clone + Send + Sync {
fn reduce<'a, Indexes, IndexesIter>(&self, indexes: Indexes) -> ReducedIndex
where
Index: 'a,
Indexes: IntoIterator<Item = &'a Index, IntoIter = IndexesIter> + ExactSizeIterator,
IndexesIter: Iterator<Item = &'a Index> + ExactSizeIterator + Clone;
fn rereduce<'a, ReducedIndexes, ReducedIndexesIter>(
&self,
values: ReducedIndexes
) -> ReducedIndex
where
Self: 'a,
ReducedIndex: 'a,
ReducedIndexes: IntoIterator<Item = &'a ReducedIndex, IntoIter = ReducedIndexesIter> + ExactSizeIterator,
ReducedIndexesIter: Iterator<Item = &'a ReducedIndex> + ExactSizeIterator + Clone;
}
Expand description
Reduces one or more Index
es or instances of Self
into a single Self
value.
This trait is used to collect statistics within the B-Tree. The Index
value is stored at the KeyEntry
level, and each Interior
entry
contains Self
, which is calculated by calling Reducer::reduce()
on all
stored Index
es.
When an Interior
node points to other interior nodes, it calculates the
stored value by calling Reducer::rereduce()
with all the stored Self
values.
Required methods
fn reduce<'a, Indexes, IndexesIter>(&self, indexes: Indexes) -> ReducedIndex where
Index: 'a,
Indexes: IntoIterator<Item = &'a Index, IntoIter = IndexesIter> + ExactSizeIterator,
IndexesIter: Iterator<Item = &'a Index> + ExactSizeIterator + Clone,
fn reduce<'a, Indexes, IndexesIter>(&self, indexes: Indexes) -> ReducedIndex where
Index: 'a,
Indexes: IntoIterator<Item = &'a Index, IntoIter = IndexesIter> + ExactSizeIterator,
IndexesIter: Iterator<Item = &'a Index> + ExactSizeIterator + Clone,
Reduces one or more indexes into a single reduced index.
fn rereduce<'a, ReducedIndexes, ReducedIndexesIter>(
&self,
values: ReducedIndexes
) -> ReducedIndex where
Self: 'a,
ReducedIndex: 'a,
ReducedIndexes: IntoIterator<Item = &'a ReducedIndex, IntoIter = ReducedIndexesIter> + ExactSizeIterator,
ReducedIndexesIter: Iterator<Item = &'a ReducedIndex> + ExactSizeIterator + Clone,
fn rereduce<'a, ReducedIndexes, ReducedIndexesIter>(
&self,
values: ReducedIndexes
) -> ReducedIndex where
Self: 'a,
ReducedIndex: 'a,
ReducedIndexes: IntoIterator<Item = &'a ReducedIndex, IntoIter = ReducedIndexesIter> + ExactSizeIterator,
ReducedIndexesIter: Iterator<Item = &'a ReducedIndex> + ExactSizeIterator + Clone,
Reduces one or more previously-reduced indexes into a single reduced index.