timely::dataflow::operators::input

Type Alias Handle

Source
pub type Handle<T, D> = Handle<T, CapacityContainerBuilder<Vec<D>>>;
Expand description

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

Aliased Type§

struct Handle<T, D> { /* private fields */ }

Implementations

Source§

impl<T: Timestamp, CB: ContainerBuilder> Handle<T, CB>

Source

pub fn new_with_builder() -> Self

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

§Examples
use timely::*;
use timely::dataflow::operators::core::{Input, Inspect};
use timely::dataflow::operators::core::input::Handle;
use timely_container::CapacityContainerBuilder;

// construct and execute a timely dataflow
timely::execute(Config::thread(), |worker| {

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

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

pub fn to_stream<G>(&mut self, scope: &mut G) -> StreamCore<G, CB::Container>
where T: TotalOrder, G: Scope<Timestamp = T>,

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

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

// construct and execute a timely dataflow
timely::execute(Config::thread(), |worker| {

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

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

pub fn send_batch(&mut self, buffer: &mut CB::Container)

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

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

§Examples
use timely::*;
use timely::dataflow::operators::core::{Input, InspectCore};
use timely::dataflow::operators::core::input::Handle;

// construct and execute a timely dataflow
timely::execute(Config::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_container(|x| println!("hello {:?}", x));
    });

    // introduce input, advance computation
    for round in 0..10 {
        input.send_batch(&mut vec![format!("{}", round)]);
        input.advance_to(round + 1);
        worker.step();
    }
});
Source

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

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.

Source

pub fn close(self)

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.

Source

pub fn epoch(&self) -> &T

Reports the current epoch.

Source

pub fn time(&self) -> &T

Reports the current timestamp.

Source§

impl<T: Timestamp, CB: ContainerBuilder> Handle<T, CB>

Source

pub fn send<D>(&mut self, data: D)
where CB: PushInto<D>,

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

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

// construct and execute a timely dataflow
timely::execute(Config::thread(), |worker| {

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

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

impl<T: Timestamp, C: Container + Data> Handle<T, CapacityContainerBuilder<C>>

Source

pub fn new() -> Self

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

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

// construct and execute a timely dataflow
timely::execute(Config::thread(), |worker| {

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

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

Trait Implementations

Source§

impl<T: Debug + Timestamp, CB: Debug + ContainerBuilder> Debug for Handle<T, CB>
where CB::Container: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Timestamp, CB: ContainerBuilder> Default for Handle<T, CB>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Timestamp, CB: ContainerBuilder> Drop for Handle<T, CB>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T, CB, D> PushInto<D> for Handle<T, CB>
where T: Timestamp, CB: ContainerBuilder + PushInto<D>,

Source§

fn push_into(&mut self, item: D)

Push item into self.