Struct differential_dataflow::input::InputSession[][src]

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

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

extern crate timely;
extern crate differential_dataflow;

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

fn main() {
    ::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

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

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

Adds an element to the collection.

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

Removes an element from the collection.

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

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

Introduces a handle as collection.

pub fn new() -> Self[src]

Allocates a new input handle.

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

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

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

Adds to the weight of an element in the collection.

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

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

pub fn flush(&mut self)[src]

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.

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

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.

pub fn epoch(&self) -> &T[src]

Reveals the current time of the session.

pub fn time(&self) -> &T[src]

Reveals the current time of the session.

pub fn close(self)[src]

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

Trait Implementations

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.