Bring up a SWIM failure detector. `cfg` — validated [`SwimConfig`]. An invalid config returns [`SwimError::InvalidConfig`] before any task is spawned. `local_id` — this node's canonical id. `local_addr` — the socket address the transport is already bound to. The membership list stores it verbatim for peers to echo back in probe responses. `seeds` — initial peer addresses. Empty list is legal and
(
cfg: SwimConfig,
local_id: NodeId,
local_addr: SocketAddr,
seeds: Vec<SocketAddr>,
transport: Arc<dyn Transport>,
)
| 86 | /// * `transport` — any [`Transport`] impl (UDP in production, the |
| 87 | /// in-memory fabric in tests). |
| 88 | pub async fn spawn( |
| 89 | cfg: SwimConfig, |
| 90 | local_id: NodeId, |
| 91 | local_addr: SocketAddr, |
| 92 | seeds: Vec<SocketAddr>, |
| 93 | transport: Arc<dyn Transport>, |
| 94 | ) -> Result<SwimHandle, SwimError> { |
| 95 | spawn_with_subscribers(cfg, local_id, local_addr, seeds, transport, Vec::new()).await |
| 96 | } |
| 97 | |
| 98 | /// Same as [`spawn`] but installs the given [`MembershipSubscriber`]s |
| 99 | /// on the detector before its run loop starts, so every state |