Skip to main content

spawn

Function spawn 

Source
pub async fn spawn(
    cfg: SwimConfig,
    local_id: NodeId,
    local_addr: SocketAddr,
    seeds: Vec<SocketAddr>,
    transport: Arc<dyn Transport>,
) -> Result<SwimHandle, SwimError>
Expand description

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 yields a solo-cluster detector that does nothing interesting until a peer arrives via an external join.
  • transport — any Transport impl (UDP in production, the in-memory fabric in tests).