pub struct VersionVector { /* private fields */ }Expand description
Version vector tracking causal progress per region.
Maps region_id → latest HLC timestamp seen from that region.
Implementations§
Source§impl VersionVector
impl VersionVector
Sourcepub fn advance(&mut self, region_id: &str, ts: HlcTimestamp) -> bool
pub fn advance(&mut self, region_id: &str, ts: HlcTimestamp) -> bool
Update the vector entry for a region if the given timestamp is newer. Returns true if the vector was actually updated (i.e., the event is new).
Sourcepub fn is_new(&self, region_id: &str, ts: &HlcTimestamp) -> bool
pub fn is_new(&self, region_id: &str, ts: &HlcTimestamp) -> bool
Check if a timestamp from a region is new (not yet seen).
Sourcepub fn get(&self, region_id: &str) -> Option<&HlcTimestamp>
pub fn get(&self, region_id: &str) -> Option<&HlcTimestamp>
Get the latest timestamp for a region.
Sourcepub fn merge(&mut self, other: &VersionVector)
pub fn merge(&mut self, other: &VersionVector)
Merge another version vector into this one (pointwise max).
Sourcepub fn entries(&self) -> &BTreeMap<String, HlcTimestamp>
pub fn entries(&self) -> &BTreeMap<String, HlcTimestamp>
Get all entries.
Trait Implementations§
Source§impl Clone for VersionVector
impl Clone for VersionVector
Source§fn clone(&self) -> VersionVector
fn clone(&self) -> VersionVector
Returns a duplicate of the value. Read more
1.0.0 · 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 VersionVector
impl Debug for VersionVector
Source§impl Default for VersionVector
impl Default for VersionVector
Source§impl<'de> Deserialize<'de> for VersionVector
impl<'de> Deserialize<'de> for VersionVector
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
Auto Trait Implementations§
impl Freeze for VersionVector
impl RefUnwindSafe for VersionVector
impl Send for VersionVector
impl Sync for VersionVector
impl Unpin for VersionVector
impl UnsafeUnpin for VersionVector
impl UnwindSafe for VersionVector
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