[][src]Struct timely::dataflow::operators::input::Handle

pub struct Handle<T: Timestamp, D: Data> { /* fields omitted */ }

A handle to an input Stream, used to introduce data to a timely dataflow computation.

Methods

impl<T: Timestamp, D: Data> Handle<T, D>[src]

pub fn new() -> Self[src]

Allocates a new input handle, from which one can create timely streams.

Examples

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

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

    // add an input and base computation off of it
    let mut input = Handle::new();
    worker.dataflow(|scope| {
        scope.input_from(&mut input)
             .inspect(|x| println!("hello {:?}", x));
    });

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

pub fn to_stream<G: Scope>(&mut self, scope: &mut G) -> Stream<G, D> where
    T: TotalOrder,
    G: ScopeParent<Timestamp = T>, 
[src]

Creates an input stream from the handle in the supplied scope.

Examples

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

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

    // add an input and base computation off of it
    let mut input = Handle::new();
    worker.dataflow(|scope| {
        input.to_stream(scope)
             .inspect(|x| println!("hello {:?}", x));
    });

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

pub fn send(&mut self, data: D)[src]

Sends one record into the corresponding timely dataflow Stream, at the current epoch.

pub fn send_batch(&mut self, buffer: &mut Vec<D>)[src]

Sends a batch of records into the corresponding timely dataflow Stream, at the current epoch.

This method flushes single elements previously sent with send, to keep the insertion order.

pub fn advance_to(&mut self, next: T)[src]

Advances the current epoch to next.

This method allows timely dataflow to issue progress notifications as it can now determine that this input can no longer produce data at earlier timestamps.

pub fn close(self)[src]

Closes the input.

This method allows timely dataflow to issue all progress notifications blocked by this input and to begin to shut down operators, as this input can no longer produce data.

pub fn epoch(&self) -> &T[src]

Reports the current epoch.

pub fn time(&self) -> &T[src]

Reports the current timestamp.

Trait Implementations

impl<T: Timestamp, D: Data> Drop for Handle<T, D>[src]

Auto Trait Implementations

impl<T, D> !Send for Handle<T, D>

impl<T, D> !Sync for Handle<T, D>

impl<T, D> Unpin for Handle<T, D> where
    D: Unpin,
    T: Unpin

impl<T, D> !UnwindSafe for Handle<T, D>

impl<T, D> !RefUnwindSafe for Handle<T, D>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]