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]

[src]

Updates the count for a time at a target.

[src]

Updates the count for a time at a source.

[src]

Returns references to per-node state describing input and output frontiers, and any pending updates to propagated consequences.

Important traits for &'a [u8]
[src]

Reference to the target mutable antichains.

Important traits for &'a [u8]
[src]

Reference to the source mutable antichains.

[src]

Clears the pointstamp counter.

[src]

[src]

Returns true if any source or target is non-empty.

[src]

Allocate a new Tracker using the shape from summaries.

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

[src]

Propagates all updates made to sources and targets.

Important traits for &'a [u8]
[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]

[src]

Returns the "default value" for a type. Read more

impl<T: Debug + Timestamp> Debug for Tracker<T> where
    T::Summary: Debug,
    T::Summary: Debug
[src]

[src]

Formats the value using the given formatter. Read more