<A extends PrimaryKey.PrimaryKey>(options?: {
readonly baseWeight?: number | undefined
}): HashRing<A>Creates an empty HashRing.
When to use
Use to create an empty weighted consistent-hashing ring with the default or custom virtual-point density.
Details
baseWeight controls how many virtual points are added for a node with
weight 1; it defaults to 128 and is clamped to at least 1.
export const const make: <
A extends PrimaryKey.PrimaryKey
>(options?: {
readonly baseWeight?: number | undefined
}) => HashRing<A>
Creates an empty HashRing.
When to use
Use to create an empty weighted consistent-hashing ring with the default or
custom virtual-point density.
Details
baseWeight controls how many virtual points are added for a node with
weight 1; it defaults to 128 and is clamped to at least 1.
make = <function (type parameter) A in <A extends PrimaryKey.PrimaryKey>(options?: {
readonly baseWeight?: number | undefined;
}): HashRing<A>
A extends import PrimaryKeyPrimaryKey.PrimaryKey>(options: | {
readonly baseWeight?: number | undefined
}
| undefined
options?: {
readonly baseWeight?: number | undefinedbaseWeight?: number | undefined
}): interface HashRing<A extends PrimaryKey.PrimaryKey>A weighted consistent-hashing ring for assigning inputs to nodes with stable
remapping as nodes are added or removed.
When to use
Use to maintain a mutable weighted hash ring for routing keys or shards to
nodes identified by PrimaryKey.
Details
Nodes are identified by their PrimaryKey value and can be iterated from the
ring.
HashRing<function (type parameter) A in <A extends PrimaryKey.PrimaryKey>(options?: {
readonly baseWeight?: number | undefined;
}): HashRing<A>
A> => {
const const self: anyself = var Object: ObjectConstructorProvides functionality common to all JavaScript objects.
Object.ObjectConstructor.create(o: object | null): any (+1 overload)Creates an object that has the specified prototype or that has null prototype.
create(const Proto: {
"~effect/cluster/HashRing": "~effect/cluster/HashRing"
[Symbol.iterator]<
A extends PrimaryKey.PrimaryKey
>(
this: HashRing<A>
): Iterator<A>
toJSON(this: HashRing<any>): {
_id: string
baseWeight: number
nodes: Array<any>
}
pipe(): unknown
toString(): string
[NodeInspectSymbol](): any
}
Proto)
const self: anyself.baseWeight = var Math: MathAn intrinsic object that provides basic mathematics functionality and constants.
Math.Math.max(...values: number[]): numberReturns the larger of a set of supplied numeric expressions.
max(options: | {
readonly baseWeight?: number | undefined
}
| undefined
options?.baseWeight?: number | undefinedbaseWeight ?? 128, 1)
const self: anyself.totalWeightCache = 0
const self: anyself.nodes = new var Map: MapConstructor
new () => Map<any, any> (+3 overloads)
Map()
const self: anyself.ring = []
return const self: anyself
}