///
import { EventEmitter } from "events";
import { NodeKey, IRedisOptions, NodeRole } from "./util";
import { CallbackFunction } from "../types";
import { IClusterOptions } from "./ClusterOptions";
/**
* Client for the official Redis Cluster
*
* @class Cluster
* @extends {EventEmitter}
*/
declare class Cluster extends EventEmitter {
private options;
private startupNodes;
private connectionPool;
private slots;
private manuallyClosing;
private retryAttempts;
private delayQueue;
private offlineQueue;
private subscriber;
private slotsTimer;
private reconnectTimeout;
private status;
private isRefreshing;
/**
* Every time Cluster#connect() is called, this value will be
* auto-incrementing. The purpose of this value is used for
* discarding previous connect attampts when creating a new
* connection.
*
* @private
* @type {number}
* @memberof Cluster
*/
private connectionEpoch;
/**
* Creates an instance of Cluster.
*
* @param {((string | number | object)[])} startupNodes
* @param {IClusterOptions} [options={}]
* @memberof Cluster
*/
constructor(startupNodes: (string | number | object)[], options?: IClusterOptions);
resetOfflineQueue(): void;
clearNodesRefreshInterval(): void;
resetNodesRefreshInterval(): void;
/**
* Connect to a cluster
*
* @returns {Promise}
* @memberof Cluster
*/
connect(): Promise;
/**
* Called when closed to check whether a reconnection should be made
*
* @private
* @memberof Cluster
*/
private handleCloseEvent;
/**
* Disconnect from every node in the cluster.
*
* @param {boolean} [reconnect=false]
* @memberof Cluster
*/
disconnect(reconnect?: boolean): void;
/**
* Quit the cluster gracefully.
*
* @param {CallbackFunction<'OK'>} [callback]
* @returns {Promise<'OK'>}
* @memberof Cluster
*/
quit(callback?: CallbackFunction<"OK">): Promise<"OK">;
/**
* Create a new instance with the same startup nodes and options as the current one.
*
* @example
* ```js
* var cluster = new Redis.Cluster([{ host: "127.0.0.1", port: "30001" }]);
* var anotherCluster = cluster.duplicate();
* ```
*
* @public
* @param {((string | number | object)[])} [overrideStartupNodes=[]]
* @param {IClusterOptions} [overrideOptions={}]
* @memberof Cluster
*/
duplicate(overrideStartupNodes?: any[], overrideOptions?: {}): Cluster;
/**
* Get nodes with the specified role
*
* @param {NodeRole} [role='all']
* @returns {any[]}
* @memberof Cluster
*/
nodes(role?: NodeRole): any[];
/**
* Change cluster instance's status
*
* @private
* @param {ClusterStatus} status
* @memberof Cluster
*/
private setStatus;
/**
* Refresh the slot cache
*
* @private
* @param {CallbackFunction} [callback]
* @memberof Cluster
*/
private refreshSlotsCache;
/**
* Flush offline queue with error.
*
* @param {Error} error
* @memberof Cluster
*/
private flushQueue;
executeOfflineCommands(): void;
natMapper(nodeKey: NodeKey | IRedisOptions): IRedisOptions;
sendCommand(command: any, stream: any, node: any): any;
handleError(error: any, ttl: any, handlers: any): void;
getInfoFromNode(redis: any, callback: any): any;
/**
* Check whether Cluster is able to process commands
*
* @param {Function} callback
* @private
*/
private readyCheck;
private dnsLookup;
/**
* Normalize startup nodes, and resolving hostnames to IPs.
*
* This process happens every time when #connect() is called since
* #startupNodes and DNS records may chanage.
*
* @private
* @returns {Promise}
*/
private resolveStartupNodeHostnames;
}
export default Cluster;