Struct differential_dataflow::operators::arrange::arrangement::Arranged[][src]

pub struct Arranged<G: Scope, Tr> where
    G::Timestamp: Lattice + Ord,
    Tr: TraceReader + Clone
{ pub stream: Stream<G, Tr::Batch>, pub trace: Tr, }

An arranged collection of (K,V) values.

An Arranged allows multiple differential operators to share the resources (communication, computation, memory) required to produce and maintain an indexed representation of a collection.

Fields

stream: Stream<G, Tr::Batch>

A stream containing arranged updates.

This stream contains the same batches of updates the trace itself accepts, so there should be no additional overhead to receiving these records. The batches can be navigated just as the batches in the trace, by key and by value.

trace: Tr

A shared trace, updated by the Arrange operator and readable by others.

Implementations

impl<G: Scope, Tr> Arranged<G, Tr> where
    G::Timestamp: Lattice + Ord,
    Tr: TraceReader<Time = G::Timestamp> + Clone,
    Tr::Batch: BatchReader<Tr::Key, Tr::Val, G::Timestamp, Tr::R>,
    Tr::Cursor: Cursor<Tr::Key, Tr::Val, G::Timestamp, Tr::R>, 
[src]

pub fn enter<'a, TInner>(
    &self,
    child: &Child<'a, G, TInner>
) -> Arranged<Child<'a, G, TInner>, TraceEnter<Tr, TInner>> where
    Tr::Key: 'static,
    Tr::Val: 'static,
    Tr::R: 'static,
    G::Timestamp: Clone + 'static,
    TInner: Refines<G::Timestamp> + Lattice + Timestamp + Clone + 'static, 
[src]

Brings an arranged collection into a nested scope.

This method produces a proxy trace handle that uses the same backing data, but acts as if the timestamps have all been extended with an additional coordinate with the default value. The resulting collection does not vary with the new timestamp coordinate.

pub fn enter_region<'a>(
    &self,
    child: &Child<'a, G, G::Timestamp>
) -> Arranged<Child<'a, G, G::Timestamp>, Tr> where
    Tr::Key: 'static,
    Tr::Val: 'static,
    Tr::R: 'static,
    G::Timestamp: Clone + 'static, 
[src]

Brings an arranged collection into a nested region.

This method only applies to regions, which are subscopes with the same timestamp as their containing scope. In this case, the trace type does not need to change.

pub fn enter_at<'a, TInner, F, P>(
    &self,
    child: &Child<'a, G, TInner>,
    logic: F,
    prior: P
) -> Arranged<Child<'a, G, TInner>, TraceEnterAt<Tr, TInner, F, P>> where
    Tr::Key: 'static,
    Tr::Val: 'static,
    Tr::R: 'static,
    G::Timestamp: Clone + 'static,
    TInner: Refines<G::Timestamp> + Lattice + Timestamp + Clone + 'static,
    F: FnMut(&Tr::Key, &Tr::Val, &G::Timestamp) -> TInner + Clone + 'static,
    P: FnMut(&TInner) -> Tr::Time + Clone + 'static, 
[src]

Brings an arranged collection into a nested scope.

This method produces a proxy trace handle that uses the same backing data, but acts as if the timestamps have all been extended with an additional coordinate with the default value. The resulting collection does not vary with the new timestamp coordinate.

pub fn filter<F>(&self, logic: F) -> Arranged<G, TraceFilter<Tr, F>> where
    Tr::Key: 'static,
    Tr::Val: 'static,
    Tr::R: 'static,
    G::Timestamp: Clone + 'static,
    F: FnMut(&Tr::Key, &Tr::Val) -> bool + Clone + 'static, 
[src]

Filters an arranged collection.

This method produces a new arrangement backed by the same shared arrangement as self, paired with user-specified logic that can filter by key and value. The resulting collection is restricted to the keys and values that return true under the user predicate.

Examples

extern crate timely;
extern crate differential_dataflow;

use differential_dataflow::input::Input;
use differential_dataflow::operators::arrange::ArrangeByKey;

fn main() {
    ::timely::example(|scope| {

        let arranged =
        scope.new_collection_from(0 .. 10).1
             .map(|x| (x, x+1))
             .arrange_by_key();

        arranged
            .filter(|k,v| k == v)
            .as_collection(|k,v| (*k,*v))
            .assert_empty();
    });
}

