/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { ICompressionRuntimeOptions } from "../containerRuntime.js";
import { BatchMessage, IBatch, IBatchCheckpoint } from "./definitions.js";
export interface IBatchManagerOptions {
    readonly hardLimit: number;
    readonly compressionOptions?: ICompressionRuntimeOptions;
    /**
     * If true, the outbox is allowed to rebase the batch during flushing.
     */
    readonly canRebase: boolean;
}
export interface BatchSequenceNumbers {
    referenceSequenceNumber?: number;
    clientSequenceNumber?: number;
}
/** Type alias for the batchId stored in batch metadata */
export type BatchId = string;
/** Compose original client ID and client sequence number into BatchId to stamp on the message during reconnect */
export declare function generateBatchId(originalClientId: string, batchStartCsn: number): BatchId;
/**
 * Helper class that manages partial batch & rollback.
 */
export declare class BatchManager {
    readonly options: IBatchManagerOptions;
    private pendingBatch;
    private batchContentSize;
    private hasReentrantOps;
    get length(): number;
    get contentSizeInBytes(): number;
    get sequenceNumbers(): BatchSequenceNumbers;
    private get referenceSequenceNumber();
    /**
     * The last-processed CSN when this batch started.
     * This is used to ensure that while the batch is open, no incoming ops are processed.
     */
    private clientSequenceNumber;
    constructor(options: IBatchManagerOptions);
    push(message: BatchMessage, reentrant: boolean, currentClientSequenceNumber?: number): boolean;
    get empty(): boolean;
    /**
     * Gets the pending batch and clears state for the next batch.
     */
    popBatch(batchId?: BatchId): IBatch;
    /**
     * Capture the pending state at this point
     */
    checkpoint(): IBatchCheckpoint;
}
/**
 * Estimates the real size in bytes on the socket for a given batch. It assumes that
 * the envelope size (and the size of an empty op) is 200 bytes, taking into account
 * extra overhead from stringification.
 *
 * @param batch - the batch to inspect
 * @returns An estimate of the payload size in bytes which will be produced when the batch is sent over the wire
 */
export declare const estimateSocketSize: (batch: IBatch) => number;
export declare const sequenceNumbersMatch: (seqNums: BatchSequenceNumbers, otherSeqNums: BatchSequenceNumbers) => boolean;
//# sourceMappingURL=batchManager.d.ts.map