MCPcopy Create free account
hub / github.com/Effect-TS/effect / getShardId

Function getShardId

packages/cluster/src/Sharding.ts:250–253  ·  view source on GitHub ↗
(entityId: EntityId, group: string)

Source from the content-addressed store, hash-verified

248 Option.isSome(config.runnerAddress) && Equal.equals(address, config.runnerAddress.value)
249
250 function getShardId(entityId: EntityId, group: string): ShardId {
251 const id = Math.abs(hashString(entityId) % config.shardsPerGroup) + 1
252 return makeShardId(group, id)
253 }
254
255 function isEntityOnLocalShards(address: EntityAddress): boolean {
256 return MutableHashSet.has(acquiredShards, address.shardId)

Callers 1

Sharding.tsFile · 0.70

Calls 2

hashStringFunction · 0.85
makeShardIdFunction · 0.85

Tested by

no test coverage detected