pub fn as_collection<D: Data, L>(&self, logic: L) -> Collection<G, D, Tr::R> where
    Tr::R: Semigroup,
    L: FnMut(&Tr::Key, &Tr::Val) -> D + 'static, 
[src]

Flattens the stream into a Collection.

The underlying Stream<G, BatchWrapper<T::Batch>> is a much more efficient way to access the data, and this method should only be used when the data need to be transformed or exchanged, rather than supplied as arguments to an operator using the same key-value structure.

pub fn flat_map_ref<I, L>(&self, logic: L) -> Collection<G, I::Item, Tr::R> where
    Tr::R: Semigroup,
    I: IntoIterator,
    I::Item: Data,
    L: FnMut(&Tr::Key, &Tr::Val) -> I + 'static, 
[src]

Extracts elements from an arrangement as a collection.

The supplied logic may produce an iterator over output values, allowing either filtering or flat mapping as part of the extraction.

pub fn flat_map_batches<I, L>(
    stream: &Stream<G, Tr::Batch>,
    logic: L
) -> Collection<G, I::Item, Tr::R> where
    Tr::R: Semigroup,
    I: IntoIterator,
    I::Item: Data,
    L: FnMut(&Tr::Key, &Tr::Val) -> I + 'static, 
[src]

Extracts elements from a stream of batches as a collection.

The supplied logic may produce an iterator over output values, allowing either filtering or flat mapping as part of the extraction.

This method exists for streams of batches without the corresponding arrangement. If you have the arrangement, its flat_map_ref method is equivalent to this.

pub fn lookup(
    &self,
    queries: &Stream<G, (Tr::Key, G::Timestamp)>
) -> Stream<G, (Tr::Key, Tr::Val, G::Timestamp, Tr::R)> where
    G::Timestamp: Data + Lattice + Ord + TotalOrder,
    Tr::Key: ExchangeData + Hashable,
    Tr::Val: ExchangeData,
    Tr::R: ExchangeData + Semigroup,
    Tr: 'static, 
[src]

Report values associated with keys at certain times.

This method consumes a stream of (key, time) queries and reports the corresponding stream of (key, value, time, diff) accumulations in the self trace.

impl<'a, G: Scope, Tr> Arranged<Child<'a, G, G::Timestamp>, Tr> where
    G::Timestamp: Lattice + Ord,
    Tr: TraceReader<Time = G::Timestamp> + Clone,
    Tr::Batch: BatchReader<Tr::Key, Tr::Val, G::Timestamp, Tr::R>,
    Tr::Cursor: Cursor<Tr::Key, Tr::Val, G::Timestamp, Tr::R>, 
[src]

pub fn leave_region(&self) -> Arranged<G, Tr>[src]

Brings an arranged collection out of a nested region.

This method only applies to regions, which are subscopes with the same timestamp as their containing scope. In this case, the trace type does not need to change.

Trait Implementations

impl<G: Scope, Tr> Clone for Arranged<G, Tr> where
    G::Timestamp: Lattice + Ord,
    Tr: TraceReader<Time = G::Timestamp> + Clone,
    Tr::Batch: BatchReader<Tr::Key, Tr::Val, G::Timestamp, Tr::R>,
    Tr::Cursor: Cursor<Tr::Key, Tr::Val, G::Timestamp, Tr::R>, 
[src]

impl<G: Scope, K: Data, T1, R: Semigroup> Count<G, K, R> for Arranged<G, T1> where
    G::Timestamp: Lattice + Ord,
    T1: TraceReader<Key = K, Val = (), Time = G::Timestamp, R = R> + Clone + 'static,
    T1::Batch: BatchReader<K, (), G::Timestamp, R>,
    T1::Cursor: Cursor<K, (), G::Timestamp, R>, 
[src]

impl<G: Scope, T1> CountTotal<G, <T1 as TraceReader>::Key, <T1 as TraceReader>::R> for Arranged<G, T1> where
    G::Timestamp: TotalOrder + Lattice + Ord,
    T1: TraceReader<Val = (), Time = G::Timestamp> + Clone + 'static,
    T1::Key: ExchangeData,
    T1::R: ExchangeData + Semigroup,
    T1::Batch: BatchReader<T1::Key, (), G::Timestamp, T1::R>,
    T1::Cursor: Cursor<T1::Key, (), G::Timestamp, T1::R>, 
