pub struct HandleCore<T: Timestamp, C: Container> { /* private fields */ }
Expand description

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

Implementations§

source§

impl<T: Timestamp, D: Container> HandleCore<T, D>

source

pub fn new() -> Self

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(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(|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, D>
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::{Input, Inspect};
use timely::dataflow::operators::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)
             .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 D)

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::{Input, InspectCore};
use timely::dataflow::operators::input::HandleCore;

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

    // add an input and base computation off of it
    let mut input = HandleCore::new();
    worker.dataflow(|scope| {
        scope.input_from_core(&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, D: Data> HandleCore<T, Vec<D>>

source

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

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

§Examples
use timely::*;
use timely::dataflow::operators::{Input, Inspect};
use timely::dataflow::operators::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(|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 HandleCore<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> Drop for HandleCore<T, C>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<T, C> !UnwindSafe for HandleCore<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<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> 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.