Trait differential_dataflow::trace::TraceReader

source ·
pub trait TraceReader {
    type Key<'a>: Copy + Clone + MyTrait<'a, Owned = Self::KeyOwned>;
    type KeyOwned: Ord + Clone;
    type Val<'a>: Copy + Clone + MyTrait<'a, Owned = Self::ValOwned>;
    type ValOwned: Ord + Clone;
    type Time: Timestamp + Lattice + Ord + Clone;
    type Diff: Semigroup;
    type Batch: for<'a> BatchReader<Key<'a> = Self::Key<'a>, KeyOwned = Self::KeyOwned, Val<'a> = Self::Val<'a>, ValOwned = Self::ValOwned, Time = Self::Time, Diff = Self::Diff> + Clone + 'static;
    type Storage;
    type Cursor: for<'a> Cursor<Storage = Self::Storage, Key<'a> = Self::Key<'a>, KeyOwned = Self::KeyOwned, Val<'a> = Self::Val<'a>, ValOwned = Self::ValOwned, Time = Self::Time, Diff = Self::Diff>;

Show 13 methods // Required methods fn cursor_through( &mut self, upper: AntichainRef<'_, Self::Time> ) -> Option<(Self::Cursor, Self::Storage)>; fn set_logical_compaction(&mut self, frontier: AntichainRef<'_, Self::Time>); fn get_logical_compaction(&mut self) -> AntichainRef<'_, Self::Time>; fn set_physical_compaction( &mut self, frontier: AntichainRef<'_, Self::Time> ); fn get_physical_compaction(&mut self) -> AntichainRef<'_, Self::Time>; fn map_batches<F: FnMut(&Self::Batch)>(&self, f: F); // Provided methods fn cursor(&mut self) -> (Self::Cursor, Self::Storage) { ... } fn advance_by(&mut self, frontier: AntichainRef<'_, Self::Time>) { ... } fn advance_frontier(&mut self) -> AntichainRef<'_, Self::Time> { ... } fn distinguish_since(&mut self, frontier: AntichainRef<'_, Self::Time>) { ... } fn distinguish_frontier(&mut self) -> AntichainRef<'_, Self::Time> { ... } fn read_upper(&mut self, target: &mut Antichain<Self::Time>) { ... } fn advance_upper(&mut self, upper: &mut Antichain<Self::Time>) { ... }
}
Expand description

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).

Required Associated Types§

source

type Key<'a>: Copy + Clone + MyTrait<'a, Owned = Self::KeyOwned>

Key by which updates are indexed.

source

type KeyOwned: Ord + Clone

Owned version of the above.

source

type Val<'a>: Copy + Clone + MyTrait<'a, Owned = Self::ValOwned>

Values associated with keys.

source

type ValOwned: Ord + Clone

Owned version of the above.

source

type Time: Timestamp + Lattice + Ord + Clone

Timestamps associated with updates

source

type Diff: Semigroup

Associated update.

source

type Batch: for<'a> BatchReader<Key<'a> = Self::Key<'a>, KeyOwned = Self::KeyOwned, Val<'a> = Self::Val<'a>, ValOwned = Self::ValOwned, Time = Self::Time, Diff = Self::Diff> + Clone + 'static

The type of an immutable collection of updates.

source

type Storage

Storage type for Self::Cursor. Likely related to Self::Batch.

source

type Cursor: for<'a> Cursor<Storage = Self::Storage, Key<'a> = Self::Key<'a>, KeyOwned = Self::KeyOwned, Val<'a> = Self::Val<'a>, ValOwned = Self::ValOwned, Time = Self::Time, Diff = Self::Diff>

The type used to enumerate the collections contents.

Required Methods§

source

