Struct timely::progress::frontier::MutableAntichain [−][src]
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]
I: IntoIterator<Item = (T, i64)>,
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]
Vec<(T, i64)>: Abomonation,
T: Abomonation,
Vec<T>: Abomonation,
ChangeBatch<T>: Abomonation,
unsafe fn entomb<W: Write>(&self, _write: &mut W) -> Result<()>
[src]
fn extent(&self) -> usize
[src]
unsafe fn exhume<'a, 'b>(
&'a mut self,
bytes: &'b mut [u8]
) -> Option<&'b mut [u8]>
[src]
&'a mut self,
bytes: &'b mut [u8]
) -> Option<&'b mut [u8]>
impl<T: Clone + PartialOrder + Ord> Clone for MutableAntichain<T>
[src]
fn clone(&self) -> MutableAntichain<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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]
T: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<T: PartialOrder + Ord> Serialize for MutableAntichain<T> where
T: Serialize,
[src]
T: Serialize,
Auto Trait Implementations
impl<T> RefUnwindSafe for MutableAntichain<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for MutableAntichain<T> where
T: Send,
T: Send,
impl<T> Sync for MutableAntichain<T> where
T: Sync,
T: Sync,
impl<T> Unpin for MutableAntichain<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for MutableAntichain<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Data for T where
T: 'static + Clone,
[src]
T: 'static + Clone,
impl<T> Data for T where
T: 'static + Send + Sync + Any + Abomonation,
[src]
T: 'static + Send + Sync + Any + Abomonation,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> ExchangeData for T where
T: Data + Data,
[src]
T: Data + Data,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ProgressEventTimestamp for T where
T: Data + Any + Debug,
[src]
T: Data + Any + Debug,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,