pub struct AppliedSet {
pub last_applied: BTreeMap<String, u64>,
pub schema_version: u32,
}Expand description
Per-origin “highest applied HLC” tracker.
Fields§
§last_applied: BTreeMap<String, u64>node_id (as a UUID hyphenated string) → highest hlc applied
from that origin.
schema_version: u32On-disk schema version of this struct (currently 1).
Implementations§
Source§impl AppliedSet
impl AppliedSet
Sourcepub fn load(data_dir: &Path) -> Result<Self>
pub fn load(data_dir: &Path) -> Result<Self>
Loads the AppliedSet from <data_dir>/_replication/state.json,
returning AppliedSet::default() when the file is missing.
Sourcepub fn save(&self, data_dir: &Path) -> Result<()>
pub fn save(&self, data_dir: &Path) -> Result<()>
Persists the AppliedSet to <data_dir>/_replication/state.json.
Creates the directory if it doesn’t exist. The write is
best-effort atomic via tmp + rename.
Sourcepub fn observe(&mut self, origin: u128, hlc: Hlc) -> ObserveOutcome
pub fn observe(&mut self, origin: u128, hlc: Hlc) -> ObserveOutcome
Records that we have applied an HLC from a given origin. Returns
New if hlc advanced our high-water mark, AlreadyApplied
otherwise (idempotent replay).
Sourcepub fn high_water(&self, origin: u128) -> Hlc
pub fn high_water(&self, origin: u128) -> Hlc
Returns the highest-applied HLC for origin, or Hlc::ZERO
if we have never observed it.
Trait Implementations§
Source§impl Clone for AppliedSet
impl Clone for AppliedSet
Source§fn clone(&self) -> AppliedSet
fn clone(&self) -> AppliedSet
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 AppliedSet
impl Debug for AppliedSet
Source§impl Default for AppliedSet
impl Default for AppliedSet
Source§impl<'de> Deserialize<'de> for AppliedSet
impl<'de> Deserialize<'de> for AppliedSet
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 AppliedSet
impl RefUnwindSafe for AppliedSet
impl Send for AppliedSet
impl Sync for AppliedSet
impl Unpin for AppliedSet
impl UnsafeUnpin for AppliedSet
impl UnwindSafe for AppliedSet
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