pub struct AckTracker { /* private fields */ }Expand description
Collects remote acks against a deadline. Pure logic — no I/O.
Implementations§
Source§impl AckTracker
impl AckTracker
Sourcepub fn new(policy: QuorumPolicy, now: Instant) -> Self
pub fn new(policy: QuorumPolicy, now: Instant) -> Self
Create a tracker for one quorum-write attempt. now is injected
for deterministic tests.
Sourcepub fn record_local(&mut self)
pub fn record_local(&mut self)
Record the local commit. Call once the originating node has durably persisted the memory.
Sourcepub fn record_peer_ack(&mut self, peer_id: impl Into<String>)
pub fn record_peer_ack(&mut self, peer_id: impl Into<String>)
Record a peer ack. peer_id is the caller’s opaque identifier
(typically the peer’s mTLS fingerprint or agent id). Duplicate
peer_id values are deduplicated.
Sourcepub fn record_id_drift(&mut self, peer_id: impl Into<String>)
pub fn record_id_drift(&mut self, peer_id: impl Into<String>)
Record that a peer returned success but with a memory id that differs from the local commit id. Does NOT count toward the quorum and surfaces in metrics.
Sourcepub fn is_quorum_met(&self, now: Instant) -> bool
pub fn is_quorum_met(&self, now: Instant) -> bool
True when the quorum is met: local commit + at least W-1
unique peer acks, and the deadline has not elapsed at now.
Sourcepub fn finalise(&self, now: Instant) -> Result<usize, QuorumError>
pub fn finalise(&self, now: Instant) -> Result<usize, QuorumError>
Finalise the attempt. Returns Ok(count_of_distinct_acks) if
quorum met, else Err(QuorumError::QuorumNotMet{…}).
§Errors
Returns QuorumError::QuorumNotMet if the deadline elapsed
before W acks arrived.
Sourcepub fn id_drift_count(&self) -> usize
pub fn id_drift_count(&self) -> usize
Count of peers that reported divergent memory ids for this write. Exposed for metrics + debugging.
Sourcepub fn acked_peer_ids(&self) -> &HashSet<String>
pub fn acked_peer_ids(&self) -> &HashSet<String>
H9 (v0.7.0 round-2) — opaque view onto the set of peer ids
that have positively acknowledged this quorum write. Exposed
so broadcast_store_quorum (and its delete/archive siblings)
can compute missing = configured_peers - acked_peers and
surface that set in a tracing::warn! when quorum is met but
some peers did not ack — operators need to see the gap in
logs before a follow-up sync cycle catches the peer up.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AckTracker
impl RefUnwindSafe for AckTracker
impl Send for AckTracker
impl Sync for AckTracker
impl Unpin for AckTracker
impl UnsafeUnpin for AckTracker
impl UnwindSafe for AckTracker
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more