/
types.ts
31 lines (28 loc) 路 908 Bytes
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { RedisOptions } from "../../redis/RedisOptions";
export interface SentinelAddress {
port: number;
host: string;
family?: number;
}
// TODO: A proper typedef. This one only declares a small subset of all the members.
export interface RedisClient {
options: RedisOptions;
sentinel(subcommand: "sentinels", name: string): Promise<string[]>;
sentinel(
subcommand: "get-master-addr-by-name",
name: string
): Promise<string[]>;
sentinel(subcommand: "slaves", name: string): Promise<string[]>;
subscribe(...channelNames: string[]): Promise<number>;
on(
event: "message",
callback: (channel: string, message: string) => void
): void;
on(event: "error", callback: (error: Error) => void): void;
on(event: "reconnecting", callback: () => void): void;
disconnect(): void;
}
export interface Sentinel {
address: Partial<SentinelAddress>;
client: RedisClient;
}