import type { Enum } from '../../../../shared/src/enum.ts';
import type { Subscription } from '../../types/subscription.ts';
import type { ChangeStreamData } from '../change-source/protocol/current.ts';
import type { WatermarkedChange } from './change-streamer-service.ts';
import { type Downstream, type Status } from './change-streamer.ts';
import * as ErrorType from './error-type-enum.ts';
type ErrorType = Enum<typeof ErrorType>;
/**
 * Encapsulates a subscriber to changes. All subscribers start in a
 * "catchup" phase in which changes are buffered in a backlog while the
 * storer is queried to send any changes that were committed since the
 * subscriber's watermark. Once the catchup is complete, calls to
 * {@link send()} result in immediately sending the change.
 */
export declare class Subscriber {
    #private;
    readonly id: string;
    constructor(protocolVersion: number, id: string, watermark: string, downstream: Subscription<Downstream>, latestStatus: () => Status);
    get watermark(): string;
    get acked(): string;
    send(change: WatermarkedChange): Promise<void>;
    sendStatus(status: Status): void;
    /** catchup() is called on ChangeEntries loaded from the store. */
    catchup(change: WatermarkedChange): Promise<void>;
    /**
     * Marks the Subscribe as "caught up" and flushes any backlog of
     * entries that were received during the catchup.
     */
    setCaughtUp(): void;
    /**
     * The number of downstream messages that have yet to be acked.
     */
    get numPending(): number;
    /**
     * The total number of downstream messages that the subscriber has
     * processed (i.e. acked).
     */
    get numProcessed(): number;
    /**
     * Records a new history entry for the number of messages processed,
     * keeping the number of samples bounded to `maxSamples`.
     */
    sampleProcessRate(now: number, maxSamples?: number): this;
    getStats(): {
        processRate: number;
        pending: number;
    };
    supportsMessage(change: ChangeStreamData[1]): boolean;
    fail(err?: unknown): void;
    close(error?: ErrorType, message?: string): void;
}
export {};
//# sourceMappingURL=subscriber.d.ts.map