Skip to main content

Merger

pub trait Merger<Output: SpineBatch> {
    // Required methods
    fn new(
        source1: &Output,
        source2: &Output,
        compaction_frontier: AntichainRef<'_, Output::Time>,
    ) -> Self;
    fn work(&mut self, source1: &Output, source2: &Output, fuel: &mut isize);
    fn done(self) -> Option<Output>;
}
Expand description

Represents a merge in progress.

Constructing a merger begins the merge of two consecutive batches. Exercising it eventually produces the same result that merging them outright would, but does so in a measured fashion, which avoids latency spikes when a large merge needs to happen.

Required Methods§

Source

fn new( source1: &Output, source2: &Output, compaction_frontier: AntichainRef<'_, Output::Time>, ) -> Self

Creates a new merger to merge the supplied batches, optionally compacting up to the supplied frontier.

Source

fn work(&mut self, source1: &Output, source2: &Output, fuel: &mut isize)

Perform some amount of work, decrementing fuel.

If fuel is non-zero after the call, the merging is complete and one should call done to extract the merged results.

Source

fn done(self) -> Option<Output>

Extracts merged results, absent if the merge cancelled to nothing.

This method should only be called after work has been called and has not brought fuel to zero. Otherwise, the merge is still in progress.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<B: SpineBatch> Merger<Rc<B>> for RcMerger<B>

Source§

impl<C> Merger<ChunkBatch<C>> for ChunkBatchMerger<C>
where C: Chunk + 'static, C::Time: Timestamp + Lattice + Ord + 'static,

Source§

impl<L: Layout<ValContainer: BatchContainer<Owned: Default>>> Merger<OrdKeyBatch<L>> for OrdKeyMerger<L>

Source§

impl<L: Layout> Merger<OrdValBatch<L>> for OrdValMerger<L>