Trait timely::dataflow::operators::input::Input [] [src]

pub trait Input<A: Allocate, T: Timestamp + Ord> {
    fn new_input<D: Data>(&mut self) -> (Handle<T, D>, Stream<Child<Root<A>, T>, D>);
}

Create a new Stream and Handle through which to supply input.

Required Methods

fn new_input<D: Data>(&mut self) -> (Handle<T, D>, Stream<Child<Root<A>, T>, D>)

Create a new Stream and Handle through which to supply input.

The new_input method returns a pair (Handle, Stream) where the Stream can be used immediately for timely dataflow construction, and the Handle is later used to introduce data into the timely dataflow computation.

The Handle also provides a means to indicate to timely dataflow that the input has advanced beyond certain timestamps, allowing timely to issue progress notifications.

Examples

use timely::*;
use timely::dataflow::Scope;
use timely::dataflow::operators::{Input, Inspect};

// construct and execute a timely dataflow
timely::execute(Configuration::Thread, |root| {

    // add an input and base computation off of it
    let mut input = root.scoped(|scope| {
        let (input, stream) = scope.new_input();
        stream.inspect(|x| println!("hello {:?}", x));
        input
    });

    // introduce input, advance computation
    for round in 0..10 {
        input.send(round);
        input.advance_to(round + 1);
        root.step();
    }
});

Implementors