@fluidframework/container-loader 0.53.0-46105 → 0.54.1
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/connectionManager.d.ts +153 -0
- package/dist/connectionManager.d.ts.map +1 -0
- package/dist/connectionManager.js +664 -0
- package/dist/connectionManager.js.map +1 -0
- package/dist/container.d.ts +2 -1
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +25 -28
- package/dist/container.js.map +1 -1
- package/dist/contracts.d.ts +112 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +14 -0
- package/dist/contracts.js.map +1 -0
- package/dist/deltaManager.d.ts +26 -135
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +142 -768
- package/dist/deltaManager.js.map +1 -1
- package/dist/loader.d.ts +9 -4
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +5 -4
- package/dist/loader.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/dist/protocolTreeDocumentStorageService.d.ts +2 -2
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/lib/connectionManager.d.ts +153 -0
- package/lib/connectionManager.d.ts.map +1 -0
- package/lib/connectionManager.js +660 -0
- package/lib/connectionManager.js.map +1 -0
- package/lib/container.d.ts +2 -1
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +25 -28
- package/lib/container.js.map +1 -1
- package/lib/contracts.d.ts +112 -0
- package/lib/contracts.d.ts.map +1 -0
- package/lib/contracts.js +11 -0
- package/lib/contracts.js.map +1 -0
- package/lib/deltaManager.d.ts +26 -135
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +146 -772
- package/lib/deltaManager.js.map +1 -1
- package/lib/loader.d.ts +9 -4
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +6 -5
- package/lib/loader.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/lib/protocolTreeDocumentStorageService.d.ts +2 -2
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/connectionManager.ts +892 -0
- package/src/container.ts +39 -39
- package/src/contracts.ts +156 -0
- package/src/deltaManager.ts +181 -979
- package/src/loader.ts +31 -9
- package/src/packageVersion.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionManager.js","sourceRoot":"","sources":["../src/connectionManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EACH,eAAe,EACf,cAAc,EACd,SAAS,GACZ,MAAM,iCAAiC,CAAC;AAOzC,OAAO,EAYH,WAAW,EACX,SAAS,GAEZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,eAAe,EACf,gBAAgB,EAChB,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,mCAAmC,EACnC,mBAAmB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACH,YAAY,GACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACH,aAAa,GAGhB,MAAM,aAAa,CAAC;AAErB,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACnC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AACvC,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC,MAAM,qBAAqB,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;AAE1D,SAAS,oBAAoB,CAAC,WAAyB;IACnD,MAAM,OAAO,GAAG,SAAS,WAAW,CAAC,IAA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BAAoB,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC,CAAC;gBAC5E,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;aACpC;SACJ;IACL,CAAC;CA2CJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDisposable,\n ITelemetryLogger,\n ITelemetryProperties,\n} from \"@fluidframework/common-definitions\";\nimport {\n IDeltaQueue,\n ReadOnlyInfo,\n IConnectionDetails,\n} from \"@fluidframework/container-definitions\";\nimport { assert, performance, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport {\n TelemetryLogger,\n normalizeError,\n wrapError,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n IDocumentService,\n IDocumentDeltaConnection,\n IDocumentDeltaConnectionEvents,\n DriverError,\n} from \"@fluidframework/driver-definitions\";\nimport {\n ConnectionMode,\n IClient,\n IClientConfiguration,\n IClientDetails,\n IDocumentMessage,\n INack,\n INackContent,\n ISequencedDocumentMessage,\n ISignalClient,\n ISignalMessage,\n ITokenClaims,\n MessageType,\n ScopeType,\n ISequencedDocumentSystemMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n canRetryOnError,\n createWriteError,\n createGenericNetworkError,\n getRetryDelayFromError,\n logNetworkFailure,\n waitForConnectedState,\n DeltaStreamConnectionForbiddenError,\n GenericNetworkError,\n} from \"@fluidframework/driver-utils\";\nimport {\n GenericError,\n} from \"@fluidframework/container-utils\";\nimport { DeltaQueue } from \"./deltaQueue\";\nimport {\n ReconnectMode,\n IConnectionManager,\n IConnectionManagerFactoryArgs,\n} from \"./contracts\";\n\nconst MaxReconnectDelayInMs = 8000;\nconst InitialReconnectDelayInMs = 1000;\nconst DefaultChunkSize = 16 * 1024;\n\nconst fatalConnectErrorProp = { fatalConnectError: true };\n\nfunction getNackReconnectInfo(nackContent: INackContent) {\n const message = `Nack (${nackContent.type}): ${nackContent.message}`;\n const canRetry = nackContent.code !== 403;\n const retryAfterMs = nackContent.retryAfter !== undefined ? nackContent.retryAfter * 1000 : undefined;\n return createGenericNetworkError(\n `nack [${nackContent.code}]`, message, canRetry, retryAfterMs, { statusCode: nackContent.code });\n}\n\nconst createReconnectError = (fluidErrorCode: string, err: any) =>\n wrapError(\n err,\n (errorMessage: string) => new GenericNetworkError(fluidErrorCode, errorMessage, true /* canRetry */),\n );\n\n/**\n * Implementation of IDocumentDeltaConnection that does not support submitting\n * or receiving ops. Used in storage-only mode.\n */\nclass NoDeltaStream\n extends TypedEventEmitter<IDocumentDeltaConnectionEvents>\n implements IDocumentDeltaConnection, IDisposable\n{\n clientId: string = \"storage-only client\";\n claims: ITokenClaims = {\n scopes: [ScopeType.DocRead],\n } as any;\n mode: ConnectionMode = \"read\";\n existing: boolean = true;\n maxMessageSize: number = 0;\n version: string = \"\";\n initialMessages: ISequencedDocumentMessage[] = [];\n initialSignals: ISignalMessage[] = [];\n initialClients: ISignalClient[] = [];\n serviceConfiguration: IClientConfiguration = {\n maxMessageSize: 0,\n blockSize: 0,\n summary: undefined as any,\n };\n checkpointSequenceNumber?: number | undefined = undefined;\n submit(messages: IDocumentMessage[]): void {\n this.emit(\"nack\", this.clientId, messages.map((operation) => {\n return {\n operation,\n content: { message: \"Cannot submit with storage-only connection\", code: 403 },\n };\n }));\n }\n submitSignal(message: any): void {\n this.emit(\"nack\", this.clientId, {\n operation: message,\n content: { message: \"Cannot submit signal with storage-only connection\", code: 403 },\n });\n }\n\n private _disposed = false;\n public get disposed() { return this._disposed; }\n public dispose() { this._disposed = true; }\n}\n\n/**\n * Implementation of IConnectionManager, used by Container class\n * Implements constant connectivity to relay service, by reconnecting in case of loast connection or error.\n * Exposes various controls to influecen this process, including manual reconnects, forced read-only mode, etc.\n */\nexport class ConnectionManager implements IConnectionManager {\n /** Connection mode used when reconnecting on error or disconnect. */\n private readonly defaultReconnectionMode: ConnectionMode;\n\n private pendingConnection = false;\n private connection: IDocumentDeltaConnection | undefined;\n\n /** file ACL - whether user has only read-only access to a file */\n private _readonlyPermissions: boolean | undefined;\n\n /** tracks host requiring read-only mode. */\n private _forceReadonly = false;\n\n /**\n * Controls whether the DeltaManager will automatically reconnect to the delta stream after receiving a disconnect.\n */\n private _reconnectMode: ReconnectMode;\n\n /** True if there is pending (async) reconnection from \"read\" to \"write\" */\n private pendingReconnect = false;\n\n /** downgrade \"write\" connection to \"read\" */\n private downgradedConnection = false;\n\n private clientSequenceNumber = 0;\n private clientSequenceNumberObserved = 0;\n /** Counts the number of noops sent by the client which may not be acked. */\n private trailingNoopCount = 0;\n\n /** track clientId used last time when we sent any ops */\n private lastSubmittedClientId: string | undefined;\n\n private connectFirstConnection = true;\n\n private _connectionVerboseProps: Record<string, string | number> = {};\n\n private _connectionProps: ITelemetryProperties = {};\n\n private closed = false;\n\n private readonly _outbound: DeltaQueue<IDocumentMessage[]>;\n\n public get connectionVerboseProps() { return this._connectionVerboseProps; }\n\n public readonly clientDetails: IClientDetails;\n\n /**\n * The current connection mode, initially read.\n */\n public get connectionMode(): ConnectionMode {\n assert(!this.downgradedConnection || this.connection?.mode === \"write\",\n 0x277 /* \"Did we forget to reset downgradedConnection on new connection?\" */);\n if (this.connection === undefined) {\n return \"read\";\n }\n return this.connection.mode;\n }\n\n public get connected() { return this.connection !== undefined; }\n\n public get clientId() { return this.connection?.clientId; }\n /**\n * Automatic reconnecting enabled or disabled.\n * If set to Never, then reconnecting will never be allowed.\n */\n public get reconnectMode(): ReconnectMode {\n return this._reconnectMode;\n }\n\n public get maxMessageSize(): number {\n return this.connection?.serviceConfiguration?.maxMessageSize\n ?? DefaultChunkSize;\n }\n\n public get version(): string {\n if (this.connection === undefined) {\n throw new Error(\"Cannot check version without a connection\");\n }\n return this.connection.version;\n }\n\n public get serviceConfiguration(): IClientConfiguration | undefined {\n return this.connection?.serviceConfiguration;\n }\n\n public get scopes(): string[] | undefined {\n return this.connection?.claims.scopes;\n }\n\n public get outbound(): IDeltaQueue<IDocumentMessage[]> {\n return this._outbound;\n }\n\n /**\n * Returns set of props that can be logged in telemetry that provide some insights / statistics\n * about current or last connection (if there is no connection at the moment)\n */\n public get connectionProps(): ITelemetryProperties {\n if (this.connection !== undefined) {\n return this._connectionProps;\n } else {\n return {\n ...this._connectionProps,\n // Report how many ops this client sent in last disconnected session\n sentOps: this.clientSequenceNumber,\n };\n }\n }\n\n public shouldJoinWrite(): boolean {\n // We don't have to wait for ack for topmost NoOps. So subtract those.\n return this.clientSequenceNumberObserved < (this.clientSequenceNumber - this.trailingNoopCount);\n }\n\n /**\n * Tells if container is in read-only mode.\n * Data stores should listen for \"readonly\" notifications and disallow user\n * making changes to data stores.\n * Readonly state can be because of no storage write permission,\n * or due to host forcing readonly mode for container.\n * It is undefined if we have not yet established websocket connection\n * and do not know if user has write access to a file.\n */\n private get readonly() {\n if (this._forceReadonly) {\n return true;\n }\n return this._readonlyPermissions;\n }\n\n public get readOnlyInfo(): ReadOnlyInfo {\n const storageOnly = this.connection !== undefined && this.connection instanceof NoDeltaStream;\n if (storageOnly || this._forceReadonly || this._readonlyPermissions === true) {\n return {\n readonly: true,\n forced: this._forceReadonly,\n permissions: this._readonlyPermissions,\n storageOnly,\n };\n }\n\n return { readonly: this._readonlyPermissions };\n }\n\n private static detailsFromConnection(connection: IDocumentDeltaConnection): IConnectionDetails {\n return {\n claims: connection.claims,\n clientId: connection.clientId,\n existing: connection.existing,\n checkpointSequenceNumber: connection.checkpointSequenceNumber,\n get initialClients() { return connection.initialClients; },\n mode: connection.mode,\n serviceConfiguration: connection.serviceConfiguration,\n version: connection.version,\n };\n }\n\n constructor(\n private readonly serviceProvider: () => IDocumentService | undefined,\n private client: IClient,\n reconnectAllowed: boolean,\n private readonly logger: ITelemetryLogger,\n private readonly props: IConnectionManagerFactoryArgs,\n ) {\n this.clientDetails = this.client.details;\n this.defaultReconnectionMode = this.client.mode;\n this._reconnectMode = reconnectAllowed ? ReconnectMode.Enabled : ReconnectMode.Never;\n\n // Outbound message queue. The outbound queue is represented as a queue of an array of ops. Ops contained\n // within an array *must* fit within the maxMessageSize and are guaranteed to be ordered sequentially.\n this._outbound = new DeltaQueue<IDocumentMessage[]>(\n (messages) => {\n if (this.connection === undefined) {\n throw new Error(\"Attempted to submit an outbound message without connection\");\n }\n this.connection.submit(messages);\n });\n\n this._outbound.on(\"error\", (error) => {\n this.props.closeHandler(normalizeError(error));\n });\n }\n\n public dispose(error: any) {\n if (this.closed) {\n return;\n }\n this.closed = true;\n\n this.pendingConnection = false;\n\n // Ensure that things like triggerConnect() will short circuit\n this._reconnectMode = ReconnectMode.Never;\n\n this._outbound.clear();\n\n const disconnectReason = error !== undefined\n ? `Closing DeltaManager (${error.message})`\n : \"Closing DeltaManager\";\n\n // This raises \"disconnect\" event if we have active connection.\n this.disconnectFromDeltaStream(disconnectReason);\n\n // Notify everyone we are in read-only state.\n // Useful for data stores in case we hit some critical error,\n // to switch to a mode where user edits are not accepted\n this.set_readonlyPermissions(true);\n }\n\n /**\n * Enables or disables automatic reconnecting.\n * Will throw an error if reconnectMode set to Never.\n */\n public setAutoReconnect(mode: ReconnectMode): void {\n assert(mode !== ReconnectMode.Never && this._reconnectMode !== ReconnectMode.Never,\n 0x278 /* \"API is not supported for non-connecting or closed container\" */);\n\n this._reconnectMode = mode;\n\n if (mode !== ReconnectMode.Enabled) {\n // immediately disconnect - do not rely on service eventually dropping connection.\n this.disconnectFromDeltaStream(\"setAutoReconnect\");\n }\n }\n\n /**\n * Sends signal to runtime (and data stores) to be read-only.\n * Hosts may have read only views, indicating to data stores that no edits are allowed.\n * This is independent from this._readonlyPermissions (permissions) and this.connectionMode\n * (server can return \"write\" mode even when asked for \"read\")\n * Leveraging same \"readonly\" event as runtime & data stores should behave the same in such case\n * as in read-only permissions.\n * But this.active can be used by some DDSes to figure out if ops can be sent\n * (for example, read-only view still participates in code proposals / upgrades decisions)\n *\n * Forcing Readonly does not prevent DDS from generating ops. It is up to user code to honour\n * the readonly flag. If ops are generated, they will accumulate locally and not be sent. If\n * there are pending in the outbound queue, it will stop sending until force readonly is\n * cleared.\n *\n * @param readonly - set or clear force readonly.\n */\n public forceReadonly(readonly: boolean) {\n if (readonly !== this._forceReadonly) {\n this.logger.sendTelemetryEvent({\n eventName: \"ForceReadOnly\",\n value: readonly,\n });\n }\n const oldValue = this.readonly;\n this._forceReadonly = readonly;\n\n if (oldValue !== this.readonly) {\n assert(this._reconnectMode !== ReconnectMode.Never,\n 0x279 /* \"API is not supported for non-connecting or closed container\" */);\n\n let reconnect = false;\n if (this.readonly === true) {\n // If we switch to readonly while connected, we should disconnect first\n // See comment in the \"readonly\" event handler to deltaManager set up by\n // the ContainerRuntime constructor\n\n if (this.shouldJoinWrite()) {\n // If we have pending changes, then we will never send them - it smells like\n // host logic error.\n this.logger.sendErrorEvent({ eventName: \"ForceReadonlyPendingChanged\" });\n }\n\n reconnect = this.disconnectFromDeltaStream(\"Force readonly\");\n }\n this.props.readonlyChangeHandler(this.readonly);\n if (reconnect) {\n // reconnect if we disconnected from before.\n this.triggerConnect(\"read\");\n }\n }\n }\n\n private set_readonlyPermissions(readonly: boolean) {\n const oldValue = this.readonly;\n this._readonlyPermissions = readonly;\n if (oldValue !== this.readonly) {\n this.props.readonlyChangeHandler(this.readonly);\n }\n }\n\n public connect(connectionMode?: ConnectionMode) {\n this.connectCore(connectionMode).catch((error) => {\n const normalizedError = normalizeError(error, { props: fatalConnectErrorProp });\n this.props.closeHandler(normalizedError);\n });\n }\n\n private async connectCore(connectionMode?: ConnectionMode): Promise<void> {\n assert(!this.closed, 0x26a /* \"not closed\" */);\n\n if (this.connection !== undefined || this.pendingConnection) {\n return;\n }\n\n let requestedMode = connectionMode ?? this.defaultReconnectionMode;\n\n // if we have any non-acked ops from last connection, reconnect as \"write\".\n // without that we would connect in view-only mode, which will result in immediate\n // firing of \"connected\" event from Container and switch of current clientId (as tracked\n // by all DDSes). This will make it impossible to figure out if ops actually made it through,\n // so DDSes will immediately resubmit all pending ops, and some of them will be duplicates, corrupting document\n if (this.shouldJoinWrite()) {\n requestedMode = \"write\";\n }\n\n const docService = this.serviceProvider();\n assert(docService !== undefined, 0x2a7 /* \"Container is not attached\" */);\n\n let connection: IDocumentDeltaConnection | undefined;\n\n if (docService.policies?.storageOnly === true) {\n connection = new NoDeltaStream();\n // to keep setupNewSuccessfulConnection happy\n this.pendingConnection = true;\n this.setupNewSuccessfulConnection(connection, \"read\");\n assert(!this.pendingConnection, 0x2b3 /* \"logic error\" */);\n return;\n }\n\n // this.pendingConnection resets to false as soon as we know the outcome of the connection attempt\n this.pendingConnection = true;\n\n let delayMs = InitialReconnectDelayInMs;\n let connectRepeatCount = 0;\n const connectStartTime = performance.now();\n let lastError: any;\n\n // This loop will keep trying to connect until successful, with a delay between each iteration.\n while (connection === undefined) {\n if (this.closed) {\n throw new Error(\"Attempting to connect a closed DeltaManager\");\n }\n connectRepeatCount++;\n\n try {\n this.client.mode = requestedMode;\n connection = await docService.connectToDeltaStream(this.client);\n\n if (connection.disposed) {\n // Nobody observed this connection, so drop it on the floor and retry.\n this.logger.sendTelemetryEvent({ eventName: \"ReceivedClosedConnection\" });\n connection = undefined;\n }\n } catch (origError) {\n if (typeof origError === \"object\" && origError !== null &&\n origError?.errorType === DeltaStreamConnectionForbiddenError.errorType) {\n connection = new NoDeltaStream();\n requestedMode = \"read\";\n break;\n }\n\n // Socket.io error when we connect to wrong socket, or hit some multiplexing bug\n if (!canRetryOnError(origError)) {\n const error = normalizeError(origError, { props: fatalConnectErrorProp });\n this.props.closeHandler(error);\n throw error;\n }\n\n // Log error once - we get too many errors in logs when we are offline,\n // and unfortunately there is no reliable way to detect that.\n if (connectRepeatCount === 1) {\n logNetworkFailure(\n this.logger,\n {\n delay: delayMs, // milliseconds\n eventName: \"DeltaConnectionFailureToConnect\",\n duration: TelemetryLogger.formatTick(performance.now() - connectStartTime),\n },\n origError);\n }\n\n lastError = origError;\n\n const retryDelayFromError = getRetryDelayFromError(origError);\n delayMs = retryDelayFromError ?? Math.min(delayMs * 2, MaxReconnectDelayInMs);\n\n if (retryDelayFromError !== undefined) {\n this.props.reconnectionDelayHandler(retryDelayFromError, origError);\n }\n await waitForConnectedState(delayMs);\n }\n }\n\n // If we retried more than once, log an event about how long it took\n if (connectRepeatCount > 1) {\n this.logger.sendTelemetryEvent(\n {\n eventName: \"MultipleDeltaConnectionFailures\",\n attempts: connectRepeatCount,\n duration: TelemetryLogger.formatTick(performance.now() - connectStartTime),\n },\n lastError,\n );\n }\n\n this.setupNewSuccessfulConnection(connection, requestedMode);\n }\n\n /**\n * Start the connection. Any error should result in container being close.\n * And report the error if it excape for any reason.\n * @param args - The connection arguments\n */\n private triggerConnect(connectionMode: ConnectionMode) {\n assert(this.connection === undefined, 0x239 /* \"called only in disconnected state\" */);\n if (this.reconnectMode !== ReconnectMode.Enabled) {\n return;\n }\n this.connect(connectionMode);\n }\n\n /**\n * Disconnect the current connection.\n * @param reason - Text description of disconnect reason to emit with disconnect event\n */\n private disconnectFromDeltaStream(reason: string): boolean {\n this.pendingReconnect = false;\n this.downgradedConnection = false;\n\n if (this.connection === undefined) {\n return false;\n }\n\n assert(!this.pendingConnection, 0x27b /* \"reentrancy may result in incorrect behavior\" */);\n\n const connection = this.connection;\n // Avoid any re-entrancy - clear object reference\n this.connection = undefined;\n\n // Remove listeners first so we don't try to retrigger this flow accidentally through reconnectOnError\n connection.off(\"op\", this.opHandler);\n connection.off(\"signal\", this.props.signalHandler);\n connection.off(\"nack\", this.nackHandler);\n connection.off(\"disconnect\", this.disconnectHandlerInternal);\n connection.off(\"error\", this.errorHandler);\n connection.off(\"pong\", this.props.pongHandler);\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._outbound.pause();\n this._outbound.clear();\n this.props.disconnectHandler(reason);\n\n connection.dispose();\n\n this._connectionVerboseProps = {};\n\n return true;\n }\n\n /**\n * Once we've successfully gotten a connection, we need to set up state, attach event listeners, and process\n * initial messages.\n * @param connection - The newly established connection\n */\n private setupNewSuccessfulConnection(connection: IDocumentDeltaConnection, requestedMode: ConnectionMode) {\n // Old connection should have been cleaned up before establishing a new one\n assert(this.connection === undefined, 0x0e6 /* \"old connection exists on new connection setup\" */);\n assert(!connection.disposed, 0x28a /* \"can't be disposed - Callers need to ensure that!\" */);\n\n if (this.pendingConnection) {\n this.pendingConnection = false;\n } else {\n assert(this.closed, 0x27f /* \"reentrancy may result in incorrect behavior\" */);\n }\n this.connection = connection;\n\n // Does information in scopes & mode matches?\n // If we asked for \"write\" and got \"read\", then file is read-only\n // But if we ask read, server can still give us write.\n const readonly = !connection.claims.scopes.includes(ScopeType.DocWrite);\n\n // This connection mode validation logic is moving to the driver layer in 0.44. These two asserts can be\n // removed after those packages have released and become ubiquitous.\n assert(requestedMode === \"read\" || readonly === (this.connectionMode === \"read\"),\n 0x0e7 /* \"claims/connectionMode mismatch\" */);\n assert(!readonly || this.connectionMode === \"read\", 0x0e8 /* \"readonly perf with write connection\" */);\n\n this.set_readonlyPermissions(readonly);\n\n if (this.closed) {\n // Raise proper events, Log telemetry event and close connection.\n this.disconnectFromDeltaStream(\"ConnectionManager already closed\");\n return;\n }\n\n this._outbound.resume();\n\n connection.on(\"op\", this.opHandler);\n connection.on(\"signal\", this.props.signalHandler);\n connection.on(\"nack\", this.nackHandler);\n connection.on(\"disconnect\", this.disconnectHandlerInternal);\n connection.on(\"error\", this.errorHandler);\n connection.on(\"pong\", this.props.pongHandler);\n\n // Initial messages are always sorted. However, due to early op handler installed by drivers and appending those\n // ops to initialMessages, resulting set is no longer sorted, which would result in client hitting storage to\n // fill in gap. We will recover by cancelling this request once we process remaining ops, but it's a waste that\n // we could avoid\n const initialMessages = connection.initialMessages.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\n // Some storages may provide checkpointSequenceNumber to identify how far client is behind.\n let checkpointSequenceNumber = connection.checkpointSequenceNumber;\n\n this._connectionVerboseProps = {\n clientId: connection.clientId,\n mode: connection.mode,\n };\n\n // reset connection props\n this._connectionProps = {};\n\n if (connection.relayServiceAgent !== undefined) {\n this._connectionVerboseProps.relayServiceAgent = connection.relayServiceAgent;\n this._connectionProps.relayServiceAgent = connection.relayServiceAgent;\n }\n this._connectionProps.socketDocumentId = connection.claims.documentId;\n this._connectionProps.connectionMode = connection.mode;\n\n let last = -1;\n if (initialMessages.length !== 0) {\n this._connectionVerboseProps.connectionInitialOpsFrom = initialMessages[0].sequenceNumber;\n last = initialMessages[initialMessages.length - 1].sequenceNumber;\n this._connectionVerboseProps.connectionInitialOpsTo = last + 1;\n // Update knowledge of how far we are behind, before raising \"connect\" event\n // This is duplication of what incomingOpHandler() does, but we have to raise event before we get there,\n // so duplicating update logic here as well.\n if (checkpointSequenceNumber === undefined || checkpointSequenceNumber < last) {\n checkpointSequenceNumber = last;\n }\n }\n\n this.props.incomingOpHandler(\n initialMessages,\n this.connectFirstConnection ? \"InitialOps\" : \"ReconnectOps\");\n\n if (connection.initialSignals !== undefined) {\n for (const signal of connection.initialSignals) {\n this.props.signalHandler(signal);\n }\n }\n\n const details = ConnectionManager.detailsFromConnection(connection);\n details.checkpointSequenceNumber = checkpointSequenceNumber;\n this.props.connectHandler(details);\n\n this.connectFirstConnection = false;\n }\n\n /**\n * Disconnect the current connection and reconnect.\n * @param connection - The connection that wants to reconnect - no-op if it's different from this.connection\n * @param requestedMode - Read or write\n * @param error - Error reconnect information including whether or not to reconnect\n * @returns A promise that resolves when the connection is reestablished or we stop trying\n */\n private reconnectOnError(\n requestedMode: ConnectionMode,\n error: DriverError,\n ) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.reconnectOnErrorCore(\n requestedMode,\n error.message,\n error);\n }\n\n /**\n * Disconnect the current connection and reconnect.\n * @param connection - The connection that wants to reconnect - no-op if it's different from this.connection\n * @param requestedMode - Read or write\n * @param error - Error reconnect information including whether or not to reconnect\n * @returns A promise that resolves when the connection is reestablished or we stop trying\n */\n private async reconnectOnErrorCore(\n requestedMode: ConnectionMode,\n disconnectMessage: string,\n error?: DriverError,\n ) {\n // We quite often get protocol errors before / after observing nack/disconnect\n // we do not want to run through same sequence twice.\n // If we're already disconnected/disconnecting it's not appropriate to call this again.\n assert(this.connection !== undefined, 0x0eb /* \"Missing connection for reconnect\" */);\n\n this.disconnectFromDeltaStream(disconnectMessage);\n\n const canRetry = error !== undefined ? canRetryOnError(error) : true;\n\n // If reconnection is not an option, close the DeltaManager\n if (!canRetry) {\n this.props.closeHandler(normalizeError(error, { props: fatalConnectErrorProp }));\n } else if (this.reconnectMode === ReconnectMode.Never) {\n // Do not raise container error if we are closing just because we lost connection.\n // Those errors (like IdleDisconnect) would show up in telemetry dashboards and\n // are very misleading, as first initial reaction - some logic is broken.\n this.props.closeHandler();\n }\n\n // If closed then we can't reconnect\n if (this.closed || this.reconnectMode !== ReconnectMode.Enabled) {\n return;\n }\n\n const delayMs = error !== undefined ? getRetryDelayFromError(error) : undefined;\n if (delayMs !== undefined) {\n this.props.reconnectionDelayHandler(delayMs, error);\n await waitForConnectedState(delayMs);\n }\n\n this.triggerConnect(requestedMode);\n }\n\n public prepareMessageToSend(message: Omit<IDocumentMessage, \"clientSequenceNumber\">): IDocumentMessage | undefined {\n if (this.readonly === true) {\n assert(this.readOnlyInfo.readonly === true, 0x1f0 /* \"Unexpected mismatch in readonly\" */);\n const error = new GenericError(\"deltaManagerReadonlySubmit\", undefined /* error */, {\n readonly: this.readOnlyInfo.readonly,\n forcedReadonly: this.readOnlyInfo.forced,\n readonlyPermissions: this.readOnlyInfo.permissions,\n storageOnly: this.readOnlyInfo.storageOnly,\n });\n this.props.closeHandler(error);\n return undefined;\n }\n\n // reset clientSequenceNumber if we are using new clientId.\n // we keep info about old connection as long as possible to be able to account for all non-acked ops\n // that we pick up on next connection.\n assert(!!this.connection, 0x0e4 /* \"Lost old connection!\" */);\n if (this.lastSubmittedClientId !== this.connection?.clientId) {\n this.lastSubmittedClientId = this.connection?.clientId;\n this.clientSequenceNumber = 0;\n this.clientSequenceNumberObserved = 0;\n }\n\n if (message.type === MessageType.NoOp) {\n this.trailingNoopCount++;\n } else {\n this.trailingNoopCount = 0;\n }\n\n return {\n ...message,\n clientSequenceNumber: ++this.clientSequenceNumber,\n };\n }\n\n public submitSignal(content: any) {\n if (this.connection !== undefined) {\n this.connection.submitSignal(content);\n } else {\n this.logger.sendErrorEvent({ eventName: \"submitSignalDisconnected\" });\n }\n }\n\n public sendMessages(messages: IDocumentMessage[]) {\n assert(this.connected, 0x2b4 /* \"not connected on sending ops!\" */);\n\n // If connection is \"read\" or implicit \"read\" (got leave op for \"write\" connection),\n // then op can't make it through - we will get a nack if op is sent.\n // We can short-circuit this process.\n // Note that we also want nacks to be rare and be treated as catastrophic failures.\n // Be careful with reentrancy though - disconnected event should not be be raised in the\n // middle of the current workflow, but rather on clean stack!\n if (this.connectionMode === \"read\" || this.downgradedConnection) {\n if (!this.pendingReconnect) {\n this.pendingReconnect = true;\n Promise.resolve().then(async () => {\n if (this.pendingReconnect) { // still valid?\n await this.reconnectOnErrorCore(\n \"write\", // connectionMode\n \"Switch to write\", // message\n );\n }\n })\n .catch(() => {});\n }\n return;\n }\n\n assert(!this.pendingReconnect, 0x2b5 /* \"logic error\" */);\n\n this._outbound.push(messages);\n }\n\n public beforeProcessingIncomingOp(message: ISequencedDocumentMessage) {\n // if we have connection, and message is local, then we better treat is as local!\n assert(this.clientId !== message.clientId || this.lastSubmittedClientId === message.clientId,\n 0x0ee /* \"Not accounting local messages correctly\" */,\n );\n\n if (this.lastSubmittedClientId !== undefined && this.lastSubmittedClientId === message.clientId) {\n const clientSequenceNumber = message.clientSequenceNumber;\n\n assert(this.clientSequenceNumberObserved < clientSequenceNumber, 0x0ef /* \"client seq# not growing\" */);\n assert(clientSequenceNumber <= this.clientSequenceNumber,\n 0x0f0 /* \"Incoming local client seq# > generated by this client\" */);\n\n this.clientSequenceNumberObserved = clientSequenceNumber;\n }\n\n if (message.type === MessageType.ClientLeave) {\n const systemLeaveMessage = message as ISequencedDocumentSystemMessage;\n const clientId = JSON.parse(systemLeaveMessage.data) as string;\n if (clientId === this.clientId) {\n // We have been kicked out from quorum\n this.logger.sendPerformanceEvent({ eventName: \"ReadConnectionTransition\" });\n this.downgradedConnection = true;\n }\n }\n }\n\n private readonly opHandler = (documentId: string, messagesArg: ISequencedDocumentMessage[]) => {\n const messages = Array.isArray(messagesArg) ? messagesArg : [messagesArg];\n this.props.incomingOpHandler(messages, \"opHandler\");\n };\n\n // Always connect in write mode after getting nacked.\n private readonly nackHandler = (documentId: string, messages: INack[]) => {\n const message = messages[0];\n // TODO: we should remove this check when service updates?\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (this._readonlyPermissions) {\n this.props.closeHandler(createWriteError(\"writeOnReadOnlyDocument\"));\n }\n\n // check message.content for Back-compat with old service.\n const reconnectInfo = message.content !== undefined\n ? getNackReconnectInfo(message.content) :\n createGenericNetworkError(\"nackReasonUnknown\", undefined, true);\n\n this.reconnectOnError(\n \"write\",\n reconnectInfo,\n );\n };\n\n // Connection mode is always read on disconnect/error unless the system mode was write.\n private readonly disconnectHandlerInternal = (disconnectReason) => {\n // Note: we might get multiple disconnect calls on same socket, as early disconnect notification\n // (\"server_disconnect\", ODSP-specific) is mapped to \"disconnect\"\n this.reconnectOnError(\n this.defaultReconnectionMode,\n createReconnectError(\"dmDocumentDeltaConnectionDisconnected\", disconnectReason),\n );\n };\n\n private readonly errorHandler = (error) => {\n this.reconnectOnError(\n this.defaultReconnectionMode,\n createReconnectError(\"dmDocumentDeltaConnectionError\", error),\n );\n };\n}\n"]}
|
package/lib/container.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export declare enum ConnectionState {
|
|
|
59
59
|
* false: storage does not provide indication of how far the client is. Container processed
|
|
60
60
|
* all the ops known to it, but it maybe still behind.
|
|
61
61
|
*/
|
|
62
|
-
export declare function waitContainerToCatchUp(container:
|
|
62
|
+
export declare function waitContainerToCatchUp(container: IContainer): Promise<boolean>;
|
|
63
63
|
export declare class Container extends EventEmitterWithErrorHandling<IContainerEvents> implements IContainer {
|
|
64
64
|
private readonly loader;
|
|
65
65
|
static version: string;
|
|
@@ -109,6 +109,7 @@ export declare class Container extends EventEmitterWithErrorHandling<IContainerE
|
|
|
109
109
|
private readonly connectionStateHandler;
|
|
110
110
|
private setAutoReconnectTime;
|
|
111
111
|
private readonly collabWindowTracker;
|
|
112
|
+
private get connectionMode();
|
|
112
113
|
get IFluidRouter(): IFluidRouter;
|
|
113
114
|
get resolvedUrl(): IResolvedUrl | undefined;
|
|
114
115
|
get loadedFromVersion(): IVersion | undefined;
|
package/lib/container.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EACH,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,iBAAiB,EAEpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,SAAS,EAET,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,WAAW,EAGX,YAAY,EACZ,kBAAkB,EACrB,MAAM,uCAAuC,CAAC;AAO/C,OAAO,EAEH,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACf,MAAM,oCAAoC,CAAC;AAc5C,OAAO,EAGH,oBAAoB,EACpB,cAAc,EAGd,gBAAgB,EAEhB,OAAO,EAEP,yBAAyB,EAOzB,QAAQ,EAQX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAEH,6BAA6B,EAG7B,eAAe,EAIlB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EACH,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,iBAAiB,EAEpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,SAAS,EAET,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,WAAW,E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BAA2B;IAiBzC,OAAO,CAAC,iCAAiC;IA4DzC,OAAO,CAAC,wBAAwB;IAuBhC,OAAO,CAAC,sBAAsB;IA4B9B,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,oBAAoB;IAoC5B,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,aAAa;IAiBrB;;;;OAIG;YACW,iBAAiB;YAkBjB,0BAA0B;YAkB1B,kBAAkB;IA0ChC,OAAO,CAAC,iBAAiB;CAG5B"}
|
package/lib/container.js
CHANGED
|
@@ -15,7 +15,8 @@ import { FileMode, MessageType, TreeEntry, SummaryType, } from "@fluidframework/
|
|
|
15
15
|
import { ChildLogger, EventEmitterWithErrorHandling, PerformanceEvent, raiseConnectedEvent, TelemetryLogger, connectedEventName, disconnectedEventName, normalizeError, } from "@fluidframework/telemetry-utils";
|
|
16
16
|
import { Audience } from "./audience";
|
|
17
17
|
import { ContainerContext } from "./containerContext";
|
|
18
|
-
import {
|
|
18
|
+
import { ReconnectMode } from "./contracts";
|
|
19
|
+
import { DeltaManager } from "./deltaManager";
|
|
19
20
|
import { DeltaManagerProxy } from "./deltaManagerProxy";
|
|
20
21
|
import { RelativeLoader } from "./loader";
|
|
21
22
|
import { pkgVersion } from "./packageVersion";
|
|
@@ -26,6 +27,7 @@ import { BlobOnlyStorage, ContainerStorageAdapter } from "./containerStorageAdap
|
|
|
26
27
|
import { getSnapshotTreeFromSerializedContainer } from "./utils";
|
|
27
28
|
import { QuorumProxy } from "./quorum";
|
|
28
29
|
import { CollabWindowTracker } from "./collabWindowTracker";
|
|
30
|
+
import { ConnectionManager } from "./connectionManager";
|
|
29
31
|
const detachedContainerRefSeqNumber = 0;
|
|
30
32
|
const dirtyContainerEvent = "dirty";
|
|
31
33
|
const savedContainerEvent = "saved";
|
|
@@ -92,6 +94,8 @@ export async function waitContainerToCatchUp(container) {
|
|
|
92
94
|
waitForOps();
|
|
93
95
|
};
|
|
94
96
|
container.on(connectedEventName, callback);
|
|
97
|
+
// TODO: Remove null check after next release #8523
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
95
99
|
container.resume();
|
|
96
100
|
});
|
|
97
101
|
}
|
|
@@ -165,7 +169,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
165
169
|
this.connectionStateHandler = new ConnectionStateHandler({
|
|
166
170
|
protocolHandler: () => this._protocolHandler,
|
|
167
171
|
logConnectionStateChangeTelemetry: (value, oldState, reason) => this.logConnectionStateChangeTelemetry(value, oldState, reason),
|
|
168
|
-
shouldClientJoinWrite: () => this._deltaManager.shouldJoinWrite(),
|
|
172
|
+
shouldClientJoinWrite: () => this._deltaManager.connectionManager.shouldJoinWrite(),
|
|
169
173
|
maxClientLeaveWaitTime: this.loader.services.options.maxClientLeaveWaitTime,
|
|
170
174
|
logConnectionIssue: (eventName) => {
|
|
171
175
|
// We get here when socket does not receive any ops on "write" connection, including
|
|
@@ -345,6 +349,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
345
349
|
}
|
|
346
350
|
return this._protocolHandler;
|
|
347
351
|
}
|
|
352
|
+
get connectionMode() { return this._deltaManager.connectionManager.connectionMode; }
|
|
348
353
|
get IFluidRouter() { return this; }
|
|
349
354
|
get resolvedUrl() {
|
|
350
355
|
return this._resolvedUrl;
|
|
@@ -359,7 +364,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
359
364
|
* Tracks host requiring read-only mode.
|
|
360
365
|
*/
|
|
361
366
|
forceReadonly(readonly) {
|
|
362
|
-
this._deltaManager.forceReadonly(readonly);
|
|
367
|
+
this._deltaManager.connectionManager.forceReadonly(readonly);
|
|
363
368
|
}
|
|
364
369
|
get id() {
|
|
365
370
|
var _a, _b;
|
|
@@ -393,7 +398,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
393
398
|
* Set once this.connected is true, otherwise undefined
|
|
394
399
|
*/
|
|
395
400
|
get scopes() {
|
|
396
|
-
return this._deltaManager.scopes;
|
|
401
|
+
return this._deltaManager.connectionManager.scopes;
|
|
397
402
|
}
|
|
398
403
|
get clientDetails() {
|
|
399
404
|
return this._deltaManager.clientDetails;
|
|
@@ -620,7 +625,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
620
625
|
throw new Error("Attempting to setAutoReconnect() a closed Container");
|
|
621
626
|
}
|
|
622
627
|
const mode = reconnect ? ReconnectMode.Enabled : ReconnectMode.Disabled;
|
|
623
|
-
const currentMode = this._deltaManager.reconnectMode;
|
|
628
|
+
const currentMode = this._deltaManager.connectionManager.reconnectMode;
|
|
624
629
|
if (currentMode === mode) {
|
|
625
630
|
return;
|
|
626
631
|
}
|
|
@@ -629,11 +634,11 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
629
634
|
this.setAutoReconnectTime = now;
|
|
630
635
|
this.logger.sendTelemetryEvent({
|
|
631
636
|
eventName: reconnect ? "AutoReconnectEnabled" : "AutoReconnectDisabled",
|
|
632
|
-
connectionMode: this.
|
|
637
|
+
connectionMode: this.connectionMode,
|
|
633
638
|
connectionState: ConnectionState[this.connectionState],
|
|
634
639
|
duration,
|
|
635
640
|
});
|
|
636
|
-
this._deltaManager.setAutoReconnect(mode);
|
|
641
|
+
this._deltaManager.connectionManager.setAutoReconnect(mode);
|
|
637
642
|
// If container state is not attached and resumed, then don't connect to delta stream. Also don't set the
|
|
638
643
|
// manual reconnection flag to true as we haven't made the initial connection yet.
|
|
639
644
|
if (reconnect && this._attachState === AttachState.Attached && this.resumedOpProcessingAfterLoad) {
|
|
@@ -642,13 +647,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
642
647
|
this.manualReconnectInProgress = true;
|
|
643
648
|
}
|
|
644
649
|
// Ensure connection to web socket
|
|
645
|
-
this.connectToDeltaStream({ reason: "autoReconnect" })
|
|
646
|
-
// All errors are reported through events ("error" / "disconnected") and telemetry in DeltaManager
|
|
647
|
-
// So there shouldn't be a need to record error here.
|
|
648
|
-
// But we have number of cases where reconnects do not happen, and no errors are recorded, so
|
|
649
|
-
// adding this log point for easier diagnostics
|
|
650
|
-
this.logger.sendTelemetryEvent({ eventName: "setAutoReconnectError" }, error);
|
|
651
|
-
});
|
|
650
|
+
this.connectToDeltaStream({ reason: "autoReconnect" });
|
|
652
651
|
}
|
|
653
652
|
}
|
|
654
653
|
resume() {
|
|
@@ -668,8 +667,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
668
667
|
this._deltaManager.inboundSignal.resume();
|
|
669
668
|
}
|
|
670
669
|
// Ensure connection to web socket
|
|
671
|
-
|
|
672
|
-
this.connectToDeltaStream(args).catch(() => { });
|
|
670
|
+
this.connectToDeltaStream(args);
|
|
673
671
|
}
|
|
674
672
|
/**
|
|
675
673
|
* Raise non-critical error to host. Calling this API will not close container.
|
|
@@ -796,13 +794,13 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
796
794
|
this.connectionTransitionTimes[ConnectionState.Disconnected] = performance.now();
|
|
797
795
|
}
|
|
798
796
|
}
|
|
799
|
-
|
|
797
|
+
connectToDeltaStream(args) {
|
|
800
798
|
this.recordConnectStartTime();
|
|
801
799
|
// All agents need "write" access, including summarizer.
|
|
802
800
|
if (!this._canReconnect || !this.client.details.capabilities.interactive) {
|
|
803
801
|
args.mode = "write";
|
|
804
802
|
}
|
|
805
|
-
|
|
803
|
+
this._deltaManager.connect(args);
|
|
806
804
|
}
|
|
807
805
|
/**
|
|
808
806
|
* Load container.
|
|
@@ -816,7 +814,6 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
816
814
|
throw new Error("Attempting to load without a resolved url");
|
|
817
815
|
}
|
|
818
816
|
this.service = await this.serviceFactory.createDocumentService(this._resolvedUrl, this.subLogger);
|
|
819
|
-
let startConnectionP;
|
|
820
817
|
// Ideally we always connect as "read" by default.
|
|
821
818
|
// Currently that works with SPO & r11s, because we get "write" connection when connecting to non-existing file.
|
|
822
819
|
// We should not rely on it by (one of them will address the issue, but we need to address both)
|
|
@@ -830,8 +827,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
830
827
|
// Start websocket connection as soon as possible. Note that there is no op handler attached yet, but the
|
|
831
828
|
// DeltaManager is resilient to this and will wait to start processing ops until after it is attached.
|
|
832
829
|
if (loadMode.deltaConnection === undefined) {
|
|
833
|
-
|
|
834
|
-
startConnectionP.catch((error) => { });
|
|
830
|
+
this.connectToDeltaStream(connectionArgs);
|
|
835
831
|
}
|
|
836
832
|
await this.connectStorageService();
|
|
837
833
|
this._attachState = AttachState.Attached;
|
|
@@ -1096,10 +1092,11 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1096
1092
|
*/
|
|
1097
1093
|
activeConnection() {
|
|
1098
1094
|
return this.connectionState === ConnectionState.Connected &&
|
|
1099
|
-
this.
|
|
1095
|
+
this.connectionMode === "write";
|
|
1100
1096
|
}
|
|
1101
1097
|
createDeltaManager() {
|
|
1102
|
-
const
|
|
1098
|
+
const serviceProvider = () => this.service;
|
|
1099
|
+
const deltaManager = new DeltaManager(serviceProvider, ChildLogger.create(this.subLogger, "DeltaManager"), () => this.activeConnection(), (props) => new ConnectionManager(serviceProvider, this.client, this._canReconnect, ChildLogger.create(this.subLogger, "ConnectionManager"), props));
|
|
1103
1100
|
// Disable inbound queues as Container is not ready to accept any ops until we are fully loaded!
|
|
1104
1101
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1105
1102
|
deltaManager.inbound.pause();
|
|
@@ -1107,12 +1104,12 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1107
1104
|
deltaManager.inboundSignal.pause();
|
|
1108
1105
|
deltaManager.on("connect", (details, opsBehind) => {
|
|
1109
1106
|
var _a;
|
|
1110
|
-
this.connectionStateHandler.receivedConnectEvent(this._deltaManager.connectionMode, details);
|
|
1111
1107
|
// Back-compat for new client and old server.
|
|
1112
1108
|
this._audience.clear();
|
|
1113
1109
|
for (const priorClient of (_a = details.initialClients) !== null && _a !== void 0 ? _a : []) {
|
|
1114
1110
|
this._audience.addMember(priorClient.clientId, priorClient.client);
|
|
1115
1111
|
}
|
|
1112
|
+
this.connectionStateHandler.receivedConnectEvent(this.connectionMode, details);
|
|
1116
1113
|
});
|
|
1117
1114
|
deltaManager.on("disconnect", (reason) => {
|
|
1118
1115
|
this.manualReconnectInProgress = false;
|
|
@@ -1150,7 +1147,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1150
1147
|
let checkpointSequenceNumber;
|
|
1151
1148
|
let opsBehind;
|
|
1152
1149
|
if (value === ConnectionState.Disconnected) {
|
|
1153
|
-
autoReconnect = this._deltaManager.reconnectMode;
|
|
1150
|
+
autoReconnect = this._deltaManager.connectionManager.reconnectMode;
|
|
1154
1151
|
}
|
|
1155
1152
|
else {
|
|
1156
1153
|
if (value === ConnectionState.Connected) {
|
|
@@ -1177,8 +1174,8 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1177
1174
|
this.logger.sendPerformanceEvent(Object.assign({ eventName: `ConnectionStateChange_${ConnectionState[value]}`, from: ConnectionState[oldState], duration,
|
|
1178
1175
|
durationFromDisconnected,
|
|
1179
1176
|
reason,
|
|
1180
|
-
connectionInitiationReason,
|
|
1181
|
-
opsBehind, online: OnlineStatus[isOnline()], lastVisible: this.lastVisible !== undefined ? performance.now() - this.lastVisible : undefined, checkpointSequenceNumber }, this._deltaManager.connectionProps
|
|
1177
|
+
connectionInitiationReason, pendingClientId: this.connectionStateHandler.pendingClientId, clientId: this.clientId, autoReconnect,
|
|
1178
|
+
opsBehind, online: OnlineStatus[isOnline()], lastVisible: this.lastVisible !== undefined ? performance.now() - this.lastVisible : undefined, checkpointSequenceNumber }, this._deltaManager.connectionProps));
|
|
1182
1179
|
if (value === ConnectionState.Connected) {
|
|
1183
1180
|
this.firstConnection = false;
|
|
1184
1181
|
this.manualReconnectInProgress = false;
|
|
@@ -1187,7 +1184,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1187
1184
|
propagateConnectionState() {
|
|
1188
1185
|
const logOpsOnReconnect = this.connectionState === ConnectionState.Connected &&
|
|
1189
1186
|
!this.firstConnection &&
|
|
1190
|
-
this.
|
|
1187
|
+
this.connectionMode === "write";
|
|
1191
1188
|
if (logOpsOnReconnect) {
|
|
1192
1189
|
this.messageCountAfterDisconnection = 0;
|
|
1193
1190
|
}
|