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

source ·
pub struct Handle<T: Timestamp, C: Container> { /* 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, 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

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

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 C)

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, C: PushContainer> Handle<T, C>

source

pub fn send<D: PushInto<C>>(&mut self, data: 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, C: Debug + Container> Debug for Handle<T, C>

source§

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

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

impl<T: Timestamp, C: Container> Default for Handle<T, C>

source§

fn default() -> Self

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

impl<T: Timestamp, C: Container> Drop for Handle<T, C>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<T, C> Freeze for Handle<T, C>
where C: Freeze, T: Freeze,

§

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

§

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

§

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

§

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

§

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

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<R, O, T> CopyOnto<ConsecutiveOffsetPairs<R, O>> for T
where R: Region<Index = (usize, usize)>, O: OffsetContainer<usize>, T: CopyOnto<R>,

source§

fn copy_onto( self, target: &mut ConsecutiveOffsetPairs<R, O> ) -> <ConsecutiveOffsetPairs<R, O> as Region>::Index

Copy self into the target container, returning an index that allows to look up the corresponding read item.
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<R, T> PushInto<FlatStack<R>> for T
where R: Region + Clone + 'static, T: CopyOnto<R>,

source§

fn push_into(self, target: &mut FlatStack<R>)

Push self into the target container.
source§

impl<T> PushInto<Vec<T>> for T

source§

fn push_into(self, target: &mut Vec<T>)

Push self into the target container.
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.