import { type Pipeable } from "./Pipeable.js";
import * as PrimaryKey from "./PrimaryKey.js";
declare const TypeId: "~effect/cluster/HashRing";
/**
* @since 3.19.0
* @category Models
* @experimental
*/
export interface HashRing extends Pipeable, Iterable {
readonly [TypeId]: typeof TypeId;
readonly baseWeight: number;
totalWeightCache: number;
readonly nodes: Map;
ring: Array<[hash: number, node: string]>;
}
/**
* @since 3.19.0
* @category Guards
* @experimental
*/
export declare const isHashRing: (u: unknown) => u is HashRing;
/**
* @since 3.19.0
* @category Constructors
* @experimental
*/
export declare const make: (options?: {
readonly baseWeight?: number | undefined;
}) => HashRing;
/**
* Add new nodes to the ring. If a node already exists in the ring, it
* will be updated. For example, you can use this to update the node's weight.
*
* @since 3.19.0
* @category Combinators
* @experimental
*/
export declare const addMany: {
/**
* Add new nodes to the ring. If a node already exists in the ring, it
* will be updated. For example, you can use this to update the node's weight.
*
* @since 3.19.0
* @category Combinators
* @experimental
*/
(nodes: Iterable, options?: {
readonly weight?: number | undefined;
}): (self: HashRing) => HashRing;
/**
* Add new nodes to the ring. If a node already exists in the ring, it
* will be updated. For example, you can use this to update the node's weight.
*
* @since 3.19.0
* @category Combinators
* @experimental
*/
(self: HashRing, nodes: Iterable, options?: {
readonly weight?: number | undefined;
}): HashRing;
};
/**
* Add a new node to the ring. If the node already exists in the ring, it
* will be updated. For example, you can use this to update the node's weight.
*
* @since 3.19.0
* @category Combinators
* @experimental
*/
export declare const add: {
/**
* Add a new node to the ring. If the node already exists in the ring, it
* will be updated. For example, you can use this to update the node's weight.
*
* @since 3.19.0
* @category Combinators
* @experimental
*/
(node: A, options?: {
readonly weight?: number | undefined;
}): (self: HashRing) => HashRing;
/**
* Add a new node to the ring. If the node already exists in the ring, it
* will be updated. For example, you can use this to update the node's weight.
*
* @since 3.19.0
* @category Combinators
* @experimental
*/
(self: HashRing, node: A, options?: {
readonly weight?: number | undefined;
}): HashRing;
};
/**
* Removes the node from the ring. No-op's if the node does not exist.
*
* @since 3.19.0
* @category Combinators
* @experimental
*/
export declare const remove: {
/**
* Removes the node from the ring. No-op's if the node does not exist.
*
* @since 3.19.0
* @category Combinators
* @experimental
*/
(node: A): (self: HashRing) => HashRing;
/**
* Removes the node from the ring. No-op's if the node does not exist.
*
* @since 3.19.0
* @category Combinators
* @experimental
*/
(self: HashRing, node: A): HashRing;
};
/**
* @since 3.19.0
* @category Combinators
* @experimental
*/
export declare const has: {
/**
* @since 3.19.0
* @category Combinators
* @experimental
*/
(node: A): (self: HashRing) => boolean;
/**
* @since 3.19.0
* @category Combinators
* @experimental
*/
(self: HashRing, node: A): boolean;
};
/**
* Gets the node which should handle the given input. Returns undefined if
* the hashring has no elements with weight.
*
* @since 3.19.0
* @category Combinators
* @experimental
*/
export declare const get: (self: HashRing, input: string) => A | undefined;
/**
* Distributes `count` shards across the nodes in the ring, attempting to
* balance the number of shards allocated to each node. Returns undefined if
* the hashring has no elements with weight.
*
* @since 3.19.0
* @category Combinators
* @experimental
*/
export declare const getShards: (self: HashRing, count: number) => Array | undefined;
export {};
//# sourceMappingURL=HashRing.d.ts.map