pub struct MergeLadder<M: Merger> { /* private fields */ }Expand description
A geometric ladder of sorted, consolidated chains, merged as they arrive.
Chains are kept in order of decreasing update count, each at least twice the next, so that there are logarithmically many and each update is merged logarithmically often.
Implementations§
Source§impl<M: Merger> MergeLadder<M>
impl<M: Merger> MergeLadder<M>
Sourcepub fn new(logger: Option<Logger>, operator_id: usize) -> Self
pub fn new(logger: Option<Logger>, operator_id: usize) -> Self
Allocates a new empty ladder.
The logger and operator identifier are used to report the ladder’s memory footprint, attributed to the operator that owns it.
Sourcepub fn insert_chain(&mut self, chain: Vec<M::Chunk>)
pub fn insert_chain(&mut self, chain: Vec<M::Chunk>)
Insert a chain and maintain chain properties: Chains are geometrically sized (by summed updates) and ordered by decreasing update weight.
Sourcepub fn merge_all(&mut self) -> Vec<M::Chunk>
pub fn merge_all(&mut self) -> Vec<M::Chunk>
Merge all chains into a single chain, and remove it from the ladder.
Sourcepub fn retain_chains(&mut self, logic: impl FnMut(&mut Vec<M::Chunk>))
pub fn retain_chains(&mut self, logic: impl FnMut(&mut Vec<M::Chunk>))
Lets logic remove updates from each chain, largest first, for batchers that release
updates from the fronts of chains rather than by merging them all.
A chain keeps the weight it was pushed with, so the ladder merges as though no updates had left it, and stays logarithmic in the updates inserted. Chains left empty are removed.
Trait Implementations§
Source§impl<M: Merger> Drop for MergeLadder<M>
impl<M: Merger> Drop for MergeLadder<M>
Auto Trait Implementations§
impl<M> !RefUnwindSafe for MergeLadder<M>
impl<M> !Send for MergeLadder<M>
impl<M> !Sync for MergeLadder<M>
impl<M> !UnwindSafe for MergeLadder<M>
impl<M> Freeze for MergeLadder<M>
impl<M> Unpin for MergeLadder<M>
impl<M> UnsafeUnpin for MergeLadder<M>where
Vec<(usize, Vec<<M as Merger>::Chunk>)>: UnsafeUnpin,
Vec<<M as Merger>::Chunk>: UnsafeUnpin,
M: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
Source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign, for types that do not implement AddAssign.