[][src]Trait differential_dataflow::trace::TraceReader

pub trait TraceReader<Key, Val, Time, R> {
    type Batch: BatchReader<Key, Val, Time, R> + Clone + 'static;
    type Cursor: Cursor<Key, Val, Time, R>;
    fn cursor_through(
        &mut self,
        upper: &[Time]
    ) -> Option<(Self::Cursor, <Self::Cursor as Cursor<Key, Val, Time, R>>::Storage)>;
fn advance_by(&mut self, frontier: &[Time]);
fn advance_frontier(&mut self) -> &[Time];
fn distinguish_since(&mut self, frontier: &[Time]);
fn distinguish_frontier(&mut self) -> &[Time];
fn map_batches<F: FnMut(&Self::Batch)>(&mut self, f: F); fn cursor(
        &mut self
    ) -> (Self::Cursor, <Self::Cursor as Cursor<Key, Val, Time, R>>::Storage) { ... } }

A trace whose contents may be read.

This is a restricted interface to the more general Trace trait, which extends this trait with further methods to update the contents of the trace. These methods are used to examine the contents, and to update the reader's capabilities (which may release restrictions on the mutations to the underlying trace and cause work to happen).

Associated Types

type Batch: BatchReader<Key, Val, Time, R> + Clone + 'static

The type of an immutable collection of updates.

type Cursor: Cursor<Key, Val, Time, R>

The type used to enumerate the collections contents.

Loading content...

Required methods

fn cursor_through(
    &mut self,
    upper: &[Time]
) -> Option<(Self::Cursor, <Self::Cursor as Cursor<Key, Val, Time, R>>::Storage)>

Acquires a cursor to the restriction of the collection's contents to updates at times not greater or equal to an element of upper.

This method is expected to work if called with an upper that (i) was an observed bound in batches from the trace, and (ii) the trace has not been advanced beyond upper. Practically, the implementation should be expected to look for a "clean cut" using upper, and if it finds such a cut can return a cursor. This should allow upper such as &[] as used by self.cursor(), though it is difficult to imagine other uses.

fn advance_by(&mut self, frontier: &[Time])

Advances the frontier of times the collection must be correctly accumulable through.

Practically, this allows the trace to advance times in updates it maintains as long as the advanced times still compare equivalently to any times greater or equal to some element of frontier. Times not greater or equal to some element of frontier may no longer correctly accumulate, so do not advance a trace unless you are quite sure you no longer require the distinction.

fn advance_frontier(&mut self) -> &[Time]

Reports the frontier from which all time comparisions should be accurate.

Times that are not greater or equal to some element of the advance frontier may accumulate inaccurately as the trace may have lost the ability to distinguish between such times. Accumulations are only guaranteed to be accurate from the frontier onwards.

fn distinguish_since(&mut self, frontier: &[Time])

Advances the frontier that may be used in cursor_through.

Practically, this allows the trace to merge batches whose upper frontier comes before frontier. The trace is likely to be annoyed or confused if you use a frontier other than one observed as an upper bound of an actual batch. This doesn't seem likely to be a problem, but get in touch if it is.

Calling distinguish_since(&[]) indicates that all batches may be merged at any point, which essentially disables the use of cursor_through with any parameter other than &[], which is the behavior of cursor.

fn distinguish_frontier(&mut self) -> &[Time]

Reports the frontier from which the collection may be subsetted.

The semantics are less elegant here, but the underlying trace will not merge batches in advance of this frontier, which ensures that operators can extract the subset of the trace at batch boundaries from this frontier onward. These boundaries may be used in cursor_through, whereas boundaries not in advance of this frontier are not guaranteed to return a cursor.

fn map_batches<F: FnMut(&Self::Batch)>(&mut self, f: F)

Maps some logic across the batches the collection manages.

This is currently used only to extract historical data to prime late-starting operators who want to reproduce the stream of batches moving past the trace. It could also be a fine basis for a default implementation of the cursor methods, as they (by default) just move through batches accumulating cursors into a cursor list.

Loading content...

Provided methods

fn cursor(
    &mut self
) -> (Self::Cursor, <Self::Cursor as Cursor<Key, Val, Time, R>>::Storage)

Provides a cursor over updates contained in the trace.

Loading content...

Implementors

impl<K, V, T, R, B> TraceReader<K, V, T, R> for Spine<K, V, T, R, B> where
    K: Ord + Clone,
    V: Ord + Clone,
    T: Lattice + Ord + Clone + Debug,
    R: Monoid,
    B: Batch<K, V, T, R> + Clone + 'static, 
[src]

type Batch = B

type Cursor = CursorList<K, V, T, R, <B as BatchReader<K, V, T, R>>::Cursor>

