pub struct QuorumTracker { /* private fields */ }Expand description
Tracks pending operations waiting for quorum acknowledgment.
Supports dual-config quorum: during reconfiguration, an operation must be acknowledged by write quorum from BOTH current and previous configurations. A replica present in both configs counts toward both quorums with a single ACK.
Implementations§
Source§impl QuorumTracker
impl QuorumTracker
pub fn new() -> Self
pub fn committed_lsn(&self) -> Lsn
Sourcepub fn set_catch_up_configuration(
&mut self,
current_members: HashSet<ReplicaId>,
current_write_quorum: u32,
previous_members: HashSet<ReplicaId>,
previous_write_quorum: u32,
must_catch_up_ids: HashSet<ReplicaId>,
member_progress: HashMap<ReplicaId, Lsn>,
)
pub fn set_catch_up_configuration( &mut self, current_members: HashSet<ReplicaId>, current_write_quorum: u32, previous_members: HashSet<ReplicaId>, previous_write_quorum: u32, must_catch_up_ids: HashSet<ReplicaId>, member_progress: HashMap<ReplicaId, Lsn>, )
Update to dual-config mode (during reconfiguration).
Seeds replica_acked_lsn for must_catch_up replicas from their
reported current_progress (the operator knows each replica’s LSN).
Sourcepub fn set_current_configuration(
&mut self,
current_members: HashSet<ReplicaId>,
current_write_quorum: u32,
)
pub fn set_current_configuration( &mut self, current_members: HashSet<ReplicaId>, current_write_quorum: u32, )
Update to single-config mode (reconfiguration complete).
Sourcepub fn register(
&mut self,
lsn: Lsn,
primary_id: ReplicaId,
reply: Sender<Result<Lsn>>,
)
pub fn register( &mut self, lsn: Lsn, primary_id: ReplicaId, reply: Sender<Result<Lsn>>, )
Register a new pending operation. The primary’s own ACK is counted immediately (primary_id).
Sourcepub fn ack(&mut self, lsn: Lsn, replica_id: ReplicaId)
pub fn ack(&mut self, lsn: Lsn, replica_id: ReplicaId)
Record an ACK from a secondary. If this causes quorum to be met, the operation is committed and the reply is sent.
Sourcepub fn fail_all(&mut self, error: KubericError)
pub fn fail_all(&mut self, error: KubericError)
Fail all pending operations (e.g., on role change or close).
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Number of pending (uncommitted) operations.
Sourcepub fn wait_for_catch_up(
&mut self,
mode: ReplicaSetQuorumMode,
reply: Sender<Result<()>>,
)
pub fn wait_for_catch_up( &mut self, mode: ReplicaSetQuorumMode, reply: Sender<Result<()>>, )
Register a waiter that will be notified when catch-up is complete.
Allmode: all pending ops committed (quorum met for each).Writemode: all pending ops committed AND everymust_catch_upreplica has individually ACKed all ops.
If already caught up, replies immediately.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QuorumTracker
impl !RefUnwindSafe for QuorumTracker
impl Send for QuorumTracker
impl Sync for QuorumTracker
impl Unpin for QuorumTracker
impl UnsafeUnpin for QuorumTracker
impl !UnwindSafe for QuorumTracker
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> 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