Builds the assignment function over a fixed node list, by rendezvous (highest-random-weight)
hashing: each node's weight for a scope is a deterministic hash of (node, scope) and the
scope belongs to the highest, so every node computes the same owner with no ring state to
coordinate, and a membership change reassigns only the departed or arrived node's scopes.
Every process in the deployment must construct it from the same list (order does not matter;
the hash does not depend on position) for the assignments to agree. Throws CONFIG_INVALID on
an empty or duplicate-bearing node list.
The router only decides where new epochs open: live sessions on a moved scope finish via
epoch rotation and the orphan sweep (src/worker/orphans.ts).
Parameters
nodes: readonlystring[]
Returns (scope:string)=>string
Example
constroute = scopeRouter(['economy-a', 'economy-b', 'economy-c']); constnode = route(worldInstanceId); // send this scope's traffic to `node`
Builds the assignment function over a fixed node list, by rendezvous (highest-random-weight) hashing: each node's weight for a scope is a deterministic hash of (node, scope) and the scope belongs to the highest, so every node computes the same owner with no ring state to coordinate, and a membership change reassigns only the departed or arrived node's scopes. Every process in the deployment must construct it from the same list (order does not matter; the hash does not depend on position) for the assignments to agree. Throws CONFIG_INVALID on an empty or duplicate-bearing node list.
The router only decides where new epochs open: live sessions on a moved scope finish via epoch rotation and the orphan sweep (src/worker/orphans.ts).