///
///
import { RedisClusterOptions } from '.';
import { RedisClientType } from '../client';
import { EventEmitter } from 'node:stream';
import { ChannelListeners } from '../client/pub-sub';
import { RedisArgument, RedisFunctions, RedisModules, RedisScripts, RespVersions, TypeMapping } from '../RESP/types';
import { PooledClientSideCacheProvider } from '../client/cache';
interface NodeAddress {
host: string;
port: number;
}
export type NodeAddressMap = {
[address: string]: NodeAddress;
} | ((address: string) => NodeAddress | undefined);
export interface Node {
address: string;
client?: RedisClientType;
connectPromise?: Promise>;
}
export interface ShardNode extends Node, NodeAddress {
id: string;
readonly: boolean;
}
export interface MasterNode extends ShardNode {
pubSub?: {
connectPromise?: Promise>;
client: RedisClientType;
};
}
export interface Shard {
master: MasterNode;
replicas?: Array>;
nodesIterator?: IterableIterator>;
}
type PubSubNode = (Omit, 'client'> & Required, 'client'>>);
export type OnShardedChannelMovedError = (err: unknown, channel: string, listeners?: ChannelListeners) => void;
export default class RedisClusterSlots {
#private;
slots: Shard[];
masters: MasterNode[];
replicas: ShardNode[];
readonly nodeByAddress: Map | MasterNode>;
pubSubNode?: PubSubNode;
clientSideCache?: PooledClientSideCacheProvider;
get isOpen(): boolean;
constructor(options: RedisClusterOptions, emit: EventEmitter['emit']);
connect(): Promise;
nodeClient(node: ShardNode): RedisClientType | Promise>;
rediscover(startWith: RedisClientType): Promise;
/**
* @deprecated Use `close` instead.
*/
quit(): Promise;
/**
* @deprecated Use `destroy` instead.
*/
disconnect(): Promise;
close(): Promise;
destroy(): void;
getClient(firstKey: RedisArgument | undefined, isReadonly: boolean | undefined): RedisClientType | Promise>;
_randomNodeIterator?: IterableIterator>;
getRandomNode(): ShardNode;
getSlotRandomNode(slotNumber: number): ShardNode;
getMasterByAddress(address: string): RedisClientType | Promise> | undefined;
getPubSubClient(): RedisClientType | Promise>;
executeUnsubscribeCommand(unsubscribe: (client: RedisClientType) => Promise): Promise;
getShardedPubSubClient(channel: string): RedisClientType | Promise>;
executeShardedUnsubscribeCommand(channel: string, unsubscribe: (client: RedisClientType) => Promise): Promise;
}
export {};
//# sourceMappingURL=cluster-slots.d.ts.map