RTCForge API Reference v1.1.1
    Preparing search index...

    Class GossipMembership

    Decentralized Membership that spreads node state across a cluster with SWIM-style anti-entropy gossip — no Redis/etcd, no central coordinator.

    Each node periodically gossips its view (self + known peers, each tagged with a monotonic incarnation and alive flag) to a random fanout of peers over a GossipTransport. Newer incarnations win; at equal incarnation a dead claim overrides a live one, and a node refutes a false death report by advancing its own incarnation. Peers not heard from within deadTimeoutMs are marked dead and eventually tombstone-GC'd. Pair with MembershipReconciler to react to joins/leaves. This is AP (available under partition) with no quorum, so treat ownership derived from it as advisory unless fenced.

    Implements

    Index

    Constructors

    Methods

    • Registers (or refreshes) a node with a heartbeat lifetime.

      Parameters

      • node: NodeInfo

        The node to register.

      • Optional_ttlMs: number

        Lifetime in milliseconds; the node is considered gone if not refreshed within this window.

      Returns Promise<void>

    • Subscribes to membership changes.

      Parameters

      • callback: (nodes: NodeInfo[]) => void

        Invoked with the full set of live nodes whenever membership changes.

      Returns () => void

      A function that cancels the subscription when called.