Select a node from the candidate set.
Eligible nodes to choose from.
Optionalregion: stringOptional preferred region; strategies typically restrict selection to nodes in this region when any exist, otherwise fall back to the full set.
Optionalkey: stringOptional routing key (for example the room id) used by deterministic strategies to map the same key to the same node.
The selected node, or undefined when candidates is empty.
PlacementStrategy that pins a key to a node via consistent hashing.
Remarks
Preferring the given
region, it maps the routingkey(e.g. a room id) onto a capacity-weighted HashRing so the same key consistently lands on the same node while the node set is stable, and only minimally reshuffles when nodes join or leave. The ring is rebuilt only when the candidate pool's id/weight signature changes. With nokey, it falls back to the first candidate.