Commit 3c742b6
committed
feat(cluster): implement SWIM failure detector
Add the core SWIM/Lifeguard failure detection runtime to nodedb-cluster.
The detector drives a tokio::select! probe loop that separates I/O from
logic via a Transport trait, allowing deterministic in-process testing
with InMemoryTransport and edge-drop/partition injection.
- FailureDetector: main runtime task owning the probe loop, suspicion
timer, and inflight-probe registry
- ProbeRound: Lifeguard ping → ping-req indirect probe sequence with
per-probe-id oneshot correlation
- ProbeScheduler: random-permutation epoch scheduler (every peer probed
once per epoch, per Lifeguard §4.3)
- SuspicionTimer: timeout math per Lifeguard §3.1
(max(min, mult * log2(n) * probe_interval)) with drain_expired polling
- Transport / InMemoryTransport / TransportFabric: Send+Sync async trait
with mpsc-backed in-memory impl for unit tests
- SwimError variants TransportClosed and ProbeInflightOverflow
async-trait added to nodedb-cluster dependencies to support the
Transport trait definition.1 parent d4c88df commit 3c742b6
9 files changed
Lines changed: 1504 additions & 0 deletions
File tree
- nodedb-cluster
- src/swim
- detector
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
0 commit comments