Struct timely::dataflow::operators::core::input::Handle

source ·
pub struct Handle<T: Timestamp, CB: ContainerBuilder> { /* private fields */ }
Expand description

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

Implementations§

source§

impl<T: Timestamp, C: Container> 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();
    }
});
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();
    }
});

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.

Auto Trait Implementations§

§

impl<T, CB> Freeze for Handle<T, CB>
where CB: Freeze, <CB as ContainerBuilder>::Container: Freeze, T: Freeze,

§

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

§

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

§

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

§

impl<T, CB> Unpin for Handle<T, CB>
where CB: Unpin, <CB as ContainerBuilder>::Container: Unpin, T: Unpin,

§

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

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.