Trait timely::dataflow::operators::core::reclock::Reclock

source ·
pub trait Reclock<S: Scope> {
    // Required method
    fn reclock<TC: Container + Data>(&self, clock: &StreamCore<S, TC>) -> Self;
}
Expand description

Extension trait for reclocking a stream.

Required Methods§

source

fn reclock<TC: Container + Data>(&self, clock: &StreamCore<S, TC>) -> Self

Delays records until an input is observed on the clock input.

The source stream is buffered until a record is seen on the clock input, at which point a notification is requested and all data with time less or equal to the clock time are sent. This method does not ensure that all workers receive the same clock records, which can be accomplished with broadcast.

§Examples
use timely::dataflow::operators::{ToStream, Delay, Map, Reclock, Capture};
use timely::dataflow::operators::capture::Extract;

let captured = timely::example(|scope| {

    // produce data 0..10 at times 0..10.
    let data = (0..10).to_stream(scope)
                      .delay(|x,t| *x);

    // product clock ticks at three times.
    let clock = vec![3, 5, 8].into_iter()
                             .to_stream(scope)
                             .delay(|x,t| *x)
                             .map(|_| ());

    // reclock the data.
    data.reclock(&clock)
        .capture()
});

let extracted = captured.extract();
assert_eq!(extracted.len(), 3);
assert_eq!(extracted[0], (3, vec![0,1,2,3]));
assert_eq!(extracted[1], (5, vec![4,5]));
assert_eq!(extracted[2], (8, vec![6,7,8]));

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<S: Scope, C: Container + Data> Reclock<S> for StreamCore<S, C>