pub struct InputSession<T: Timestamp + Clone, D: Data, R: Semigroup> { /* private fields */ }
Expand description

An input session wrapping a single timely dataflow capability.

Each timely dataflow message has a corresponding capability, which is a logical time in the timely dataflow system. Differential dataflow updates can happen at a much higher rate than timely dataflow’s progress tracking infrastructure supports, because the logical times are promoted to data and updates are batched together. The InputSession type does this batching.

§Examples

use timely::Config;
use differential_dataflow::input::Input;

::timely::execute(Config::thread(), |worker| {

    let (mut handle, probe) = worker.dataflow(|scope| {
        // create input handle and collection.
        let (handle, data) = scope.new_collection_from(0 .. 10);
        let probe = data.map(|x| x * 2)
                        .inspect(|x| println!("{:?}", x))
                        .probe();
        (handle, probe)
    });

    handle.insert(3);
    handle.advance_to(1);
    handle.insert(5);
    handle.advance_to(2);
    handle.flush();

    while probe.less_than(handle.time()) {
        worker.step();
    }

    handle.remove(5);
    handle.advance_to(3);
    handle.flush();

    while probe.less_than(handle.time()) {
        worker.step();
    }

}).unwrap();

Implementations§

source§

impl<T: Timestamp + Clone, D: Data> InputSession<T, D, isize>

source

pub fn insert(&mut self, element: D)

Adds an element to the collection.

source

pub fn remove(&mut self, element: D)

Removes an element from the collection.

source§

impl<T: Timestamp + Clone, D: Data, R: Semigroup> InputSession<T, D, R>

source

pub fn to_collection<G>(&mut self, scope: &mut G) -> Collection<G, D, R>
where G: ScopeParent<Timestamp = T> + TimelyInput,

Introduces a handle as collection.

source

pub fn new() -> Self

Allocates a new input handle.

source

pub fn from(handle: Handle<T, (D, T, R)>) -> Self

Creates a new session from a reference to an input handle.

source

pub fn update(&mut self, element: D, change: R)

Adds to the weight of an element in the collection.

source

pub fn update_at(&mut self, element: D, time: T, change: R)

Adds to the weight of an element in the collection at a future time.

source

pub fn flush(&mut self)

Forces buffered data into the timely dataflow input, and advances its time to match that of the session.

It is important to call flush before expecting timely dataflow to report progress. Until this method is called, all updates may still be in internal buffers and not exposed to timely dataflow. Once the method is called, all buffers are flushed and timely dataflow is advised that some logical times are no longer possible.

source

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

Advances the logical time for future records.

Importantly, this method does not immediately inform timely dataflow of the change. This happens only when the session is dropped or flushed. It is not correct to use this time as a basis for a computation’s step_while method unless the session has just been flushed.

source

pub fn epoch(&self) -> &T

Reveals the current time of the session.

source

pub fn time(&self) -> &T

Reveals the current time of the session.

source

pub fn close(self)

Closes the input, flushing and sealing the wrapped timely input.

Trait Implementations§

source§

impl<T: Timestamp + Clone, D: Data, R: Semigroup> Drop for InputSession<T, D, R>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<T, D, R> !RefUnwindSafe for InputSession<T, D, R>

§

impl<T, D, R> !Send for InputSession<T, D, R>

§

impl<T, D, R> !Sync for InputSession<T, D, R>

§

impl<T, D, R> Unpin for InputSession<T, D, R>
where D: Unpin, R: Unpin, T: Unpin,

§

impl<T, D, R> !UnwindSafe for InputSession<T, D, R>

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.