[src]

impl<G, Tr> Join<G, <Tr as TraceReader>::Key, <Tr as TraceReader>::Val, <Tr as TraceReader>::R> for Arranged<G, Tr> where
    G: Scope,
    G::Timestamp: Lattice + Ord,
    Tr: TraceReader<Time = G::Timestamp> + Clone + 'static,
    Tr::Key: Data + Hashable,
    Tr::Val: Data,
    Tr::R: Semigroup,
    Tr::Batch: BatchReader<Tr::Key, Tr::Val, G::Timestamp, Tr::R> + 'static,
    Tr::Cursor: Cursor<Tr::Key, Tr::Val, G::Timestamp, Tr::R> + 'static, 
[src]

impl<G, T1> JoinCore<G, <T1 as TraceReader>::Key, <T1 as TraceReader>::Val, <T1 as TraceReader>::R> for Arranged<G, T1> where
    G: Scope,
    G::Timestamp: Lattice + Ord + Debug,
    T1: TraceReader<Time = G::Timestamp> + Clone + 'static,
    T1::Key: Ord + Debug + 'static,
    T1::Val: Ord + Clone + Debug + 'static,
    T1::R: Semigroup,
    T1::Batch: BatchReader<T1::Key, T1::Val, G::Timestamp, T1::R> + 'static,
    T1::Cursor: Cursor<T1::Key, T1::Val, G::Timestamp, T1::R> + 'static, 
[src]

impl<G: Scope, K: Data, V: Data, T1, R: Semigroup> Reduce<G, K, V, R> for Arranged<G, T1> where
    G::Timestamp: Lattice + Ord,
    T1: TraceReader<Key = K, Val = V, Time = G::Timestamp, R = R> + Clone + 'static,
    T1::Batch: BatchReader<K, V, G::Timestamp, R>,
    T1::Cursor: Cursor<K, V, G::Timestamp, R>, 
[src]

impl<G: Scope, K: Data, V: Data, T1, R: Semigroup> ReduceCore<G, K, V, R> for Arranged<G, T1> where
    G::Timestamp: Lattice + Ord,
    T1: TraceReader<Key = K, Val = V, Time = G::Timestamp, R = R> + Clone + 'static,
    T1::Batch: BatchReader<K, V, G::Timestamp, R>,
    T1::Cursor: Cursor<K, V, G::Timestamp, R>, 
[src]

impl<G: Scope, K: Data, T1, R1: Semigroup> Threshold<G, K, R1> for Arranged<G, T1> where
    G::Timestamp: Lattice + Ord,
    T1: TraceReader<Key = K, Val = (), Time = G::Timestamp, R = R1> + Clone + 'static,
    T1::Batch: BatchReader<K, (), G::Timestamp, R1>,
    T1::Cursor: Cursor<K, (), G::Timestamp, R1>, 
[src]

impl<G: Scope, T1> ThresholdTotal<G, <T1 as TraceReader>::Key, <T1 as TraceReader>::R> for Arranged<G, T1> where
    G::Timestamp: TotalOrder + Lattice + Ord,
    T1: TraceReader<Val = (), Time = G::Timestamp> + Clone + 'static,
    T1::Key: ExchangeData,
    T1::R: ExchangeData + Semigroup,
    T1::Batch: BatchReader<T1::Key, (), G::Timestamp, T1::R>,
    T1::Cursor: Cursor<T1::Key, (), G::Timestamp, T1::R>, 
[src]

Auto Trait Implementations

impl<G, Tr> !RefUnwindSafe for Arranged<G, Tr>

impl<G, Tr> !Send for Arranged<G, Tr>

impl<G, Tr> !Sync for Arranged<G, Tr>

impl<G, Tr> Unpin for Arranged<G, Tr> where
    G: Unpin,
    Tr: Unpin

impl<G, Tr> !UnwindSafe for Arranged<G, Tr>

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> Data for T where
    T: 'static + Clone
[src]

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.