allocateShards
allocateShards(
shardIds,clusterCount):number[][]
Defined in: packages/sharding/src/context.ts:62
Splits shard IDs across clusters in contiguous blocks, in order. When they do
not divide evenly the first clusters get one more: 10 shards over 3 clusters
are [0-3] [4-6] [7-9]. The same input always gives the same output.
Parameters
Section titled “Parameters”shardIds
Section titled “shardIds”readonly number[]
clusterCount
Section titled “clusterCount”number
Returns
Section titled “Returns”number[][]
One list per cluster (empty ones at the end when there are more clusters than shards).
Throws
Section titled “Throws”If clusterCount is not a positive integer.