UNPKG

1.06 kBTypeScriptView Raw
1/// <reference types="node" />
2import { SrvRecord } from "dns";
3export declare type NodeKey = string;
4export declare type NodeRole = "master" | "slave" | "all";
5export interface RedisOptions {
6 port: number;
7 host: string;
8 username?: string;
9 password?: string;
10 [key: string]: any;
11}
12export interface SrvRecordsGroup {
13 totalWeight: number;
14 records: SrvRecord[];
15}
16export interface GroupedSrvRecords {
17 [key: number]: SrvRecordsGroup;
18}
19export declare function getNodeKey(node: RedisOptions): NodeKey;
20export declare function nodeKeyToRedisOptions(nodeKey: NodeKey): RedisOptions;
21export declare function normalizeNodeOptions(nodes: Array<string | number | object>): RedisOptions[];
22export declare function getUniqueHostnamesFromOptions(nodes: RedisOptions[]): string[];
23export declare function groupSrvRecords(records: SrvRecord[]): GroupedSrvRecords;
24export declare function weightSrvRecords(recordsGroup: SrvRecordsGroup): SrvRecord;
25export declare function getConnectionName(component: any, nodeConnectionName: any): string;