fn cursor(
    &mut self
) -> (Self::Cursor, <Self::Cursor as Cursor<Key, Val, Time, R>>::Storage)
[src]

impl<K, V, T, R, Tr> TraceReader<K, V, T, R> for TraceAgent<K, V, T, R, Tr> where
    T: Lattice + Ord + Clone + 'static,
    Tr: TraceReader<K, V, T, R>, 
[src]

type Batch = Tr::Batch

type Cursor = Tr::Cursor

fn cursor(
    &mut self
) -> (Self::Cursor, <Self::Cursor as Cursor<Key, Val, Time, R>>::Storage)
[src]

impl<K, V, T, R, Tr> TraceReader<K, V, T, R> for TraceRc<K, V, T, R, Tr> where
    T: Lattice + Ord + Clone + 'static,
    Tr: TraceReader<K, V, T, R>, 
[src]

type Batch = Tr::Batch

type Cursor = Tr::Cursor

fn advance_by(&mut self, frontier: &[T])[src]

Sets frontier to now be elements in frontier.

This change may not have immediately observable effects. It informs the shared trace that this handle no longer requires access to times other than those in the future of frontier, but if there are other handles to the same trace, it may not yet be able to compact.

fn distinguish_since(&mut self, frontier: &[T])[src]

Allows the trace to compact batches of times before frontier.

fn cursor_through(
    &mut self,
    frontier: &[T]
) -> Option<(Tr::Cursor, <Tr::Cursor as Cursor<K, V, T, R>>::Storage)>
[src]

Creates a new cursor over the wrapped trace.

fn cursor(
    &mut self
) -> (Self::Cursor, <Self::Cursor as Cursor<Key, Val, Time, R>>::Storage)
[src]

impl<K, V, T, R, Tr, F> TraceReader<K, V, T, R> for TraceFilter<K, V, T, R, Tr, F> where
    Tr: TraceReader<K, V, T, R>,
    Tr::Batch: Clone,
    K: 'static,
    V: 'static,
    T: Timestamp,
    R: 'static,
    F: Fn(&K, &V) -> bool + 'static, 
[src]

type Batch = BatchFilter<K, V, T, R, Tr::Batch, F>

type Cursor = CursorFilter<K, V, T, R, Tr::Cursor, F>

fn cursor(
    &mut self
) -> (Self::Cursor, <Self::Cursor as Cursor<Key, Val, Time, R>>::Storage)
[src]

impl<K, V, T, R, Tr, F> TraceReader<K, V, T, R> for TraceFreeze<K, V, T, R, Tr, F> where
    Tr: TraceReader<K, V, T, R>,
    Tr::Batch: Clone,
    K: 'static,
    V: 'static,
    T: Lattice + Clone + Default + 'static,
    R: 'static,
    F: Fn(&T) -> Option<T> + 'static, 
[src]

type Batch = BatchFreeze<K, V, T, R, Tr::Batch, F>

type Cursor = CursorFreeze<K, V, T, R, Tr::Cursor, F>

fn cursor(
    &mut self
) -> (Self::Cursor, <Self::Cursor as Cursor<Key, Val, Time, R>>::Storage)
[src]

impl<K, V, T, R, Tr, TInner> TraceReader<K, V, TInner, R> for differential_dataflow::trace::wrappers::enter::TraceEnter<K, V, T, R, Tr, TInner> where
    Tr: TraceReader<K, V, T, R>,
    Tr::Batch: Clone,
    K: 'static,
    V: 'static,
    T: Timestamp,
    TInner: Refines<T> + Lattice,
    R: 'static, 
[src]

type Batch = BatchEnter<K, V, T, R, Tr::Batch, TInner>

type Cursor = CursorEnter<K, V, T, R, Tr::Cursor, TInner>

fn cursor(
    &mut self
) -> (Self::Cursor, <Self::Cursor as Cursor<Key, Val, Time, R>>::Storage)
[src]

impl<K, V, T, R, Tr, TInner, F> TraceReader<K, V, TInner, R> for differential_dataflow::trace::wrappers::enter_at::TraceEnter<K, V, T, R, Tr, TInner, F> where
    Tr: TraceReader<K, V, T, R>,
    Tr::Batch: Clone,
    K: 'static,
    V: 'static,
    T: Timestamp,
    TInner: Refines<T> + Lattice,
    R: 'static,
    F: 'static,
    F: Fn(&K, &V, &T) -> TInner, 
[src]

type Batch = BatchEnter<K, V, T, R, Tr::Batch, TInner, F>

type Cursor = CursorEnter<K, V, T, R, Tr::Cursor, TInner, F>

fn cursor(
    &mut self
) -> (Self::Cursor, <Self::Cursor as Cursor<Key, Val, Time, R>>::Storage)
[src]

Loading content...