fn cursor_through( &mut self, upper: AntichainRef<'_, Self::Time> ) -> Option<(Self::Cursor, Self::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.

source

fn set_logical_compaction(&mut self, frontier: AntichainRef<'_, Self::Time>)

Advances the frontier that constrains logical compaction.

Logical compaction is the ability of the trace to change the times of the updates it contains. Update times may be changed as long as their comparison to all query times beyond the logical compaction frontier remains unchanged. Practically, this means that groups of timestamps not beyond the frontier can be coalesced into fewer representative times.

Logical compaction is important, as it allows the trace to forget historical distinctions between update times, and maintain a compact memory footprint over an unbounded update history.

By advancing the logical compaction frontier, the caller unblocks merging of otherwise equivalent udates, but loses the ability to observe historical detail that is not beyond frontier.

It is an error to call this method with a frontier not equal to or beyond the most recent arguments to this method, or the initial value of get_logical_compaction() if this method has not yet been called.

source

fn get_logical_compaction(&mut self) -> AntichainRef<'_, Self::Time>

Reports the logical compaction frontier.

All update times beyond this frontier will be presented with their original times, and all update times not beyond this frontier will present as a time that compares identically with all query times beyond this frontier. Practically, update times not beyond this frontier should not be taken to be accurate as presented, and should be used carefully, only in accumulation to times that are beyond the frontier.

source

fn set_physical_compaction(&mut self, frontier: AntichainRef<'_, Self::Time>)

Advances the frontier that constrains physical compaction.

Physical compaction is the ability of the trace to merge the batches of updates it maintains. Physical compaction does not change the updates or their timestamps, although it is also the moment at which logical compaction is most likely to happen.

Physical compaction allows the trace to maintain a logarithmic number of batches of updates, which is what allows the trace to provide efficient random access by keys and values.

By advancing the physical compaction frontier, the caller unblocks the merging of batches of updates, but loses the ability to create a cursor through any frontier not beyond frontier.

It is an error to call this method with a frontier not equal to or beyond the most recent arguments to this method, or the initial value of get_physical_compaction() if this method has not yet been called.

source

fn get_physical_compaction(&mut self) -> AntichainRef<'_, Self::Time>

Reports the physical compaction frontier.

All batches containing updates beyond this frontier will not be merged with ohter batches. This allows the caller to create a cursor through any frontier beyond the physical compaction frontier, with the cursor_through() method. This functionality is primarily of interest to the join operator, and any other operators who need to take notice of the physical structure of update batches.

source

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

Maps logic across the non-empty sequence of batches in the trace.

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.

Provided Methods§

source

fn cursor(&mut self) -> (Self::Cursor, Self::Storage)

Provides a cursor over updates contained in the trace.

source

fn advance_by(&mut self, frontier: AntichainRef<'_, Self::Time>)

👎Deprecated since 0.11: please use set_logical_compaction

Deprecated form of set_logical_compaction.

source

fn advance_frontier(&mut self) -> AntichainRef<'_, Self::Time>

👎Deprecated since 0.11: please use get_logical_compaction

Deprecated form of get_logical_compaction.

source

fn distinguish_since(&mut self, frontier: AntichainRef<'_, Self::Time>)

👎Deprecated since 0.11: please use set_physical_compaction

Deprecated form of set_physical_compaction.

source

fn distinguish_frontier(&mut self) -> AntichainRef<'_, Self::Time>

👎Deprecated since 0.11: please use get_physical_compaction

Deprecated form of get_physical_compaction.

source

fn read_upper(&mut self, target: &mut Antichain<Self::Time>)

Reads the upper frontier of committed times.

source

fn advance_upper(&mut self, upper: &mut Antichain<Self::Time>)

Advances upper by any empty batches.

An empty batch whose batch.lower bound equals the current contents of upper will advance upper to batch.upper. Taken across all batches, this should advance upper across empty batch regions.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<B, BA, BU> TraceReader for Spine<B, BA, BU>
where B: Batch + Clone + 'static,

§

type Key<'a> = <B as BatchReader>::Key<'a>

§

type KeyOwned = <B as BatchReader>::KeyOwned

§

type Val<'a> = <B as BatchReader>::Val<'a>

§

type ValOwned = <B as BatchReader>::ValOwned

§

type Time = <B as BatchReader>::Time

§

type Diff = <B as BatchReader>::Diff

§

type Batch = B

§

type Storage = Vec<B>

§

type Cursor = CursorList<<B as BatchReader>::Cursor>

source§

impl<Tr> TraceReader for TraceAgent<Tr>
where Tr: TraceReader,

§

type Key<'a> = <Tr as TraceReader>::Key<'a>

§

type KeyOwned = <Tr as TraceReader>::KeyOwned

§

type Val<'a> = <Tr as TraceReader>::Val<'a>

§

type ValOwned = <Tr as TraceReader>::ValOwned

§

type Time = <Tr as TraceReader>::Time

§

type Diff = <Tr as TraceReader>::Diff

§

type Batch = <Tr as TraceReader>::Batch

§

type Storage = <Tr as TraceReader>::Storage

§

type Cursor = <Tr as TraceReader>::Cursor

source§

impl<Tr, F> TraceReader for TraceFilter<Tr, F>
where Tr: TraceReader, Tr::Batch: Clone, F: FnMut(Tr::Key<'_>, Tr::Val<'_>) -> bool + Clone + 'static,

§

type Key<'a> = <Tr as TraceReader>::Key<'a>

§

type KeyOwned = <Tr as TraceReader>::KeyOwned

§

type Val<'a> = <Tr as TraceReader>::Val<'a>

§

type ValOwned = <Tr as TraceReader>::ValOwned

§

type Time = <Tr as TraceReader>::Time

§

type Diff = <Tr as TraceReader>::Diff

§

type Batch = BatchFilter<<Tr as TraceReader>::Batch, F>

§

type Storage = <Tr as TraceReader>::Storage

§

type Cursor = CursorFilter<<Tr as TraceReader>::Cursor, F>

source§

impl<Tr, F> TraceReader for TraceFreeze<Tr, F>
where Tr: TraceReader, Tr::Batch: Clone, F: Fn(&Tr::Time) -> Option<Tr::Time> + 'static,

§

type Key<'a> = <Tr as TraceReader>::Key<'a>

§

type KeyOwned = <Tr as TraceReader>::KeyOwned

§

type Val<'a> = <Tr as TraceReader>::Val<'a>

§

type ValOwned = <Tr as TraceReader>::ValOwned

§

type Time = <Tr as TraceReader>::Time

§

type Diff = <Tr as TraceReader>::Diff

§

type Batch = BatchFreeze<<Tr as TraceReader>::Batch, F>

§

type Storage = <Tr as TraceReader>::Storage

§

type Cursor = CursorFreeze<<Tr as TraceReader>::Cursor, F>

source§

impl<Tr, TInner> TraceReader for differential_dataflow::trace::wrappers::enter::TraceEnter<Tr, TInner>
where Tr: TraceReader, Tr::Batch: Clone, TInner: Refines<Tr::Time> + Lattice,

§

type Key<'a> = <Tr as TraceReader>::Key<'a>

§

type KeyOwned = <Tr as TraceReader>::KeyOwned

§

type Val<'a> = <Tr as TraceReader>::Val<'a>

§

type ValOwned = <Tr as TraceReader>::ValOwned

§

type Time = TInner

§

type Diff = <Tr as TraceReader>::Diff

§

type Batch = BatchEnter<<Tr as TraceReader>::Batch, TInner>

§

type Storage = <Tr as TraceReader>::Storage

§

type Cursor = CursorEnter<<Tr as TraceReader>::Cursor, TInner>

source§

impl<Tr, TInner, F, G> TraceReader for differential_dataflow::trace::wrappers::enter_at::TraceEnter<Tr, TInner, F, G>
where Tr: TraceReader, Tr::Batch: Clone, TInner: Refines<Tr::Time> + Lattice, F: 'static + FnMut(Tr::Key<'_>, Tr::Val<'_>, &Tr::Time) -> TInner + Clone, G: FnMut(&TInner) -> Tr::Time + Clone + 'static,

§

type Key<'a> = <Tr as TraceReader>::Key<'a>

§

type KeyOwned = <Tr as TraceReader>::KeyOwned

§

type Val<'a> = <Tr as TraceReader>::Val<'a>

§

type ValOwned = <Tr as TraceReader>::ValOwned

§

type Time = TInner

§

type Diff = <Tr as TraceReader>::Diff

§

type Batch = BatchEnter<<Tr as TraceReader>::Batch, TInner, F>

§

type Storage = <Tr as TraceReader>::Storage

§

type Cursor = CursorEnter<<Tr as TraceReader>::Cursor, TInner, F>

source§

impl<Tr: TraceReader> TraceReader for TraceFrontier<Tr>

§

type Key<'a> = <Tr as TraceReader>::Key<'a>

§

type KeyOwned = <Tr as TraceReader>::KeyOwned

§

type Val<'a> = <Tr as TraceReader>::Val<'a>

§

type ValOwned = <Tr as TraceReader>::ValOwned

§

type Time = <Tr as TraceReader>::Time

§

type Diff = <Tr as TraceReader>::Diff

§

type Batch = BatchFrontier<<Tr as TraceReader>::Batch>

§

type Storage = <Tr as TraceReader>::Storage

§

type Cursor = CursorFrontier<<Tr as TraceReader>::Cursor, <Tr as TraceReader>::Time>

source§

impl<Tr: TraceReader> TraceReader for TraceRc<Tr>

§

type Key<'a> = <Tr as TraceReader>::Key<'a>

§

type KeyOwned = <Tr as TraceReader>::KeyOwned

§

type Val<'a> = <Tr as TraceReader>::Val<'a>

§

type ValOwned = <Tr as TraceReader>::ValOwned

§

type Time = <Tr as TraceReader>::Time

§

type Diff = <Tr as TraceReader>::Diff

§

type Batch = <Tr as TraceReader>::Batch

§

type Storage = <Tr as TraceReader>::Storage

§

type Cursor = <Tr as TraceReader>::Cursor