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§
Required Methods§
Sourcefn set_frontier(&mut self, frontier: &Self::Time)
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.
Sourcefn consolidate(self) -> Option<Self::Batch>
fn consolidate(self) -> Option<Self::Batch>
Merge all updates in a trace into a single batch.
Sourcefn insert_arc(&mut self, batch: Arc<Self::Batch>)
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.
Sourcefn clear_dirty_flag(&mut self)
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.
Sourcefn retain_keys(&mut self, filter: Filter<Self::Key>)
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.
Sourcefn retain_values(&mut self, filter: GroupFilter<Self::Val>)
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.
fn key_filter(&self) -> &Option<Filter<Self::Key>>
fn value_filter(&self) -> &Option<GroupFilter<Self::Val>>
Sourcefn save(
&mut self,
base: &StoragePath,
pid: &str,
files: &mut Vec<Arc<dyn FileCommitter>>,
) -> Result<(), Error>
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.
Provided Methods§
Sourcefn metadata(&self, _meta: &mut OperatorMeta)
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.