Skip to main content

FailoverTransport

Trait FailoverTransport 

Source
pub trait FailoverTransport {
    // Required methods
    fn freeze_primary(&mut self) -> u64;
    fn resume_primary(&mut self);
    fn elapsed(&self) -> Duration;
    fn poll_target_frontier(&mut self) -> u64;
    fn commit_handover(&mut self, new_term: u64);
}
Expand description

Cluster mutations and the clock the coordinator drives, injected so the state machine stays pure and deterministically testable.

Implementors back these onto the real WAL frontier, the replica registry, and the gRPC role-swap in production; tests back them onto a scripted fake.

Required Methods§

Source

fn freeze_primary(&mut self) -> u64

Pause writes on the current primary and return the frontier LSN (current_lsn) frozen at the instant writes stopped. After this returns, no new LSN is minted, so the returned value is a fixed catch-up target.

Source

fn resume_primary(&mut self)

Resume writes on the old primary. Called only when a coordinated handover aborts, so the cluster keeps serving with no lost write.

Source

fn elapsed(&self) -> Duration

Time elapsed since the failover began, so the coordinator can enforce the deadline without owning a clock.

Source

fn poll_target_frontier(&mut self) -> u64

Block for one poll interval (clamped by the caller’s remaining deadline in spirit), then return the target replica’s current acknowledged (durable) frontier LSN.

Source

fn commit_handover(&mut self, new_term: u64)

Commit the role swap: stamp new_term on the target (promoting it to primary) and reconfigure the old primary to stream as a replica of the new primary under new_term.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§