Struct timely::progress::frontier::MutableAntichain[][src]

pub struct MutableAntichain<T: PartialOrder + Ord> { /* fields omitted */ }

An antichain based on a multiset whose elements frequencies can be updated.

The MutableAntichain maintains frequencies for many elements of type T, and exposes the set of elements with positive count not greater than any other elements with positive count. The antichain may both advance and retreat; the changes do not all need to be to elements greater or equal to some elements of the frontier.

The type T must implement PartialOrder as well as Ord. The implementation of the Ord trait is used to efficiently organize the updates for cancellation, and to efficiently determine the lower bounds, and only needs to not contradict the PartialOrder implementation (that is, if PartialOrder orders two elements, then so does the Ord implementation).

The MutableAntichain implementation is done with the intent that updates to it are done in batches, and it is acceptable to rebuild the frontier from scratch when a batch of updates change it. This means that it can be expensive to maintain a large number of counts and change few elements near the frontier.

There is an update_dirty method for single updates that leave the MutableAntichain in a dirty state, but I strongly recommend against using them unless you must (on part of timely progress tracking seems to be greatly simplified by access to this)

Implementations

impl<T: PartialOrder + Ord + Clone> MutableAntichain<T>[src]

pub fn new() -> MutableAntichain<T>[src]

Creates a new empty MutableAntichain.

Examples

 use timely::progress::frontier::MutableAntichain;

 let frontier = MutableAntichain::<usize>::new();
 assert!(frontier.is_empty());

pub fn clear(&mut self)[src]

Removes all elements.

Examples

 use timely::progress::frontier::MutableAntichain;

 let mut frontier = MutableAntichain::<usize>::new();
 frontier.clear();
 assert!(frontier.is_empty());

pub fn empty(&mut self)[src]

This method deletes the contents. Unlike clear it records doing so.

pub fn frontier(&self) -> AntichainRef<'_, T>[src]

Reveals the minimal elements with positive count.

Examples

 use timely::progress::frontier::MutableAntichain;

 let mut frontier = MutableAntichain::<usize>::new();
 assert!(frontier.frontier().len() == 0);

pub fn new_bottom(bottom: T) -> MutableAntichain<T>[src]

Creates a new singleton MutableAntichain.

Examples

 use timely::progress::frontier::{AntichainRef, MutableAntichain};

 let mut frontier = MutableAntichain::new_bottom(0u64);
 assert!(frontier.frontier() == AntichainRef::new(&[0u64]));

pub fn is_empty(&self) -> bool[src]

Returns true if there are no elements in the MutableAntichain.

Examples

 use timely::progress::frontier::MutableAntichain;

 let mut frontier = MutableAntichain::<usize>::new();
 assert!(frontier.is_empty());

pub fn less_than(&self, time: &T) -> bool[src]

Returns true if any item in the MutableAntichain is strictly less than the argument.

Examples

 use timely::progress::frontier::MutableAntichain;

 let mut frontier = MutableAntichain::new_bottom(1u64);
 assert!(!frontier.less_than(&0));
 assert!(!frontier.less_than(&1));
 assert!(frontier.less_than(&2));

pub fn less_equal(&self, time: &T) -> bool[src]

Returns true if any item in the MutableAntichain is less than or equal to the argument.

Examples

 use timely::progress::frontier::MutableAntichain;

 let mut frontier = MutableAntichain::new_bottom(1u64);
 assert!(!frontier.less_equal(&0));
 assert!(frontier.less_equal(&1));
 assert!(frontier.less_equal(&2));

pub fn update_dirty(&mut self, time: T, delta: i64)[src]

Allows a single-element push, but dirties the antichain and prevents inspection until cleaned.

At the moment inspection is prevented via panic, so best be careful (this should probably be fixed). It is very important if you want to use this method that very soon afterwards you call something akin to update_iter, perhaps with a None argument if you have no more data, as this method will tidy up the internal representation.

pub fn update_iter<'a, I>(&'a mut self, updates: I) -> Drain<'a, (T, i64)> where
    I: IntoIterator<Item = (T, i64)>, 
[src]

Applies updates to the antichain and enumerates any changes.

Examples

 use timely::progress::frontier::{AntichainRef, MutableAntichain};

 let mut frontier = MutableAntichain::new_bottom(1u64);
 let changes =
 frontier
     .update_iter(vec![(1, -1), (2, 7)])
     .collect::<Vec<_>>();

 assert!(frontier.frontier() == AntichainRef::new(&[2]));
 assert!(changes == vec![(1, -1), (2, 1)]);

pub fn count_for(&self, query_time: &T) -> i64[src]

Reports the count for a queried time.

Trait Implementations

impl<T: PartialOrder + Ord> Abomonation for MutableAntichain<T> where
    Vec<(T, i64)>: Abomonation,
    T: Abomonation,
    Vec<T>: Abomonation,
    ChangeBatch<T>: Abomonation
[src]

impl<T: Clone + PartialOrder + Ord> Clone for MutableAntichain<T>[src]

impl<T: Debug + PartialOrder + Ord> Debug for MutableAntichain<T>[src]

impl<'de, T: PartialOrder + Ord> Deserialize<'de> for MutableAntichain<T> where
    T: Deserialize<'de>, 
[src]

impl<T: PartialOrder + Ord> Serialize for MutableAntichain<T> where
    T: Serialize
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for MutableAntichain<T> where
    T: RefUnwindSafe

impl<T> Send for MutableAntichain<T> where
    T: Send

impl<T> Sync for MutableAntichain<T> where
    T: Sync

impl<T> Unpin for MutableAntichain<T> where
    T: Unpin

impl<T> UnwindSafe for MutableAntichain<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Data for T where
    T: 'static + Clone
[src]

impl<T> Data for T where
    T: 'static + Send + Sync + Any + Abomonation
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> ExchangeData for T where
    T: Data + Data
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ProgressEventTimestamp for T where
    T: Data + Any + Debug
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.