Trait PathSummary

Source
pub trait PathSummary<T>:
    Clone
    + 'static
    + Eq
    + PartialOrder
    + Debug
    + Default {
    // Required methods
    fn results_in(&self, src: &T) -> Option<T>;
    fn followed_by(&self, other: &Self) -> Option<Self>;
}
Expand description

A summary of how a timestamp advances along a timely dataflow path.

Required Methods§

Source

fn results_in(&self, src: &T) -> Option<T>

Advances a timestamp according to the timestamp actions on the path.

The path may advance the timestamp sufficiently that it is no longer valid, for example if incrementing fields would result in integer overflow. In this case, results_in should return None.

The feedback operator, apparently the only point where timestamps are actually incremented in computation, uses this method and will drop messages with timestamps that when advanced result in None. Ideally, all other timestamp manipulation should behave similarly.

This function must be monotonic increasing in both inputs. If s1.less_equal(&s2) then for all t we have s1.results_in(&t).less_equal(&s2.results_in(&t)). If t1.less_equal(&t2) then for all s we have s.results_in(&t1).less_equal(&s.results_in(&t2)).

Note that Self::default() is expected to behave as an “empty” or “noop” summary, such that Self::default().results_in(&t) == Some(t). The default summary does not need to be a minimal summary, in that summaries are technically permitted to walk timestamps backwards. Care should be used when doing this to avoid potentially cyclic dataflows without strict timestamp advancement.

§Examples
use timely::progress::timestamp::PathSummary;

let timestamp = 3;

let summary1 = 5;
let summary2 = usize::MAX - 2;

assert_eq!(summary1.results_in(&timestamp), Some(8));
assert_eq!(summary2.results_in(&timestamp), None);
Source

fn followed_by(&self, other: &Self) -> Option<Self>

Composes this path summary with another path summary.

It is possible that the two composed paths result in an invalid summary, for example when integer additions overflow. If it is correct that all timestamps moved along these paths would also result in overflow and be discarded, followed_by can return None. It is very important that this not be used casually, as this does not prevent the actual movement of data.

Calling results_in on the composed summary should behave the same as though the two summaries were applied to the argument in order.

§Examples
use timely::progress::timestamp::PathSummary;

let summary1 = 5;
let summary2 = usize::MAX - 3;

assert_eq!(summary1.followed_by(&summary2), None);

let time = 10;
let summary2 = 15;
assert_eq!(
    // Applying the composed summary...
    summary1.followed_by(&summary2).and_then(|s| s.results_in(&time)),
    // ...has the same result as applying the two summaries in sequence.
    summary1.results_in(&time).and_then(|t| summary2.results_in(&t)),
);

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.

Implementations on Foreign Types§

Source§

impl PathSummary<i8> for i8

Source§

fn results_in(&self, src: &i8) -> Option<i8>

Source§

fn followed_by(&self, other: &i8) -> Option<i8>

Source§

impl PathSummary<i16> for i16

Source§

fn results_in(&self, src: &i16) -> Option<i16>

Source§

fn followed_by(&self, other: &i16) -> Option<i16>

Source§

impl PathSummary<i32> for i32

Source§

fn results_in(&self, src: &i32) -> Option<i32>

Source§

fn followed_by(&self, other: &i32) -> Option<i32>

Source§

impl PathSummary<i64> for i64

Source§

fn results_in(&self, src: &i64) -> Option<i64>

Source§

fn followed_by(&self, other: &i64) -> Option<i64>

Source§

impl PathSummary<i128> for i128

Source§

fn results_in(&self, src: &i128) -> Option<i128>

Source§

fn followed_by(&self, other: &i128) -> Option<i128>

Source§

impl PathSummary<isize> for isize

Source§

fn results_in(&self, src: &isize) -> Option<isize>

Source§

fn followed_by(&self, other: &isize) -> Option<isize>

Source§

impl PathSummary<u8> for u8

Source§

fn results_in(&self, src: &u8) -> Option<u8>

Source§

fn followed_by(&self, other: &u8) -> Option<u8>

Source§

impl PathSummary<u16> for u16

Source§

fn results_in(&self, src: &u16) -> Option<u16>

Source§

fn followed_by(&self, other: &u16) -> Option<u16>

Source§

impl PathSummary<u32> for u32

Source§

fn results_in(&self, src: &u32) -> Option<u32>

Source§

fn followed_by(&self, other: &u32) -> Option<u32>

Source§

impl PathSummary<u64> for u64

Source§

fn results_in(&self, src: &u64) -> Option<u64>

Source§

fn followed_by(&self, other: &u64) -> Option<u64>

Source§

impl PathSummary<u128> for u128

Source§

fn results_in(&self, src: &u128) -> Option<u128>

Source§

fn followed_by(&self, other: &u128) -> Option<u128>

Source§

impl PathSummary<()> for ()

Source§

fn results_in(&self, _src: &()) -> Option<()>

Source§

fn followed_by(&self, _other: &()) -> Option<()>

Source§

impl PathSummary<usize> for usize

Source§

fn results_in(&self, src: &usize) -> Option<usize>

Source§

fn followed_by(&self, other: &usize) -> Option<usize>

Source§

impl PathSummary<Duration> for Duration

Source§

impl<TOuter: Timestamp, TInner: Timestamp> PathSummary<(TOuter, TInner)> for (TOuter::Summary, TInner::Summary)

Source§

fn results_in( &self, (outer, inner): &(TOuter, TInner), ) -> Option<(TOuter, TInner)>

Source§

fn followed_by( &self, (outer, inner): &(TOuter::Summary, TInner::Summary), ) -> Option<(TOuter::Summary, TInner::Summary)>

Implementors§

Source§

impl<TOuter: Timestamp, TInner: Timestamp> PathSummary<Product<TOuter, TInner>> for Product<TOuter::Summary, TInner::Summary>