Time source used for TTL expiry.
OptionalsweepIntervalMs: numberWhen set (> 0), a background timer prunes
expired nodes every this-many milliseconds and notifies watchers, so a
silently-dead node's TTL expiry fires watch/reconciler onRemove
without anything having to poll list. Omit to disable (watchers
then only fire on register/deregister and explicit list()).
Removes a node from the registry.
The id of the node to remove.
Returns a snapshot of the currently live nodes.
The live nodes; expired entries are pruned before the snapshot is taken.
Registers (or refreshes) a node with a heartbeat lifetime.
The node to register.
Lifetime in milliseconds; the node is considered gone if not refreshed within this window.
Stops the background TTL sweeper (if one was started). Idempotent.
Subscribes to membership changes.
Invoked with the full set of live nodes whenever membership changes.
A function that cancels the subscription when called.
In-process Membership backed by a
Mapwith TTL-based expiry.Remarks
The default implementation for single-node deployments and tests: nodes are held in memory, each with an expiry derived from the
ttlMspassed to register. Entries whose TTL has lapsed are pruned lazily on list and, if asweepIntervalMsis supplied, proactively by a background timer that fires watchers when a silently-dead node expires. Watchers receive the full live set on every change. For multi-node clusters useGossipMembershipinstead.