/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces"; import type { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal"; import type { LocalEmptyBatchPlaceholder, OutboundBatch, OutboundSingletonBatch } from "./definitions.js"; /** * The number of ops in a batch above which the batch is considered "large" * for telemetry purposes. Used by both {@link OpGroupingManager} (GroupLargeBatch event) * and as the default staging-mode auto-flush threshold. */ export declare const largeBatchThreshold = 1000; export declare function isGroupedBatch(op: ISequencedDocumentMessage): boolean; export interface OpGroupingManagerConfig { readonly groupedBatchingEnabled: boolean; } /** * This is the type of an empty grouped batch we send over the wire * We also put this in the placeholder for an empty batch in the PendingStateManager. * But most places throughout the ContainerRuntime, this will not be used (just as Grouped Batches in general don't appear outside opLifecycle dir) */ export interface EmptyGroupedBatch { type: typeof OpGroupingManager.groupedBatchOp; contents: readonly []; } export declare class OpGroupingManager { private readonly config; static readonly groupedBatchOp = "groupedBatch"; private readonly logger; constructor(config: OpGroupingManagerConfig, logger: ITelemetryBaseLogger); /** * Creates a new batch with a single message of type "groupedBatch" and empty contents. * This is needed as a placeholder if a batch becomes empty on resubmit, but we are tracking batch IDs. * @param resubmittingBatchId - batch ID of the resubmitting batch * @param referenceSequenceNumber - reference sequence number * @returns The outbound batch as well as the interior placeholder message */ createEmptyGroupedBatch(resubmittingBatchId: string, referenceSequenceNumber: number): { outboundBatch: OutboundSingletonBatch; placeholderMessage: LocalEmptyBatchPlaceholder; }; /** * Converts the given batch into a "grouped batch" - a batch with a single message of type "groupedBatch", * with contents being an array of the original batch's messages. * * If the batch already has only 1 message, it is returned as-is. * * @remarks Remember that a BatchMessage has its content JSON serialized, so the incoming batch message contents * must be parsed first, and then the type and contents mentioned above are hidden in that JSON serialization. */ groupBatch(batch: OutboundBatch): OutboundSingletonBatch; ungroupOp(op: ISequencedDocumentMessage): ISequencedDocumentMessage[]; groupedBatchingEnabled(): boolean; } //# sourceMappingURL=opGroupingManager.d.ts.map