pub struct SwimHandler { /* private fields */ }Expand description
The tokio-facing I/O shell around SwimState.
It owns the pure state machine behind a Mutex, converts wall
time into the logical protocol-period ticks the state machine
speaks, and reconciles the machine’s peer-state transitions onto
the shared ServerPool. Its SwimHandler::evaluate returns
the same Vec<(u32, PeerState)> shape as
crate::cluster::gossip::GossipHandler::evaluate, so the run
loop and every downstream consumer (dispatch, hinted handoff) are
identical regardless of which membership backend is selected.
The actual ping / ping-req socket traffic and the ack-timeout
wait live in the run loop that calls SwimHandler::on_probe /
SwimHandler::on_update; this shell deliberately holds no
sockets so the protocol logic stays in the deterministically
testable SwimState.
Implementations§
Source§impl SwimHandler
impl SwimHandler
Sourcepub fn new(
pool: Arc<ServerPool>,
me: usize,
n: usize,
cfg: SwimConfig,
period: Duration,
) -> Self
pub fn new( pool: Arc<ServerPool>, me: usize, n: usize, cfg: SwimConfig, period: Duration, ) -> Self
Build a handler for local node me over a pool of n
peers, using cfg tunables and a period-length protocol
interval.
Sourcepub fn pool(&self) -> &Arc<ServerPool> ⓘ
pub fn pool(&self) -> &Arc<ServerPool> ⓘ
Borrow the owning pool.
Sourcepub fn on_probe(
&self,
now: Instant,
target: usize,
result: ProbeResult,
) -> Vec<(u32, PeerState)>
pub fn on_probe( &self, now: Instant, target: usize, result: ProbeResult, ) -> Vec<(u32, PeerState)>
Feed a completed probe outcome into the state machine and reconcile the result onto the pool. Returns the applied transitions.
Trait Implementations§
Source§impl Clone for SwimHandler
impl Clone for SwimHandler
Source§fn clone(&self) -> SwimHandler
fn clone(&self) -> SwimHandler
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more