@pwngh/economy-lab
    Preparing search index...

    Function scopeRouter

    • 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: readonly string[]

      Returns (scope: string) => string

      const route = scopeRouter(['economy-a', 'economy-b', 'economy-c']);
      const node = route(worldInstanceId); // send this scope's traffic to `node`