pub struct VectorClock { /* private fields */ }Expand description
A vector clock for causal ordering across fleet nodes.
Implementations§
Source§impl VectorClock
impl VectorClock
Sourcepub fn increment(&mut self, node: &str) -> u64
pub fn increment(&mut self, node: &str) -> u64
Increment a node’s counter (after a local event).
Sourcepub fn merge(&mut self, other: &Self)
pub fn merge(&mut self, other: &Self)
Merge with another vector clock (element-wise max). Returns self after merging.
Sourcepub fn compare(&self, other: &Self) -> CausalOrder
pub fn compare(&self, other: &Self) -> CausalOrder
Compare causal ordering with another clock.
Sourcepub fn happened_before_or_equal(&self, other: &Self) -> bool
pub fn happened_before_or_equal(&self, other: &Self) -> bool
Is this clock happened-before or equal to other?
Sourcepub fn is_concurrent(&self, other: &Self) -> bool
pub fn is_concurrent(&self, other: &Self) -> bool
Is this clock concurrent with other?
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of nodes in this clock.
Sourcepub fn total_time(&self) -> u64
pub fn total_time(&self) -> u64
Total logical time (sum of all counters).
Trait Implementations§
Source§impl Clone for VectorClock
impl Clone for VectorClock
Source§fn clone(&self) -> VectorClock
fn clone(&self) -> VectorClock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VectorClock
impl Debug for VectorClock
Source§impl<'de> Deserialize<'de> for VectorClock
impl<'de> Deserialize<'de> for VectorClock
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for VectorClock
impl Display for VectorClock
Source§impl PartialEq for VectorClock
impl PartialEq for VectorClock
Source§fn eq(&self, other: &VectorClock) -> bool
fn eq(&self, other: &VectorClock) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for VectorClock
impl Serialize for VectorClock
impl StructuralPartialEq for VectorClock
Auto Trait Implementations§
impl Freeze for VectorClock
impl RefUnwindSafe for VectorClock
impl Send for VectorClock
impl Sync for VectorClock
impl Unpin for VectorClock
impl UnsafeUnpin for VectorClock
impl UnwindSafe for VectorClock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more