Skip to main content

Trace

Trait Trace 

Source
pub trait Trace: BatchReader {
    type Batch: Batch<Key = Self::Key, Val = Self::Val, Time = Self::Time, R = Self::R, Factories = Self::Factories>;

Show 15 methods // Required methods fn new(factories: &Self::Factories) -> Self; fn set_frontier(&mut self, frontier: &Self::Time); fn exert(&mut self, effort: &mut isize); fn consolidate(self) -> Option<Self::Batch>; fn insert(&mut self, batch: Self::Batch); fn insert_arc(&mut self, batch: Arc<Self::Batch>); fn clear_dirty_flag(&mut self); fn dirty(&self) -> bool; fn retain_keys(&mut self, filter: Filter<Self::Key>); fn retain_values(&mut self, filter: GroupFilter<Self::Val>); fn key_filter(&self) -> &Option<Filter<Self::Key>>; fn value_filter(&self) -> &Option<GroupFilter<Self::Val>>; fn save( &mut self, base: &StoragePath, pid: &str, files: &mut Vec<Arc<dyn FileCommitter>>, ) -> Result<(), Error>; fn restore(&mut self, base: &StoragePath, pid: &str) -> Result<(), Error>; // Provided method fn metadata(&self, _meta: &mut OperatorMeta) { ... }
}
Expand description

A set of (key, val, time, diff) tuples that can be read and extended.

Trace extends BatchReader, most notably with insert for adding new batches of tuples.

See crate documentation for more information on batches and traces.

Required Associated Types§

Source

type Batch: Batch<Key = Self::Key, Val = Self::Val, Time = Self::Time, R = Self::R, Factories = Self::Factories>

The type of an immutable collection of updates.

Required Methods§

Source

fn new(factories: &Self::Factories) -> Self

Allocates a new empty trace.

Source

fn set_frontier(&mut self, frontier: &Self::Time)

Sets a compaction frontier, i.e., a timestamp such that timestamps below the frontier are indistinguishable to DBSP, therefore any ts in the trace can be safely replaced with ts.join(frontier) without affecting the output of the circuit. By applying this replacement, updates to the same (key, value) pairs applied during different steps can be merged or discarded.

The compaction is performed lazily at merge time.

Source

fn exert(&mut self, effort: &mut isize)

Exert merge effort, even without updates.

Source

fn consolidate(self) -> Option<Self::Batch>

Merge all updates in a trace into a single batch.

Source

fn insert(&mut self, batch: Self::Batch)

Introduces a batch of updates to the trace.

Source

fn insert_arc(&mut self, batch: Arc<Self::Batch>)

Introduces a batch of updates to the trace. More efficient that cloning a batch and calling insert.

Source

fn clear_dirty_flag(&mut self)

Clears the value of the “dirty” flag to false.

The “dirty” flag is used to efficiently track changes to the trace, e.g., as part of checking whether a circuit has reached a fixed point. Pushing a non-empty batch to the trace sets the flag to true. The Self::dirty method returns true iff the trace has changed since the last call to clear_dirty_flag.

Source

fn dirty(&self) -> bool

Returns the value of the dirty flag.

Source

fn retain_keys(&mut self, filter: Filter<Self::Key>)

Informs the trace that keys that don’t pass the filter are no longer used and can be removed from the trace.

The implementation is not required to remove truncated keys instantly or at all. This method is just a hint that keys that don’t pass the filter are no longer of interest to the consumer of the trace and can be garbage collected.

§Rationale

This API is similar to the old API BatchReader::truncate_keys_below, but in Trace instead of BatchReader. The difference is that a batch can truncate its keys instanly by simply moving an internal pointer to the first remaining key. However, there is no similar way to retain keys based on arbitrary predicates, this can only be done efficiently as part of trace maintenance when either merging or compacting batches.

Source

fn retain_values(&mut self, filter: GroupFilter<Self::Val>)

Informs the trace that values that don’t pass the filter are no longer used and can be removed from the trace.

The implementation is not required to remove truncated values instantly or at all. This method is just a hint that values that don’t pass the filter are no longer of interest to the consumer of the trace and can be garbage collected.

Source

fn key_filter(&self) -> &Option<Filter<Self::Key>>

Source

fn value_filter(&self) -> &Option<GroupFilter<Self::Val>>

Source

fn save( &mut self, base: &StoragePath, pid: &str, files: &mut Vec<Arc<dyn FileCommitter>>, ) -> Result<(), Error>

Writes this trace to storage beneath base, using pid as a file name prefix. Adds the files that were written to files so that they can be committed later.

Source

fn restore(&mut self, base: &StoragePath, pid: &str) -> Result<(), Error>

Reads this trace back from storage under base with pid as the prefix.

Provided Methods§

Source

fn metadata(&self, _meta: &mut OperatorMeta)

Allows the trace to report additional metadata.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<B> Trace for Spine<B>
where B: Batch,

Source§

type Batch = B