import type { MessageStore } from '../types/message-store.js';
import type { EventLog, EventLogReadOptions, EventLogReadResult, EventLogSubscribeOptions, EventSubscription, ProgressToken, ReplicationFeedReader, SubscriptionListener, WakeSubscriber } from '../types/subscriptions.js';
export type DurableEventLogStore = ReplicationFeedReader & Pick<MessageStore, 'query'>;
export type DurableEventLogConfig = {
    /**
     * Maximum number of log rows read per drain step.
     * Defaults to 100.
     */
    readLimit?: number;
    /**
     * Interval for idle re-drain. This bounds dropped-wake latency.
     * Set to 0 to disable the interval.
     */
    idleRedrainIntervalMs?: number;
    /**
     * Optional handler for background subscription-drain errors.
     */
    errorHandler?: (error: unknown) => void;
};
/**
 * EventLog implementation backed by the durable replication feed.
 *
 * Writes are store-owned: MessageStore commits publish wakes after the row is
 * durable.
 */
export declare class DurableEventLog implements EventLog {
    private readonly store;
    private readonly wakeSubscriber;
    private readonly subscriptions;
    private readonly readLimit;
    private readonly idleRedrainIntervalMs;
    private readonly errorHandler;
    private unsubscribeWake?;
    private idleRedrainTimer?;
    private isOpen;
    constructor(store: DurableEventLogStore, wakeSubscriber: WakeSubscriber, config?: DurableEventLogConfig);
    open(): Promise<void>;
    close(): Promise<void>;
    read(tenant: string, options?: EventLogReadOptions): Promise<EventLogReadResult>;
    subscribe(tenant: string, id: string, listener: SubscriptionListener, options?: EventLogSubscribeOptions): Promise<EventSubscription>;
    getReplayBounds(tenant: string): Promise<{
        oldest: ProgressToken;
        latest: ProgressToken;
    } | undefined>;
    private getInitialCursor;
    private handleWake;
    private redrainAll;
    private scheduleDrain;
    private handleDrainError;
    private catchUpSubscription;
    private getCatchUpHighWater;
    private deliverCatchUpPage;
    private drainSubscription;
    private drainOnce;
    private deliverEntry;
    private attachInitialWrites;
    private attachInitialWrite;
    private static needsInitialWrite;
    private static getRecordId;
    private buildToken;
    private static getEntryPosition;
    private static getProgressGapInfo;
    private static isCatchUpComplete;
    private static finishCatchUp;
    private static isLatestBaseState;
    private static getProtocol;
    private static detachEntryEncodedData;
}
//# sourceMappingURL=durable-event-log.d.ts.map