@fluidframework/container-loader 2.5.0 → 2.10.0-305357
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/container.js +5 -5
- package/dist/container.js.map +1 -1
- package/dist/deltaManager.d.ts +2 -2
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loadPaused.d.ts.map +1 -1
- package/dist/loadPaused.js +5 -3
- package/dist/loadPaused.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/container.js +5 -5
- package/lib/container.js.map +1 -1
- package/lib/deltaManager.d.ts +2 -2
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/loadPaused.d.ts.map +1 -1
- package/lib/loadPaused.js +3 -1
- package/lib/loadPaused.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +19 -15
- package/src/container.ts +5 -5
- package/src/deltaManager.ts +2 -4
- package/src/index.ts +4 -1
- package/src/loadPaused.ts +3 -0
- package/src/packageVersion.ts +1 -1
package/dist/deltaManager.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { ICriticalContainerError } from "@fluidframework/container-definitions";
|
|
6
|
-
import {
|
|
6
|
+
import { IDeltaManagerEvents, IDeltaManagerFull, IDeltaQueue, type IDeltaSender, type ReadOnlyInfo } from "@fluidframework/container-definitions/internal";
|
|
7
7
|
import { IEventProvider, ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
8
8
|
import { IThrottlingWarning } from "@fluidframework/core-interfaces/internal";
|
|
9
9
|
import { ConnectionMode } from "@fluidframework/driver-definitions";
|
|
@@ -43,7 +43,7 @@ export interface IDeltaHandlerStrategy {
|
|
|
43
43
|
* Manages the flow of both inbound and outbound messages. This class ensures that shared objects receive delta
|
|
44
44
|
* messages in order regardless of possible network conditions or timings causing out of order delivery.
|
|
45
45
|
*/
|
|
46
|
-
export declare class DeltaManager<TConnectionManager extends IConnectionManager> extends EventEmitterWithErrorHandling<IDeltaManagerInternalEvents> implements
|
|
46
|
+
export declare class DeltaManager<TConnectionManager extends IConnectionManager> extends EventEmitterWithErrorHandling<IDeltaManagerInternalEvents> implements IDeltaManagerFull, IEventProvider<IDeltaManagerInternalEvents> {
|
|
47
47
|
private readonly serviceProvider;
|
|
48
48
|
private readonly logger;
|
|
49
49
|
private readonly _active;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deltaManager.d.ts","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EACN,
|
|
1
|
+
{"version":3,"file":"deltaManager.d.ts","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EACN,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,cAAc,EAEd,wBAAwB,EACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAE9E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC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C;QAE/E,wFAAwF;QACxF,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACpC,mCAAmC;YACnC,yFAAyF;YACzF,2EAA2E;YAC3E,gGAAgG;YAChG,iGAAiG;YACjG,qGAAqG;YACrG,wFAAwF;YACxF,uGAAuG;YACvG,kGAAkG;YAClG,iGAAiG;YACjG,YAAY;YACZ,kFAAkF;YAClF,IAAI,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;gBAChE,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;YACtC,CAAC;QACF,CAAC;IACF,CAAC;IAEO,4BAA4B,CAAC,GAAW;QAC/C,IAAI,IAAI,CAAC,qBAAqB,GAAG,GAAG,EAAE,CAAC;YACtC,IAAI,CAAC,qBAAqB,GAAG,GAAG,CAAC;QAClC,CAAC;IACF,CAAC;CACD;AArjCD,oCAqjCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport {\n\tIDeltaManager,\n\tIDeltaManagerEvents,\n\tIDeltaQueue,\n\ttype IDeltaSender,\n\ttype ReadOnlyInfo,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tIEventProvider,\n\ttype ITelemetryBaseEvent,\n\tITelemetryBaseProperties,\n} from \"@fluidframework/core-interfaces\";\nimport { IThrottlingWarning } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ConnectionMode } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tDriverErrorTypes,\n\tIDocumentMessage,\n\tMessageType,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n\ttype IClientDetails,\n\ttype IClientConfiguration,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { NonRetryableError, isRuntimeMessage } from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype ITelemetryErrorEventExt,\n\ttype ITelemetryGenericEventExt,\n\tITelemetryLoggerExt,\n\tDataCorruptionError,\n\tDataProcessingError,\n\tUsageError,\n\textractSafePropertiesFromMessage,\n\tisFluidError,\n\tnormalizeError,\n\tsafeRaiseEvent,\n\tEventEmitterWithErrorHandling,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport {\n\tIConnectionDetailsInternal,\n\tIConnectionManager,\n\tIConnectionManagerFactoryArgs,\n\tIConnectionStateChangeReason,\n} from \"./contracts.js\";\nimport { DeltaQueue } from \"./deltaQueue.js\";\nimport { ThrottlingWarning } from \"./error.js\";\n\nexport interface IConnectionArgs {\n\tmode?: ConnectionMode;\n\tfetchOpsFromStorage?: boolean;\n\treason: IConnectionStateChangeReason;\n}\n\n/**\n * Includes events emitted by the concrete implementation DeltaManager\n * but not exposed on the public interface IDeltaManager\n */\nexport interface IDeltaManagerInternalEvents extends IDeltaManagerEvents {\n\t(event: \"throttled\", listener: (error: IThrottlingWarning) => void);\n\t(event: \"closed\" | \"disposed\", listener: (error?: ICriticalContainerError) => void);\n\t(\n\t\tevent: \"connect\",\n\t\tlistener: (details: IConnectionDetailsInternal, opsBehind?: number) => void,\n\t);\n\t(event: \"establishingConnection\", listener: (reason: IConnectionStateChangeReason) => void);\n\t(\n\t\tevent: \"cancelEstablishingConnection\",\n\t\tlistener: (reason: IConnectionStateChangeReason) => void,\n\t);\n}\n\n/**\n * Batching makes assumptions about what might be on the metadata. This interface codifies those assumptions, but does not validate them.\n */\ninterface IBatchMetadata {\n\tbatch?: boolean;\n}\n\n/**\n * Interface used to define a strategy for handling incoming delta messages\n */\nexport interface IDeltaHandlerStrategy {\n\t/**\n\t * Processes the message.\n\t */\n\tprocess: (message: ISequencedDocumentMessage) => void;\n\n\t/**\n\t * Processes the signal.\n\t */\n\tprocessSignal: (message: ISignalMessage) => void;\n}\n\n/**\n * Determines if message was sent by client, not service\n */\nfunction isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean {\n\tif (isRuntimeMessage(message)) {\n\t\treturn true;\n\t}\n\tswitch (message.type) {\n\t\tcase MessageType.Propose:\n\t\tcase MessageType.Reject:\n\t\tcase MessageType.NoOp:\n\t\tcase MessageType.Accept:\n\t\tcase MessageType.Summarize: {\n\t\t\treturn true;\n\t\t}\n\t\tdefault: {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\n/**\n * Like assert, but logs only if the condition is false, rather than throwing\n * @param condition - The condition to attest too\n * @param logger - The logger to log with\n * @param event - The string or event to log\n * @returns The outcome of the condition\n */\nfunction logIfFalse(\n\tcondition: boolean,\n\tlogger: ITelemetryLoggerExt,\n\tevent: string | ITelemetryGenericEventExt,\n): condition is true {\n\tif (condition) {\n\t\treturn true;\n\t}\n\tconst newEvent: ITelemetryBaseEvent =\n\t\ttypeof event === \"string\"\n\t\t\t? { eventName: event, category: \"error\" }\n\t\t\t: { category: \"error\", ...event };\n\tlogger.send(newEvent);\n\treturn false;\n}\n\n/**\n * Manages the flow of both inbound and outbound messages. This class ensures that shared objects receive delta\n * messages in order regardless of possible network conditions or timings causing out of order delivery.\n */\nexport class DeltaManager<TConnectionManager extends IConnectionManager>\n\textends EventEmitterWithErrorHandling<IDeltaManagerInternalEvents>\n\timplements\n\t\tIDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tIEventProvider<IDeltaManagerInternalEvents>\n{\n\tpublic readonly connectionManager: TConnectionManager;\n\n\tpublic get active(): boolean {\n\t\treturn this._active();\n\t}\n\n\tpublic get disposed(): boolean {\n\t\treturn this._closed;\n\t}\n\n\tpublic get IDeltaSender(): IDeltaSender {\n\t\treturn this;\n\t}\n\n\tprivate pending: ISequencedDocumentMessage[] = [];\n\tprivate fetchReason: string | undefined;\n\n\t// A boolean used to assert that ops are not being sent while processing another op.\n\tprivate currentlyProcessingOps: boolean = false;\n\n\t// The minimum sequence number and last sequence number received from the server\n\tprivate minSequenceNumber: number = 0;\n\n\t// There are three numbers we track\n\t// * lastQueuedSequenceNumber is the last queued sequence number. If there are gaps in seq numbers, then this number\n\t// is not updated until we cover that gap, so it increases each time by 1.\n\t// * lastObservedSeqNumber is an estimation of last known sequence number for container in storage. It's initially\n\t// populated at web socket connection time (if storage provides that info) and is updated once ops shows up.\n\t// It's never less than lastQueuedSequenceNumber\n\t// * lastProcessedSequenceNumber - last processed sequence number\n\tprivate lastQueuedSequenceNumber: number = 0;\n\tprivate lastObservedSeqNumber: number = 0;\n\tprivate lastProcessedSequenceNumber: number = 0;\n\tprivate lastProcessedMessage: ISequencedDocumentMessage | undefined;\n\n\t/**\n\t * Count the number of noops sent by the client which may not be acked\n\t */\n\tprivate noOpCount: number = 0;\n\t/**\n\t * Track clientSequenceNumber of the last op\n\t */\n\tprivate lastClientSequenceNumber: number = 0;\n\n\t/**\n\t * Track down the ops size.\n\t */\n\tprivate opsSize: number = 0;\n\tprivate prevEnqueueMessagesReason: string | undefined;\n\tprivate previouslyProcessedMessage: ISequencedDocumentMessage | undefined;\n\n\t// The sequence number we initially loaded from\n\t// In case of reading from a snapshot or pending state, its value will be equal to\n\t// the last message that got serialized.\n\tprivate initSequenceNumber: number = 0;\n\n\tprivate readonly _inbound: DeltaQueue<ISequencedDocumentMessage>;\n\tprivate readonly _inboundSignal: DeltaQueue<ISignalMessage>;\n\n\tprivate _closed = false;\n\tprivate _disposed = false;\n\n\tprivate handler: IDeltaHandlerStrategy | undefined;\n\tprivate deltaStorage: IDocumentDeltaStorageService | undefined;\n\n\tprivate readonly throttlingIdSet = new Set<string>();\n\tprivate timeTillThrottling: number = 0;\n\n\tpublic readonly closeAbortController = new AbortController();\n\n\tprivate readonly deltaStorageDelayId = uuid();\n\tprivate readonly deltaStreamDelayId = uuid();\n\n\tprivate messageBuffer: IDocumentMessage[] = [];\n\n\tprivate _checkpointSequenceNumber: number | undefined;\n\n\tpublic get inbound(): IDeltaQueue<ISequencedDocumentMessage> {\n\t\treturn this._inbound;\n\t}\n\n\tpublic get inboundSignal(): IDeltaQueue<ISignalMessage> {\n\t\treturn this._inboundSignal;\n\t}\n\n\tpublic get initialSequenceNumber(): number {\n\t\treturn this.initSequenceNumber;\n\t}\n\n\tpublic get lastSequenceNumber(): number {\n\t\treturn this.lastProcessedSequenceNumber;\n\t}\n\n\tpublic get lastMessage(): ISequencedDocumentMessage | undefined {\n\t\treturn this.lastProcessedMessage;\n\t}\n\n\tpublic get lastKnownSeqNumber(): number {\n\t\treturn this.lastObservedSeqNumber;\n\t}\n\n\tpublic get minimumSequenceNumber(): number {\n\t\treturn this.minSequenceNumber;\n\t}\n\n\t/**\n\t * Tells if current connection has checkpoint information.\n\t * I.e. we know how far behind the client was at the time of establishing connection\n\t */\n\tpublic get hasCheckpointSequenceNumber(): boolean {\n\t\t// Valid to be called only if we have active connection.\n\t\tassert(this.connectionManager.connected, 0x0df /* \"Missing active connection\" */);\n\t\treturn this._checkpointSequenceNumber !== undefined;\n\t}\n\n\t// Forwarding connection manager properties / IDeltaManager implementation\n\tpublic get maxMessageSize(): number {\n\t\treturn this.connectionManager.maxMessageSize;\n\t}\n\tpublic get version(): string {\n\t\treturn this.connectionManager.version;\n\t}\n\tpublic get serviceConfiguration(): IClientConfiguration | undefined {\n\t\treturn this.connectionManager.serviceConfiguration;\n\t}\n\tpublic get outbound(): IDeltaQueue<IDocumentMessage[]> {\n\t\treturn this.connectionManager.outbound;\n\t}\n\tpublic get readOnlyInfo(): ReadOnlyInfo {\n\t\treturn this.connectionManager.readOnlyInfo;\n\t}\n\tpublic get clientDetails(): IClientDetails {\n\t\treturn this.connectionManager.clientDetails;\n\t}\n\n\tpublic submit(\n\t\ttype: MessageType,\n\t\tcontents?: string,\n\t\tbatch = false,\n\t\tmetadata?: unknown,\n\t\tcompression?: string,\n\t\treferenceSequenceNumber?: number,\n\t): number {\n\t\t// Back-compat ADO:3455\n\t\tconst backCompatRefSeqNum = referenceSequenceNumber ?? this.lastProcessedSequenceNumber;\n\t\tconst messagePartial: Omit<IDocumentMessage, \"clientSequenceNumber\"> = {\n\t\t\tcontents,\n\t\t\tmetadata,\n\t\t\treferenceSequenceNumber: backCompatRefSeqNum,\n\t\t\ttype,\n\t\t\tcompression,\n\t\t};\n\n\t\tif (!batch) {\n\t\t\tthis.flush();\n\t\t}\n\t\tconst message = this.connectionManager.prepareMessageToSend(messagePartial);\n\t\tif (message === undefined) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tassert(isClientMessage(message), 0x419 /* client sends non-client message */);\n\n\t\tif (contents !== undefined) {\n\t\t\tthis.opsSize += contents.length;\n\t\t}\n\n\t\tthis.messageBuffer.push(message);\n\n\t\tif (message.type === MessageType.NoOp) {\n\t\t\tthis.noOpCount++;\n\t\t}\n\n\t\tthis.emit(\"submitOp\", message);\n\n\t\tif (!batch) {\n\t\t\tthis.flush();\n\t\t}\n\t\treturn message.clientSequenceNumber;\n\t}\n\n\tpublic submitSignal(content: string, targetClientId?: string): void {\n\t\treturn this.connectionManager.submitSignal(content, targetClientId);\n\t}\n\n\tpublic flush(): void {\n\t\tconst batch = this.messageBuffer;\n\t\tif (batch.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.messageBuffer = [];\n\n\t\t// The prepareFlush event allows listeners to append metadata to the batch prior to submission.\n\t\tthis.emit(\"prepareSend\", batch);\n\n\t\tif (batch.length === 1) {\n\t\t\tassert(\n\t\t\t\t(batch[0].metadata as IBatchMetadata)?.batch === undefined,\n\t\t\t\t0x3c9 /* no batch markup on single message */,\n\t\t\t);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\t(batch[0].metadata as IBatchMetadata)?.batch === true,\n\t\t\t\t0x3ca /* no start batch markup */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\t(batch[batch.length - 1].metadata as IBatchMetadata)?.batch === false,\n\t\t\t\t0x3cb /* no end batch markup */,\n\t\t\t);\n\t\t}\n\n\t\tthis.connectionManager.sendMessages(batch);\n\n\t\tassert(this.messageBuffer.length === 0, 0x3cc /* reentrancy */);\n\t}\n\n\tpublic get connectionProps(): ITelemetryBaseProperties {\n\t\treturn {\n\t\t\tsequenceNumber: this.lastSequenceNumber,\n\t\t\topsSize: this.opsSize > 0 ? this.opsSize : undefined,\n\t\t\tdeltaManagerState: this._disposed ? \"disposed\" : this._closed ? \"closed\" : \"open\",\n\t\t\t...this.connectionManager.connectionProps,\n\t\t};\n\t}\n\n\t/**\n\t * Log error event with a bunch of internal to DeltaManager information about state of op processing\n\t * Used to diagnose connectivity issues related to op processing (i.e. cases where for some reason\n\t * we stop processing ops that results in no processing join op and thus moving to connected state)\n\t * @param event - Event to log.\n\t */\n\tpublic logConnectionIssue(event: ITelemetryErrorEventExt): void {\n\t\tassert(this.connectionManager.connected, 0x238 /* \"called only in connected state\" */);\n\n\t\tconst pendingSorted = this.pending.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\t...event,\n\t\t\t// This directly tells us if fetching ops is in flight, and thus likely the reason of\n\t\t\t// stalled op processing\n\t\t\tfetchReason: this.fetchReason,\n\t\t\t// A bunch of useful sequence numbers to understand if we are holding some ops from processing\n\t\t\tlastQueuedSequenceNumber: this.lastQueuedSequenceNumber, // last sequential op\n\t\t\tlastProcessedSequenceNumber: this.lastProcessedSequenceNumber, // same as above, but after processing\n\t\t\tlastObserved: this.lastObservedSeqNumber, // last sequence we ever saw; may have gaps with above.\n\t\t\t// connection info\n\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\tpendingOps: this.pending.length, // Do we have any pending ops?\n\t\t\tpendingFirst: pendingSorted[0]?.sequenceNumber, // is the first pending op the one that we are missing?\n\t\t\thaveHandler: this.handler !== undefined, // do we have handler installed?\n\t\t\tinboundLength: this.inbound.length,\n\t\t\tinboundPaused: this.inbound.paused,\n\t\t});\n\t}\n\n\tconstructor(\n\t\tprivate readonly serviceProvider: () => IDocumentService | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly _active: () => boolean,\n\t\tcreateConnectionManager: (props: IConnectionManagerFactoryArgs) => TConnectionManager,\n\t) {\n\t\tsuper((name, error) => {\n\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"DeltaManagerEventHandlerException\",\n\t\t\t\t\tname: typeof name === \"string\" ? name : undefined,\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t\tthis.close(normalizeError(error));\n\t\t});\n\t\tconst props: IConnectionManagerFactoryArgs = {\n\t\t\tincomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.enqueueMessages(messages, reason);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"EnqueueMessages_Exception\" }, error);\n\t\t\t\t\tthis.close(normalizeError(error));\n\t\t\t\t}\n\t\t\t},\n\t\t\tsignalHandler: (signals: ISignalMessage[]) => {\n\t\t\t\tfor (const signal of signals) {\n\t\t\t\t\tthis._inboundSignal.push(signal);\n\t\t\t\t}\n\t\t\t},\n\t\t\treconnectionDelayHandler: (delayMs: number, error: unknown) =>\n\t\t\t\tthis.emitDelayInfo(this.deltaStreamDelayId, delayMs, error),\n\t\t\tcloseHandler: (error: ICriticalContainerError | undefined) => this.close(error),\n\t\t\tdisconnectHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.disconnectHandler(reason),\n\t\t\tconnectHandler: (connection: IConnectionDetailsInternal) =>\n\t\t\t\tthis.connectHandler(connection),\n\t\t\tpongHandler: (latency: number) => this.emit(\"pong\", latency),\n\t\t\treadonlyChangeHandler: (\n\t\t\t\treadonly?: boolean,\n\t\t\t\treadonlyConnectionReason?: IConnectionStateChangeReason,\n\t\t\t) => {\n\t\t\t\tsafeRaiseEvent(this, this.logger, \"readonly\", readonly, readonlyConnectionReason);\n\t\t\t},\n\t\t\testablishConnectionHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.establishingConnection(reason),\n\t\t\tcancelConnectionHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.cancelEstablishingConnection(reason),\n\t\t};\n\n\t\tthis.connectionManager = createConnectionManager(props);\n\t\tthis._inbound = new DeltaQueue<ISequencedDocumentMessage>((op) => {\n\t\t\tthis.processInboundMessage(op);\n\t\t});\n\n\t\tthis._inbound.on(\"error\", (error) => {\n\t\t\tthis.close(\n\t\t\t\tDataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\terror,\n\t\t\t\t\t\"deltaManagerInboundErrorHandler\",\n\t\t\t\t\tthis.lastMessage,\n\t\t\t\t),\n\t\t\t);\n\t\t});\n\n\t\t// Inbound signal queue\n\t\tthis._inboundSignal = new DeltaQueue<ISignalMessage>((message) => {\n\t\t\tif (this.handler === undefined) {\n\t\t\t\tthrow new Error(\"Attempted to process an inbound signal without a handler attached\");\n\t\t\t}\n\n\t\t\tthis.handler.processSignal({\n\t\t\t\t...message,\n\t\t\t\tcontent: JSON.parse(message.content as string),\n\t\t\t});\n\t\t});\n\n\t\tthis._inboundSignal.on(\"error\", (error) => {\n\t\t\tthis.close(normalizeError(error));\n\t\t});\n\n\t\t// Initially, all queues are created paused.\n\t\t// - outbound is flipped back and forth in setupNewSuccessfulConnection / disconnectFromDeltaStream\n\t\t// - inbound & inboundSignal are resumed in attachOpHandler() when we have handler setup\n\t}\n\n\tprivate cancelEstablishingConnection(reason: IConnectionStateChangeReason): void {\n\t\tthis.emit(\"cancelEstablishingConnection\", reason);\n\t}\n\n\tprivate establishingConnection(reason: IConnectionStateChangeReason): void {\n\t\tthis.emit(\"establishingConnection\", reason);\n\t}\n\n\tprivate connectHandler(connection: IConnectionDetailsInternal): void {\n\t\tthis.refreshDelayInfo(this.deltaStreamDelayId);\n\n\t\tconst props = this.connectionManager.connectionVerboseProps;\n\t\tprops.connectionLastQueuedSequenceNumber = this.lastQueuedSequenceNumber;\n\t\tprops.connectionLastObservedSeqNumber = this.lastObservedSeqNumber;\n\n\t\tconst checkpointSequenceNumber = connection.checkpointSequenceNumber;\n\t\tthis._checkpointSequenceNumber = checkpointSequenceNumber;\n\t\tif (checkpointSequenceNumber !== undefined) {\n\t\t\tthis.updateLatestKnownOpSeqNumber(checkpointSequenceNumber);\n\t\t}\n\n\t\t// We cancel all ops on lost of connectivity, and rely on DDSes to resubmit them.\n\t\t// Semantics are not well defined for batches (and they are broken right now on disconnects anyway),\n\t\t// but it's safe to assume (until better design is put into place) that batches should not exist\n\t\t// across multiple connections. Right now we assume runtime will not submit any ops in disconnected\n\t\t// state. As requirements change, so should these checks.\n\t\tassert(\n\t\t\tthis.messageBuffer.length === 0,\n\t\t\t0x0e9 /* \"messageBuffer is not empty on new connection\" */,\n\t\t);\n\n\t\tthis.opsSize = 0;\n\t\tthis.noOpCount = 0;\n\n\t\tthis.emit(\n\t\t\t\"connect\",\n\t\t\tconnection,\n\t\t\tcheckpointSequenceNumber === undefined\n\t\t\t\t? undefined\n\t\t\t\t: this.lastObservedSeqNumber - this.lastSequenceNumber,\n\t\t);\n\n\t\t// If we got some initial ops, then we know the gap and call above fetched ops to fill it.\n\t\t// Same is true for \"write\" mode even if we have no ops - we will get \"join\" own op very very soon.\n\t\t// However if we are connecting as view-only, then there is no good signal to realize if client is behind.\n\t\t// Thus we have to hit storage to see if any ops are there.\n\t\tif (checkpointSequenceNumber !== undefined) {\n\t\t\t// We know how far we are behind (roughly). If it's non-zero gap, fetch ops right away.\n\t\t\tif (checkpointSequenceNumber > this.lastQueuedSequenceNumber) {\n\t\t\t\tthis.fetchMissingDeltas(\"AfterConnection\");\n\t\t\t}\n\t\t\t// we do not know the gap, and we will not learn about it if socket is quite - have to ask.\n\t\t} else if (connection.mode === \"read\") {\n\t\t\tthis.fetchMissingDeltas(\"AfterReadConnection\");\n\t\t}\n\t}\n\n\t/**\n\t * Sets the sequence number from which inbound messages should be returned\n\t * @param snapshotSequenceNumber - The sequence number of the snapshot at which the document loaded from.\n\t * @param lastProcessedSequenceNumber - The last processed sequence number, for offline, it should be greater than the sequence number.\n\t * Setting lastProcessedSequenceNumber allows the DeltaManager to skip downloading and processing ops that have already been processed.\n\t */\n\tpublic async attachOpHandler(\n\t\tminSequenceNumber: number,\n\t\tsnapshotSequenceNumber: number,\n\t\thandler: IDeltaHandlerStrategy,\n\t\tprefetchType: \"cached\" | \"all\" | \"none\" = \"none\",\n\t\tlastProcessedSequenceNumber: number = snapshotSequenceNumber,\n\t): Promise<void> {\n\t\tthis.initSequenceNumber = snapshotSequenceNumber;\n\t\tthis.lastProcessedSequenceNumber = lastProcessedSequenceNumber;\n\t\tthis.minSequenceNumber = minSequenceNumber;\n\t\tthis.lastQueuedSequenceNumber = lastProcessedSequenceNumber;\n\t\tthis.lastObservedSeqNumber = lastProcessedSequenceNumber;\n\n\t\t// We will use same check in other places to make sure all the seq number above are set properly.\n\t\tassert(\n\t\t\tthis.handler === undefined,\n\t\t\t0x0e2 /* \"DeltaManager already has attached op handler!\" */,\n\t\t);\n\t\tthis.handler = handler;\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tassert(!!this.handler, 0x0e3 /* \"Newly set op handler is null/undefined!\" */);\n\n\t\t// There should be no pending fetch!\n\t\t// This API is called right after attachOpHandler by Container.load().\n\t\t// We might have connection already and it might have called fetchMissingDeltas() from\n\t\t// setupNewSuccessfulConnection. But it should do nothing, because there is no way to fetch ops before\n\t\t// we know snapshot sequence number that is set in attachOpHandler. So all such calls should be noop.\n\t\tassert(\n\t\t\tthis.fetchReason === undefined,\n\t\t\t0x268 /* \"There can't be pending fetch that early in boot sequence!\" */,\n\t\t);\n\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._inbound.resume();\n\t\tthis._inboundSignal.resume();\n\n\t\tif (prefetchType !== \"none\") {\n\t\t\tconst cacheOnly = prefetchType === \"cached\";\n\t\t\tawait this.fetchMissingDeltasCore(`DocumentOpen_${prefetchType}`, cacheOnly);\n\n\t\t\t// Keep going with fetching ops from storage once we have all cached ops in.\n\t\t\t// But do not block load and make this request async / not blocking this api.\n\t\t\t// Ops processing will start once cached ops are in and and will stop when queue is empty\n\t\t\t// (which in most cases will happen when we are done processing cached ops)\n\t\t\tif (cacheOnly) {\n\t\t\t\t// fire and forget\n\t\t\t\tthis.fetchMissingDeltas(\"PostDocumentOpen\");\n\t\t\t}\n\t\t}\n\n\t\t// Ensure there is no need to call this.processPendingOps() at the end of boot sequence\n\t\tassert(\n\t\t\tthis.fetchReason !== undefined || this.pending.length === 0,\n\t\t\t0x269 /* \"pending ops are not dropped\" */,\n\t\t);\n\t}\n\n\tpublic connect(args: IConnectionArgs): void {\n\t\tconst fetchOpsFromStorage = args.fetchOpsFromStorage ?? true;\n\t\tlogIfFalse(\n\t\t\tthis.handler !== undefined || !fetchOpsFromStorage,\n\t\t\tthis.logger,\n\t\t\t\"CantFetchWithoutBaseline\",\n\t\t); // can't fetch if no baseline\n\n\t\t// Note: There is race condition here.\n\t\t// We want to issue request to storage as soon as possible, to\n\t\t// reduce latency of becoming current, thus this code here.\n\t\t// But there is no ordering between fetching OPs and connection to delta stream\n\t\t// As result, we might be behind by the time we connect to delta stream\n\t\t// In case of r/w connection, that's not an issue, because we will hear our\n\t\t// own \"join\" message and realize any gap client has in ops.\n\t\t// But for view-only connection, we have no such signal, and with no traffic\n\t\t// on the wire, we might be always behind.\n\t\t// See comment at the end of \"connect\" handler\n\t\tif (fetchOpsFromStorage) {\n\t\t\tthis.fetchMissingDeltas(args.reason.text);\n\t\t}\n\n\t\tthis.connectionManager.connect(args.reason, args.mode);\n\t}\n\n\tprivate async getDeltas(\n\t\tfrom: number, // inclusive\n\t\tto: number | undefined, // exclusive\n\t\tfetchReason: string,\n\t\tcallback: (messages: ISequencedDocumentMessage[]) => void,\n\t\tcacheOnly: boolean,\n\t): Promise<void> {\n\t\tconst docService = this.serviceProvider();\n\t\tif (docService === undefined) {\n\t\t\tthrow new Error(\"Delta manager is not attached\");\n\t\t}\n\n\t\tif (this.deltaStorage === undefined) {\n\t\t\tthis.deltaStorage = await docService.connectToDeltaStorage();\n\t\t}\n\n\t\tlet cancelFetch: (op: ISequencedDocumentMessage) => boolean;\n\n\t\tif (to === undefined) {\n\t\t\t// Unbound requests are made to proactively fetch ops, but also get up to date in cases where socket\n\t\t\t// is silent (and connection is \"read\", thus we might not have any data on how far client is behind).\n\t\t\t// Once we have any op coming in from socket, we can cancel it as it's not needed any more.\n\t\t\t// That said, if we have socket connection, make sure we got ops up to checkpointSequenceNumber!\n\t\t\tcancelFetch = (op: ISequencedDocumentMessage): boolean =>\n\t\t\t\top.sequenceNumber >= this.lastObservedSeqNumber;\n\t\t} else {\n\t\t\tconst lastExpectedOp = to - 1; // make it inclusive!\n\n\t\t\t// It is possible that due to asynchrony (including await above), required ops were already\n\t\t\t// received through delta stream. Validate that before moving forward.\n\t\t\tif (this.lastQueuedSequenceNumber >= lastExpectedOp) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\treason: fetchReason,\n\t\t\t\t\teventName: \"ExtraStorageCall\",\n\t\t\t\t\tearly: true,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto,\n\t\t\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Be prepared for the case where webSocket would receive the ops that we are trying to fill through\n\t\t\t// storage. Ideally it should never happen (i.e. ops on socket are always ordered, and thus once we\n\t\t\t// detected gap, this gap can't be filled in later on through websocket).\n\t\t\t// And in practice that does look like the case. The place where this code gets hit is if we lost\n\t\t\t// connection and reconnected (likely to another box), and new socket's initial ops contains these ops.\n\t\t\tcancelFetch = (op: ISequencedDocumentMessage): boolean =>\n\t\t\t\top.sequenceNumber >= lastExpectedOp;\n\t\t}\n\n\t\tconst controller = new AbortController();\n\t\tlet opsFromFetch = false;\n\n\t\tconst opListener = (op: ISequencedDocumentMessage): void => {\n\t\t\tassert(op.sequenceNumber === this.lastQueuedSequenceNumber, 0x23a /* \"seq#'s\" */);\n\t\t\t// Ops that are coming from this request should not cancel itself.\n\t\t\t// This is useless for known ranges (to is defined) as it means request is over either way.\n\t\t\t// And it will cancel unbound request too early, not allowing us to learn where the end of the file is.\n\t\t\tif (!opsFromFetch && cancelFetch(op)) {\n\t\t\t\tcontroller.abort(\"DeltaManager getDeltas fetch cancelled\");\n\t\t\t\tthis._inbound.off(\"push\", opListener);\n\t\t\t}\n\t\t};\n\n\t\ttry {\n\t\t\tthis._inbound.on(\"push\", opListener);\n\t\t\tassert(this.closeAbortController.signal.onabort === null, 0x1e8 /* \"reentrancy\" */);\n\t\t\tthis.closeAbortController.signal.addEventListener(\"abort\", () =>\n\t\t\t\tcontroller.abort(this.closeAbortController.signal.reason),\n\t\t\t);\n\n\t\t\tconst stream = this.deltaStorage.fetchMessages(\n\t\t\t\tfrom, // inclusive\n\t\t\t\tto, // exclusive\n\t\t\t\tcontroller.signal,\n\t\t\t\tcacheOnly,\n\t\t\t\tfetchReason,\n\t\t\t);\n\n\t\t\t// eslint-disable-next-line no-constant-condition\n\t\t\twhile (true) {\n\t\t\t\tconst result = await stream.read();\n\t\t\t\tif (result.done) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\topsFromFetch = true;\n\t\t\t\t\tcallback(result.value);\n\t\t\t\t} finally {\n\t\t\t\t\topsFromFetch = false;\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tif (controller.signal.aborted) {\n\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"DeltaManager_GetDeltasAborted\",\n\t\t\t\t\tfetchReason,\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\treason: controller.signal.reason,\n\t\t\t\t});\n\t\t\t}\n\t\t\t// eslint-disable-next-line unicorn/no-null, unicorn/prefer-add-event-listener\n\t\t\tthis.closeAbortController.signal.onabort = null;\n\t\t\tthis._inbound.off(\"push\", opListener);\n\t\t\tassert(!opsFromFetch, 0x289 /* \"logic error\" */);\n\t\t}\n\t}\n\n\t/**\n\t * Closes the connection and clears inbound & outbound queues.\n\t *\n\t * Differences from dispose:\n\t * - close will trigger readonly notification\n\t * - close emits \"closed\"\n\t * - close cannot be called after dispose\n\t */\n\tpublic close(error?: ICriticalContainerError): void {\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._closed = true;\n\n\t\tthis.connectionManager.dispose(error, true /* switchToReadonly */);\n\t\tthis.clearQueues();\n\t\tthis.emit(\"closed\", error);\n\t}\n\n\t/**\n\t * Disposes the connection and clears the inbound & outbound queues.\n\t *\n\t * Differences from close:\n\t * - dispose will emit \"disposed\"\n\t * - dispose will remove all listeners\n\t * - dispose can be called after closure\n\t */\n\tpublic dispose(error?: Error | ICriticalContainerError): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tif (error !== undefined && !isFluidError(error)) {\n\t\t\tthrow new UsageError(\"Error must be a Fluid error\");\n\t\t}\n\n\t\tthis._disposed = true;\n\t\tthis._closed = true; // We consider \"disposed\" as a further state than \"closed\"\n\n\t\tthis.connectionManager.dispose(error, false /* switchToReadonly */);\n\t\tthis.clearQueues();\n\n\t\t// This needs to be the last thing we do (before removing listeners), as it causes\n\t\t// Container to dispose context and break ability of data stores / runtime to \"hear\" from delta manager.\n\t\tthis.emit(\"disposed\", error);\n\t\tthis.removeAllListeners();\n\t}\n\n\tprivate clearQueues(): void {\n\t\tthis.closeAbortController.abort(\"DeltaManager is closed\");\n\n\t\tthis._inbound.clear();\n\t\tthis._inboundSignal.clear();\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tthis._inbound.pause();\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tthis._inboundSignal.pause();\n\n\t\t// Drop pending messages - this will ensure catchUp() does not go into infinite loop\n\t\tthis.pending = [];\n\t}\n\n\tpublic refreshDelayInfo(id: string): void {\n\t\tthis.throttlingIdSet.delete(id);\n\t\tif (this.throttlingIdSet.size === 0) {\n\t\t\tthis.timeTillThrottling = 0;\n\t\t}\n\t}\n\n\tprivate disconnectHandler(reason: IConnectionStateChangeReason): void {\n\t\tthis.messageBuffer.length = 0;\n\t\tthis.emit(\"disconnect\", reason.text, reason.error);\n\t}\n\n\t/**\n\t * Emit info about a delay in service communication on account of throttling.\n\t * @param id - Id of the connection that is delayed\n\t * @param delayMs - Duration of the delay\n\t * @param error - error object indicating the throttling\n\t */\n\tpublic emitDelayInfo(id: string, delayMs: number, error: unknown): void {\n\t\tconst timeNow = Date.now();\n\t\tthis.throttlingIdSet.add(id);\n\t\tif (delayMs > 0 && timeNow + delayMs > this.timeTillThrottling) {\n\t\t\tthis.timeTillThrottling = timeNow + delayMs;\n\n\t\t\tconst throttlingWarning: IThrottlingWarning = ThrottlingWarning.wrap(\n\t\t\t\terror,\n\t\t\t\tdelayMs / 1000 /* retryAfterSeconds */,\n\t\t\t\tthis.logger,\n\t\t\t);\n\t\t\tthis.emit(\"throttled\", throttlingWarning);\n\t\t}\n\t}\n\n\t// returns parts of message (in string format) that should never change for a given message.\n\t// Used for message comparison. It attempts to avoid comparing fields that potentially may differ.\n\t// for example, it's not clear if serverMetadata or timestamp property is a property of message or server state.\n\t// We only extract the most obvious fields that are sufficient (with high probability) to detect sequence number\n\t// reuse.\n\t// Also payload goes to telemetry, so no content or anything else that shouldn't be logged for privacy reasons\n\t// Note: It's possible for a duplicate op to be broadcasted and have everything the same except the timestamp.\n\tprivate comparableMessagePayload(m: ISequencedDocumentMessage): string {\n\t\treturn `${m.clientId}-${m.type}-${m.minimumSequenceNumber}-${m.referenceSequenceNumber}-${m.timestamp}`;\n\t}\n\n\tprivate enqueueMessages(\n\t\tmessages: ISequencedDocumentMessage[],\n\t\treason: string,\n\t\tallowGaps = false,\n\t): void {\n\t\tif (this.handler === undefined) {\n\t\t\t// We did not setup handler yet.\n\t\t\t// This happens when we connect to web socket faster than we get attributes for container\n\t\t\t// and thus faster than attachOpHandler() is called\n\t\t\t// this.lastProcessedSequenceNumber is still zero, so we can't rely on this.fetchMissingDeltas()\n\t\t\t// to do the right thing.\n\t\t\tthis.pending = [...this.pending, ...messages];\n\t\t\treturn;\n\t\t}\n\n\t\t// Pending ops should never just hang around for nothing.\n\t\t// This invariant will stay true through this function execution,\n\t\t// so there is no need to process pending ops here.\n\t\t// It's responsibility of\n\t\t// - attachOpHandler()\n\t\t// - fetchMissingDeltas() after it's done with querying storage\n\t\tassert(\n\t\t\tthis.pending.length === 0 || this.fetchReason !== undefined,\n\t\t\t0x1e9 /* \"Pending ops\" */,\n\t\t);\n\n\t\tif (messages.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst from = messages[0].sequenceNumber;\n\t\tconst last = messages[messages.length - 1].sequenceNumber;\n\n\t\t// Report stats about missing and duplicate ops\n\t\t// This helps better understand why we fetch ops from storage, and thus may delay\n\t\t// getting current / sending ops\n\t\t// It's possible that this batch is already too late - do not bother\n\t\tif (last > this.lastQueuedSequenceNumber) {\n\t\t\tlet prev = from - 1;\n\t\t\tconst initialGap = prev - this.lastQueuedSequenceNumber;\n\t\t\tlet firstMissing: number | undefined;\n\t\t\tlet duplicate = 0;\n\t\t\tlet gap = 0;\n\n\t\t\t// Count all gaps and duplicates\n\t\t\tfor (const message of messages) {\n\t\t\t\tif (message.sequenceNumber === prev) {\n\t\t\t\t\tduplicate++;\n\t\t\t\t} else if (message.sequenceNumber !== prev + 1) {\n\t\t\t\t\tgap++;\n\t\t\t\t\tif (firstMissing === undefined) {\n\t\t\t\t\t\tfirstMissing = prev + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tprev = message.sequenceNumber;\n\t\t\t}\n\n\t\t\tlet eventName: string | undefined;\n\n\t\t\t// Report if we found some issues\n\t\t\tif (\n\t\t\t\tduplicate !== 0 ||\n\t\t\t\t(gap !== 0 && !allowGaps) ||\n\t\t\t\t(initialGap > 0 && this.fetchReason === undefined)\n\t\t\t) {\n\t\t\t\teventName = \"enqueueMessages\";\n\t\t\t\t// Also report if we are fetching ops, and same range comes in, thus making this fetch obsolete.\n\t\t\t} else if (\n\t\t\t\tthis.fetchReason !== undefined &&\n\t\t\t\tthis.fetchReason !== reason &&\n\t\t\t\tfrom <= this.lastQueuedSequenceNumber + 1 &&\n\t\t\t\tlast > this.lastQueuedSequenceNumber\n\t\t\t) {\n\t\t\t\teventName = \"enqueueMessagesExtraFetch\";\n\t\t\t}\n\n\t\t\t// Report if there is something to report\n\t\t\t// Do not report when pending fetch is in progress, as such reporting will not\n\t\t\t// correctly take into account pending ops.\n\t\t\tif (eventName !== undefined) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName,\n\t\t\t\t\treason,\n\t\t\t\t\tpreviousReason: this.prevEnqueueMessagesReason,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto: last + 1, // exclusive, being consistent with the other telemetry / APIs\n\t\t\t\t\tlength: messages.length,\n\t\t\t\t\tfetchReason: this.fetchReason,\n\t\t\t\t\tduplicate: duplicate > 0 ? duplicate : undefined,\n\t\t\t\t\tinitialGap: initialGap === 0 ? undefined : initialGap,\n\t\t\t\t\tgap: gap > 0 ? gap : undefined,\n\t\t\t\t\tfirstMissing,\n\t\t\t\t\tdmInitialSeqNumber: this.initialSequenceNumber,\n\t\t\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tthis.updateLatestKnownOpSeqNumber(messages[messages.length - 1].sequenceNumber);\n\n\t\tconst n = this.previouslyProcessedMessage?.sequenceNumber;\n\t\tassert(\n\t\t\tn === undefined || n === this.lastQueuedSequenceNumber,\n\t\t\t0x0ec /* \"Unexpected value for previously processed message's sequence number\" */,\n\t\t);\n\n\t\tfor (const message of messages) {\n\t\t\t// Check that the messages are arriving in the expected order\n\t\t\tif (message.sequenceNumber <= this.lastQueuedSequenceNumber) {\n\t\t\t\t// Validate that we do not have data loss, i.e. sequencing is reset and started again\n\t\t\t\t// with numbers that this client already observed before.\n\t\t\t\tif (this.previouslyProcessedMessage?.sequenceNumber === message.sequenceNumber) {\n\t\t\t\t\tconst message1 = this.comparableMessagePayload(this.previouslyProcessedMessage);\n\t\t\t\t\tconst message2 = this.comparableMessagePayload(message);\n\t\t\t\t\tif (message1 !== message2) {\n\t\t\t\t\t\tconst error = new NonRetryableError(\n\t\t\t\t\t\t\t// This looks like a data corruption but the culprit was that the file was overwritten\n\t\t\t\t\t\t\t// in storage. See PR #5882.\n\t\t\t\t\t\t\t// Likely to be an issue with Fluid Services. Content does not match previous client\n\t\t\t\t\t\t\t// knowledge about this file. If the file is overwritten for any reason, this error can be\n\t\t\t\t\t\t\t// hit. One example is that some clients could be submitting ops to two different service\n\t\t\t\t\t\t\t// instances such that the same sequence number is reused for two different ops.\n\t\t\t\t\t\t\t// pre-0.58 error message: twoMessagesWithSameSeqNumAndDifferentPayload\n\t\t\t\t\t\t\t\"Found two messages with the same sequenceNumber but different payloads. Likely to be a \" +\n\t\t\t\t\t\t\t\t\"service issue\",\n\t\t\t\t\t\t\tDriverErrorTypes.fileOverwrittenInStorage,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t\t\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\t\t\t\t\tmessage1,\n\t\t\t\t\t\t\t\tmessage2,\n\t\t\t\t\t\t\t\tdriverVersion: undefined,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.close(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (message.sequenceNumber === this.lastQueuedSequenceNumber + 1) {\n\t\t\t\tthis.lastQueuedSequenceNumber = message.sequenceNumber;\n\t\t\t\tthis.previouslyProcessedMessage = message;\n\t\t\t\tthis._inbound.push(message);\n\t\t\t} else {\n\t\t\t\tthis.pending.push(message);\n\t\t\t\tthis.fetchMissingDeltas(reason, message.sequenceNumber);\n\t\t\t}\n\t\t}\n\n\t\t// When / if we report a gap in ops in the future, we want telemetry to correctly reflect source\n\t\t// of prior ops. But if we have some out of order ops (this.pending), then reporting current reason\n\t\t// becomes not accurate, as the gap existed before current batch, so we should just report \"unknown\".\n\t\tthis.prevEnqueueMessagesReason = this.pending.length > 0 ? \"unknown\" : reason;\n\t}\n\n\tprivate processInboundMessage(message: ISequencedDocumentMessage): void {\n\t\tconst startTime = Date.now();\n\t\tassert(!this.currentlyProcessingOps, 0x3af /* Already processing ops. */);\n\t\tthis.currentlyProcessingOps = true;\n\t\tthis.lastProcessedMessage = message;\n\n\t\tconst isString = typeof message.clientId === \"string\";\n\t\tassert(message.clientId === null || isString, 0x41a /* undefined or string */);\n\t\t// All client messages are coming from some client, and should have clientId,\n\t\t// and non-client message should not have clientId. But, there are two exceptions:\n\t\t// 1. (Legacy) We can see message.type === \"attach\" or \"chunkedOp\" for legacy files before RTM\n\t\t// 2. Non-immediate noops (contents: null) can be sent by service without clientId\n\t\tif (!isString && isClientMessage(message) && message.type !== MessageType.NoOp) {\n\t\t\tthrow new DataCorruptionError(\"Mismatch in clientId\", {\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\tmessageType: message.type,\n\t\t\t});\n\t\t}\n\n\t\t// Validate client sequence number has no gap. Decrement the noOpCount by gap\n\t\t// If the count ends up negative, that means we have a real gap and throw error\n\t\tif (\n\t\t\tthis.connectionManager.clientId !== undefined &&\n\t\t\tthis.connectionManager.clientId === message.clientId\n\t\t) {\n\t\t\tif (message.type === MessageType.NoOp) {\n\t\t\t\tthis.noOpCount--;\n\t\t\t}\n\t\t\tconst clientSeqNumGap = message.clientSequenceNumber - this.lastClientSequenceNumber - 1;\n\t\t\tthis.noOpCount -= clientSeqNumGap;\n\t\t\tif (this.noOpCount < 0) {\n\t\t\t\tthrow new Error(`gap in client sequence number: ${clientSeqNumGap}`);\n\t\t\t}\n\t\t\tthis.lastClientSequenceNumber = message.clientSequenceNumber;\n\t\t}\n\n\t\tthis.connectionManager.beforeProcessingIncomingOp(message);\n\n\t\t// Watch the minimum sequence number and be ready to update as needed\n\t\tif (this.minSequenceNumber > message.minimumSequenceNumber) {\n\t\t\t// This indicates that an invalid series of ops was received by this client.\n\t\t\t// In the unlikely case where these ops have been truly sequenced and persisted to storage,\n\t\t\t// this document is corrupted - It will fail here on boot every time.\n\t\t\t// The more likely scenario, based on the realities of production service operation, is that\n\t\t\t// something has changed out from under the file on the server, such that the service lost some ops\n\t\t\t// which this client already processed - the very ops that made this _next_ op to appear invalid.\n\t\t\t// In this case, only this client will fail (and lose this recent data), but others will be able to connect and continue.\n\t\t\tthrow DataProcessingError.create(\n\t\t\t\t// error message through v0.57: msnMovesBackwards\n\t\t\t\t// error message through v2.1: \"Found a lower minimumSequenceNumber (msn) than previously recorded\",\n\t\t\t\t\"Invalid MinimumSequenceNumber from service - document may have been restored to previous state\",\n\t\t\t\t\"DeltaManager.processInboundMessage\",\n\t\t\t\tmessage,\n\t\t\t\t{\n\t\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// Client ops: MSN has to be lower than sequence #, as client can continue to send ops with same\n\t\t// reference sequence number as this op.\n\t\t// System ops (when no clients are connected) are the only ops where equation is possible.\n\t\tconst diff = message.sequenceNumber - message.minimumSequenceNumber;\n\t\tif (diff < 0 || (diff === 0 && message.clientId !== null)) {\n\t\t\tthrow new DataCorruptionError(\n\t\t\t\t\"MSN has to be lower than sequence #\",\n\t\t\t\textractSafePropertiesFromMessage(message),\n\t\t\t);\n\t\t}\n\n\t\tthis.minSequenceNumber = message.minimumSequenceNumber;\n\n\t\tif (message.sequenceNumber !== this.lastProcessedSequenceNumber + 1) {\n\t\t\t// pre-0.58 error message: nonSequentialSequenceNumber\n\t\t\tthrow new DataCorruptionError(\"Found a non-Sequential sequenceNumber\", {\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t});\n\t\t}\n\t\tthis.lastProcessedSequenceNumber = message.sequenceNumber;\n\n\t\t// a bunch of code assumes that this is true\n\t\tassert(\n\t\t\tthis.lastProcessedSequenceNumber <= this.lastObservedSeqNumber,\n\t\t\t0x267 /* \"lastObservedSeqNumber should be updated first\" */,\n\t\t);\n\n\t\tif (this.handler === undefined) {\n\t\t\tthrow new Error(\"Attempted to process an inbound message without a handler attached\");\n\t\t}\n\t\tthis.handler.process(message);\n\t\tthis.currentlyProcessingOps = false;\n\t\tconst endTime = Date.now();\n\n\t\t// Should be last, after changing this.lastProcessedSequenceNumber above, as many callers\n\t\t// test this.lastProcessedSequenceNumber instead of using op.sequenceNumber itself.\n\t\tthis.emit(\"op\", message, endTime - startTime);\n\t}\n\n\t/**\n\t * Retrieves the missing deltas between the given sequence numbers\n\t */\n\tprivate fetchMissingDeltas(reasonArg: string, to?: number): void {\n\t\tthis.fetchMissingDeltasCore(reasonArg, false /* cacheOnly */, to).catch((error) => {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"fetchMissingDeltasException\" }, error);\n\t\t});\n\t}\n\n\t/**\n\t * Retrieves the missing deltas between the given sequence numbers\n\t */\n\tprivate async fetchMissingDeltasCore(\n\t\treason: string,\n\t\tcacheOnly: boolean,\n\t\tto?: number,\n\t): Promise<void> {\n\t\t// Exit out early if we're already fetching deltas\n\t\tif (this.fetchReason !== undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._closed) {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"fetchMissingDeltasClosedConnection\",\n\t\t\t\treason,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.handler === undefined) {\n\t\t\t// We do not poses yet any information\n\t\t\tassert(this.lastQueuedSequenceNumber === 0, 0x26b /* \"initial state\" */);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlet from = this.lastQueuedSequenceNumber + 1;\n\n\t\t\tconst n = this.previouslyProcessedMessage?.sequenceNumber;\n\t\t\tif (n !== undefined) {\n\t\t\t\t// If we already processed at least one op, then we have this.previouslyProcessedMessage populated\n\t\t\t\t// and can use it to validate that we are operating on same file, i.e. it was not overwritten.\n\t\t\t\t// Knowing about this mechanism, we could ask for op we already observed to increase validation.\n\t\t\t\t// This is especially useful when coming out of offline mode or loading from\n\t\t\t\t// very old cached (by client / driver) snapshot.\n\t\t\t\tassert(n === this.lastQueuedSequenceNumber, 0x0f2 /* \"previouslyProcessedMessage\" */);\n\t\t\t\tassert(from > 1, 0x0f3 /* \"not positive\" */);\n\t\t\t\tfrom--;\n\t\t\t}\n\n\t\t\tconst fetchReason = `${reason}_fetch`;\n\t\t\tthis.fetchReason = fetchReason;\n\n\t\t\tawait this.getDeltas(\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tfetchReason,\n\t\t\t\t(messages) => {\n\t\t\t\t\tthis.refreshDelayInfo(this.deltaStorageDelayId);\n\t\t\t\t\tthis.enqueueMessages(messages, fetchReason);\n\t\t\t\t},\n\t\t\t\tcacheOnly,\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"GetDeltas_Exception\" }, error);\n\t\t\tthis.close(normalizeError(error));\n\t\t} finally {\n\t\t\tthis.refreshDelayInfo(this.deltaStorageDelayId);\n\t\t\tthis.fetchReason = undefined;\n\t\t\tthis.processPendingOps(reason);\n\t\t}\n\t}\n\n\t/**\n\t * Sorts pending ops and attempts to apply them\n\t */\n\tprivate processPendingOps(reason?: string): void {\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(this.handler !== undefined, 0x26c /* \"handler should be installed\" */);\n\n\t\tconst pendingSorted = this.pending.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\t\tthis.pending = [];\n\t\t// Given that we do not track where these ops came from any more, it's not very\n\t\t// actionably to report gaps in this range.\n\t\tthis.enqueueMessages(pendingSorted, `${reason}_pending`, true /* allowGaps */);\n\n\t\t// Re-entrancy is ignored by fetchMissingDeltas, execution will come here when it's over\n\t\tif (this.fetchReason === undefined) {\n\t\t\t// See issue #7312 for more details\n\t\t\t// We observe cases where client gets into situation where it is not aware of missing ops\n\t\t\t// (i.e. client being behind), and as such, does not attempt to fetch them.\n\t\t\t// In some cases client may not have enough signal (example - \"read\" connection that is silent -\n\t\t\t// there is no easy way for client to realize it's behind, see a bit of commentary / logic at the\n\t\t\t// end of setupNewSuccessfulConnection). In other cases it should be able to learn that info (\"write\"\n\t\t\t// connection, learn by receiving its own join op), but data suggest it does not happen.\n\t\t\t// In 50% of these cases we do know we are behind through checkpointSequenceNumber on connection object\n\t\t\t// and thus can leverage that to trigger recovery. But this is not going to solve all the problems\n\t\t\t// (the other 50%), and thus these errors below should be looked at even if code below results in\n\t\t\t// recovery.\n\t\t\t// eslint-disable-next-line unicorn/no-lonely-if -- Docs make more sense like this\n\t\t\tif (this.lastQueuedSequenceNumber < this.lastObservedSeqNumber) {\n\t\t\t\tthis.fetchMissingDeltas(\"OpsBehind\");\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate updateLatestKnownOpSeqNumber(seq: number): void {\n\t\tif (this.lastObservedSeqNumber < seq) {\n\t\t\tthis.lastObservedSeqNumber = seq;\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"deltaManager.js","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAgBH,kEAA6D;AAE7D,0EAUqD;AACrD,oEAA4F;AAC5F,uEAYkD;AAClD,+BAAkC;AAQlC,mDAA6C;AAC7C,yCAA+C;AAgD/C;;GAEG;AACH,SAAS,eAAe,CAAC,OAAqD;IAC7E,IAAI,IAAA,2BAAgB,EAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACb,CAAC;IACD,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACtB,KAAK,sBAAW,CAAC,OAAO,CAAC;QACzB,KAAK,sBAAW,CAAC,MAAM,CAAC;QACxB,KAA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;QAC/C,IAAI,IAAI,CAAC,qBAAqB,GAAG,GAAG,EAAE,CAAC;YACtC,IAAI,CAAC,qBAAqB,GAAG,GAAG,CAAC;QAClC,CAAC;IACF,CAAC;CACD;AAnjCD,oCAmjCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport {\n\tIDeltaManagerEvents,\n\tIDeltaManagerFull,\n\tIDeltaQueue,\n\ttype IDeltaSender,\n\ttype ReadOnlyInfo,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tIEventProvider,\n\ttype ITelemetryBaseEvent,\n\tITelemetryBaseProperties,\n} from \"@fluidframework/core-interfaces\";\nimport { IThrottlingWarning } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ConnectionMode } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tDriverErrorTypes,\n\tIDocumentMessage,\n\tMessageType,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n\ttype IClientDetails,\n\ttype IClientConfiguration,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { NonRetryableError, isRuntimeMessage } from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype ITelemetryErrorEventExt,\n\ttype ITelemetryGenericEventExt,\n\tITelemetryLoggerExt,\n\tDataCorruptionError,\n\tDataProcessingError,\n\tUsageError,\n\textractSafePropertiesFromMessage,\n\tisFluidError,\n\tnormalizeError,\n\tsafeRaiseEvent,\n\tEventEmitterWithErrorHandling,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport {\n\tIConnectionDetailsInternal,\n\tIConnectionManager,\n\tIConnectionManagerFactoryArgs,\n\tIConnectionStateChangeReason,\n} from \"./contracts.js\";\nimport { DeltaQueue } from \"./deltaQueue.js\";\nimport { ThrottlingWarning } from \"./error.js\";\n\nexport interface IConnectionArgs {\n\tmode?: ConnectionMode;\n\tfetchOpsFromStorage?: boolean;\n\treason: IConnectionStateChangeReason;\n}\n\n/**\n * Includes events emitted by the concrete implementation DeltaManager\n * but not exposed on the public interface IDeltaManager\n */\nexport interface IDeltaManagerInternalEvents extends IDeltaManagerEvents {\n\t(event: \"throttled\", listener: (error: IThrottlingWarning) => void);\n\t(event: \"closed\" | \"disposed\", listener: (error?: ICriticalContainerError) => void);\n\t(\n\t\tevent: \"connect\",\n\t\tlistener: (details: IConnectionDetailsInternal, opsBehind?: number) => void,\n\t);\n\t(event: \"establishingConnection\", listener: (reason: IConnectionStateChangeReason) => void);\n\t(\n\t\tevent: \"cancelEstablishingConnection\",\n\t\tlistener: (reason: IConnectionStateChangeReason) => void,\n\t);\n}\n\n/**\n * Batching makes assumptions about what might be on the metadata. This interface codifies those assumptions, but does not validate them.\n */\ninterface IBatchMetadata {\n\tbatch?: boolean;\n}\n\n/**\n * Interface used to define a strategy for handling incoming delta messages\n */\nexport interface IDeltaHandlerStrategy {\n\t/**\n\t * Processes the message.\n\t */\n\tprocess: (message: ISequencedDocumentMessage) => void;\n\n\t/**\n\t * Processes the signal.\n\t */\n\tprocessSignal: (message: ISignalMessage) => void;\n}\n\n/**\n * Determines if message was sent by client, not service\n */\nfunction isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean {\n\tif (isRuntimeMessage(message)) {\n\t\treturn true;\n\t}\n\tswitch (message.type) {\n\t\tcase MessageType.Propose:\n\t\tcase MessageType.Reject:\n\t\tcase MessageType.NoOp:\n\t\tcase MessageType.Accept:\n\t\tcase MessageType.Summarize: {\n\t\t\treturn true;\n\t\t}\n\t\tdefault: {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\n/**\n * Like assert, but logs only if the condition is false, rather than throwing\n * @param condition - The condition to attest too\n * @param logger - The logger to log with\n * @param event - The string or event to log\n * @returns The outcome of the condition\n */\nfunction logIfFalse(\n\tcondition: boolean,\n\tlogger: ITelemetryLoggerExt,\n\tevent: string | ITelemetryGenericEventExt,\n): condition is true {\n\tif (condition) {\n\t\treturn true;\n\t}\n\tconst newEvent: ITelemetryBaseEvent =\n\t\ttypeof event === \"string\"\n\t\t\t? { eventName: event, category: \"error\" }\n\t\t\t: { category: \"error\", ...event };\n\tlogger.send(newEvent);\n\treturn false;\n}\n\n/**\n * Manages the flow of both inbound and outbound messages. This class ensures that shared objects receive delta\n * messages in order regardless of possible network conditions or timings causing out of order delivery.\n */\nexport class DeltaManager<TConnectionManager extends IConnectionManager>\n\textends EventEmitterWithErrorHandling<IDeltaManagerInternalEvents>\n\timplements IDeltaManagerFull, IEventProvider<IDeltaManagerInternalEvents>\n{\n\tpublic readonly connectionManager: TConnectionManager;\n\n\tpublic get active(): boolean {\n\t\treturn this._active();\n\t}\n\n\tpublic get disposed(): boolean {\n\t\treturn this._closed;\n\t}\n\n\tpublic get IDeltaSender(): IDeltaSender {\n\t\treturn this;\n\t}\n\n\tprivate pending: ISequencedDocumentMessage[] = [];\n\tprivate fetchReason: string | undefined;\n\n\t// A boolean used to assert that ops are not being sent while processing another op.\n\tprivate currentlyProcessingOps: boolean = false;\n\n\t// The minimum sequence number and last sequence number received from the server\n\tprivate minSequenceNumber: number = 0;\n\n\t// There are three numbers we track\n\t// * lastQueuedSequenceNumber is the last queued sequence number. If there are gaps in seq numbers, then this number\n\t// is not updated until we cover that gap, so it increases each time by 1.\n\t// * lastObservedSeqNumber is an estimation of last known sequence number for container in storage. It's initially\n\t// populated at web socket connection time (if storage provides that info) and is updated once ops shows up.\n\t// It's never less than lastQueuedSequenceNumber\n\t// * lastProcessedSequenceNumber - last processed sequence number\n\tprivate lastQueuedSequenceNumber: number = 0;\n\tprivate lastObservedSeqNumber: number = 0;\n\tprivate lastProcessedSequenceNumber: number = 0;\n\tprivate lastProcessedMessage: ISequencedDocumentMessage | undefined;\n\n\t/**\n\t * Count the number of noops sent by the client which may not be acked\n\t */\n\tprivate noOpCount: number = 0;\n\t/**\n\t * Track clientSequenceNumber of the last op\n\t */\n\tprivate lastClientSequenceNumber: number = 0;\n\n\t/**\n\t * Track down the ops size.\n\t */\n\tprivate opsSize: number = 0;\n\tprivate prevEnqueueMessagesReason: string | undefined;\n\tprivate previouslyProcessedMessage: ISequencedDocumentMessage | undefined;\n\n\t// The sequence number we initially loaded from\n\t// In case of reading from a snapshot or pending state, its value will be equal to\n\t// the last message that got serialized.\n\tprivate initSequenceNumber: number = 0;\n\n\tprivate readonly _inbound: DeltaQueue<ISequencedDocumentMessage>;\n\tprivate readonly _inboundSignal: DeltaQueue<ISignalMessage>;\n\n\tprivate _closed = false;\n\tprivate _disposed = false;\n\n\tprivate handler: IDeltaHandlerStrategy | undefined;\n\tprivate deltaStorage: IDocumentDeltaStorageService | undefined;\n\n\tprivate readonly throttlingIdSet = new Set<string>();\n\tprivate timeTillThrottling: number = 0;\n\n\tpublic readonly closeAbortController = new AbortController();\n\n\tprivate readonly deltaStorageDelayId = uuid();\n\tprivate readonly deltaStreamDelayId = uuid();\n\n\tprivate messageBuffer: IDocumentMessage[] = [];\n\n\tprivate _checkpointSequenceNumber: number | undefined;\n\n\tpublic get inbound(): IDeltaQueue<ISequencedDocumentMessage> {\n\t\treturn this._inbound;\n\t}\n\n\tpublic get inboundSignal(): IDeltaQueue<ISignalMessage> {\n\t\treturn this._inboundSignal;\n\t}\n\n\tpublic get initialSequenceNumber(): number {\n\t\treturn this.initSequenceNumber;\n\t}\n\n\tpublic get lastSequenceNumber(): number {\n\t\treturn this.lastProcessedSequenceNumber;\n\t}\n\n\tpublic get lastMessage(): ISequencedDocumentMessage | undefined {\n\t\treturn this.lastProcessedMessage;\n\t}\n\n\tpublic get lastKnownSeqNumber(): number {\n\t\treturn this.lastObservedSeqNumber;\n\t}\n\n\tpublic get minimumSequenceNumber(): number {\n\t\treturn this.minSequenceNumber;\n\t}\n\n\t/**\n\t * Tells if current connection has checkpoint information.\n\t * I.e. we know how far behind the client was at the time of establishing connection\n\t */\n\tpublic get hasCheckpointSequenceNumber(): boolean {\n\t\t// Valid to be called only if we have active connection.\n\t\tassert(this.connectionManager.connected, 0x0df /* \"Missing active connection\" */);\n\t\treturn this._checkpointSequenceNumber !== undefined;\n\t}\n\n\t// Forwarding connection manager properties / IDeltaManager implementation\n\tpublic get maxMessageSize(): number {\n\t\treturn this.connectionManager.maxMessageSize;\n\t}\n\tpublic get version(): string {\n\t\treturn this.connectionManager.version;\n\t}\n\tpublic get serviceConfiguration(): IClientConfiguration | undefined {\n\t\treturn this.connectionManager.serviceConfiguration;\n\t}\n\tpublic get outbound(): IDeltaQueue<IDocumentMessage[]> {\n\t\treturn this.connectionManager.outbound;\n\t}\n\tpublic get readOnlyInfo(): ReadOnlyInfo {\n\t\treturn this.connectionManager.readOnlyInfo;\n\t}\n\tpublic get clientDetails(): IClientDetails {\n\t\treturn this.connectionManager.clientDetails;\n\t}\n\n\tpublic submit(\n\t\ttype: MessageType,\n\t\tcontents?: string,\n\t\tbatch = false,\n\t\tmetadata?: unknown,\n\t\tcompression?: string,\n\t\treferenceSequenceNumber?: number,\n\t): number {\n\t\t// Back-compat ADO:3455\n\t\tconst backCompatRefSeqNum = referenceSequenceNumber ?? this.lastProcessedSequenceNumber;\n\t\tconst messagePartial: Omit<IDocumentMessage, \"clientSequenceNumber\"> = {\n\t\t\tcontents,\n\t\t\tmetadata,\n\t\t\treferenceSequenceNumber: backCompatRefSeqNum,\n\t\t\ttype,\n\t\t\tcompression,\n\t\t};\n\n\t\tif (!batch) {\n\t\t\tthis.flush();\n\t\t}\n\t\tconst message = this.connectionManager.prepareMessageToSend(messagePartial);\n\t\tif (message === undefined) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tassert(isClientMessage(message), 0x419 /* client sends non-client message */);\n\n\t\tif (contents !== undefined) {\n\t\t\tthis.opsSize += contents.length;\n\t\t}\n\n\t\tthis.messageBuffer.push(message);\n\n\t\tif (message.type === MessageType.NoOp) {\n\t\t\tthis.noOpCount++;\n\t\t}\n\n\t\tthis.emit(\"submitOp\", message);\n\n\t\tif (!batch) {\n\t\t\tthis.flush();\n\t\t}\n\t\treturn message.clientSequenceNumber;\n\t}\n\n\tpublic submitSignal(content: string, targetClientId?: string): void {\n\t\treturn this.connectionManager.submitSignal(content, targetClientId);\n\t}\n\n\tpublic flush(): void {\n\t\tconst batch = this.messageBuffer;\n\t\tif (batch.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.messageBuffer = [];\n\n\t\t// The prepareFlush event allows listeners to append metadata to the batch prior to submission.\n\t\tthis.emit(\"prepareSend\", batch);\n\n\t\tif (batch.length === 1) {\n\t\t\tassert(\n\t\t\t\t(batch[0].metadata as IBatchMetadata)?.batch === undefined,\n\t\t\t\t0x3c9 /* no batch markup on single message */,\n\t\t\t);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\t(batch[0].metadata as IBatchMetadata)?.batch === true,\n\t\t\t\t0x3ca /* no start batch markup */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\t(batch[batch.length - 1].metadata as IBatchMetadata)?.batch === false,\n\t\t\t\t0x3cb /* no end batch markup */,\n\t\t\t);\n\t\t}\n\n\t\tthis.connectionManager.sendMessages(batch);\n\n\t\tassert(this.messageBuffer.length === 0, 0x3cc /* reentrancy */);\n\t}\n\n\tpublic get connectionProps(): ITelemetryBaseProperties {\n\t\treturn {\n\t\t\tsequenceNumber: this.lastSequenceNumber,\n\t\t\topsSize: this.opsSize > 0 ? this.opsSize : undefined,\n\t\t\tdeltaManagerState: this._disposed ? \"disposed\" : this._closed ? \"closed\" : \"open\",\n\t\t\t...this.connectionManager.connectionProps,\n\t\t};\n\t}\n\n\t/**\n\t * Log error event with a bunch of internal to DeltaManager information about state of op processing\n\t * Used to diagnose connectivity issues related to op processing (i.e. cases where for some reason\n\t * we stop processing ops that results in no processing join op and thus moving to connected state)\n\t * @param event - Event to log.\n\t */\n\tpublic logConnectionIssue(event: ITelemetryErrorEventExt): void {\n\t\tassert(this.connectionManager.connected, 0x238 /* \"called only in connected state\" */);\n\n\t\tconst pendingSorted = this.pending.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\t...event,\n\t\t\t// This directly tells us if fetching ops is in flight, and thus likely the reason of\n\t\t\t// stalled op processing\n\t\t\tfetchReason: this.fetchReason,\n\t\t\t// A bunch of useful sequence numbers to understand if we are holding some ops from processing\n\t\t\tlastQueuedSequenceNumber: this.lastQueuedSequenceNumber, // last sequential op\n\t\t\tlastProcessedSequenceNumber: this.lastProcessedSequenceNumber, // same as above, but after processing\n\t\t\tlastObserved: this.lastObservedSeqNumber, // last sequence we ever saw; may have gaps with above.\n\t\t\t// connection info\n\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\tpendingOps: this.pending.length, // Do we have any pending ops?\n\t\t\tpendingFirst: pendingSorted[0]?.sequenceNumber, // is the first pending op the one that we are missing?\n\t\t\thaveHandler: this.handler !== undefined, // do we have handler installed?\n\t\t\tinboundLength: this.inbound.length,\n\t\t\tinboundPaused: this.inbound.paused,\n\t\t});\n\t}\n\n\tconstructor(\n\t\tprivate readonly serviceProvider: () => IDocumentService | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly _active: () => boolean,\n\t\tcreateConnectionManager: (props: IConnectionManagerFactoryArgs) => TConnectionManager,\n\t) {\n\t\tsuper((name, error) => {\n\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"DeltaManagerEventHandlerException\",\n\t\t\t\t\tname: typeof name === \"string\" ? name : undefined,\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t\tthis.close(normalizeError(error));\n\t\t});\n\t\tconst props: IConnectionManagerFactoryArgs = {\n\t\t\tincomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.enqueueMessages(messages, reason);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"EnqueueMessages_Exception\" }, error);\n\t\t\t\t\tthis.close(normalizeError(error));\n\t\t\t\t}\n\t\t\t},\n\t\t\tsignalHandler: (signals: ISignalMessage[]) => {\n\t\t\t\tfor (const signal of signals) {\n\t\t\t\t\tthis._inboundSignal.push(signal);\n\t\t\t\t}\n\t\t\t},\n\t\t\treconnectionDelayHandler: (delayMs: number, error: unknown) =>\n\t\t\t\tthis.emitDelayInfo(this.deltaStreamDelayId, delayMs, error),\n\t\t\tcloseHandler: (error: ICriticalContainerError | undefined) => this.close(error),\n\t\t\tdisconnectHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.disconnectHandler(reason),\n\t\t\tconnectHandler: (connection: IConnectionDetailsInternal) =>\n\t\t\t\tthis.connectHandler(connection),\n\t\t\tpongHandler: (latency: number) => this.emit(\"pong\", latency),\n\t\t\treadonlyChangeHandler: (\n\t\t\t\treadonly?: boolean,\n\t\t\t\treadonlyConnectionReason?: IConnectionStateChangeReason,\n\t\t\t) => {\n\t\t\t\tsafeRaiseEvent(this, this.logger, \"readonly\", readonly, readonlyConnectionReason);\n\t\t\t},\n\t\t\testablishConnectionHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.establishingConnection(reason),\n\t\t\tcancelConnectionHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.cancelEstablishingConnection(reason),\n\t\t};\n\n\t\tthis.connectionManager = createConnectionManager(props);\n\t\tthis._inbound = new DeltaQueue<ISequencedDocumentMessage>((op) => {\n\t\t\tthis.processInboundMessage(op);\n\t\t});\n\n\t\tthis._inbound.on(\"error\", (error) => {\n\t\t\tthis.close(\n\t\t\t\tDataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\terror,\n\t\t\t\t\t\"deltaManagerInboundErrorHandler\",\n\t\t\t\t\tthis.lastMessage,\n\t\t\t\t),\n\t\t\t);\n\t\t});\n\n\t\t// Inbound signal queue\n\t\tthis._inboundSignal = new DeltaQueue<ISignalMessage>((message) => {\n\t\t\tif (this.handler === undefined) {\n\t\t\t\tthrow new Error(\"Attempted to process an inbound signal without a handler attached\");\n\t\t\t}\n\n\t\t\tthis.handler.processSignal({\n\t\t\t\t...message,\n\t\t\t\tcontent: JSON.parse(message.content as string),\n\t\t\t});\n\t\t});\n\n\t\tthis._inboundSignal.on(\"error\", (error) => {\n\t\t\tthis.close(normalizeError(error));\n\t\t});\n\n\t\t// Initially, all queues are created paused.\n\t\t// - outbound is flipped back and forth in setupNewSuccessfulConnection / disconnectFromDeltaStream\n\t\t// - inbound & inboundSignal are resumed in attachOpHandler() when we have handler setup\n\t}\n\n\tprivate cancelEstablishingConnection(reason: IConnectionStateChangeReason): void {\n\t\tthis.emit(\"cancelEstablishingConnection\", reason);\n\t}\n\n\tprivate establishingConnection(reason: IConnectionStateChangeReason): void {\n\t\tthis.emit(\"establishingConnection\", reason);\n\t}\n\n\tprivate connectHandler(connection: IConnectionDetailsInternal): void {\n\t\tthis.refreshDelayInfo(this.deltaStreamDelayId);\n\n\t\tconst props = this.connectionManager.connectionVerboseProps;\n\t\tprops.connectionLastQueuedSequenceNumber = this.lastQueuedSequenceNumber;\n\t\tprops.connectionLastObservedSeqNumber = this.lastObservedSeqNumber;\n\n\t\tconst checkpointSequenceNumber = connection.checkpointSequenceNumber;\n\t\tthis._checkpointSequenceNumber = checkpointSequenceNumber;\n\t\tif (checkpointSequenceNumber !== undefined) {\n\t\t\tthis.updateLatestKnownOpSeqNumber(checkpointSequenceNumber);\n\t\t}\n\n\t\t// We cancel all ops on lost of connectivity, and rely on DDSes to resubmit them.\n\t\t// Semantics are not well defined for batches (and they are broken right now on disconnects anyway),\n\t\t// but it's safe to assume (until better design is put into place) that batches should not exist\n\t\t// across multiple connections. Right now we assume runtime will not submit any ops in disconnected\n\t\t// state. As requirements change, so should these checks.\n\t\tassert(\n\t\t\tthis.messageBuffer.length === 0,\n\t\t\t0x0e9 /* \"messageBuffer is not empty on new connection\" */,\n\t\t);\n\n\t\tthis.opsSize = 0;\n\t\tthis.noOpCount = 0;\n\n\t\tthis.emit(\n\t\t\t\"connect\",\n\t\t\tconnection,\n\t\t\tcheckpointSequenceNumber === undefined\n\t\t\t\t? undefined\n\t\t\t\t: this.lastObservedSeqNumber - this.lastSequenceNumber,\n\t\t);\n\n\t\t// If we got some initial ops, then we know the gap and call above fetched ops to fill it.\n\t\t// Same is true for \"write\" mode even if we have no ops - we will get \"join\" own op very very soon.\n\t\t// However if we are connecting as view-only, then there is no good signal to realize if client is behind.\n\t\t// Thus we have to hit storage to see if any ops are there.\n\t\tif (checkpointSequenceNumber !== undefined) {\n\t\t\t// We know how far we are behind (roughly). If it's non-zero gap, fetch ops right away.\n\t\t\tif (checkpointSequenceNumber > this.lastQueuedSequenceNumber) {\n\t\t\t\tthis.fetchMissingDeltas(\"AfterConnection\");\n\t\t\t}\n\t\t\t// we do not know the gap, and we will not learn about it if socket is quite - have to ask.\n\t\t} else if (connection.mode === \"read\") {\n\t\t\tthis.fetchMissingDeltas(\"AfterReadConnection\");\n\t\t}\n\t}\n\n\t/**\n\t * Sets the sequence number from which inbound messages should be returned\n\t * @param snapshotSequenceNumber - The sequence number of the snapshot at which the document loaded from.\n\t * @param lastProcessedSequenceNumber - The last processed sequence number, for offline, it should be greater than the sequence number.\n\t * Setting lastProcessedSequenceNumber allows the DeltaManager to skip downloading and processing ops that have already been processed.\n\t */\n\tpublic async attachOpHandler(\n\t\tminSequenceNumber: number,\n\t\tsnapshotSequenceNumber: number,\n\t\thandler: IDeltaHandlerStrategy,\n\t\tprefetchType: \"cached\" | \"all\" | \"none\" = \"none\",\n\t\tlastProcessedSequenceNumber: number = snapshotSequenceNumber,\n\t): Promise<void> {\n\t\tthis.initSequenceNumber = snapshotSequenceNumber;\n\t\tthis.lastProcessedSequenceNumber = lastProcessedSequenceNumber;\n\t\tthis.minSequenceNumber = minSequenceNumber;\n\t\tthis.lastQueuedSequenceNumber = lastProcessedSequenceNumber;\n\t\tthis.lastObservedSeqNumber = lastProcessedSequenceNumber;\n\n\t\t// We will use same check in other places to make sure all the seq number above are set properly.\n\t\tassert(\n\t\t\tthis.handler === undefined,\n\t\t\t0x0e2 /* \"DeltaManager already has attached op handler!\" */,\n\t\t);\n\t\tthis.handler = handler;\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tassert(!!this.handler, 0x0e3 /* \"Newly set op handler is null/undefined!\" */);\n\n\t\t// There should be no pending fetch!\n\t\t// This API is called right after attachOpHandler by Container.load().\n\t\t// We might have connection already and it might have called fetchMissingDeltas() from\n\t\t// setupNewSuccessfulConnection. But it should do nothing, because there is no way to fetch ops before\n\t\t// we know snapshot sequence number that is set in attachOpHandler. So all such calls should be noop.\n\t\tassert(\n\t\t\tthis.fetchReason === undefined,\n\t\t\t0x268 /* \"There can't be pending fetch that early in boot sequence!\" */,\n\t\t);\n\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._inbound.resume();\n\t\tthis._inboundSignal.resume();\n\n\t\tif (prefetchType !== \"none\") {\n\t\t\tconst cacheOnly = prefetchType === \"cached\";\n\t\t\tawait this.fetchMissingDeltasCore(`DocumentOpen_${prefetchType}`, cacheOnly);\n\n\t\t\t// Keep going with fetching ops from storage once we have all cached ops in.\n\t\t\t// But do not block load and make this request async / not blocking this api.\n\t\t\t// Ops processing will start once cached ops are in and and will stop when queue is empty\n\t\t\t// (which in most cases will happen when we are done processing cached ops)\n\t\t\tif (cacheOnly) {\n\t\t\t\t// fire and forget\n\t\t\t\tthis.fetchMissingDeltas(\"PostDocumentOpen\");\n\t\t\t}\n\t\t}\n\n\t\t// Ensure there is no need to call this.processPendingOps() at the end of boot sequence\n\t\tassert(\n\t\t\tthis.fetchReason !== undefined || this.pending.length === 0,\n\t\t\t0x269 /* \"pending ops are not dropped\" */,\n\t\t);\n\t}\n\n\tpublic connect(args: IConnectionArgs): void {\n\t\tconst fetchOpsFromStorage = args.fetchOpsFromStorage ?? true;\n\t\tlogIfFalse(\n\t\t\tthis.handler !== undefined || !fetchOpsFromStorage,\n\t\t\tthis.logger,\n\t\t\t\"CantFetchWithoutBaseline\",\n\t\t); // can't fetch if no baseline\n\n\t\t// Note: There is race condition here.\n\t\t// We want to issue request to storage as soon as possible, to\n\t\t// reduce latency of becoming current, thus this code here.\n\t\t// But there is no ordering between fetching OPs and connection to delta stream\n\t\t// As result, we might be behind by the time we connect to delta stream\n\t\t// In case of r/w connection, that's not an issue, because we will hear our\n\t\t// own \"join\" message and realize any gap client has in ops.\n\t\t// But for view-only connection, we have no such signal, and with no traffic\n\t\t// on the wire, we might be always behind.\n\t\t// See comment at the end of \"connect\" handler\n\t\tif (fetchOpsFromStorage) {\n\t\t\tthis.fetchMissingDeltas(args.reason.text);\n\t\t}\n\n\t\tthis.connectionManager.connect(args.reason, args.mode);\n\t}\n\n\tprivate async getDeltas(\n\t\tfrom: number, // inclusive\n\t\tto: number | undefined, // exclusive\n\t\tfetchReason: string,\n\t\tcallback: (messages: ISequencedDocumentMessage[]) => void,\n\t\tcacheOnly: boolean,\n\t): Promise<void> {\n\t\tconst docService = this.serviceProvider();\n\t\tif (docService === undefined) {\n\t\t\tthrow new Error(\"Delta manager is not attached\");\n\t\t}\n\n\t\tif (this.deltaStorage === undefined) {\n\t\t\tthis.deltaStorage = await docService.connectToDeltaStorage();\n\t\t}\n\n\t\tlet cancelFetch: (op: ISequencedDocumentMessage) => boolean;\n\n\t\tif (to === undefined) {\n\t\t\t// Unbound requests are made to proactively fetch ops, but also get up to date in cases where socket\n\t\t\t// is silent (and connection is \"read\", thus we might not have any data on how far client is behind).\n\t\t\t// Once we have any op coming in from socket, we can cancel it as it's not needed any more.\n\t\t\t// That said, if we have socket connection, make sure we got ops up to checkpointSequenceNumber!\n\t\t\tcancelFetch = (op: ISequencedDocumentMessage): boolean =>\n\t\t\t\top.sequenceNumber >= this.lastObservedSeqNumber;\n\t\t} else {\n\t\t\tconst lastExpectedOp = to - 1; // make it inclusive!\n\n\t\t\t// It is possible that due to asynchrony (including await above), required ops were already\n\t\t\t// received through delta stream. Validate that before moving forward.\n\t\t\tif (this.lastQueuedSequenceNumber >= lastExpectedOp) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\treason: fetchReason,\n\t\t\t\t\teventName: \"ExtraStorageCall\",\n\t\t\t\t\tearly: true,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto,\n\t\t\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Be prepared for the case where webSocket would receive the ops that we are trying to fill through\n\t\t\t// storage. Ideally it should never happen (i.e. ops on socket are always ordered, and thus once we\n\t\t\t// detected gap, this gap can't be filled in later on through websocket).\n\t\t\t// And in practice that does look like the case. The place where this code gets hit is if we lost\n\t\t\t// connection and reconnected (likely to another box), and new socket's initial ops contains these ops.\n\t\t\tcancelFetch = (op: ISequencedDocumentMessage): boolean =>\n\t\t\t\top.sequenceNumber >= lastExpectedOp;\n\t\t}\n\n\t\tconst controller = new AbortController();\n\t\tlet opsFromFetch = false;\n\n\t\tconst opListener = (op: ISequencedDocumentMessage): void => {\n\t\t\tassert(op.sequenceNumber === this.lastQueuedSequenceNumber, 0x23a /* \"seq#'s\" */);\n\t\t\t// Ops that are coming from this request should not cancel itself.\n\t\t\t// This is useless for known ranges (to is defined) as it means request is over either way.\n\t\t\t// And it will cancel unbound request too early, not allowing us to learn where the end of the file is.\n\t\t\tif (!opsFromFetch && cancelFetch(op)) {\n\t\t\t\tcontroller.abort(\"DeltaManager getDeltas fetch cancelled\");\n\t\t\t\tthis._inbound.off(\"push\", opListener);\n\t\t\t}\n\t\t};\n\n\t\ttry {\n\t\t\tthis._inbound.on(\"push\", opListener);\n\t\t\tassert(this.closeAbortController.signal.onabort === null, 0x1e8 /* \"reentrancy\" */);\n\t\t\tthis.closeAbortController.signal.addEventListener(\"abort\", () =>\n\t\t\t\tcontroller.abort(this.closeAbortController.signal.reason),\n\t\t\t);\n\n\t\t\tconst stream = this.deltaStorage.fetchMessages(\n\t\t\t\tfrom, // inclusive\n\t\t\t\tto, // exclusive\n\t\t\t\tcontroller.signal,\n\t\t\t\tcacheOnly,\n\t\t\t\tfetchReason,\n\t\t\t);\n\n\t\t\t// eslint-disable-next-line no-constant-condition\n\t\t\twhile (true) {\n\t\t\t\tconst result = await stream.read();\n\t\t\t\tif (result.done) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\topsFromFetch = true;\n\t\t\t\t\tcallback(result.value);\n\t\t\t\t} finally {\n\t\t\t\t\topsFromFetch = false;\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tif (controller.signal.aborted) {\n\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"DeltaManager_GetDeltasAborted\",\n\t\t\t\t\tfetchReason,\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\treason: controller.signal.reason,\n\t\t\t\t});\n\t\t\t}\n\t\t\t// eslint-disable-next-line unicorn/no-null, unicorn/prefer-add-event-listener\n\t\t\tthis.closeAbortController.signal.onabort = null;\n\t\t\tthis._inbound.off(\"push\", opListener);\n\t\t\tassert(!opsFromFetch, 0x289 /* \"logic error\" */);\n\t\t}\n\t}\n\n\t/**\n\t * Closes the connection and clears inbound & outbound queues.\n\t *\n\t * Differences from dispose:\n\t * - close will trigger readonly notification\n\t * - close emits \"closed\"\n\t * - close cannot be called after dispose\n\t */\n\tpublic close(error?: ICriticalContainerError): void {\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._closed = true;\n\n\t\tthis.connectionManager.dispose(error, true /* switchToReadonly */);\n\t\tthis.clearQueues();\n\t\tthis.emit(\"closed\", error);\n\t}\n\n\t/**\n\t * Disposes the connection and clears the inbound & outbound queues.\n\t *\n\t * Differences from close:\n\t * - dispose will emit \"disposed\"\n\t * - dispose will remove all listeners\n\t * - dispose can be called after closure\n\t */\n\tpublic dispose(error?: Error | ICriticalContainerError): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tif (error !== undefined && !isFluidError(error)) {\n\t\t\tthrow new UsageError(\"Error must be a Fluid error\");\n\t\t}\n\n\t\tthis._disposed = true;\n\t\tthis._closed = true; // We consider \"disposed\" as a further state than \"closed\"\n\n\t\tthis.connectionManager.dispose(error, false /* switchToReadonly */);\n\t\tthis.clearQueues();\n\n\t\t// This needs to be the last thing we do (before removing listeners), as it causes\n\t\t// Container to dispose context and break ability of data stores / runtime to \"hear\" from delta manager.\n\t\tthis.emit(\"disposed\", error);\n\t\tthis.removeAllListeners();\n\t}\n\n\tprivate clearQueues(): void {\n\t\tthis.closeAbortController.abort(\"DeltaManager is closed\");\n\n\t\tthis._inbound.clear();\n\t\tthis._inboundSignal.clear();\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tthis._inbound.pause();\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tthis._inboundSignal.pause();\n\n\t\t// Drop pending messages - this will ensure catchUp() does not go into infinite loop\n\t\tthis.pending = [];\n\t}\n\n\tpublic refreshDelayInfo(id: string): void {\n\t\tthis.throttlingIdSet.delete(id);\n\t\tif (this.throttlingIdSet.size === 0) {\n\t\t\tthis.timeTillThrottling = 0;\n\t\t}\n\t}\n\n\tprivate disconnectHandler(reason: IConnectionStateChangeReason): void {\n\t\tthis.messageBuffer.length = 0;\n\t\tthis.emit(\"disconnect\", reason.text, reason.error);\n\t}\n\n\t/**\n\t * Emit info about a delay in service communication on account of throttling.\n\t * @param id - Id of the connection that is delayed\n\t * @param delayMs - Duration of the delay\n\t * @param error - error object indicating the throttling\n\t */\n\tpublic emitDelayInfo(id: string, delayMs: number, error: unknown): void {\n\t\tconst timeNow = Date.now();\n\t\tthis.throttlingIdSet.add(id);\n\t\tif (delayMs > 0 && timeNow + delayMs > this.timeTillThrottling) {\n\t\t\tthis.timeTillThrottling = timeNow + delayMs;\n\n\t\t\tconst throttlingWarning: IThrottlingWarning = ThrottlingWarning.wrap(\n\t\t\t\terror,\n\t\t\t\tdelayMs / 1000 /* retryAfterSeconds */,\n\t\t\t\tthis.logger,\n\t\t\t);\n\t\t\tthis.emit(\"throttled\", throttlingWarning);\n\t\t}\n\t}\n\n\t// returns parts of message (in string format) that should never change for a given message.\n\t// Used for message comparison. It attempts to avoid comparing fields that potentially may differ.\n\t// for example, it's not clear if serverMetadata or timestamp property is a property of message or server state.\n\t// We only extract the most obvious fields that are sufficient (with high probability) to detect sequence number\n\t// reuse.\n\t// Also payload goes to telemetry, so no content or anything else that shouldn't be logged for privacy reasons\n\t// Note: It's possible for a duplicate op to be broadcasted and have everything the same except the timestamp.\n\tprivate comparableMessagePayload(m: ISequencedDocumentMessage): string {\n\t\treturn `${m.clientId}-${m.type}-${m.minimumSequenceNumber}-${m.referenceSequenceNumber}-${m.timestamp}`;\n\t}\n\n\tprivate enqueueMessages(\n\t\tmessages: ISequencedDocumentMessage[],\n\t\treason: string,\n\t\tallowGaps = false,\n\t): void {\n\t\tif (this.handler === undefined) {\n\t\t\t// We did not setup handler yet.\n\t\t\t// This happens when we connect to web socket faster than we get attributes for container\n\t\t\t// and thus faster than attachOpHandler() is called\n\t\t\t// this.lastProcessedSequenceNumber is still zero, so we can't rely on this.fetchMissingDeltas()\n\t\t\t// to do the right thing.\n\t\t\tthis.pending = [...this.pending, ...messages];\n\t\t\treturn;\n\t\t}\n\n\t\t// Pending ops should never just hang around for nothing.\n\t\t// This invariant will stay true through this function execution,\n\t\t// so there is no need to process pending ops here.\n\t\t// It's responsibility of\n\t\t// - attachOpHandler()\n\t\t// - fetchMissingDeltas() after it's done with querying storage\n\t\tassert(\n\t\t\tthis.pending.length === 0 || this.fetchReason !== undefined,\n\t\t\t0x1e9 /* \"Pending ops\" */,\n\t\t);\n\n\t\tif (messages.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst from = messages[0].sequenceNumber;\n\t\tconst last = messages[messages.length - 1].sequenceNumber;\n\n\t\t// Report stats about missing and duplicate ops\n\t\t// This helps better understand why we fetch ops from storage, and thus may delay\n\t\t// getting current / sending ops\n\t\t// It's possible that this batch is already too late - do not bother\n\t\tif (last > this.lastQueuedSequenceNumber) {\n\t\t\tlet prev = from - 1;\n\t\t\tconst initialGap = prev - this.lastQueuedSequenceNumber;\n\t\t\tlet firstMissing: number | undefined;\n\t\t\tlet duplicate = 0;\n\t\t\tlet gap = 0;\n\n\t\t\t// Count all gaps and duplicates\n\t\t\tfor (const message of messages) {\n\t\t\t\tif (message.sequenceNumber === prev) {\n\t\t\t\t\tduplicate++;\n\t\t\t\t} else if (message.sequenceNumber !== prev + 1) {\n\t\t\t\t\tgap++;\n\t\t\t\t\tif (firstMissing === undefined) {\n\t\t\t\t\t\tfirstMissing = prev + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tprev = message.sequenceNumber;\n\t\t\t}\n\n\t\t\tlet eventName: string | undefined;\n\n\t\t\t// Report if we found some issues\n\t\t\tif (\n\t\t\t\tduplicate !== 0 ||\n\t\t\t\t(gap !== 0 && !allowGaps) ||\n\t\t\t\t(initialGap > 0 && this.fetchReason === undefined)\n\t\t\t) {\n\t\t\t\teventName = \"enqueueMessages\";\n\t\t\t\t// Also report if we are fetching ops, and same range comes in, thus making this fetch obsolete.\n\t\t\t} else if (\n\t\t\t\tthis.fetchReason !== undefined &&\n\t\t\t\tthis.fetchReason !== reason &&\n\t\t\t\tfrom <= this.lastQueuedSequenceNumber + 1 &&\n\t\t\t\tlast > this.lastQueuedSequenceNumber\n\t\t\t) {\n\t\t\t\teventName = \"enqueueMessagesExtraFetch\";\n\t\t\t}\n\n\t\t\t// Report if there is something to report\n\t\t\t// Do not report when pending fetch is in progress, as such reporting will not\n\t\t\t// correctly take into account pending ops.\n\t\t\tif (eventName !== undefined) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName,\n\t\t\t\t\treason,\n\t\t\t\t\tpreviousReason: this.prevEnqueueMessagesReason,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto: last + 1, // exclusive, being consistent with the other telemetry / APIs\n\t\t\t\t\tlength: messages.length,\n\t\t\t\t\tfetchReason: this.fetchReason,\n\t\t\t\t\tduplicate: duplicate > 0 ? duplicate : undefined,\n\t\t\t\t\tinitialGap: initialGap === 0 ? undefined : initialGap,\n\t\t\t\t\tgap: gap > 0 ? gap : undefined,\n\t\t\t\t\tfirstMissing,\n\t\t\t\t\tdmInitialSeqNumber: this.initialSequenceNumber,\n\t\t\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tthis.updateLatestKnownOpSeqNumber(messages[messages.length - 1].sequenceNumber);\n\n\t\tconst n = this.previouslyProcessedMessage?.sequenceNumber;\n\t\tassert(\n\t\t\tn === undefined || n === this.lastQueuedSequenceNumber,\n\t\t\t0x0ec /* \"Unexpected value for previously processed message's sequence number\" */,\n\t\t);\n\n\t\tfor (const message of messages) {\n\t\t\t// Check that the messages are arriving in the expected order\n\t\t\tif (message.sequenceNumber <= this.lastQueuedSequenceNumber) {\n\t\t\t\t// Validate that we do not have data loss, i.e. sequencing is reset and started again\n\t\t\t\t// with numbers that this client already observed before.\n\t\t\t\tif (this.previouslyProcessedMessage?.sequenceNumber === message.sequenceNumber) {\n\t\t\t\t\tconst message1 = this.comparableMessagePayload(this.previouslyProcessedMessage);\n\t\t\t\t\tconst message2 = this.comparableMessagePayload(message);\n\t\t\t\t\tif (message1 !== message2) {\n\t\t\t\t\t\tconst error = new NonRetryableError(\n\t\t\t\t\t\t\t// This looks like a data corruption but the culprit was that the file was overwritten\n\t\t\t\t\t\t\t// in storage. See PR #5882.\n\t\t\t\t\t\t\t// Likely to be an issue with Fluid Services. Content does not match previous client\n\t\t\t\t\t\t\t// knowledge about this file. If the file is overwritten for any reason, this error can be\n\t\t\t\t\t\t\t// hit. One example is that some clients could be submitting ops to two different service\n\t\t\t\t\t\t\t// instances such that the same sequence number is reused for two different ops.\n\t\t\t\t\t\t\t// pre-0.58 error message: twoMessagesWithSameSeqNumAndDifferentPayload\n\t\t\t\t\t\t\t\"Found two messages with the same sequenceNumber but different payloads. Likely to be a \" +\n\t\t\t\t\t\t\t\t\"service issue\",\n\t\t\t\t\t\t\tDriverErrorTypes.fileOverwrittenInStorage,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t\t\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\t\t\t\t\tmessage1,\n\t\t\t\t\t\t\t\tmessage2,\n\t\t\t\t\t\t\t\tdriverVersion: undefined,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.close(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (message.sequenceNumber === this.lastQueuedSequenceNumber + 1) {\n\t\t\t\tthis.lastQueuedSequenceNumber = message.sequenceNumber;\n\t\t\t\tthis.previouslyProcessedMessage = message;\n\t\t\t\tthis._inbound.push(message);\n\t\t\t} else {\n\t\t\t\tthis.pending.push(message);\n\t\t\t\tthis.fetchMissingDeltas(reason, message.sequenceNumber);\n\t\t\t}\n\t\t}\n\n\t\t// When / if we report a gap in ops in the future, we want telemetry to correctly reflect source\n\t\t// of prior ops. But if we have some out of order ops (this.pending), then reporting current reason\n\t\t// becomes not accurate, as the gap existed before current batch, so we should just report \"unknown\".\n\t\tthis.prevEnqueueMessagesReason = this.pending.length > 0 ? \"unknown\" : reason;\n\t}\n\n\tprivate processInboundMessage(message: ISequencedDocumentMessage): void {\n\t\tconst startTime = Date.now();\n\t\tassert(!this.currentlyProcessingOps, 0x3af /* Already processing ops. */);\n\t\tthis.currentlyProcessingOps = true;\n\t\tthis.lastProcessedMessage = message;\n\n\t\tconst isString = typeof message.clientId === \"string\";\n\t\tassert(message.clientId === null || isString, 0x41a /* undefined or string */);\n\t\t// All client messages are coming from some client, and should have clientId,\n\t\t// and non-client message should not have clientId. But, there are two exceptions:\n\t\t// 1. (Legacy) We can see message.type === \"attach\" or \"chunkedOp\" for legacy files before RTM\n\t\t// 2. Non-immediate noops (contents: null) can be sent by service without clientId\n\t\tif (!isString && isClientMessage(message) && message.type !== MessageType.NoOp) {\n\t\t\tthrow new DataCorruptionError(\"Mismatch in clientId\", {\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\tmessageType: message.type,\n\t\t\t});\n\t\t}\n\n\t\t// Validate client sequence number has no gap. Decrement the noOpCount by gap\n\t\t// If the count ends up negative, that means we have a real gap and throw error\n\t\tif (\n\t\t\tthis.connectionManager.clientId !== undefined &&\n\t\t\tthis.connectionManager.clientId === message.clientId\n\t\t) {\n\t\t\tif (message.type === MessageType.NoOp) {\n\t\t\t\tthis.noOpCount--;\n\t\t\t}\n\t\t\tconst clientSeqNumGap = message.clientSequenceNumber - this.lastClientSequenceNumber - 1;\n\t\t\tthis.noOpCount -= clientSeqNumGap;\n\t\t\tif (this.noOpCount < 0) {\n\t\t\t\tthrow new Error(`gap in client sequence number: ${clientSeqNumGap}`);\n\t\t\t}\n\t\t\tthis.lastClientSequenceNumber = message.clientSequenceNumber;\n\t\t}\n\n\t\tthis.connectionManager.beforeProcessingIncomingOp(message);\n\n\t\t// Watch the minimum sequence number and be ready to update as needed\n\t\tif (this.minSequenceNumber > message.minimumSequenceNumber) {\n\t\t\t// This indicates that an invalid series of ops was received by this client.\n\t\t\t// In the unlikely case where these ops have been truly sequenced and persisted to storage,\n\t\t\t// this document is corrupted - It will fail here on boot every time.\n\t\t\t// The more likely scenario, based on the realities of production service operation, is that\n\t\t\t// something has changed out from under the file on the server, such that the service lost some ops\n\t\t\t// which this client already processed - the very ops that made this _next_ op to appear invalid.\n\t\t\t// In this case, only this client will fail (and lose this recent data), but others will be able to connect and continue.\n\t\t\tthrow DataProcessingError.create(\n\t\t\t\t// error message through v0.57: msnMovesBackwards\n\t\t\t\t// error message through v2.1: \"Found a lower minimumSequenceNumber (msn) than previously recorded\",\n\t\t\t\t\"Invalid MinimumSequenceNumber from service - document may have been restored to previous state\",\n\t\t\t\t\"DeltaManager.processInboundMessage\",\n\t\t\t\tmessage,\n\t\t\t\t{\n\t\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// Client ops: MSN has to be lower than sequence #, as client can continue to send ops with same\n\t\t// reference sequence number as this op.\n\t\t// System ops (when no clients are connected) are the only ops where equation is possible.\n\t\tconst diff = message.sequenceNumber - message.minimumSequenceNumber;\n\t\tif (diff < 0 || (diff === 0 && message.clientId !== null)) {\n\t\t\tthrow new DataCorruptionError(\n\t\t\t\t\"MSN has to be lower than sequence #\",\n\t\t\t\textractSafePropertiesFromMessage(message),\n\t\t\t);\n\t\t}\n\n\t\tthis.minSequenceNumber = message.minimumSequenceNumber;\n\n\t\tif (message.sequenceNumber !== this.lastProcessedSequenceNumber + 1) {\n\t\t\t// pre-0.58 error message: nonSequentialSequenceNumber\n\t\t\tthrow new DataCorruptionError(\"Found a non-Sequential sequenceNumber\", {\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t});\n\t\t}\n\t\tthis.lastProcessedSequenceNumber = message.sequenceNumber;\n\n\t\t// a bunch of code assumes that this is true\n\t\tassert(\n\t\t\tthis.lastProcessedSequenceNumber <= this.lastObservedSeqNumber,\n\t\t\t0x267 /* \"lastObservedSeqNumber should be updated first\" */,\n\t\t);\n\n\t\tif (this.handler === undefined) {\n\t\t\tthrow new Error(\"Attempted to process an inbound message without a handler attached\");\n\t\t}\n\t\tthis.handler.process(message);\n\t\tthis.currentlyProcessingOps = false;\n\t\tconst endTime = Date.now();\n\n\t\t// Should be last, after changing this.lastProcessedSequenceNumber above, as many callers\n\t\t// test this.lastProcessedSequenceNumber instead of using op.sequenceNumber itself.\n\t\tthis.emit(\"op\", message, endTime - startTime);\n\t}\n\n\t/**\n\t * Retrieves the missing deltas between the given sequence numbers\n\t */\n\tprivate fetchMissingDeltas(reasonArg: string, to?: number): void {\n\t\tthis.fetchMissingDeltasCore(reasonArg, false /* cacheOnly */, to).catch((error) => {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"fetchMissingDeltasException\" }, error);\n\t\t});\n\t}\n\n\t/**\n\t * Retrieves the missing deltas between the given sequence numbers\n\t */\n\tprivate async fetchMissingDeltasCore(\n\t\treason: string,\n\t\tcacheOnly: boolean,\n\t\tto?: number,\n\t): Promise<void> {\n\t\t// Exit out early if we're already fetching deltas\n\t\tif (this.fetchReason !== undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._closed) {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"fetchMissingDeltasClosedConnection\",\n\t\t\t\treason,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.handler === undefined) {\n\t\t\t// We do not poses yet any information\n\t\t\tassert(this.lastQueuedSequenceNumber === 0, 0x26b /* \"initial state\" */);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlet from = this.lastQueuedSequenceNumber + 1;\n\n\t\t\tconst n = this.previouslyProcessedMessage?.sequenceNumber;\n\t\t\tif (n !== undefined) {\n\t\t\t\t// If we already processed at least one op, then we have this.previouslyProcessedMessage populated\n\t\t\t\t// and can use it to validate that we are operating on same file, i.e. it was not overwritten.\n\t\t\t\t// Knowing about this mechanism, we could ask for op we already observed to increase validation.\n\t\t\t\t// This is especially useful when coming out of offline mode or loading from\n\t\t\t\t// very old cached (by client / driver) snapshot.\n\t\t\t\tassert(n === this.lastQueuedSequenceNumber, 0x0f2 /* \"previouslyProcessedMessage\" */);\n\t\t\t\tassert(from > 1, 0x0f3 /* \"not positive\" */);\n\t\t\t\tfrom--;\n\t\t\t}\n\n\t\t\tconst fetchReason = `${reason}_fetch`;\n\t\t\tthis.fetchReason = fetchReason;\n\n\t\t\tawait this.getDeltas(\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tfetchReason,\n\t\t\t\t(messages) => {\n\t\t\t\t\tthis.refreshDelayInfo(this.deltaStorageDelayId);\n\t\t\t\t\tthis.enqueueMessages(messages, fetchReason);\n\t\t\t\t},\n\t\t\t\tcacheOnly,\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"GetDeltas_Exception\" }, error);\n\t\t\tthis.close(normalizeError(error));\n\t\t} finally {\n\t\t\tthis.refreshDelayInfo(this.deltaStorageDelayId);\n\t\t\tthis.fetchReason = undefined;\n\t\t\tthis.processPendingOps(reason);\n\t\t}\n\t}\n\n\t/**\n\t * Sorts pending ops and attempts to apply them\n\t */\n\tprivate processPendingOps(reason?: string): void {\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(this.handler !== undefined, 0x26c /* \"handler should be installed\" */);\n\n\t\tconst pendingSorted = this.pending.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\t\tthis.pending = [];\n\t\t// Given that we do not track where these ops came from any more, it's not very\n\t\t// actionably to report gaps in this range.\n\t\tthis.enqueueMessages(pendingSorted, `${reason}_pending`, true /* allowGaps */);\n\n\t\t// Re-entrancy is ignored by fetchMissingDeltas, execution will come here when it's over\n\t\tif (this.fetchReason === undefined) {\n\t\t\t// See issue #7312 for more details\n\t\t\t// We observe cases where client gets into situation where it is not aware of missing ops\n\t\t\t// (i.e. client being behind), and as such, does not attempt to fetch them.\n\t\t\t// In some cases client may not have enough signal (example - \"read\" connection that is silent -\n\t\t\t// there is no easy way for client to realize it's behind, see a bit of commentary / logic at the\n\t\t\t// end of setupNewSuccessfulConnection). In other cases it should be able to learn that info (\"write\"\n\t\t\t// connection, learn by receiving its own join op), but data suggest it does not happen.\n\t\t\t// In 50% of these cases we do know we are behind through checkpointSequenceNumber on connection object\n\t\t\t// and thus can leverage that to trigger recovery. But this is not going to solve all the problems\n\t\t\t// (the other 50%), and thus these errors below should be looked at even if code below results in\n\t\t\t// recovery.\n\t\t\t// eslint-disable-next-line unicorn/no-lonely-if -- Docs make more sense like this\n\t\t\tif (this.lastQueuedSequenceNumber < this.lastObservedSeqNumber) {\n\t\t\t\tthis.fetchMissingDeltas(\"OpsBehind\");\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate updateLatestKnownOpSeqNumber(seq: number): void {\n\t\tif (this.lastObservedSeqNumber < seq) {\n\t\t\tthis.lastObservedSeqNumber = seq;\n\t\t}\n\t}\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ export { ICodeDetailsLoader, IDetachedBlobStorage, IFluidModuleWithDetails, ILoa
|
|
|
8
8
|
export { loadContainerPaused } from "./loadPaused.js";
|
|
9
9
|
export { isLocationRedirectionError, resolveWithLocationRedirectionHandling, } from "./location-redirection-utilities/index.js";
|
|
10
10
|
export { IProtocolHandler, ProtocolHandlerBuilder } from "./protocol.js";
|
|
11
|
-
export { tryParseCompatibleResolvedUrl, IParsedUrl } from "./utils.js";
|
|
11
|
+
export { tryParseCompatibleResolvedUrl, IParsedUrl, } from "./utils.js";
|
|
12
12
|
export { IBaseProtocolHandler, IScribeProtocolState, IQuorumSnapshot, QuorumClientsSnapshot, QuorumProposalsSnapshot, } from "./protocol/index.js";
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EACN,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,MAAM,GACN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACN,0BAA0B,EAC1B,sCAAsC,GACtC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EACN,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,MAAM,GACN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACN,0BAA0B,EAC1B,sCAAsC,GACtC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACN,6BAA6B,EAC7B,UAAU,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,GACvB,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAuD;AAA9C,qHAAA,eAAe,OAAA;AACxB,+CAAgF;AAA/C,sHAAA,sBAAsB,OAAA;AACvD,yCAQqB;AADpB,mGAAA,MAAM,OAAA;AAEP,iDAAsD;AAA7C,oHAAA,mBAAmB,OAAA;AAC5B,sEAGmD;AAFlD,sHAAA,0BAA0B,OAAA;AAC1B,kIAAA,sCAAsC,OAAA;AAGvC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAuD;AAA9C,qHAAA,eAAe,OAAA;AACxB,+CAAgF;AAA/C,sHAAA,sBAAsB,OAAA;AACvD,yCAQqB;AADpB,mGAAA,MAAM,OAAA;AAEP,iDAAsD;AAA7C,oHAAA,mBAAmB,OAAA;AAC5B,sEAGmD;AAFlD,sHAAA,0BAA0B,OAAA;AAC1B,kIAAA,sCAAsC,OAAA;AAGvC,uCAGoB;AAFnB,yHAAA,6BAA6B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { ConnectionState } from \"./connectionState.js\";\nexport { IContainerExperimental, waitContainerToCatchUp } from \"./container.js\";\nexport {\n\tICodeDetailsLoader,\n\tIDetachedBlobStorage,\n\tIFluidModuleWithDetails,\n\tILoaderOptions,\n\tILoaderProps,\n\tILoaderServices,\n\tLoader,\n} from \"./loader.js\";\nexport { loadContainerPaused } from \"./loadPaused.js\";\nexport {\n\tisLocationRedirectionError,\n\tresolveWithLocationRedirectionHandling,\n} from \"./location-redirection-utilities/index.js\";\nexport { IProtocolHandler, ProtocolHandlerBuilder } from \"./protocol.js\";\nexport {\n\ttryParseCompatibleResolvedUrl,\n\tIParsedUrl,\n} from \"./utils.js\";\nexport {\n\tIBaseProtocolHandler,\n\tIScribeProtocolState,\n\tIQuorumSnapshot,\n\tQuorumClientsSnapshot,\n\tQuorumProposalsSnapshot,\n} from \"./protocol/index.js\";\n"]}
|
package/dist/loadPaused.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadPaused.d.ts","sourceRoot":"","sources":["../src/loadPaused.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,OAAO,
|
|
1
|
+
{"version":3,"file":"loadPaused.d.ts","sourceRoot":"","sources":["../src/loadPaused.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,OAAO,EAGP,KAAK,UAAU,EACf,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAO3D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,mBAAmB,CACxC,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,EACjB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,UAAU,CAAC,CAkGrB"}
|
package/dist/loadPaused.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.loadContainerPaused = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/container-definitions/internal");
|
|
9
|
-
const internal_2 = require("@fluidframework/
|
|
9
|
+
const internal_2 = require("@fluidframework/core-utils/internal");
|
|
10
|
+
const internal_3 = require("@fluidframework/telemetry-utils/internal");
|
|
10
11
|
/* eslint-disable jsdoc/check-indentation */
|
|
11
12
|
/**
|
|
12
13
|
* Loads container and leaves it in a state where it does not process any ops.
|
|
@@ -49,6 +50,7 @@ async function loadContainerPaused(loader, request, loadToSequenceNumber, signal
|
|
|
49
50
|
const dm = container.deltaManager;
|
|
50
51
|
const lastProcessedSequenceNumber = dm.initialSequenceNumber;
|
|
51
52
|
const pauseContainer = () => {
|
|
53
|
+
(0, internal_2.assert)((0, internal_1.isIDeltaManagerFull)(dm), "Delta manager does not have inbound/outbound queues.");
|
|
52
54
|
// eslint-disable-next-line no-void
|
|
53
55
|
void dm.inbound.pause();
|
|
54
56
|
// eslint-disable-next-line no-void
|
|
@@ -63,7 +65,7 @@ async function loadContainerPaused(loader, request, loadToSequenceNumber, signal
|
|
|
63
65
|
}
|
|
64
66
|
// If we are trying to pause at a specific sequence number, ensure the latest snapshot is not newer than the desired sequence number.
|
|
65
67
|
if (lastProcessedSequenceNumber > loadToSequenceNumber) {
|
|
66
|
-
const error = new
|
|
68
|
+
const error = new internal_3.GenericError("Cannot satisfy request to pause the container at the specified sequence number. Most recent snapshot is newer than the specified sequence number.");
|
|
67
69
|
container.close(error);
|
|
68
70
|
throw error;
|
|
69
71
|
}
|
|
@@ -71,7 +73,7 @@ async function loadContainerPaused(loader, request, loadToSequenceNumber, signal
|
|
|
71
73
|
let onAbort;
|
|
72
74
|
let onClose;
|
|
73
75
|
const promise = new Promise((resolve, reject) => {
|
|
74
|
-
onAbort = () => reject(new
|
|
76
|
+
onAbort = () => reject(new internal_3.GenericError("Canceled due to cancellation request."));
|
|
75
77
|
onClose = (error) => reject(error);
|
|
76
78
|
// We need to setup a listener to stop op processing once we reach the desired sequence number (if specified).
|
|
77
79
|
opHandler = () => {
|
package/dist/loadPaused.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadPaused.js","sourceRoot":"","sources":["../src/loadPaused.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"loadPaused.js","sourceRoot":"","sources":["../src/loadPaused.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6EAKwD;AAGxD,kEAA6D;AAC7D,uEAAwE;AAExE,4CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACI,KAAK,UAAU,mBAAmB,CACxC,MAAe,EACf,OAAiB,EACjB,oBAA6B,EAC7B,MAAoB;IAEpB,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QACtC,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,OAAO,EAAE;YACR,GAAG,OAAO,CAAC,OAAO;YAClB,kGAAkG;YAClG,CAAC,uBAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE;SAChF;KACD,CAAC,CAAC;IAEH,2FAA2F;IAC3F,SAAS,CAAC,aAAa,EAAE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,oBAAoB,EAC5C,CAAC;gBACF,wEAAwE;gBACxE,cAAc,EAAE,CAAC;gBACjB,OAAO,EAAE,CAAC;YACX,CAAC;QACF,CAAC,CAAC;QAEF,sGAAsG;QACtG,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC3C,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC9B,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,4DAA4D;IAC5D,oHAAoH;IACpH,oFAAoF;IACpF,kGAAkG;IAClG,sIAAsI;IACtI,2CAA2C;IAC3C,SAAS,CAAC,OAAO,EAAE,CAAC;IAEpB,oCAAoC;IACpC,MAAM,OAAO;QACZ,8DAA8D;SAC7D,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;QACrB,iEAAiE;QACjE,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvB,MAAM,KAAK,CAAC;IACb,CAAC,CAAC;SACD,OAAO,CAAC,GAAG,EAAE;QACb,+IAA+I;QAC/I,8HAA8H;QAC9H,kGAAkG;QAClG,SAAS,CAAC,UAAU,EAAE,CAAC;QAEvB,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC/B,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACjC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEJ,OAAO,SAAS,CAAC;AAClB,CAAC;AAvGD,kDAuGC;AAED,2CAA2C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tILoader,\n\tisIDeltaManagerFull,\n\tLoaderHeader,\n\ttype IContainer,\n} from \"@fluidframework/container-definitions/internal\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport type { IErrorBase } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { GenericError } from \"@fluidframework/telemetry-utils/internal\";\n\n/* eslint-disable jsdoc/check-indentation */\n\n/**\n * Loads container and leaves it in a state where it does not process any ops.\n * Container instance returned by this function is in special mode where some functionality that is available in normal use will not work correctly\n * with instance of container returned by this function. Some examples:\n * 1. calling IContainer.connect() will have very little impact on this container as it will not process ops.\n * 2. functionality like waitContainerToCatchUp() or waiting for ops in any other way would hand infinitely, as this container is not processing ops\n * 3. No changes can be made to this container - they will be lost.\n *\n * If sequence number is provided, loads up to this sequence number and stops there, otherwise stops immediately after loading snapshot.\n * In all cases, container is returned disconnected & paused, or an exception is thrown\n * Notes:\n * 1. Ignores LoaderHeader.loadMode headers. Container is always returned with ops applied upt to provided sequence number,\n * or no ops applied at all (if sequence number is not provided)\n * 2. This call can hang infinitately if disconnected from internet (or hit some other conditions, like 429 storm).\n * Compare to Container.load() experience (with default settings) - it either returns failure right away, or succeeds, with\n * ops fetching / delta connection happening in parallel / after container load flow, and thus providing an object (Container instance) to observe\n * network connectivity issues / ability to cancel (IContainer.disconnect) or close container (IContainer.close)\n * This flow needs to fetch ops (potentially connecting to delta connection), and any retriable errors on this path result in infinite retry.\n * If you need to cancel that process, consider supplying AbortSignal parameter.\n * @param loader - loader instance to use to load container\n * @param request - request identifying container instance / load parameters. LoaderHeader.loadMode headers are ignored (see above)\n * @param loadToSequenceNumber - optional sequence number. If provided, ops are processed up to this sequence number.\n * @param signal - optional abort signal that can be used to cancel waiting for the ops.\n * @returns IContainer instance\n *\n * @internal\n */\nexport async function loadContainerPaused(\n\tloader: ILoader,\n\trequest: IRequest,\n\tloadToSequenceNumber?: number,\n\tsignal?: AbortSignal,\n): Promise<IContainer> {\n\tconst container = await loader.resolve({\n\t\turl: request.url,\n\t\theaders: {\n\t\t\t...request.headers,\n\t\t\t// ensure we do not process any ops, such that we can examine container before ops starts to flow.\n\t\t\t[LoaderHeader.loadMode]: { opsBeforeReturn: undefined, deltaConnection: \"none\" },\n\t\t},\n\t});\n\n\t// Force readonly mode - this will ensure we don't receive an error for the lack of join op\n\tcontainer.forceReadonly?.(true);\n\n\tconst dm = container.deltaManager;\n\tconst lastProcessedSequenceNumber = dm.initialSequenceNumber;\n\n\tconst pauseContainer = (): void => {\n\t\tassert(isIDeltaManagerFull(dm), \"Delta manager does not have inbound/outbound queues.\");\n\t\t// eslint-disable-next-line no-void\n\t\tvoid dm.inbound.pause();\n\t\t// eslint-disable-next-line no-void\n\t\tvoid dm.outbound.pause();\n\t};\n\n\t// Happy path - we are already there.\n\tif (\n\t\tloadToSequenceNumber === undefined ||\n\t\tlastProcessedSequenceNumber === loadToSequenceNumber\n\t) {\n\t\t// If we have already reached the desired sequence number, call pauseContainer() to pause immediately.\n\t\tpauseContainer();\n\t\treturn container;\n\t}\n\n\t// If we are trying to pause at a specific sequence number, ensure the latest snapshot is not newer than the desired sequence number.\n\tif (lastProcessedSequenceNumber > loadToSequenceNumber) {\n\t\tconst error = new GenericError(\n\t\t\t\"Cannot satisfy request to pause the container at the specified sequence number. Most recent snapshot is newer than the specified sequence number.\",\n\t\t);\n\t\tcontainer.close(error);\n\t\tthrow error;\n\t}\n\n\tlet opHandler: () => void;\n\tlet onAbort: () => void;\n\tlet onClose: (error?: IErrorBase) => void;\n\n\tconst promise = new Promise<void>((resolve, reject) => {\n\t\tonAbort = (): void => reject(new GenericError(\"Canceled due to cancellation request.\"));\n\t\tonClose = (error?: IErrorBase): void => reject(error);\n\n\t\t// We need to setup a listener to stop op processing once we reach the desired sequence number (if specified).\n\t\topHandler = (): void => {\n\t\t\t// If there is a specified sequence number, keep processing until we reach it.\n\t\t\tif (\n\t\t\t\tloadToSequenceNumber !== undefined &&\n\t\t\t\tdm.lastSequenceNumber >= loadToSequenceNumber\n\t\t\t) {\n\t\t\t\t// Pause op processing once we have processed the desired number of ops.\n\t\t\t\tpauseContainer();\n\t\t\t\tresolve();\n\t\t\t}\n\t\t};\n\n\t\t// If we have not yet reached the desired sequence number, setup a listener to pause once we reach it.\n\t\tsignal?.addEventListener(\"abort\", onAbort);\n\t\tcontainer.on(\"op\", opHandler);\n\t\tcontainer.on(\"closed\", onClose);\n\t});\n\n\t// There are no guarantees on when ops will land in storage.\n\t// No guarantees that driver implements ops caching (i.e. ops observed in previous session can be served from cache)\n\t// or that browser will provide caching capabilities / keep the data (localStorage).\n\t// Thus, we have to ensure we connect to delta storage in order to make forward progress with ops.\n\t// We also instructed not to fetch / apply any ops from storage above (to be able to install callback above before ops are processed),\n\t// connect() call will fetch ops as needed.\n\tcontainer.connect();\n\n\t// Wait for the ops to be processed.\n\tawait promise\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t.catch((error: any) => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\t\tcontainer.close(error);\n\t\t\tthrow error;\n\t\t})\n\t\t.finally(() => {\n\t\t\t// There is not much value in leaving delta connection on. We are not processing ops, we also can't advance to \"connected\" state because of it.\n\t\t\t// We are not sending ops (due to forceReadonly() call above). We are holding collab window and any consensus-based processes.\n\t\t\t// It's better not to have connection in such case, as there are only nagatives, and no positives.\n\t\t\tcontainer.disconnect();\n\n\t\t\tcontainer.off(\"op\", opHandler);\n\t\t\tcontainer.off(\"closed\", onClose);\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t});\n\n\treturn container;\n}\n\n/* eslint-enable jsdoc/check-indentation */\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/container-loader";
|
|
8
|
-
export declare const pkgVersion = "2.
|
|
8
|
+
export declare const pkgVersion = "2.10.0-305357";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,qCAAqC,CAAC;AAC1D,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,qCAAqC,CAAC;AAC1D,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/container-loader";
|
|
11
|
-
exports.pkgVersion = "2.
|
|
11
|
+
exports.pkgVersion = "2.10.0-305357";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,kCAAkC,CAAC;AAC7C,QAAA,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,kCAAkC,CAAC;AAC7C,QAAA,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-loader\";\nexport const pkgVersion = \"2.10.0-305357\";\n"]}
|
package/lib/container.js
CHANGED
|
@@ -436,7 +436,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
436
436
|
};
|
|
437
437
|
const createAttachmentSummary = (redirectTable) => {
|
|
438
438
|
try {
|
|
439
|
-
assert(this.
|
|
439
|
+
assert(this._deltaManager.inbound.length === 0, 0x0d6 /* "Inbound queue should be empty when attaching" */);
|
|
440
440
|
return combineAppAndProtocolSummary(this.runtime.createSummary(redirectTable), this.captureProtocolSummary());
|
|
441
441
|
}
|
|
442
442
|
catch (error) {
|
|
@@ -922,12 +922,12 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
922
922
|
async processCodeProposal() {
|
|
923
923
|
const codeDetails = this.getCodeDetailsFromQuorum();
|
|
924
924
|
await Promise.all([
|
|
925
|
-
this.
|
|
926
|
-
this.
|
|
925
|
+
this._deltaManager.inbound.pause(),
|
|
926
|
+
this._deltaManager.inboundSignal.pause(),
|
|
927
927
|
]);
|
|
928
928
|
if ((await this.satisfies(codeDetails)) === true) {
|
|
929
|
-
this.
|
|
930
|
-
this.
|
|
929
|
+
this._deltaManager.inbound.resume();
|
|
930
|
+
this._deltaManager.inboundSignal.resume();
|
|
931
931
|
return;
|
|
932
932
|
}
|
|
933
933
|
// pre-0.58 error message: existingContextDoesNotSatisfyIncomingProposal
|