DataHandler.d.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /// <reference types="node" />
  2. import { NetStream, CommandItem } from "./types";
  3. import Deque = require("denque");
  4. import { EventEmitter } from "events";
  5. import SubscriptionSet from "./SubscriptionSet";
  6. export interface Condition {
  7. select: number;
  8. auth?: string | [string, string];
  9. subscriber: false | SubscriptionSet;
  10. }
  11. export declare type FlushQueueOptions = {
  12. offlineQueue?: boolean;
  13. commandQueue?: boolean;
  14. };
  15. export interface DataHandledable extends EventEmitter {
  16. stream: NetStream;
  17. status: string;
  18. condition: Condition | null;
  19. commandQueue: Deque<CommandItem>;
  20. disconnect(reconnect: boolean): void;
  21. recoverFromFatalError(commandError: Error, err: Error, options: FlushQueueOptions): void;
  22. handleReconnection(err: Error, item: CommandItem): void;
  23. }
  24. interface ParserOptions {
  25. stringNumbers: boolean;
  26. }
  27. export default class DataHandler {
  28. private redis;
  29. constructor(redis: DataHandledable, parserOptions: ParserOptions);
  30. private returnFatalError;
  31. private returnError;
  32. private returnReply;
  33. private handleSubscriberReply;
  34. private handleMonitorReply;
  35. private shiftCommand;
  36. }
  37. export {};