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

Function get

packages/effect/src/HashRing.ts:298–305  ·  view source on GitHub ↗
(self: HashRing<A>, input: string)

Source from the content-addressed store, hash-verified

296 * @since 3.19.0
297 */
298export const get = <A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, input: string): A | undefined => {
299 if (self.ring.length === 0) {
300 return undefined
301 }
302 const index = getIndexForInput(self, Hash.string(input))[0]
303 const node = self.ring[index][1]!
304 return self.nodes.get(node)![0]
305}
306
307/**
308 * Computes a balanced shard distribution across the nodes in the ring.

Callers

nothing calls this directly

Calls 2

getIndexForInputFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected