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, the 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)

Methods

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

[src]

Creates a new empty MutableAntichain.

#Examples

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

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

[src]

Removes all elements.

#Examples

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

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

[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);

[src]

Creates a new singleton MutableAntichain.

#Examples

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

 let mut frontier = MutableAntichain::new_bottom(0u64);
 assert_eq!(frontier.frontier(), &[0u64]);

[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());

[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));

[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));

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

[src]

Applies updates to the antichain and applies action to each frontier change.

This method applies a batch of updates and if any affects the frontier it is rebuilt.

#Examples

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

 let mut frontier = MutableAntichain::new_bottom(1u64);
 frontier.update_iter(vec![(1, -1), (2, 1)].into_iter());
 assert_eq!(frontier.frontier(), &[2]);

[src]

Applies updates to the antichain and applies action to each frontier change.

This method applies a batch of updates and if any affects the frontier it is rebuilt. Once rebuilt, action is called with the corresponding changes to the frontier, which should be various times and { +1, -1 } differences.

#Examples

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

 let mut frontier = MutableAntichain::new_bottom(1u64);
 let mut changes = Vec::new();
 frontier.update_iter_and(vec![(1, -1), (2, 1)].into_iter(), |time, diff| {
     changes.push((time.clone(), diff));
 });
 assert_eq!(frontier.frontier(), &[2]);
 changes.sort();
 assert_eq!(&changes[..], &[(1, -1), (2, 1)]);

Trait Implementations

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

[src]

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

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

[src]

Formats the value using the given formatter.

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

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more