Struct timely::progress::nested::reachability::Tracker
[−]
[src]
pub struct Tracker<T: Timestamp> { /* fields omitted */ }
An interactive tracker of propagated reachability information.
A Tracker
tracks, for a fixed graph topology, the consequences of
pointstamp changes at various node input and output ports. These changes may
alter the potential pointstamps that could arrive at downstream input ports.
A Tracker
instance is constructed from a reachability summary, by
way of its allocate_from
method. With a fixed topology, users can interactively
call update_target
and update_source
to change observed pointstamp counts
at node inputs and outputs, respectively. These changes are buffered until a
user invokes either propagate_all
or propagate_node
, which consume buffered
changes propagate their consequences along the graph to any other port that
can be reached. These changes can be read for each node using pushed_mut
.
Examples
use timely::progress::frontier::Antichain; use timely::progress::nested::subgraph::{Source, Target}; use timely::progress::nested::reachability::{Builder, Tracker}; // allocate a new empty topology builder. let mut builder = Builder::<usize>::new(); // Each node with one input connected to one output. builder.add_node(0, 1, 1, vec![vec![Antichain::from_elem(0)]]); builder.add_node(1, 1, 1, vec![vec![Antichain::from_elem(0)]]); builder.add_node(2, 1, 1, vec![vec![Antichain::from_elem(1)]]); // Connect nodes in sequence, looping around to the first from the last. builder.add_edge(Source { index: 0, port: 0}, Target { index: 1, port: 0} ); builder.add_edge(Source { index: 1, port: 0}, Target { index: 2, port: 0} ); builder.add_edge(Source { index: 2, port: 0}, Target { index: 0, port: 0} ); // Construct a reachability tracker. let mut tracker = Tracker::allocate_from(builder.summarize()); // Introduce a pointstamp at the output of the first node. tracker.update_source(Source { index: 0, port: 0}, 17, 1); // Propagate changes; until this call updates are simply buffered. tracker.propagate_all(); // Propagated changes should have a single element, incremented for node zero. assert_eq!(tracker.pushed_mut(0)[0].drain().collect::<Vec<_>>(), vec![(18, 1)]); assert_eq!(tracker.pushed_mut(1)[0].drain().collect::<Vec<_>>(), vec![(17, 1)]); assert_eq!(tracker.pushed_mut(2)[0].drain().collect::<Vec<_>>(), vec![(17, 1)]);
Methods
impl<T: Timestamp> Tracker<T>
[src]
pub fn update_target(&mut self, target: Target, time: T, value: i64)
[src]
Updates the count for a time at a target.
pub fn update_source(&mut self, source: Source, time: T, value: i64)
[src]
Updates the count for a time at a source.
pub fn node_state(
&mut self,
index: usize
) -> (&[MutableAntichain<T>], &[MutableAntichain<T>], &mut [ChangeBatch<T>])
[src]
&mut self,
index: usize
) -> (&[MutableAntichain<T>], &[MutableAntichain<T>], &mut [ChangeBatch<T>])
Returns references to per-node state describing input and output frontiers, and any pending updates to propagated consequences.
pub fn target(&mut self, index: usize) -> &mut [MutableAntichain<T>]
[src]
Reference to the target mutable antichains.
pub fn source(&mut self, index: usize) -> &mut [MutableAntichain<T>]
[src]
Reference to the source mutable antichains.
pub fn clear(&mut self)
[src]
Clears the pointstamp counter.
pub fn is_empty(&mut self) -> bool
[src]
pub fn tracking_anything(&mut self) -> bool
[src]
Returns true if any source or target is non-empty.
pub fn allocate_from(summary: Summary<T>) -> Self
[src]
Allocate a new Tracker
using the shape from summaries
.
pub fn propagate_node(&mut self, index: usize)
[src]
Propagates updates from an indicated node.
This method is potentially useful for propagating the consequences of a single node invocation, to make the results available immediately.
pub fn propagate_all(&mut self)
[src]
Propagates all updates made to sources and targets.
pub fn pushed_mut(&mut self, node: usize) -> &mut [ChangeBatch<T>]
[src]
Provides access to pushed changes for a node.
The caller may read the results or consume the results, as appropriate. The method itself does not clear the buffer, so pushed values will stay in place until they are consumed by some caller.
Trait Implementations
impl<T: Default + Timestamp> Default for Tracker<T> where
T::Summary: Default,
T::Summary: Default,
[src]
T::Summary: Default,
T::Summary: Default,
impl<T: Debug + Timestamp> Debug for Tracker<T> where
T::Summary: Debug,
T::Summary: Debug,
[src]
T::Summary: Debug,
T::Summary: Debug,