/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import type { ICompressionRuntimeOptions } from "../compressionDefinitions.js"; import type { IPendingMessage } from "../pendingStateManager.js"; import type { LocalBatchMessage, IBatchCheckpoint, LocalBatch } from "./definitions.js"; import type { BatchStartInfo } from "./remoteMessageProcessor.js"; export interface IBatchManagerOptions { readonly disableGroupedBatching: boolean; readonly compressionOptions?: ICompressionRuntimeOptions; } 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; /** * Get the effective batch ID for the input argument. * Supports either an IPendingMessage or BatchStartInfo. * If the batch ID is explicitly present, return it. * Otherwise, generate a new batch ID using the client ID and batch start CSN. */ export declare function getEffectiveBatchId(pendingMessageOrBatchStartInfo: IPendingMessage | BatchStartInfo): string; /** * Helper class that manages partial batch & rollback. */ export declare class BatchManager { readonly options: IBatchManagerOptions; private pendingBatch; private hasReentrantOps; get length(): 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: LocalBatchMessage, reentrant: boolean, currentClientSequenceNumber?: number): void; get empty(): boolean; /** * Gets the pending batch and clears state for the next batch. * The caller is responsible for calling {@link addBatchMetadata} after any modifications (e.g. prepending messages). */ popBatch(): LocalBatch; /** * Capture the pending state at this point */ checkpoint(): IBatchCheckpoint; /** * Does this batch current contain user changes ("dirtyable" ops)? */ containsUserChanges(): boolean; } export declare const addBatchMetadata: (batch: LocalBatch, batchId?: BatchId) => LocalBatch; export declare const sequenceNumbersMatch: (seqNums: BatchSequenceNumbers, otherSeqNums: BatchSequenceNumbers) => boolean; //# sourceMappingURL=batchManager.d.ts.map