Skip to main content

ProxyReduceBackend

Trait ProxyReduceBackend 

Source
pub trait ProxyReduceBackend<B1: BatchReader, B2: BatchReader<Time = B1::Time>> {
    type RIn: Semigroup;
    type ROut: Semigroup + 'static;

    // Required methods
    fn seed_times(
        &self,
        instance: &ReduceInstance<'_, B1, B2>,
    ) -> Vec<(u64, B1::Time)>;
    fn begin(&mut self, tiles: &[Description<B1::Time>]);
    fn next_window(
        &mut self,
        instance: &ReduceInstance<'_, B1, B2>,
        changed: &[u64],
        cursor: &mut usize,
    ) -> Option<ReduceWindow<B1::Time, Self::RIn, Self::ROut>>;
    fn reduce_corrections(
        &mut self,
        keys: &[u64],
        in_ends: &[usize],
        input: &[(u64, Self::RIn)],
        out_ends: &[usize],
        output: &[(u64, Self::ROut)],
    ) -> (Vec<(u64, Self::ROut)>, Vec<usize>);
    fn emit(
        &mut self,
        tile: usize,
        records: &[((u64, u64), B1::Time, Self::ROut)],
    );
    fn finish(&mut self) -> Vec<B2>;
}
Expand description

The reduce backend: value semantics for a proxy-space reduction, driven by ProxyReduceTactic.

The protocol is currently (temporarily) for each round of invocation: seed_times begin [ next_window reduce_correction* emit ]* finish This should be improved to put the seed_times in the per-window loop, or remove it entirely.

Required Associated Types§

Source

type RIn: Semigroup

Diff type presented for the input.

Source

type ROut: Semigroup + 'static

Diff type of the output.

Required Methods§

Source

fn seed_times( &self, instance: &ReduceInstance<'_, B1, B2>, ) -> Vec<(u64, B1::Time)>

Hash keys and associated times in the instance’s novel input batches.

This is used (with held times) to seed the interesting times for each key.

Source

fn begin(&mut self, tiles: &[Description<B1::Time>])

Initiate a session to create batches for these descriptions, which span [lower, upper).

It is the backend’s job to prepare output batches for each of these descriptions. The computation proceeds in windows of keys, where only the backend maintains this work in progress, until finish() is called.

Source

fn next_window( &mut self, instance: &ReduceInstance<'_, B1, B2>, changed: &[u64], cursor: &mut usize, ) -> Option<ReduceWindow<B1::Time, Self::RIn, Self::ROut>>

Produce the next window, resticted to changed[cursor..], and update cursor to track.

The size of the window is up to the backend, where the window should be large enough to amortize the crossings between the harness and the backend. The proxy bridges for the whole window will be active at the same time, so tighter windows reduce the required state.

Source

fn reduce_corrections( &mut self, keys: &[u64], in_ends: &[usize], input: &[(u64, Self::RIn)], out_ends: &[usize], output: &[(u64, Self::ROut)], ) -> (Vec<(u64, Self::ROut)>, Vec<usize>)

A wave of input-output reconciliation, in which the backend supplies necessary edits.

Multiple keys are provided concurrently, for each an accumulated input and tentative output. The backend should provide for each key the necessary output updates to bring the output in with its desires. The usize integers upper bound the range for the corresponding key.

Source

fn emit(&mut self, tile: usize, records: &[((u64, u64), B1::Time, Self::ROut)])

Commit to a collection of updates at a specific batch in progress.

The tile: usize indexes the list of descriptions provided to begin(), and these updates are aimed at that batch in progress.

Source

fn finish(&mut self) -> Vec<B2>

Complete the session matching begin. The outputs correspond to the descriptions it was provided.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§