pub trait Reclock<S: Scope> {
    // Required method
    fn reclock<TC: Container<Item = ()>>(
        clock: &StreamCore<S, TC>
    ) -> Self;
Expand description

Extension trait for reclocking a stream.

Required Methods§


fn reclock<TC: Container<Item = ()>>(&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.

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()
                             .delay(|x,t| *x)
                             .map(|_| ());

    // reclock the data.

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.



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