Struct SemigroupVariable

Source
pub struct SemigroupVariable<G, C>
where G: Scope<Timestamp: Lattice>, C: Container,
{ /* private fields */ }
Expand description

A recursively defined collection that only “grows”.

SemigroupVariable is a weakening of Variable to allow difference types that do not implement Abelian and only implement Semigroup. This means that it can be used in settings where the difference type does not support negation.

Implementations§

Source§

impl<G, C> SemigroupVariable<G, C>
where G: Scope<Timestamp: Lattice>, C: ResultsIn<<G::Timestamp as Timestamp>::Summary> + Container,

Source

pub fn new(scope: &mut G, step: <G::Timestamp as Timestamp>::Summary) -> Self

Creates a new initially empty SemigroupVariable.

Source

pub fn set(self, result: &Collection<G, C>) -> Collection<G, C>

Adds a new source of data to self.

Methods from Deref<Target = Collection<G, C>>§

Source

pub fn concat(&self, other: &Self) -> Self

Creates a new collection accumulating the contents of the two collections.

Despite the name, differential dataflow collections are unordered. This method is so named because the implementation is the concatenation of the stream of updates, but it corresponds to the addition of the two collections.

§Examples
use differential_dataflow::input::Input;

::timely::example(|scope| {

    let data = scope.new_collection_from(1 .. 10).1;

    let odds = data.filter(|x| x % 2 == 1);
    let evens = data.filter(|x| x % 2 == 0);

    odds.concat(&evens)
        .assert_eq(&data);
});
Source

pub fn concatenate<I>(&self, sources: I) -> Self
where I: IntoIterator<Item = Self>,

Creates a new collection accumulating the contents of the two collections.

Despite the name, differential dataflow collections are unordered. This method is so named because the implementation is the concatenation of the stream of updates, but it corresponds to the addition of the two collections.

§Examples
use differential_dataflow::input::Input;

::timely::example(|scope| {

    let data = scope.new_collection_from(1 .. 10).1;

    let odds = data.filter(|x| x % 2 == 1);
    let evens = data.filter(|x| x % 2 == 0);

    odds.concatenate(Some(evens))
        .assert_eq(&data);
});
Source

pub fn enter_region<'a>( &self, child: &Child<'a, G, <G as ScopeParent>::Timestamp>, ) -> Collection<Child<'a, G, <G as ScopeParent>::Timestamp>, C>

This method is a specialization of enter to the case where the nested scope is a region. It removes the need for an operator that adjusts the timestamp.

Source

pub fn inspect_container<F>(&self, func: F) -> Self
where F: FnMut(Result<(&G::Timestamp, &C), &[G::Timestamp]>) + 'static,

Applies a supplied function to each batch of updates.

This method is analogous to inspect, but operates on batches and reveals the timestamp of the timely dataflow capability associated with the batch of updates. The observed batching depends on how the system executes, and may vary run to run.

§Examples
use differential_dataflow::input::Input;

::timely::example(|scope| {
    scope.new_collection_from(1 .. 10).1
         .map_in_place(|x| *x *= 2)
         .filter(|x| x % 2 == 1)
         .inspect_container(|event| println!("event: {:?}", event));
});
Source

pub fn probe(&self) -> Handle<G::Timestamp>

Attaches a timely dataflow probe to the output of a Collection.

This probe is used to determine when the state of the Collection has stabilized and can be read out.

Source

pub fn probe_with(&self, handle: &Handle<G::Timestamp>) -> Self

Attaches a timely dataflow probe to the output of a Collection.

This probe is used to determine when the state of the Collection has stabilized and all updates observed. In addition, a probe is also often use to limit the number of rounds of input in flight at any moment; a computation can wait until the probe has caught up to the input before introducing more rounds of data, to avoid swamping the system.

Source

pub fn scope(&self) -> G

The scope containing the underlying timely dataflow stream.

Source

pub fn negate(&self) -> Self
where C: Negate,

Creates a new collection whose counts are the negation of those in the input.

This method is most commonly used with concat to get those element in one collection but not another. However, differential dataflow computations are still defined for all values of the difference type R, including negative counts.

§Examples
use differential_dataflow::input::Input;

::timely::example(|scope| {

    let data = scope.new_collection_from(1 .. 10).1;

    let odds = data.filter(|x| x % 2 == 1);
    let evens = data.filter(|x| x % 2 == 0);

    odds.negate()
        .concat(&data)
        .assert_eq(&evens);
});
Source

pub fn enter<'a, T>( &self, child: &Child<'a, G, T>, ) -> Collection<Child<'a, G, T>, <C as Enter<<G as ScopeParent>::Timestamp, T>>::InnerContainer>
where C: Enter<<G as ScopeParent>::Timestamp, T, InnerContainer: Container>, T: Refines<<G as ScopeParent>::Timestamp>,

Brings a Collection into a nested scope.

§Examples
use timely::dataflow::Scope;
use differential_dataflow::input::Input;

::timely::example(|scope| {

    let data = scope.new_collection_from(1 .. 10).1;

    let result = scope.region(|child| {
        data.enter(child)
            .leave()
    });

    data.assert_eq(&result);
});
Source

pub fn results_in(&self, step: <G::Timestamp as Timestamp>::Summary) -> Self
where C: ResultsIn<<G::Timestamp as Timestamp>::Summary>,

Advances a timestamp in the stream according to the timestamp actions on the path.

The path may advance the timestamp sufficiently that it is no longer valid, for example if incrementing fields would result in integer overflow. In this case, the record is dropped.

§Examples
use timely::dataflow::Scope;
use timely::dataflow::operators::{ToStream, Concat, Inspect, BranchWhen};

use differential_dataflow::input::Input;

timely::example(|scope| {
    let summary1 = 5;

    let data = scope.new_collection_from(1 .. 10).1;
    /// Applies `results_in` on every timestamp in the collection.
    data.results_in(summary1);
});

Trait Implementations§

Source§

impl<G: Scope, C: Container> Deref for SemigroupVariable<G, C>
where G::Timestamp: Lattice,

Source§

type Target = Collection<G, C>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<G, C> Freeze for SemigroupVariable<G, C>
where <<G as ScopeParent>::Timestamp as Timestamp>::Summary: Freeze, G: Freeze, C: Freeze,

§

impl<G, C> !RefUnwindSafe for SemigroupVariable<G, C>

§

impl<G, C> !Send for SemigroupVariable<G, C>

§

impl<G, C> !Sync for SemigroupVariable<G, C>

§

impl<G, C> Unpin for SemigroupVariable<G, C>

§

impl<G, C> !UnwindSafe for SemigroupVariable<G, 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<'a, S, T> Semigroup<&'a S> for T
where T: Semigroup<S>,

Source§

fn plus_equals(&mut self, rhs: &&'a S)

The method of std::ops::AddAssign, for types that do not implement AddAssign.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.