pub struct AckTracker { /* private fields */ }Expand description
Tracks transaction commit acknowledgments from replicas.
When the master commits a transaction, it may need to wait for one or more
replicas to acknowledge receipt before considering the transaction durable.
The AckTracker manages pending acknowledgments, recording which replicas
have acked which VLSNs, and detecting when sufficient acks have been
received or when ack timeouts have occurred.
Implementations§
Source§impl AckTracker
impl AckTracker
Sourcepub fn register(&self, vlsn: u64, needed_acks: u32)
pub fn register(&self, vlsn: u64, needed_acks: u32)
Register a new VLSN that needs acknowledgments.
If the VLSN is already registered, this is a no-op (the existing registration is preserved).
Sourcepub fn record_ack(&self, vlsn: u64, replica_name: &str) -> AckResult
pub fn record_ack(&self, vlsn: u64, replica_name: &str) -> AckResult
Record an acknowledgment from a replica for a VLSN.
Returns the result indicating whether the ack was accepted and whether it satisfied the durability requirement.
Sourcepub fn is_satisfied(&self, vlsn: u64) -> bool
pub fn is_satisfied(&self, vlsn: u64) -> bool
Check if a VLSN has sufficient acks.
Sourcepub fn received_count(&self, vlsn: u64) -> Option<u32>
pub fn received_count(&self, vlsn: u64) -> Option<u32>
Number of distinct replica acks recorded for vlsn, or None
if no registration exists for that VLSN.
Used by the F1 commit-coordinator path to report the partial
ack count when a commit times out without satisfying the
configured ReplicaAckPolicy.
Sourcepub fn cleanup_through(&self, vlsn: u64)
pub fn cleanup_through(&self, vlsn: u64)
Remove all pending acks for VLSNs <= the given value.
This is used to clean up acks for transactions that have been durably committed and no longer need tracking.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Get the number of pending (unsatisfied) acks.
Sourcepub fn check_timeouts(&self, timeout: Duration) -> Vec<u64>
pub fn check_timeouts(&self, timeout: Duration) -> Vec<u64>
Check for timed-out acks and return their VLSNs.
An ack is considered timed out if it was registered more than
timeout ago and has not yet been satisfied.
Side effect: for each unsatisfied, timed-out pending ack found
during this scan, total_timeouts is incremented by one.
Sourcepub fn get_total_acks(&self) -> u64
pub fn get_total_acks(&self) -> u64
Get total number of acks received across all VLSNs.
Sourcepub fn get_total_timeouts(&self) -> u64
pub fn get_total_timeouts(&self) -> u64
Get total number of ack timeouts.
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
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