pub struct VectorClock {
pub counters: HashMap<NodeId, u64>,
}Expand description
Vector clock for tracking causal ordering in ternary distributed systems.
Maps node IDs to monotonically increasing counters. Two vector clocks can be compared to determine happened-before, concurrent, or equal relationships.
Fields§
§counters: HashMap<NodeId, u64>Implementations§
Source§impl VectorClock
impl VectorClock
pub fn new() -> Self
pub fn increment(&mut self, node_id: NodeId) -> u64
pub fn get(&self, node_id: NodeId) -> u64
pub fn merge(&self, other: &VectorClock) -> VectorClock
Sourcepub fn happened_before(&self, other: &VectorClock) -> bool
pub fn happened_before(&self, other: &VectorClock) -> bool
Returns true if self happened-before other.
Sourcepub fn is_concurrent(&self, other: &VectorClock) -> bool
pub fn is_concurrent(&self, other: &VectorClock) -> bool
Returns true if self and other are concurrent (neither happened-before the other).
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
impl Eq 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 PartialOrd for VectorClock
impl PartialOrd 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