pub struct CommitWaiter { /* private fields */ }Implementations§
Source§impl CommitWaiter
impl CommitWaiter
pub fn new() -> CommitWaiter
Sourcepub fn record_replica_ack(&self, replica_id: &str, lsn: u64)
pub fn record_replica_ack(&self, replica_id: &str, lsn: u64)
Replica reports it has durably persisted up to lsn.
Idempotent: only advances forward. Wakes every waiter so they
can recheck their threshold.
Sourcepub fn drop_replica(&self, replica_id: &str)
pub fn drop_replica(&self, replica_id: &str)
Best-effort cleanup when a replica disconnects. Removes its
durable LSN from the map so it doesn’t artificially inflate
ack_n counts. Wakes waiters because the count of replicas
at the target may have decreased — they need to re-evaluate
against the new reality (some will start failing if their
margin was thin).
Sourcepub fn snapshot(&self) -> Vec<(String, u64)>
pub fn snapshot(&self) -> Vec<(String, u64)>
Snapshot of the current durable-LSN map. Useful for observability and tests; doesn’t unblock waiters.
Sourcepub fn await_acks(
&self,
target_lsn: u64,
required: u32,
timeout: Duration,
) -> AwaitOutcome
pub fn await_acks( &self, target_lsn: u64, required: u32, timeout: Duration, ) -> AwaitOutcome
Block until at least required replicas have durable LSN
>= target_lsn, or timeout expires. required == 0 is a
no-op (returns NotRequired instantly).
Uses Condvar::wait_timeout to avoid spinning. On every wake
(whether from an ack or a spurious wakeup), we recompute the
count and either return or wait again with the remaining
budget.
Trait Implementations§
Source§impl Debug for CommitWaiter
impl Debug for CommitWaiter
Source§impl Default for CommitWaiter
impl Default for CommitWaiter
Source§fn default() -> CommitWaiter
fn default() -> CommitWaiter
Auto Trait Implementations§
impl !Freeze for CommitWaiter
impl RefUnwindSafe for CommitWaiter
impl Send for CommitWaiter
impl Sync for CommitWaiter
impl Unpin for CommitWaiter
impl UnsafeUnpin for CommitWaiter
impl UnwindSafe for CommitWaiter
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
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request