import { EventEmitter } from 'events'; import type { IBackoffFactory } from '../../deps/cockatiel'; import { type Rangable } from './range'; import * as RPC from './rpc'; import { type EBError } from '../base/errors'; import { type NSApplicator } from '../base/util'; export declare class WatchManager { private readonly client; private readonly initialBackoff; private state; private stream; private watchers; private readonly expectedClosers; private queue; private backoff; constructor(client: RPC.WatchClient, initialBackoff: IBackoffFactory); attach(watcher: Watcher): void; detach(watcher: Watcher): Promise; private getStream; private establishStream; private destroyStream; private handleError; private handleCancelResponse; private handleUpdateResponse; private handleCreatedResponse; private handleResponse; } export declare const operationNames: { put: RPC.FilterType; delete: RPC.FilterType; }; export declare class WatchBuilder { private readonly manager; private readonly namespace; private readonly request; constructor(manager: WatchManager, namespace: NSApplicator); key(key: string | Buffer): this; prefix(value: string | Buffer): this; inRange(r: Rangable): this; ignore(...operations: Array): this; only(...operations: Array): this; withPreviousKV(): this; startRevision(revision: string): this; watcher(): Watcher; create(): Promise; } export declare class Watcher extends EventEmitter { private readonly manager; private readonly namespace; readonly request: RPC.IWatchCreateRequest; readonly id: string | null; constructor(manager: WatchManager, namespace: NSApplicator, request: RPC.IWatchCreateRequest); on(event: 'connecting', handler: (req: RPC.IWatchRequest) => void): this; on(event: 'connected' | 'data', handler: (res: RPC.IWatchResponse) => void): this; on(event: 'put' | 'delete', handler: (kv: RPC.IKeyValue, previous?: RPC.IKeyValue) => void): this; on(event: 'end', handler: () => void): this; on(event: 'disconnected', handler: (res: EBError) => void): this; on(event: 'error', handler: (err: EBError) => void): this; lastRevision(): number | null; cancel(): Promise; private updateRevision; }