pub struct StateVersion {
pub vector_clock: VectorClock,
pub timestamp_ms: u128,
}Expand description
State version representing a causal snapshot of the system Tracks which instance is at which logical clock value
Fields§
§vector_clock: VectorClockVector clock representing this state
timestamp_ms: u128Timestamp when this version was created (ms since UNIX epoch)
Implementations§
Source§impl StateVersion
impl StateVersion
Sourcepub fn new(vector_clock: VectorClock, timestamp_ms: u128) -> Self
pub fn new(vector_clock: VectorClock, timestamp_ms: u128) -> Self
Create a new state version
Sourcepub fn from_clocks(clocks: HashMap<String, u64>, timestamp_ms: u128) -> Self
pub fn from_clocks(clocks: HashMap<String, u64>, timestamp_ms: u128) -> Self
Create a state version from clocks
Sourcepub fn happens_before(&self, other: &StateVersion) -> bool
pub fn happens_before(&self, other: &StateVersion) -> bool
Check if this state version causally precedes another
Sourcepub fn is_concurrent(&self, other: &StateVersion) -> bool
pub fn is_concurrent(&self, other: &StateVersion) -> bool
Check if two state versions are concurrent
Sourcepub fn causal_cmp(&self, other: &StateVersion) -> Ordering
pub fn causal_cmp(&self, other: &StateVersion) -> Ordering
Get causal ordering between two state versions
Trait Implementations§
Source§impl Clone for StateVersion
impl Clone for StateVersion
Source§impl Debug for StateVersion
impl Debug for StateVersion
Source§impl<'de> Deserialize<'de> for StateVersion
impl<'de> Deserialize<'de> for StateVersion
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
impl Eq for StateVersion
Source§impl PartialEq for StateVersion
impl PartialEq for StateVersion
Source§impl Serialize for StateVersion
impl Serialize for StateVersion
impl StructuralPartialEq for StateVersion
Auto Trait Implementations§
impl Freeze for StateVersion
impl RefUnwindSafe for StateVersion
impl Send for StateVersion
impl Sync for StateVersion
impl Unpin for StateVersion
impl UnsafeUnpin for StateVersion
impl UnwindSafe for StateVersion
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