Struct timely::dataflow::operators::Notificator[][src]

pub struct Notificator<'a, T: Timestamp> { /* fields omitted */ }

Tracks requests for notification and delivers available notifications.

A Notificator represents a dynamic set of notifications and a fixed notification frontier. One can interact with one by requesting notification with notify_at, and retrieving notifications with for_each and next. The next notification to be delivered will be the available notification with the least timestamp, with the implication that the notifications will be non-decreasing as long as you do not request notifications at times prior to those that have already been delivered.

Notification requests persist across uses of Notificator, and it may help to think of Notificator as a notification session. However, idiomatically it seems you mostly want to restrict your usage to such sessions, which is why this is the main notificator type.

Implementations

impl<'a, T: Timestamp> Notificator<'a, T>[src]

pub fn new(
    frontiers: &'a [&'a MutableAntichain<T>],
    inner: &'a mut FrontierNotificator<T>,
    logging: &'a Option<Logger>
) -> Self
[src]

Allocates a new Notificator.

This is more commonly accomplished using input.monotonic(frontiers).

pub fn frontier(&self, input: usize) -> AntichainRef<'_, T>[src]

Reveals the elements in the frontier of the indicated input.

pub fn notify_at(&mut self, cap: Capability<T>)[src]

Requests a notification at the time associated with capability cap.

In order to request a notification at future timestamp, obtain a capability for the new timestamp first, as show in the example.

Examples

use timely::dataflow::operators::ToStream;
use timely::dataflow::operators::generic::Operator;
use timely::dataflow::channels::pact::Pipeline;

timely::example(|scope| {
    (0..10).to_stream(scope)
           .unary_notify(Pipeline, "example", Vec::new(), |input, output, notificator| {
               input.for_each(|cap, data| {
                   output.session(&cap).give_vec(&mut data.replace(Vec::new()));
                   let time = cap.time().clone() + 1;
                   notificator.notify_at(cap.delayed(&time));
               });
               notificator.for_each(|cap,_,_| {
                   println!("done with time: {:?}", cap.time());
               });
           });
});

pub fn for_each<F: FnMut(Capability<T>, u64, &mut Notificator<'_, T>)>(
    &mut self,
    logic: F
)
[src]

Repeatedly calls logic until exhaustion of the available notifications.

logic receives a capability for t, the timestamp being notified and a count representing how many capabilities were requested for that specific timestamp.

Trait Implementations

impl<'a, T: Timestamp> Iterator for Notificator<'a, T>[src]

type Item = (Capability<T>, u64)

The type of the elements being iterated over.

fn next(&mut self) -> Option<(Capability<T>, u64)>[src]

Retrieve the next available notification.

Returns None if no notification is available. Returns Some(cap, count) otherwise: cap is a capability for t, the timestamp being notified and, count represents how many notifications (out of those requested) are being delivered for that specific timestamp.

Auto Trait Implementations

impl<'a, T> !RefUnwindSafe for Notificator<'a, T>

impl<'a, T> !Send for Notificator<'a, T>

impl<'a, T> !Sync for Notificator<'a, T>

impl<'a, T> Unpin for Notificator<'a, T>

impl<'a, T> !UnwindSafe for Notificator<'a, T>

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<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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.