mz_storage::source::types

Type Alias StackedCollection

Source
pub type StackedCollection<G, T> = Collection<G, T, Diff, TimelyStack<(T, <G as ScopeParent>::Timestamp, Diff)>>;

Aliased Type§

struct StackedCollection<G, T> {
    pub inner: StreamCore<G, TimelyStack<(T, <G as ScopeParent>::Timestamp, i64)>>,
    /* private fields */
}

Fields§

§inner: StreamCore<G, TimelyStack<(T, <G as ScopeParent>::Timestamp, i64)>>

The underlying timely dataflow stream.

This field is exposed to support direct timely dataflow manipulation when required, but it is not intended to be the idiomatic way to work with the collection.

Implementations

Source§

impl<G, D, R, C> Collection<Child<'_, G, <G as ScopeParent>::Timestamp>, D, R, C>
where G: Scope, C: Container + Data,

Methods requiring a region as the scope.

Source

pub fn leave_region(&self) -> Collection<G, D, R, C>

Returns the value of a Collection from a nested region to its containing scope.

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

Source§

impl<G, D, R, C> Collection<G, D, R, C>
where G: Scope,

Source

pub fn new(stream: StreamCore<G, C>) -> Collection<G, D, R, C>

Creates a new Collection from a timely dataflow stream.

This method seems to be rarely used, with the as_collection method on streams being a more idiomatic approach to convert timely streams to collections. Also, the input::Input trait provides a new_collection method which will create a new collection for you without exposing the underlying timely stream at all.

Source§

impl<G, D, R, C> Collection<G, D, R, C>
where G: Scope, C: Container + Clone + 'static,

Source

pub fn concat(&self, other: &Collection<G, D, R, C>) -> Collection<G, D, R, C>

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) -> Collection<G, D, R, C>
where I: IntoIterator<Item = Collection<G, D, R, C>>,

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>, D, R, 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) -> Collection<G, D, R, C>
where F: FnMut(Result<(&<G as ScopeParent>::Timestamp, &C), &[<G as ScopeParent>::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 as ScopeParent>::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 as ScopeParent>::Timestamp>, ) -> Collection<G, D, R, C>

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) -> Collection<G, D, R, C>
where StreamCore<G, C>: Negate<G, C>,

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);
});

Trait Implementations

Source§

impl<G, D, R, C> Clone for Collection<G, D, R, C>
where G: Clone + Scope, D: Clone, R: Clone, C: Clone,

Source§

fn clone(&self) -> Collection<G, D, R, C>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<G, D, R, C> Negate<G, C> for Collection<G, D, R, C>
where G: Scope, C: Clone, StreamCore<G, C>: Negate<G, C>,

Source§

fn negate(&self) -> Collection<G, D, R, C>

Creates a new collection whose counts are the negation of those in the input. Read more
Source§

impl<G, D, R, C> ResultsIn<G, C> for Collection<G, D, R, C>
where G: Scope, C: Clone, StreamCore<G, C>: ResultsIn<G, C>,

Source§

fn results_in( &self, step: <<G as ScopeParent>::Timestamp as Timestamp>::Summary, ) -> Collection<G, D, R, C>

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