/// /// import { ValkeyClientType } from "../client"; import { ValkeyClusterOptions } from "."; import { ValkeyCommandArgument, ValkeyFunctions, ValkeyModules, ValkeyScripts } from "../commands"; import { ChannelListeners } from "../client/pub-sub"; import { EventEmitter } from "stream"; interface NodeAddress { host: string; port: number; } export type NodeAddressMap = { [address: string]: NodeAddress; } | ((address: string) => NodeAddress | undefined); type ValueOrPromise = T | Promise; type ClientOrPromise = ValueOrPromise>; export interface Node { address: string; client?: ClientOrPromise; } export interface ShardNode extends Node { id: string; host: string; port: number; readonly: boolean; } export interface MasterNode extends ShardNode { pubSubClient?: ClientOrPromise; } export interface Shard { master: MasterNode; replicas?: Array>; nodesIterator?: IterableIterator>; } export type PubSubNode = Required>; export type OnShardedChannelMovedError = (err: unknown, channel: string, listeners?: ChannelListeners) => void; export default class ValkeyClusterSlots { #private; slots: Shard[]; shards: Shard[]; masters: ShardNode[]; replicas: ShardNode[]; readonly nodeByAddress: Map | MasterNode>; pubSubNode?: PubSubNode; get isOpen(): boolean; constructor(options: ValkeyClusterOptions, emit: EventEmitter["emit"]); connect(): Promise; nodeClient(node: ShardNode): ClientOrPromise; rediscover(startWith: ValkeyClientType): Promise; quit(): Promise; disconnect(): Promise; getClient(firstKey: ValkeyCommandArgument | undefined, isReadonly: boolean | undefined): ClientOrPromise; getRandomNode(): ShardNode; getSlotRandomNode(slotNumber: number): ShardNode; getMasterByAddress(address: string): ClientOrPromise | undefined; getPubSubClient(): ClientOrPromise; executeUnsubscribeCommand(unsubscribe: (client: ValkeyClientType) => Promise): Promise; getShardedPubSubClient(channel: string): ClientOrPromise; executeShardedUnsubscribeCommand(channel: string, unsubscribe: (client: ValkeyClientType) => Promise): Promise; } export {};