Skip to content

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.

readonly number[]

number

number[][]

One list per cluster (empty ones at the end when there are more clusters than shards).

If clusterCount is not a positive integer.