ziron-rendezvous
Version:
24 lines (23 loc) • 717 B
TypeScript
export default class RendezvousMapper {
private readonly _fanout;
private readonly _hashAlgorithm;
private readonly _targetClusterSize;
private readonly _minClusterSize;
private _clusterCount;
private _clusters;
private _virtualLevelCount;
constructor(options?: {
fanout?: number;
hashAlgorithm?: string;
targetClusterSize?: number;
minClusterSize?: number;
});
private static _logx;
private static _getVirtualLevelCount;
private _hash;
private _generateClusters;
setSites(sites: string[]): void;
getSites(): string[];
findSite(key: string, salt?: number): string | null;
private _findIndexWithHighestRandomWeight;
}