Trait differential_dataflow::operators::iterate::Iterate

source ·
pub trait Iterate<G: Scope, D: Data, R: Semigroup> {
    // Required method
    fn iterate<F>(&self, logic: F) -> Collection<G, D, R>
       where G::Timestamp: Lattice,
             for<'a> F: FnOnce(&Collection<Iterative<'a, G, u64>, D, R>) -> Collection<Iterative<'a, G, u64>, D, R>;
}
Expand description

An extension trait for the iterate method.

Required Methods§

source

fn iterate<F>(&self, logic: F) -> Collection<G, D, R>
where G::Timestamp: Lattice, for<'a> F: FnOnce(&Collection<Iterative<'a, G, u64>, D, R>) -> Collection<Iterative<'a, G, u64>, D, R>,

Iteratively apply logic to the source collection until convergence.

Importantly, this method does not automatically consolidate results. It may be important to conclude with consolidate() to ensure that logically empty collections that contain cancelling records do not result in non-termination. Operators like reduce, distinct, and count also perform consolidation, and are safe to conclude with.

§Examples
use differential_dataflow::input::Input;
use differential_dataflow::operators::Iterate;

::timely::example(|scope| {

    scope.new_collection_from(1 .. 10u32).1
         .iterate(|values| {
             values.map(|x| if x % 2 == 0 { x/2 } else { x })
                   .consolidate()
         });
});

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<G: Scope, D: Ord + Data + Debug, R: Abelian> Iterate<G, D, R> for Collection<G, D, R>

source§

impl<G: Scope, D: Ord + Data + Debug, R: Semigroup> Iterate<G, D, R> for G