/// import { NetStream, CommandItem, ProtocolVersion, ReplyMappingMode } from "./types"; import Deque = require("denque"); import { EventEmitter } from "events"; import SubscriptionSet from "./SubscriptionSet"; import { type MaintenanceNotification } from "./maintNotifications"; /** * Emitted on the client when a reply empties `commandQueue`. A symbol keeps * this internal drain signal from becoming an accidental public event. */ export declare const COMMAND_QUEUE_DRAINED: unique symbol; export interface Condition { select: number; auth?: string | [string, string]; subscriber: false | SubscriptionSet; protocol: ProtocolVersion; replyMapping: ReplyMappingMode; handshake: boolean; watching: boolean; } export type FlushQueueOptions = { offlineQueue?: boolean; commandQueue?: boolean; }; export interface DataHandledable extends EventEmitter { stream: NetStream; status: string; condition: Condition | null; commandQueue: Deque; disconnect(reconnect: boolean): void; recoverFromFatalError(commandError: Error, err: Error, options: FlushQueueOptions): void; handleReconnection(err: Error, item: CommandItem): void; silentEmit(eventName: string, arg?: unknown): boolean; } interface ParserOptions { stringNumbers: boolean; replyMapping: ReplyMappingMode; onMaintenanceNotification?: (notification: MaintenanceNotification) => void | Promise; } export default class DataHandler { private redis; private onMaintenanceNotification?; private readonly onData; constructor(redis: DataHandledable, parserOptions: ParserOptions); /** * Attaches to a new owner after the previous stream listeners were removed. * Keep the decoder and its callbacks intact: an unfinished frame may have * captured a callback that must dispatch through this handler's new owner. */ rebind(redis: DataHandledable, onMaintenanceNotification: ParserOptions["onMaintenanceNotification"]): void; private dispatch; private returnFatalError; private returnError; private returnReply; private returnPush; private handleMaintenanceNotification; private reportMaintenanceError; private handleUnsolicitedUnsubscribe; private handleSubscriberReply; private handleMonitorReply; private shiftCommand; } export {};