feat(hashring): add custom hash function type to algorithm (#43161)

This commit is contained in:
Super Zheng 2020-03-19 04:23:00 +08:00 committed by GitHub
parent 4a852d7a7d
commit 76bb329370
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,8 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />
declare namespace HashRing {
interface HashRingOptions {
/**
@ -57,8 +59,11 @@ declare namespace HashRing {
}
declare class HashRing {
constructor(servers: HashRing.Servers,
algorithm?: string, options?: Partial<HashRing.HashRingOptions>);
constructor(
servers: HashRing.Servers,
algorithm?: string | ((key: string) => string | Buffer),
options?: Partial<HashRing.HashRingOptions>,
);
/**
* Generates the continuum of server a.k.a as the Hash Ring