@fluidframework/datastore 0.57.0 → 0.58.0-55983
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/channelDeltaConnection.d.ts.map +1 -1
- package/dist/channelDeltaConnection.js +1 -1
- package/dist/channelDeltaConnection.js.map +1 -1
- package/dist/dataStoreRuntime.js +1 -1
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/localChannelContext.d.ts.map +1 -1
- package/dist/localChannelContext.js +1 -1
- package/dist/localChannelContext.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/channelDeltaConnection.d.ts.map +1 -1
- package/lib/channelDeltaConnection.js +2 -2
- package/lib/channelDeltaConnection.js.map +1 -1
- package/lib/dataStoreRuntime.js +2 -2
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/localChannelContext.d.ts.map +1 -1
- package/lib/localChannelContext.js +2 -2
- package/lib/localChannelContext.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 +15 -15
- package/src/channelDeltaConnection.ts +3 -2
- package/src/dataStoreRuntime.ts +2 -2
- package/src/localChannelContext.ts +3 -2
- package/src/packageVersion.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelDeltaConnection.d.ts","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,qBAAa,sBAAuB,Y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AE,MAAM,IAAI;aACjB,wBAAwB,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,KAAK,IAAI;IAf7G,OAAO,CAAC,QAAQ,CAA4B;IAE5C,OAAO,KAAK,OAAO,GAGlB;IACD,IAAW,SAAS,IAAI,OAAO,CAE9B;gBAGU,QAAQ,EAAE,MAAM,EACf,UAAU,EAAE,OAAO,EACX,MAAM,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI,EACrE,KAAK,EAAE,MAAM,IAAI,EACjB,wBAAwB,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,KAAK,IAAI;IAGtG,MAAM,CAAC,OAAO,EAAE,aAAa;IAK7B,kBAAkB,CAAC,SAAS,EAAE,OAAO;IAKrC,OAAO,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO;IAUpF,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAI/C,cAAc,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO;CAGrE"}
|
|
@@ -36,7 +36,7 @@ class ChannelDeltaConnection {
|
|
|
36
36
|
this.handler.process(message, local, localOpMetadata);
|
|
37
37
|
}
|
|
38
38
|
catch (error) {
|
|
39
|
-
throw container_utils_1.
|
|
39
|
+
throw container_utils_1.DataProcessingError.wrapIfUnrecognized(error, "channelDeltaConnectionFailedToProcessMessage", message);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
reSubmit(content, localOpMetadata) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelDeltaConnection.js","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AAGtD,
|
|
1
|
+
{"version":3,"file":"channelDeltaConnection.js","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"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,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACpD,CAAC;IAEM,cAAc,CAAC,OAAkC;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;CACJ;AA9CD,wDA8CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IDocumentMessage, ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IDeltaConnection, IDeltaHandler } from \"@fluidframework/datastore-definitions\";\nimport { DataProcessingError } from \"@fluidframework/container-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\n\nexport class ChannelDeltaConnection implements IDeltaConnection {\n private _handler: IDeltaHandler | undefined;\n\n private get handler(): IDeltaHandler {\n assert(!!this._handler, 0x177 /* \"Missing delta handler\" */);\n return this._handler;\n }\n public get connected(): boolean {\n return this._connected;\n }\n\n constructor(\n public objectId: string,\n private _connected: boolean,\n public readonly submit: (message: IDocumentMessage, localOpMetadata: unknown) => void,\n public readonly dirty: () => void,\n public readonly addedGCOutboundReference: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void) {\n }\n\n public attach(handler: IDeltaHandler) {\n assert(this._handler === undefined, 0x178 /* \"Missing delta handler on attach\" */);\n this._handler = handler;\n }\n\n public setConnectionState(connected: boolean) {\n this._connected = connected;\n this.handler.setConnectionState(connected);\n }\n\n public process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n try {\n // catches as data processing error whether or not they come from async pending queues\n this.handler.process(message, local, localOpMetadata);\n } catch (error) {\n throw DataProcessingError.wrapIfUnrecognized(\n error, \"channelDeltaConnectionFailedToProcessMessage\", message);\n }\n }\n\n public reSubmit(content: any, localOpMetadata: unknown) {\n this.handler.reSubmit(content, localOpMetadata);\n }\n\n public applyStashedOp(message: ISequencedDocumentMessage): unknown {\n return this.handler.applyStashedOp(message);\n }\n}\n"]}
|
package/dist/dataStoreRuntime.js
CHANGED
|
@@ -331,7 +331,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
331
331
|
this.emit("op", message);
|
|
332
332
|
}
|
|
333
333
|
catch (error) {
|
|
334
|
-
throw container_utils_1.
|
|
334
|
+
throw container_utils_1.DataProcessingError.wrapIfUnrecognized(error, "fluidDataStoreRuntimeFailedToProcessMessage", message);
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
processSignal(message, local) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRuntime.js","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,iFAM+C;AAC/C,qEAAwE;AACxE,+DAMsC;AACtC,qEAGyC;AACzC,+DAAiE;AACjE,+EAQ8C;AAC9C,6EAU6C;AAC7C,iEASuC;AAOvC,yEAI2C;AAC3C,+BAAkC;AAClC,qDAAqE;AACrE,+DAAoH;AACpH,iEAA8D;AAE9D,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC5B,wBAAwB;IACxB,yCAAiB,CAAA;IACjB,wCAAgB,CAAA;AACpB,CAAC,EAJW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAI/B;AAQD;;GAEG;AACH,MAAa,qBAAsB,SACnC,gCAA+C;IAiF3C,YACqB,gBAAwC,EACxC,oBAA2C,EAC5D,QAAiB;QAEjB,KAAK,EAAE,CAAC;QAJS,qBAAgB,GAAhB,gBAAgB,CAAwB;QACxC,yBAAoB,GAApB,oBAAoB,CAAuB;QA/BxD,cAAS,GAAG,KAAK,CAAC;QAGT,aAAQ,GAAG,IAAI,GAAG,EAA2B,CAAC;QAC9C,qBAAgB,GAAG,IAAI,GAAG,EAAqC,CAAC;QAChE,kBAAa,GAAG,IAAI,GAAG,EAA0B,CAAC;QAGnE,iHAAiH;QACjH,uFAAuF;QACvF,0DAA0D;QAClD,qBAA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;QACD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,GAAG,IAAW;QAC1B,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,OAAO,KAAK,SAAS,EAAE;YACvB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;SACxD;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CAC4B,CAAC;AAnCzB,QAAA,mBAAmB,uBAmCM","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n IFluidHandle,\n IFluidHandleContext,\n IRequest,\n IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport {\n IAudience,\n IDeltaManager,\n BindState,\n AttachState,\n ILoaderOptions,\n} from \"@fluidframework/container-definitions\";\nimport { CreateProcessingError } from \"@fluidframework/container-utils\";\nimport {\n assert,\n Deferred,\n LazyPromise,\n TypedEventEmitter,\n unreachableCase,\n} from \"@fluidframework/common-utils\";\nimport {\n ChildLogger,\n raiseConnectedEvent,\n} from \"@fluidframework/telemetry-utils\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport {\n IClientDetails,\n IDocumentMessage,\n ISequencedDocumentMessage,\n SummaryType,\n ISummaryBlob,\n ISummaryTree,\n IQuorumClients,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n CreateSummarizerNodeSource,\n IAttachMessage,\n IEnvelope,\n IFluidDataStoreContext,\n IFluidDataStoreChannel,\n IGarbageCollectionData,\n IGarbageCollectionDetailsBase,\n IInboundSignalMessage,\n ISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n convertSnapshotTreeToSummaryTree,\n convertSummaryTreeToITree,\n generateHandleContextPath,\n RequestParser,\n SummaryTreeBuilder,\n create404Response,\n createResponseError,\n exceptionToResponse,\n} from \"@fluidframework/runtime-utils\";\nimport {\n IChannel,\n IFluidDataStoreRuntime,\n IFluidDataStoreRuntimeEvents,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n GCDataBuilder,\n unpackChildNodesGCDetails,\n unpackChildNodesUsedRoutes,\n} from \"@fluidframework/garbage-collector\";\nimport { v4 as uuid } from \"uuid\";\nimport { IChannelContext, summarizeChannel } from \"./channelContext\";\nimport { LocalChannelContext, LocalChannelContextBase, RehydratedLocalChannelContext } from \"./localChannelContext\";\nimport { RemoteChannelContext } from \"./remoteChannelContext\";\n\nexport enum DataStoreMessageType {\n // Creates a new channel\n Attach = \"attach\",\n ChannelOp = \"op\",\n}\n\nexport interface ISharedObjectRegistry {\n // TODO consider making this async. A consequence is that either the creation of a distributed data type\n // is async or we need a new API to split the synchronous vs. asynchronous creation.\n get(name: string): IChannelFactory | undefined;\n}\n\n/**\n * Base data store class\n */\nexport class FluidDataStoreRuntime extends\nTypedEventEmitter<IFluidDataStoreRuntimeEvents> implements\nIFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {\n /**\n * Loads the data store runtime\n * @param context - The data store context\n * @param sharedObjectRegistry - The registry of shared objects used by this data store\n * @param existing - If loading from an existing file.\n */\n public static load(\n context: IFluidDataStoreContext,\n sharedObjectRegistry: ISharedObjectRegistry,\n existing: boolean,\n ): FluidDataStoreRuntime {\n return new FluidDataStoreRuntime(context, sharedObjectRegistry, existing);\n }\n\n public get IFluidRouter() { return this; }\n\n public get connected(): boolean {\n return this.dataStoreContext.connected;\n }\n\n public get clientId(): string | undefined {\n return this.dataStoreContext.clientId;\n }\n\n public get clientDetails(): IClientDetails {\n return this.dataStoreContext.clientDetails;\n }\n\n public get isAttached(): boolean {\n return this.attachState !== AttachState.Detached;\n }\n\n public get attachState(): AttachState {\n return this._attachState;\n }\n\n public get absolutePath(): string {\n return generateHandleContextPath(this.id, this.routeContext);\n }\n\n public get routeContext(): IFluidHandleContext {\n return this.dataStoreContext.IFluidHandleContext;\n }\n\n public get IFluidHandleContext() { return this; }\n\n public get rootRoutingContext() { return this; }\n public get channelsRoutingContext() { return this; }\n public get objectsRoutingContext() { return this; }\n\n private _disposed = false;\n public get disposed() { return this._disposed; }\n\n private readonly contexts = new Map<string, IChannelContext>();\n private readonly contextsDeferred = new Map<string, Deferred<IChannelContext>>();\n private readonly pendingAttach = new Map<string, IAttachMessage>();\n\n private bindState: BindState;\n // For new data stores, this is used to break the recursion while attaching the graph. The graph must be attached\n // before the data store can move to Attached state (see _attachState) and become live.\n // For existing data stores, the graph is always attached.\n private graphAttachState: AttachState = AttachState.Detached;\n private readonly deferredAttached = new Deferred<void>();\n private readonly localChannelContextQueue = new Map<string, LocalChannelContextBase>();\n private readonly notBoundedChannelContextSet = new Set<string>();\n private boundhandles: Set<IFluidHandle> | undefined;\n private _attachState: AttachState;\n\n public readonly id: string;\n public readonly options: ILoaderOptions;\n public readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n private readonly quorum: IQuorumClients;\n private readonly audience: IAudience;\n public readonly logger: ITelemetryLogger;\n\n // A map of child channel context ids to the their base GC details. This is used to initialize the GC state of the\n // channel contexts.\n private readonly channelsBaseGCDetails: LazyPromise<Map<string, IGarbageCollectionDetailsBase>>;\n\n public constructor(\n private readonly dataStoreContext: IFluidDataStoreContext,\n private readonly sharedObjectRegistry: ISharedObjectRegistry,\n existing: boolean,\n ) {\n super();\n\n this.logger = ChildLogger.create(\n dataStoreContext.logger,\n \"FluidDataStoreRuntime\",\n {all:{ dataStoreId: uuid() }},\n );\n\n this.id = dataStoreContext.id;\n this.options = dataStoreContext.options;\n this.deltaManager = dataStoreContext.deltaManager;\n this.quorum = dataStoreContext.getQuorum();\n this.audience = dataStoreContext.getAudience();\n\n const tree = dataStoreContext.baseSnapshot;\n\n this.channelsBaseGCDetails = new LazyPromise(async () => {\n const baseGCDetails = await\n (this.dataStoreContext.getBaseGCDetails?.() ?? this.dataStoreContext.getInitialGCSummaryDetails());\n return unpackChildNodesGCDetails(baseGCDetails);\n });\n\n // Must always receive the data store type inside of the attributes\n if (tree?.trees !== undefined) {\n Object.keys(tree.trees).forEach((path) => {\n // Issue #4414\n if (path === \"_search\") { return; }\n\n let channelContext: IChannelContext;\n // If already exists on storage, then create a remote channel. However, if it is case of rehydrating a\n // container from snapshot where we load detached container from a snapshot, isLocalDataStore would be\n // true. In this case create a RehydratedLocalChannelContext.\n if (dataStoreContext.isLocalDataStore) {\n channelContext = new RehydratedLocalChannelContext(\n path,\n this.sharedObjectRegistry,\n this,\n this.dataStoreContext,\n this.dataStoreContext.storage,\n this.logger,\n (content, localOpMetadata) => this.submitChannelOp(path, content, localOpMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle),\n tree.trees[path]);\n // This is the case of rehydrating a detached container from snapshot. Now due to delay loading of\n // data store, if the data store is loaded after the container is attached, then we missed marking\n // the channel as attached. So mark it now. Otherwise add it to local channel context queue, so\n // that it can be mark attached later with the data store.\n if (dataStoreContext.attachState !== AttachState.Detached) {\n (channelContext as LocalChannelContextBase).markAttached();\n } else {\n this.localChannelContextQueue.set(path, channelContext as LocalChannelContextBase);\n }\n } else {\n channelContext = new RemoteChannelContext(\n this,\n dataStoreContext,\n dataStoreContext.storage,\n (content, localOpMetadata) => this.submitChannelOp(path, content, localOpMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle),\n path,\n tree.trees[path],\n this.sharedObjectRegistry,\n undefined /* extraBlobs */,\n this.dataStoreContext.getCreateChildSummarizerNodeFn(\n path,\n { type: CreateSummarizerNodeSource.FromSummary },\n ),\n async () => this.getChannelBaseGCDetails(path));\n }\n const deferred = new Deferred<IChannelContext>();\n deferred.resolve(channelContext);\n\n this.contexts.set(path, channelContext);\n this.contextsDeferred.set(path, deferred);\n });\n }\n\n this.attachListener();\n // If exists on storage or loaded from a snapshot, it should already be binded.\n this.bindState = existing ? BindState.Bound : BindState.NotBound;\n this._attachState = dataStoreContext.attachState;\n\n // If it's existing we know it has been attached.\n if (existing) {\n this.deferredAttached.resolve();\n }\n }\n\n public dispose(): void {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n\n this.emit(\"dispose\");\n this.removeAllListeners();\n }\n\n public async resolveHandle(request: IRequest): Promise<IResponse> {\n return this.request(request);\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n try {\n const parser = RequestParser.create(request);\n const id = parser.pathParts[0];\n\n if (id === \"_channels\" || id === \"_custom\") {\n return this.request(parser.createSubRequest(1));\n }\n\n // Check for a data type reference first\n if (this.contextsDeferred.has(id) && parser.isLeaf(1)) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const value = await this.contextsDeferred.get(id)!.promise;\n const channel = await value.getChannel();\n\n return { mimeType: \"fluid/object\", status: 200, value: channel };\n } catch (error) {\n this.logger.sendErrorEvent({ eventName: \"GetChannelFailedInRequest\" }, error);\n\n return createResponseError(500, `Failed to get Channel: ${error}`, request);\n }\n }\n\n // Otherwise defer to an attached request handler\n return create404Response(request);\n } catch (error) {\n return exceptionToResponse(error);\n }\n }\n\n public async getChannel(id: string): Promise<IChannel> {\n this.verifyNotClosed();\n\n // TODO we don't assume any channels (even root) in the runtime. If you request a channel that doesn't exist\n // we will never resolve the promise. May want a flag to getChannel that doesn't wait for the promise if\n // it doesn't exist\n if (!this.contextsDeferred.has(id)) {\n this.contextsDeferred.set(id, new Deferred<IChannelContext>());\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const context = await this.contextsDeferred.get(id)!.promise;\n const channel = await context.getChannel();\n\n return channel;\n }\n\n public createChannel(id: string = uuid(), type: string): IChannel {\n this.verifyNotClosed();\n\n assert(!this.contexts.has(id), 0x179 /* \"createChannel() with existing ID\" */);\n this.notBoundedChannelContextSet.add(id);\n const context = new LocalChannelContext(\n id,\n this.sharedObjectRegistry,\n type,\n this,\n this.dataStoreContext,\n this.dataStoreContext.storage,\n this.logger,\n (content, localOpMetadata) => this.submitChannelOp(id, content, localOpMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle));\n this.contexts.set(id, context);\n\n if (this.contextsDeferred.has(id)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.contextsDeferred.get(id)!.resolve(context);\n } else {\n const deferred = new Deferred<IChannelContext>();\n deferred.resolve(context);\n this.contextsDeferred.set(id, deferred);\n }\n\n assert(!!context.channel, 0x17a /* \"Channel should be loaded when created!!\" */);\n return context.channel;\n }\n\n /**\n * Binds a channel with the runtime. If the runtime is attached we will attach the channel right away.\n * If the runtime is not attached we will defer the attach until the runtime attaches.\n * @param channel - channel to be registered.\n */\n public bindChannel(channel: IChannel): void {\n assert(this.notBoundedChannelContextSet.has(channel.id),\n 0x17b /* \"Channel to be binded should be in not bounded set\" */);\n this.notBoundedChannelContextSet.delete(channel.id);\n // If our data store is attached, then attach the channel.\n if (this.isAttached) {\n this.attachChannel(channel);\n return;\n } else {\n this.bind(channel.handle);\n\n // If our data store is local then add the channel to the queue\n if (!this.localChannelContextQueue.has(channel.id)) {\n this.localChannelContextQueue.set(channel.id, this.contexts.get(channel.id) as LocalChannelContextBase);\n }\n }\n }\n\n public attachGraph() {\n if (this.graphAttachState !== AttachState.Detached) {\n return;\n }\n this.graphAttachState = AttachState.Attaching;\n if (this.boundhandles !== undefined) {\n this.boundhandles.forEach((handle) => {\n handle.attachGraph();\n });\n this.boundhandles = undefined;\n }\n\n // Flush the queue to set any pre-existing channels to local\n this.localChannelContextQueue.forEach((channel) => {\n // When we are attaching the data store we don't need to send attach for the registered services.\n // This is because they will be captured as part of the Attach data store snapshot\n channel.markAttached();\n });\n\n this.localChannelContextQueue.clear();\n this.bindToContext();\n this.graphAttachState = AttachState.Attached;\n }\n\n /**\n * Binds this runtime to the container\n * This includes the following:\n * 1. Sending an Attach op that includes all existing state\n * 2. Attaching the graph if the data store becomes attached.\n */\n public bindToContext() {\n if (this.bindState !== BindState.NotBound) {\n return;\n }\n this.bindState = BindState.Binding;\n this.dataStoreContext.bindToContext();\n this.bindState = BindState.Bound;\n }\n\n public bind(handle: IFluidHandle): void {\n // If the data store is already attached or its graph is already in attaching or attached state,\n // then attach the incoming handle too.\n if (this.isAttached || this.graphAttachState !== AttachState.Detached) {\n handle.attachGraph();\n return;\n }\n if (this.boundhandles === undefined) {\n this.boundhandles = new Set<IFluidHandle>();\n }\n\n this.boundhandles.add(handle);\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n this.verifyNotClosed();\n\n for (const [, object] of this.contexts) {\n object.setConnectionState(connected, clientId);\n }\n\n raiseConnectedEvent(this.logger, this, connected, clientId);\n }\n\n public getQuorum(): IQuorumClients {\n return this.quorum;\n }\n\n public getAudience(): IAudience {\n return this.audience;\n }\n\n public async uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n this.verifyNotClosed();\n\n return this.dataStoreContext.uploadBlob(blob);\n }\n\n public process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n this.verifyNotClosed();\n\n try {\n // catches as data processing error whether or not they come from async pending queues\n switch (message.type) {\n case DataStoreMessageType.Attach: {\n const attachMessage = message.contents as IAttachMessage;\n const id = attachMessage.id;\n\n // If a non-local operation then go and create the object\n // Otherwise mark it as officially attached.\n if (local) {\n assert(this.pendingAttach.has(id), 0x17c /* \"Unexpected attach (local) channel OP\" */);\n this.pendingAttach.delete(id);\n } else {\n assert(!this.contexts.has(id),\n 0x17d, /* `Unexpected attach channel OP,\n is in pendingAttach set: ${this.pendingAttach.has(id)},\n is local channel contexts: ${this.contexts.get(id) instanceof LocalChannelContextBase}` */);\n\n const flatBlobs = new Map<string, ArrayBufferLike>();\n const snapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatBlobs);\n\n const remoteChannelContext = new RemoteChannelContext(\n this,\n this.dataStoreContext,\n this.dataStoreContext.storage,\n (content, localContentMetadata) => this.submitChannelOp(id, content, localContentMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle),\n id,\n snapshotTree,\n this.sharedObjectRegistry,\n flatBlobs,\n this.dataStoreContext.getCreateChildSummarizerNodeFn(\n id,\n {\n type: CreateSummarizerNodeSource.FromAttach,\n sequenceNumber: message.sequenceNumber,\n snapshot: attachMessage.snapshot,\n },\n ),\n async () => this.getChannelBaseGCDetails(id),\n attachMessage.type);\n\n this.contexts.set(id, remoteChannelContext);\n if (this.contextsDeferred.has(id)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.contextsDeferred.get(id)!.resolve(remoteChannelContext);\n } else {\n const deferred = new Deferred<IChannelContext>();\n deferred.resolve(remoteChannelContext);\n this.contextsDeferred.set(id, deferred);\n }\n }\n break;\n }\n\n case DataStoreMessageType.ChannelOp:\n this.processChannelOp(message, local, localOpMetadata);\n break;\n default:\n }\n\n this.emit(\"op\", message);\n } catch (error) {\n throw CreateProcessingError(error, \"fluidDataStoreRuntimeFailedToProcessMessage\", message);\n }\n }\n\n public processSignal(message: IInboundSignalMessage, local: boolean) {\n this.emit(\"signal\", message, local);\n }\n\n private isChannelAttached(id: string): boolean {\n return (\n // Added in createChannel\n // Removed when bindChannel is called\n !this.notBoundedChannelContextSet.has(id)\n // Added in bindChannel only if this is not attached yet\n // Removed when this is attached by calling attachGraph\n && !this.localChannelContextQueue.has(id)\n // Added in attachChannel called by bindChannel\n // Removed when attach op is broadcast\n && !this.pendingAttach.has(id)\n );\n }\n\n /**\n * Returns the outbound routes of this channel. Currently, all contexts in this channel are considered\n * referenced and are hence outbound. This will change when we have root and non-root channel contexts.\n * The only root contexts will be considered as referenced.\n */\n private getOutboundRoutes(): string[] {\n const outboundRoutes: string[] = [];\n for (const [contextId] of this.contexts) {\n outboundRoutes.push(`${this.absolutePath}/${contextId}`);\n }\n return outboundRoutes;\n }\n\n /**\n * Updates the GC nodes of this channel. It does the following:\n * - Adds a back route to self to all its child GC nodes.\n * - Adds a node for this channel.\n * @param builder - The builder that contains the GC nodes for this channel's children.\n */\n private updateGCNodes(builder: GCDataBuilder) {\n // Add a back route to self in each child's GC nodes. If any child is referenced, then its parent should\n // be considered referenced as well.\n builder.addRouteToAllNodes(this.absolutePath);\n\n // Get the outbound routes and add a GC node for this channel.\n builder.addNode(\"/\", this.getOutboundRoutes());\n }\n\n /**\n * Generates data used for garbage collection. This includes a list of GC nodes that represent this channel\n * including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the\n * document. It does the following:\n * 1. Calls into each child context to get its GC data.\n * 2. Prefixs the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be\n * idenfied as belonging to the child.\n * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent\n * the GC data of this channel.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n const builder = new GCDataBuilder();\n // Iterate over each channel context and get their GC data.\n await Promise.all(Array.from(this.contexts)\n .filter(([contextId, _]) => {\n // Get GC data only for attached contexts. Detached contexts are not connected in the GC reference\n // graph so any references they might have won't be connected as well.\n return this.isChannelAttached(contextId);\n }).map(async ([contextId, context]) => {\n const contextGCData = await context.getGCData(fullGC);\n // Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.\n // This also gradually builds the id of each node to be a path from the root.\n builder.prefixAndAddNodes(contextId, contextGCData.gcNodes);\n }));\n\n this.updateGCNodes(builder);\n return builder.getGCData();\n }\n\n /**\n * After GC has run, called to notify this channel of routes that are used in it. It calls the child contexts to\n * update their used routes.\n * @param usedRoutes - The routes that are used in all contexts in this channel.\n * @param gcTimestamp - The time when GC was run that generated these used routes. If any node becomes unreferenced\n * as part of this GC run, this should be used to update the time when it happens.\n */\n public updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number) {\n // Get a map of channel ids to routes used in it.\n const usedContextRoutes = unpackChildNodesUsedRoutes(usedRoutes);\n\n // Verify that the used routes are correct.\n for (const [id] of usedContextRoutes) {\n assert(this.contexts.has(id), 0x17e /* \"Used route does not belong to any known context\" */);\n }\n\n // Update the used routes in each context. Used routes is empty for unused context.\n for (const [contextId, context] of this.contexts) {\n context.updateUsedRoutes(usedContextRoutes.get(contextId) ?? [], gcTimestamp);\n }\n }\n\n /**\n * Called when a new outbound reference is added to another node. This is used by garbage collection to identify\n * all references added in the system.\n * @param srcHandle - The handle of the node that added the reference.\n * @param outboundHandle - The handle of the outbound node that is referenced.\n */\n private addedGCOutboundReference(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) {\n this.dataStoreContext.addedGCOutboundReference?.(srcHandle, outboundHandle);\n }\n\n /**\n * Returns the base GC details for the channel with the given id. This is used to initialize its GC state.\n * @param channelId - The id of the channel context that is asked for the initial GC details.\n * @returns the requested channel's base GC details.\n */\n private async getChannelBaseGCDetails(channelId: string): Promise<IGarbageCollectionDetailsBase> {\n let channelBaseGCDetails = (await this.channelsBaseGCDetails).get(channelId);\n if (channelBaseGCDetails === undefined) {\n channelBaseGCDetails = {};\n }\n\n // Currently, channel context's are always considered used. So, it there are no used routes for it, we still\n // need to mark it as used. Add self-route (empty string) to the channel context's used routes.\n if (channelBaseGCDetails.usedRoutes === undefined || channelBaseGCDetails.usedRoutes.length === 0) {\n channelBaseGCDetails.usedRoutes = [\"\"];\n }\n return channelBaseGCDetails;\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n */\n public async summarize(fullTree: boolean = false, trackState: boolean = true): Promise<ISummaryTreeWithStats> {\n const summaryBuilder = new SummaryTreeBuilder();\n\n // Iterate over each data store and ask it to summarize\n await Promise.all(Array.from(this.contexts)\n .filter(([contextId, _]) => {\n const isAttached = this.isChannelAttached(contextId);\n // We are not expecting local dds! Summary may not capture local state.\n assert(isAttached, 0x17f /* \"Not expecting detached channels during summarize\" */);\n // If the object is registered - and we have received the sequenced op creating the object\n // (i.e. it has a base mapping) - then we go ahead and summarize\n return isAttached;\n }).map(async ([contextId, context]) => {\n // If BlobAggregationStorage is engaged, we have to write full summary for data stores\n // BlobAggregationStorage relies on this behavior, as it aggregates blobs across DDSs.\n // Not generating full summary will mean data loss, as we will overwrite aggregate blob in new summary,\n // and any virtual blobs that stayed (for unchanged DDSs) will need aggregate blob in previous summary\n // that is no longer present in this summary.\n // This is temporal limitation that can be lifted in future once BlobAggregationStorage becomes smarter.\n const contextSummary = await context.summarize(true /* fullTree */, trackState);\n summaryBuilder.addWithStats(contextId, contextSummary);\n }));\n\n return summaryBuilder.getSummaryTree();\n }\n\n public getAttachSummary(): ISummaryTreeWithStats {\n this.attachGraph();\n\n const summaryBuilder = new SummaryTreeBuilder();\n\n // Craft the .attributes file for each shared object\n for (const [contextId, context] of this.contexts) {\n if (!(context instanceof LocalChannelContextBase)) {\n throw new Error(\"Should only be called with local channel handles\");\n }\n\n if (!this.notBoundedChannelContextSet.has(contextId)) {\n let summaryTree: ISummaryTreeWithStats;\n if (context.isLoaded) {\n const contextSummary = context.getAttachSummary();\n assert(\n contextSummary.summary.type === SummaryType.Tree,\n 0x180 /* \"getAttachSummary should always return a tree\" */);\n summaryTree = { stats: contextSummary.stats, summary: contextSummary.summary };\n } else {\n // If this channel is not yet loaded, then there should be no changes in the snapshot from which\n // it was created as it is detached container. So just use the previous snapshot.\n assert(!!this.dataStoreContext.baseSnapshot,\n 0x181 /* \"BaseSnapshot should be there as detached container loaded from snapshot\" */);\n summaryTree = convertSnapshotTreeToSummaryTree(this.dataStoreContext.baseSnapshot.trees[contextId]);\n }\n summaryBuilder.addWithStats(contextId, summaryTree);\n }\n }\n\n return summaryBuilder.getSummaryTree();\n }\n\n public submitMessage(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n this.submit(type, content, localOpMetadata);\n }\n\n public submitSignal(type: string, content: any) {\n this.verifyNotClosed();\n return this.dataStoreContext.submitSignal(type, content);\n }\n\n /**\n * Will return when the data store is attached.\n */\n public async waitAttached(): Promise<void> {\n return this.deferredAttached.promise;\n }\n\n /**\n * Attach channel should only be called after the data store has been attached\n */\n private attachChannel(channel: IChannel): void {\n this.verifyNotClosed();\n // If this handle is already attached no need to attach again.\n if (channel.handle.isAttached) {\n return;\n }\n\n channel.handle.attachGraph();\n\n assert(this.isAttached, 0x182 /* \"Data store should be attached to attach the channel.\" */);\n // Get the object snapshot only if the data store is Bound and its graph is attached too,\n // because if the graph is attaching, then it would get included in the data store snapshot.\n if (this.bindState === BindState.Bound && this.graphAttachState === AttachState.Attached) {\n const summarizeResult = summarizeChannel(channel, true /* fullTree */, false /* trackState */);\n // Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.\n const snapshot = convertSummaryTreeToITree(summarizeResult.summary);\n\n const message: IAttachMessage = {\n id: channel.id,\n snapshot,\n type: channel.attributes.type,\n };\n this.pendingAttach.set(channel.id, message);\n this.submit(DataStoreMessageType.Attach, message);\n }\n\n const context = this.contexts.get(channel.id) as LocalChannelContextBase;\n context.markAttached();\n }\n\n private submitChannelOp(address: string, contents: any, localOpMetadata: unknown) {\n const envelope: IEnvelope = { address, contents };\n this.submit(DataStoreMessageType.ChannelOp, envelope, localOpMetadata);\n }\n\n private submit(\n type: DataStoreMessageType,\n content: any,\n localOpMetadata: unknown = undefined): void {\n this.verifyNotClosed();\n this.dataStoreContext.submitMessage(type, content, localOpMetadata);\n }\n\n /**\n * For messages of type MessageType.Operation, finds the right channel and asks it to resubmit the message.\n * For all other messages, just submit it again.\n * This typically happens when we reconnect and there are unacked messages.\n * @param content - The content of the original message.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n public reSubmit(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n this.verifyNotClosed();\n\n switch (type) {\n case DataStoreMessageType.ChannelOp:\n {\n // For Operations, find the right channel and trigger resubmission on it.\n const envelope = content as IEnvelope;\n const channelContext = this.contexts.get(envelope.address);\n assert(!!channelContext, 0x183 /* \"There should be a channel context for the op\" */);\n channelContext.reSubmit(envelope.contents, localOpMetadata);\n break;\n }\n case DataStoreMessageType.Attach:\n // For Attach messages, just submit them again.\n this.submit(type, content, localOpMetadata);\n break;\n default:\n unreachableCase(type);\n }\n }\n\n public async applyStashedOp(content: any): Promise<unknown> {\n const envelope = content as IEnvelope;\n const channelContext = this.contexts.get(envelope.address);\n assert(!!channelContext, 0x184 /* \"There should be a channel context for the op\" */);\n await channelContext.getChannel();\n return channelContext.applyStashedOp(envelope.contents);\n }\n\n private setChannelDirty(address: string): void {\n this.verifyNotClosed();\n this.dataStoreContext.setChannelDirty(address);\n }\n\n private processChannelOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n this.verifyNotClosed();\n\n const envelope = message.contents as IEnvelope;\n\n const transformed: ISequencedDocumentMessage = {\n ...message,\n contents: envelope.contents,\n };\n\n const channelContext = this.contexts.get(envelope.address);\n assert(!!channelContext, 0x185 /* \"Channel not found\" */);\n channelContext.processOp(transformed, local, localOpMetadata);\n\n return channelContext;\n }\n\n private attachListener() {\n this.setMaxListeners(Number.MAX_SAFE_INTEGER);\n this.dataStoreContext.once(\"attaching\", () => {\n assert(this.bindState !== BindState.NotBound,\n 0x186 /* \"Data store attaching should not occur if it is not bound\" */);\n this._attachState = AttachState.Attaching;\n // This promise resolution will be moved to attached event once we fix the scheduler.\n this.deferredAttached.resolve();\n this.emit(\"attaching\");\n });\n this.dataStoreContext.once(\"attached\", () => {\n assert(this.bindState === BindState.Bound,\n 0x187 /* \"Data store should only be attached after it is bound\" */);\n this._attachState = AttachState.Attached;\n this.emit(\"attached\");\n });\n }\n\n private verifyNotClosed() {\n if (this._disposed) {\n throw new Error(\"Runtime is closed\");\n }\n }\n}\n\n/**\n * Mixin class that adds request handler to FluidDataStoreRuntime\n * Request handler is only called when data store can't resolve request, i.e. for custom requests.\n * @param Base - base class, inherits from FluidDataStoreRuntime\n * @param requestHandler - request handler to mix in\n */\nexport const mixinRequestHandler = (\n requestHandler: (request: IRequest, runtime: FluidDataStoreRuntime) => Promise<IResponse>,\n Base: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n) => class RuntimeWithRequestHandler extends Base {\n public async request(request: IRequest) {\n const response = await super.request(request);\n if (response.status === 404) {\n return requestHandler(request, this);\n }\n return response;\n }\n } as typeof FluidDataStoreRuntime;\n\n/**\n * Mixin class that adds await for DataObject to finish initialization before we proceed to summary.\n * @param handler - handler that returns info about blob to be added to summary.\n * Or undefined not to add anything to summary.\n * @param Base - base class, inherits from FluidDataStoreRuntime\n */\nexport const mixinSummaryHandler = (\n handler: (runtime: FluidDataStoreRuntime) => Promise<{ path: string[], content: string } | undefined >,\n Base: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n) => class RuntimeWithSummarizerHandler extends Base {\n private addBlob(summary: ISummaryTreeWithStats, path: string[], content: string) {\n const firstName = path.shift();\n if (firstName === undefined) {\n throw new Error(\"Path can't be empty\");\n }\n\n let blob: ISummaryTree | ISummaryBlob = {\n type: SummaryType.Blob,\n content,\n };\n summary.stats.blobNodeCount++;\n summary.stats.totalBlobSize += content.length;\n\n for (const name of path.reverse()) {\n blob = {\n type: SummaryType.Tree,\n tree: { [name]: blob },\n };\n summary.stats.treeNodeCount++;\n }\n summary.summary.tree[firstName] = blob;\n }\n\n async summarize(...args: any[]) {\n const summary = await super.summarize(...args);\n const content = await handler(this);\n if (content !== undefined) {\n this.addBlob(summary, content.path, content.content);\n }\n return summary;\n }\n } as typeof FluidDataStoreRuntime;\n"]}
|
|
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,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;SACxD;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CAC4B,CAAC;AAnCzB,QAAA,mBAAmB,uBAmCM","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n IFluidHandle,\n IFluidHandleContext,\n IRequest,\n IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport {\n IAudience,\n IDeltaManager,\n BindState,\n AttachState,\n ILoaderOptions,\n} from \"@fluidframework/container-definitions\";\nimport { DataProcessingError } from \"@fluidframework/container-utils\";\nimport {\n assert,\n Deferred,\n LazyPromise,\n TypedEventEmitter,\n unreachableCase,\n} from \"@fluidframework/common-utils\";\nimport {\n ChildLogger,\n raiseConnectedEvent,\n} from \"@fluidframework/telemetry-utils\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport {\n IClientDetails,\n IDocumentMessage,\n ISequencedDocumentMessage,\n SummaryType,\n ISummaryBlob,\n ISummaryTree,\n IQuorumClients,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n CreateSummarizerNodeSource,\n IAttachMessage,\n IEnvelope,\n IFluidDataStoreContext,\n IFluidDataStoreChannel,\n IGarbageCollectionData,\n IGarbageCollectionDetailsBase,\n IInboundSignalMessage,\n ISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n convertSnapshotTreeToSummaryTree,\n convertSummaryTreeToITree,\n generateHandleContextPath,\n RequestParser,\n SummaryTreeBuilder,\n create404Response,\n createResponseError,\n exceptionToResponse,\n} from \"@fluidframework/runtime-utils\";\nimport {\n IChannel,\n IFluidDataStoreRuntime,\n IFluidDataStoreRuntimeEvents,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n GCDataBuilder,\n unpackChildNodesGCDetails,\n unpackChildNodesUsedRoutes,\n} from \"@fluidframework/garbage-collector\";\nimport { v4 as uuid } from \"uuid\";\nimport { IChannelContext, summarizeChannel } from \"./channelContext\";\nimport { LocalChannelContext, LocalChannelContextBase, RehydratedLocalChannelContext } from \"./localChannelContext\";\nimport { RemoteChannelContext } from \"./remoteChannelContext\";\n\nexport enum DataStoreMessageType {\n // Creates a new channel\n Attach = \"attach\",\n ChannelOp = \"op\",\n}\n\nexport interface ISharedObjectRegistry {\n // TODO consider making this async. A consequence is that either the creation of a distributed data type\n // is async or we need a new API to split the synchronous vs. asynchronous creation.\n get(name: string): IChannelFactory | undefined;\n}\n\n/**\n * Base data store class\n */\nexport class FluidDataStoreRuntime extends\nTypedEventEmitter<IFluidDataStoreRuntimeEvents> implements\nIFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {\n /**\n * Loads the data store runtime\n * @param context - The data store context\n * @param sharedObjectRegistry - The registry of shared objects used by this data store\n * @param existing - If loading from an existing file.\n */\n public static load(\n context: IFluidDataStoreContext,\n sharedObjectRegistry: ISharedObjectRegistry,\n existing: boolean,\n ): FluidDataStoreRuntime {\n return new FluidDataStoreRuntime(context, sharedObjectRegistry, existing);\n }\n\n public get IFluidRouter() { return this; }\n\n public get connected(): boolean {\n return this.dataStoreContext.connected;\n }\n\n public get clientId(): string | undefined {\n return this.dataStoreContext.clientId;\n }\n\n public get clientDetails(): IClientDetails {\n return this.dataStoreContext.clientDetails;\n }\n\n public get isAttached(): boolean {\n return this.attachState !== AttachState.Detached;\n }\n\n public get attachState(): AttachState {\n return this._attachState;\n }\n\n public get absolutePath(): string {\n return generateHandleContextPath(this.id, this.routeContext);\n }\n\n public get routeContext(): IFluidHandleContext {\n return this.dataStoreContext.IFluidHandleContext;\n }\n\n public get IFluidHandleContext() { return this; }\n\n public get rootRoutingContext() { return this; }\n public get channelsRoutingContext() { return this; }\n public get objectsRoutingContext() { return this; }\n\n private _disposed = false;\n public get disposed() { return this._disposed; }\n\n private readonly contexts = new Map<string, IChannelContext>();\n private readonly contextsDeferred = new Map<string, Deferred<IChannelContext>>();\n private readonly pendingAttach = new Map<string, IAttachMessage>();\n\n private bindState: BindState;\n // For new data stores, this is used to break the recursion while attaching the graph. The graph must be attached\n // before the data store can move to Attached state (see _attachState) and become live.\n // For existing data stores, the graph is always attached.\n private graphAttachState: AttachState = AttachState.Detached;\n private readonly deferredAttached = new Deferred<void>();\n private readonly localChannelContextQueue = new Map<string, LocalChannelContextBase>();\n private readonly notBoundedChannelContextSet = new Set<string>();\n private boundhandles: Set<IFluidHandle> | undefined;\n private _attachState: AttachState;\n\n public readonly id: string;\n public readonly options: ILoaderOptions;\n public readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n private readonly quorum: IQuorumClients;\n private readonly audience: IAudience;\n public readonly logger: ITelemetryLogger;\n\n // A map of child channel context ids to the their base GC details. This is used to initialize the GC state of the\n // channel contexts.\n private readonly channelsBaseGCDetails: LazyPromise<Map<string, IGarbageCollectionDetailsBase>>;\n\n public constructor(\n private readonly dataStoreContext: IFluidDataStoreContext,\n private readonly sharedObjectRegistry: ISharedObjectRegistry,\n existing: boolean,\n ) {\n super();\n\n this.logger = ChildLogger.create(\n dataStoreContext.logger,\n \"FluidDataStoreRuntime\",\n {all:{ dataStoreId: uuid() }},\n );\n\n this.id = dataStoreContext.id;\n this.options = dataStoreContext.options;\n this.deltaManager = dataStoreContext.deltaManager;\n this.quorum = dataStoreContext.getQuorum();\n this.audience = dataStoreContext.getAudience();\n\n const tree = dataStoreContext.baseSnapshot;\n\n this.channelsBaseGCDetails = new LazyPromise(async () => {\n const baseGCDetails = await\n (this.dataStoreContext.getBaseGCDetails?.() ?? this.dataStoreContext.getInitialGCSummaryDetails());\n return unpackChildNodesGCDetails(baseGCDetails);\n });\n\n // Must always receive the data store type inside of the attributes\n if (tree?.trees !== undefined) {\n Object.keys(tree.trees).forEach((path) => {\n // Issue #4414\n if (path === \"_search\") { return; }\n\n let channelContext: IChannelContext;\n // If already exists on storage, then create a remote channel. However, if it is case of rehydrating a\n // container from snapshot where we load detached container from a snapshot, isLocalDataStore would be\n // true. In this case create a RehydratedLocalChannelContext.\n if (dataStoreContext.isLocalDataStore) {\n channelContext = new RehydratedLocalChannelContext(\n path,\n this.sharedObjectRegistry,\n this,\n this.dataStoreContext,\n this.dataStoreContext.storage,\n this.logger,\n (content, localOpMetadata) => this.submitChannelOp(path, content, localOpMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle),\n tree.trees[path]);\n // This is the case of rehydrating a detached container from snapshot. Now due to delay loading of\n // data store, if the data store is loaded after the container is attached, then we missed marking\n // the channel as attached. So mark it now. Otherwise add it to local channel context queue, so\n // that it can be mark attached later with the data store.\n if (dataStoreContext.attachState !== AttachState.Detached) {\n (channelContext as LocalChannelContextBase).markAttached();\n } else {\n this.localChannelContextQueue.set(path, channelContext as LocalChannelContextBase);\n }\n } else {\n channelContext = new RemoteChannelContext(\n this,\n dataStoreContext,\n dataStoreContext.storage,\n (content, localOpMetadata) => this.submitChannelOp(path, content, localOpMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle),\n path,\n tree.trees[path],\n this.sharedObjectRegistry,\n undefined /* extraBlobs */,\n this.dataStoreContext.getCreateChildSummarizerNodeFn(\n path,\n { type: CreateSummarizerNodeSource.FromSummary },\n ),\n async () => this.getChannelBaseGCDetails(path));\n }\n const deferred = new Deferred<IChannelContext>();\n deferred.resolve(channelContext);\n\n this.contexts.set(path, channelContext);\n this.contextsDeferred.set(path, deferred);\n });\n }\n\n this.attachListener();\n // If exists on storage or loaded from a snapshot, it should already be binded.\n this.bindState = existing ? BindState.Bound : BindState.NotBound;\n this._attachState = dataStoreContext.attachState;\n\n // If it's existing we know it has been attached.\n if (existing) {\n this.deferredAttached.resolve();\n }\n }\n\n public dispose(): void {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n\n this.emit(\"dispose\");\n this.removeAllListeners();\n }\n\n public async resolveHandle(request: IRequest): Promise<IResponse> {\n return this.request(request);\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n try {\n const parser = RequestParser.create(request);\n const id = parser.pathParts[0];\n\n if (id === \"_channels\" || id === \"_custom\") {\n return this.request(parser.createSubRequest(1));\n }\n\n // Check for a data type reference first\n if (this.contextsDeferred.has(id) && parser.isLeaf(1)) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const value = await this.contextsDeferred.get(id)!.promise;\n const channel = await value.getChannel();\n\n return { mimeType: \"fluid/object\", status: 200, value: channel };\n } catch (error) {\n this.logger.sendErrorEvent({ eventName: \"GetChannelFailedInRequest\" }, error);\n\n return createResponseError(500, `Failed to get Channel: ${error}`, request);\n }\n }\n\n // Otherwise defer to an attached request handler\n return create404Response(request);\n } catch (error) {\n return exceptionToResponse(error);\n }\n }\n\n public async getChannel(id: string): Promise<IChannel> {\n this.verifyNotClosed();\n\n // TODO we don't assume any channels (even root) in the runtime. If you request a channel that doesn't exist\n // we will never resolve the promise. May want a flag to getChannel that doesn't wait for the promise if\n // it doesn't exist\n if (!this.contextsDeferred.has(id)) {\n this.contextsDeferred.set(id, new Deferred<IChannelContext>());\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const context = await this.contextsDeferred.get(id)!.promise;\n const channel = await context.getChannel();\n\n return channel;\n }\n\n public createChannel(id: string = uuid(), type: string): IChannel {\n this.verifyNotClosed();\n\n assert(!this.contexts.has(id), 0x179 /* \"createChannel() with existing ID\" */);\n this.notBoundedChannelContextSet.add(id);\n const context = new LocalChannelContext(\n id,\n this.sharedObjectRegistry,\n type,\n this,\n this.dataStoreContext,\n this.dataStoreContext.storage,\n this.logger,\n (content, localOpMetadata) => this.submitChannelOp(id, content, localOpMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle));\n this.contexts.set(id, context);\n\n if (this.contextsDeferred.has(id)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.contextsDeferred.get(id)!.resolve(context);\n } else {\n const deferred = new Deferred<IChannelContext>();\n deferred.resolve(context);\n this.contextsDeferred.set(id, deferred);\n }\n\n assert(!!context.channel, 0x17a /* \"Channel should be loaded when created!!\" */);\n return context.channel;\n }\n\n /**\n * Binds a channel with the runtime. If the runtime is attached we will attach the channel right away.\n * If the runtime is not attached we will defer the attach until the runtime attaches.\n * @param channel - channel to be registered.\n */\n public bindChannel(channel: IChannel): void {\n assert(this.notBoundedChannelContextSet.has(channel.id),\n 0x17b /* \"Channel to be binded should be in not bounded set\" */);\n this.notBoundedChannelContextSet.delete(channel.id);\n // If our data store is attached, then attach the channel.\n if (this.isAttached) {\n this.attachChannel(channel);\n return;\n } else {\n this.bind(channel.handle);\n\n // If our data store is local then add the channel to the queue\n if (!this.localChannelContextQueue.has(channel.id)) {\n this.localChannelContextQueue.set(channel.id, this.contexts.get(channel.id) as LocalChannelContextBase);\n }\n }\n }\n\n public attachGraph() {\n if (this.graphAttachState !== AttachState.Detached) {\n return;\n }\n this.graphAttachState = AttachState.Attaching;\n if (this.boundhandles !== undefined) {\n this.boundhandles.forEach((handle) => {\n handle.attachGraph();\n });\n this.boundhandles = undefined;\n }\n\n // Flush the queue to set any pre-existing channels to local\n this.localChannelContextQueue.forEach((channel) => {\n // When we are attaching the data store we don't need to send attach for the registered services.\n // This is because they will be captured as part of the Attach data store snapshot\n channel.markAttached();\n });\n\n this.localChannelContextQueue.clear();\n this.bindToContext();\n this.graphAttachState = AttachState.Attached;\n }\n\n /**\n * Binds this runtime to the container\n * This includes the following:\n * 1. Sending an Attach op that includes all existing state\n * 2. Attaching the graph if the data store becomes attached.\n */\n public bindToContext() {\n if (this.bindState !== BindState.NotBound) {\n return;\n }\n this.bindState = BindState.Binding;\n this.dataStoreContext.bindToContext();\n this.bindState = BindState.Bound;\n }\n\n public bind(handle: IFluidHandle): void {\n // If the data store is already attached or its graph is already in attaching or attached state,\n // then attach the incoming handle too.\n if (this.isAttached || this.graphAttachState !== AttachState.Detached) {\n handle.attachGraph();\n return;\n }\n if (this.boundhandles === undefined) {\n this.boundhandles = new Set<IFluidHandle>();\n }\n\n this.boundhandles.add(handle);\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n this.verifyNotClosed();\n\n for (const [, object] of this.contexts) {\n object.setConnectionState(connected, clientId);\n }\n\n raiseConnectedEvent(this.logger, this, connected, clientId);\n }\n\n public getQuorum(): IQuorumClients {\n return this.quorum;\n }\n\n public getAudience(): IAudience {\n return this.audience;\n }\n\n public async uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n this.verifyNotClosed();\n\n return this.dataStoreContext.uploadBlob(blob);\n }\n\n public process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n this.verifyNotClosed();\n\n try {\n // catches as data processing error whether or not they come from async pending queues\n switch (message.type) {\n case DataStoreMessageType.Attach: {\n const attachMessage = message.contents as IAttachMessage;\n const id = attachMessage.id;\n\n // If a non-local operation then go and create the object\n // Otherwise mark it as officially attached.\n if (local) {\n assert(this.pendingAttach.has(id), 0x17c /* \"Unexpected attach (local) channel OP\" */);\n this.pendingAttach.delete(id);\n } else {\n assert(!this.contexts.has(id),\n 0x17d, /* `Unexpected attach channel OP,\n is in pendingAttach set: ${this.pendingAttach.has(id)},\n is local channel contexts: ${this.contexts.get(id) instanceof LocalChannelContextBase}` */);\n\n const flatBlobs = new Map<string, ArrayBufferLike>();\n const snapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatBlobs);\n\n const remoteChannelContext = new RemoteChannelContext(\n this,\n this.dataStoreContext,\n this.dataStoreContext.storage,\n (content, localContentMetadata) => this.submitChannelOp(id, content, localContentMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle),\n id,\n snapshotTree,\n this.sharedObjectRegistry,\n flatBlobs,\n this.dataStoreContext.getCreateChildSummarizerNodeFn(\n id,\n {\n type: CreateSummarizerNodeSource.FromAttach,\n sequenceNumber: message.sequenceNumber,\n snapshot: attachMessage.snapshot,\n },\n ),\n async () => this.getChannelBaseGCDetails(id),\n attachMessage.type);\n\n this.contexts.set(id, remoteChannelContext);\n if (this.contextsDeferred.has(id)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.contextsDeferred.get(id)!.resolve(remoteChannelContext);\n } else {\n const deferred = new Deferred<IChannelContext>();\n deferred.resolve(remoteChannelContext);\n this.contextsDeferred.set(id, deferred);\n }\n }\n break;\n }\n\n case DataStoreMessageType.ChannelOp:\n this.processChannelOp(message, local, localOpMetadata);\n break;\n default:\n }\n\n this.emit(\"op\", message);\n } catch (error) {\n throw DataProcessingError.wrapIfUnrecognized(error, \"fluidDataStoreRuntimeFailedToProcessMessage\", message);\n }\n }\n\n public processSignal(message: IInboundSignalMessage, local: boolean) {\n this.emit(\"signal\", message, local);\n }\n\n private isChannelAttached(id: string): boolean {\n return (\n // Added in createChannel\n // Removed when bindChannel is called\n !this.notBoundedChannelContextSet.has(id)\n // Added in bindChannel only if this is not attached yet\n // Removed when this is attached by calling attachGraph\n && !this.localChannelContextQueue.has(id)\n // Added in attachChannel called by bindChannel\n // Removed when attach op is broadcast\n && !this.pendingAttach.has(id)\n );\n }\n\n /**\n * Returns the outbound routes of this channel. Currently, all contexts in this channel are considered\n * referenced and are hence outbound. This will change when we have root and non-root channel contexts.\n * The only root contexts will be considered as referenced.\n */\n private getOutboundRoutes(): string[] {\n const outboundRoutes: string[] = [];\n for (const [contextId] of this.contexts) {\n outboundRoutes.push(`${this.absolutePath}/${contextId}`);\n }\n return outboundRoutes;\n }\n\n /**\n * Updates the GC nodes of this channel. It does the following:\n * - Adds a back route to self to all its child GC nodes.\n * - Adds a node for this channel.\n * @param builder - The builder that contains the GC nodes for this channel's children.\n */\n private updateGCNodes(builder: GCDataBuilder) {\n // Add a back route to self in each child's GC nodes. If any child is referenced, then its parent should\n // be considered referenced as well.\n builder.addRouteToAllNodes(this.absolutePath);\n\n // Get the outbound routes and add a GC node for this channel.\n builder.addNode(\"/\", this.getOutboundRoutes());\n }\n\n /**\n * Generates data used for garbage collection. This includes a list of GC nodes that represent this channel\n * including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the\n * document. It does the following:\n * 1. Calls into each child context to get its GC data.\n * 2. Prefixs the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be\n * idenfied as belonging to the child.\n * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent\n * the GC data of this channel.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n const builder = new GCDataBuilder();\n // Iterate over each channel context and get their GC data.\n await Promise.all(Array.from(this.contexts)\n .filter(([contextId, _]) => {\n // Get GC data only for attached contexts. Detached contexts are not connected in the GC reference\n // graph so any references they might have won't be connected as well.\n return this.isChannelAttached(contextId);\n }).map(async ([contextId, context]) => {\n const contextGCData = await context.getGCData(fullGC);\n // Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.\n // This also gradually builds the id of each node to be a path from the root.\n builder.prefixAndAddNodes(contextId, contextGCData.gcNodes);\n }));\n\n this.updateGCNodes(builder);\n return builder.getGCData();\n }\n\n /**\n * After GC has run, called to notify this channel of routes that are used in it. It calls the child contexts to\n * update their used routes.\n * @param usedRoutes - The routes that are used in all contexts in this channel.\n * @param gcTimestamp - The time when GC was run that generated these used routes. If any node becomes unreferenced\n * as part of this GC run, this should be used to update the time when it happens.\n */\n public updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number) {\n // Get a map of channel ids to routes used in it.\n const usedContextRoutes = unpackChildNodesUsedRoutes(usedRoutes);\n\n // Verify that the used routes are correct.\n for (const [id] of usedContextRoutes) {\n assert(this.contexts.has(id), 0x17e /* \"Used route does not belong to any known context\" */);\n }\n\n // Update the used routes in each context. Used routes is empty for unused context.\n for (const [contextId, context] of this.contexts) {\n context.updateUsedRoutes(usedContextRoutes.get(contextId) ?? [], gcTimestamp);\n }\n }\n\n /**\n * Called when a new outbound reference is added to another node. This is used by garbage collection to identify\n * all references added in the system.\n * @param srcHandle - The handle of the node that added the reference.\n * @param outboundHandle - The handle of the outbound node that is referenced.\n */\n private addedGCOutboundReference(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) {\n this.dataStoreContext.addedGCOutboundReference?.(srcHandle, outboundHandle);\n }\n\n /**\n * Returns the base GC details for the channel with the given id. This is used to initialize its GC state.\n * @param channelId - The id of the channel context that is asked for the initial GC details.\n * @returns the requested channel's base GC details.\n */\n private async getChannelBaseGCDetails(channelId: string): Promise<IGarbageCollectionDetailsBase> {\n let channelBaseGCDetails = (await this.channelsBaseGCDetails).get(channelId);\n if (channelBaseGCDetails === undefined) {\n channelBaseGCDetails = {};\n }\n\n // Currently, channel context's are always considered used. So, it there are no used routes for it, we still\n // need to mark it as used. Add self-route (empty string) to the channel context's used routes.\n if (channelBaseGCDetails.usedRoutes === undefined || channelBaseGCDetails.usedRoutes.length === 0) {\n channelBaseGCDetails.usedRoutes = [\"\"];\n }\n return channelBaseGCDetails;\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n */\n public async summarize(fullTree: boolean = false, trackState: boolean = true): Promise<ISummaryTreeWithStats> {\n const summaryBuilder = new SummaryTreeBuilder();\n\n // Iterate over each data store and ask it to summarize\n await Promise.all(Array.from(this.contexts)\n .filter(([contextId, _]) => {\n const isAttached = this.isChannelAttached(contextId);\n // We are not expecting local dds! Summary may not capture local state.\n assert(isAttached, 0x17f /* \"Not expecting detached channels during summarize\" */);\n // If the object is registered - and we have received the sequenced op creating the object\n // (i.e. it has a base mapping) - then we go ahead and summarize\n return isAttached;\n }).map(async ([contextId, context]) => {\n // If BlobAggregationStorage is engaged, we have to write full summary for data stores\n // BlobAggregationStorage relies on this behavior, as it aggregates blobs across DDSs.\n // Not generating full summary will mean data loss, as we will overwrite aggregate blob in new summary,\n // and any virtual blobs that stayed (for unchanged DDSs) will need aggregate blob in previous summary\n // that is no longer present in this summary.\n // This is temporal limitation that can be lifted in future once BlobAggregationStorage becomes smarter.\n const contextSummary = await context.summarize(true /* fullTree */, trackState);\n summaryBuilder.addWithStats(contextId, contextSummary);\n }));\n\n return summaryBuilder.getSummaryTree();\n }\n\n public getAttachSummary(): ISummaryTreeWithStats {\n this.attachGraph();\n\n const summaryBuilder = new SummaryTreeBuilder();\n\n // Craft the .attributes file for each shared object\n for (const [contextId, context] of this.contexts) {\n if (!(context instanceof LocalChannelContextBase)) {\n throw new Error(\"Should only be called with local channel handles\");\n }\n\n if (!this.notBoundedChannelContextSet.has(contextId)) {\n let summaryTree: ISummaryTreeWithStats;\n if (context.isLoaded) {\n const contextSummary = context.getAttachSummary();\n assert(\n contextSummary.summary.type === SummaryType.Tree,\n 0x180 /* \"getAttachSummary should always return a tree\" */);\n summaryTree = { stats: contextSummary.stats, summary: contextSummary.summary };\n } else {\n // If this channel is not yet loaded, then there should be no changes in the snapshot from which\n // it was created as it is detached container. So just use the previous snapshot.\n assert(!!this.dataStoreContext.baseSnapshot,\n 0x181 /* \"BaseSnapshot should be there as detached container loaded from snapshot\" */);\n summaryTree = convertSnapshotTreeToSummaryTree(this.dataStoreContext.baseSnapshot.trees[contextId]);\n }\n summaryBuilder.addWithStats(contextId, summaryTree);\n }\n }\n\n return summaryBuilder.getSummaryTree();\n }\n\n public submitMessage(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n this.submit(type, content, localOpMetadata);\n }\n\n public submitSignal(type: string, content: any) {\n this.verifyNotClosed();\n return this.dataStoreContext.submitSignal(type, content);\n }\n\n /**\n * Will return when the data store is attached.\n */\n public async waitAttached(): Promise<void> {\n return this.deferredAttached.promise;\n }\n\n /**\n * Attach channel should only be called after the data store has been attached\n */\n private attachChannel(channel: IChannel): void {\n this.verifyNotClosed();\n // If this handle is already attached no need to attach again.\n if (channel.handle.isAttached) {\n return;\n }\n\n channel.handle.attachGraph();\n\n assert(this.isAttached, 0x182 /* \"Data store should be attached to attach the channel.\" */);\n // Get the object snapshot only if the data store is Bound and its graph is attached too,\n // because if the graph is attaching, then it would get included in the data store snapshot.\n if (this.bindState === BindState.Bound && this.graphAttachState === AttachState.Attached) {\n const summarizeResult = summarizeChannel(channel, true /* fullTree */, false /* trackState */);\n // Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.\n const snapshot = convertSummaryTreeToITree(summarizeResult.summary);\n\n const message: IAttachMessage = {\n id: channel.id,\n snapshot,\n type: channel.attributes.type,\n };\n this.pendingAttach.set(channel.id, message);\n this.submit(DataStoreMessageType.Attach, message);\n }\n\n const context = this.contexts.get(channel.id) as LocalChannelContextBase;\n context.markAttached();\n }\n\n private submitChannelOp(address: string, contents: any, localOpMetadata: unknown) {\n const envelope: IEnvelope = { address, contents };\n this.submit(DataStoreMessageType.ChannelOp, envelope, localOpMetadata);\n }\n\n private submit(\n type: DataStoreMessageType,\n content: any,\n localOpMetadata: unknown = undefined): void {\n this.verifyNotClosed();\n this.dataStoreContext.submitMessage(type, content, localOpMetadata);\n }\n\n /**\n * For messages of type MessageType.Operation, finds the right channel and asks it to resubmit the message.\n * For all other messages, just submit it again.\n * This typically happens when we reconnect and there are unacked messages.\n * @param content - The content of the original message.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n public reSubmit(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n this.verifyNotClosed();\n\n switch (type) {\n case DataStoreMessageType.ChannelOp:\n {\n // For Operations, find the right channel and trigger resubmission on it.\n const envelope = content as IEnvelope;\n const channelContext = this.contexts.get(envelope.address);\n assert(!!channelContext, 0x183 /* \"There should be a channel context for the op\" */);\n channelContext.reSubmit(envelope.contents, localOpMetadata);\n break;\n }\n case DataStoreMessageType.Attach:\n // For Attach messages, just submit them again.\n this.submit(type, content, localOpMetadata);\n break;\n default:\n unreachableCase(type);\n }\n }\n\n public async applyStashedOp(content: any): Promise<unknown> {\n const envelope = content as IEnvelope;\n const channelContext = this.contexts.get(envelope.address);\n assert(!!channelContext, 0x184 /* \"There should be a channel context for the op\" */);\n await channelContext.getChannel();\n return channelContext.applyStashedOp(envelope.contents);\n }\n\n private setChannelDirty(address: string): void {\n this.verifyNotClosed();\n this.dataStoreContext.setChannelDirty(address);\n }\n\n private processChannelOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n this.verifyNotClosed();\n\n const envelope = message.contents as IEnvelope;\n\n const transformed: ISequencedDocumentMessage = {\n ...message,\n contents: envelope.contents,\n };\n\n const channelContext = this.contexts.get(envelope.address);\n assert(!!channelContext, 0x185 /* \"Channel not found\" */);\n channelContext.processOp(transformed, local, localOpMetadata);\n\n return channelContext;\n }\n\n private attachListener() {\n this.setMaxListeners(Number.MAX_SAFE_INTEGER);\n this.dataStoreContext.once(\"attaching\", () => {\n assert(this.bindState !== BindState.NotBound,\n 0x186 /* \"Data store attaching should not occur if it is not bound\" */);\n this._attachState = AttachState.Attaching;\n // This promise resolution will be moved to attached event once we fix the scheduler.\n this.deferredAttached.resolve();\n this.emit(\"attaching\");\n });\n this.dataStoreContext.once(\"attached\", () => {\n assert(this.bindState === BindState.Bound,\n 0x187 /* \"Data store should only be attached after it is bound\" */);\n this._attachState = AttachState.Attached;\n this.emit(\"attached\");\n });\n }\n\n private verifyNotClosed() {\n if (this._disposed) {\n throw new Error(\"Runtime is closed\");\n }\n }\n}\n\n/**\n * Mixin class that adds request handler to FluidDataStoreRuntime\n * Request handler is only called when data store can't resolve request, i.e. for custom requests.\n * @param Base - base class, inherits from FluidDataStoreRuntime\n * @param requestHandler - request handler to mix in\n */\nexport const mixinRequestHandler = (\n requestHandler: (request: IRequest, runtime: FluidDataStoreRuntime) => Promise<IResponse>,\n Base: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n) => class RuntimeWithRequestHandler extends Base {\n public async request(request: IRequest) {\n const response = await super.request(request);\n if (response.status === 404) {\n return requestHandler(request, this);\n }\n return response;\n }\n } as typeof FluidDataStoreRuntime;\n\n/**\n * Mixin class that adds await for DataObject to finish initialization before we proceed to summary.\n * @param handler - handler that returns info about blob to be added to summary.\n * Or undefined not to add anything to summary.\n * @param Base - base class, inherits from FluidDataStoreRuntime\n */\nexport const mixinSummaryHandler = (\n handler: (runtime: FluidDataStoreRuntime) => Promise<{ path: string[], content: string } | undefined >,\n Base: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n) => class RuntimeWithSummarizerHandler extends Base {\n private addBlob(summary: ISummaryTreeWithStats, path: string[], content: string) {\n const firstName = path.shift();\n if (firstName === undefined) {\n throw new Error(\"Path can't be empty\");\n }\n\n let blob: ISummaryTree | ISummaryBlob = {\n type: SummaryType.Blob,\n content,\n };\n summary.stats.blobNodeCount++;\n summary.stats.totalBlobSize += content.length;\n\n for (const name of path.reverse()) {\n blob = {\n type: SummaryType.Tree,\n tree: { [name]: blob },\n };\n summary.stats.treeNodeCount++;\n }\n summary.summary.tree[firstName] = blob;\n }\n\n async summarize(...args: any[]) {\n const summary = await super.summarize(...args);\n const content = await handler(this);\n if (content !== undefined) {\n this.addBlob(summary, content.path, content.content);\n }\n return summary;\n }\n } as typeof FluidDataStoreRuntime;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelContext.d.ts","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,EACH,QAAQ,EACR,sBAAsB,EACtB,e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EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,KAAK,IAAI,EAC1E,YAAY,EAAE,aAAa;IA4BnC,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC;YAW9B,WAAW;IA8BzB,OAAO,CAAC,oCAAoC;IAkB5C,OAAO,CAAC,gBAAgB;CAa3B;AAED,qBAAa,mBAAoB,SAAQ,uBAAuB;IAC5D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAGtB;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;gBAEjC,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,qBAAqB,EAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,sBAAsB,EAC/B,gBAAgB,EAAE,sBAAsB,EACxC,cAAc,EAAE,uBAAuB,EACvC,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI,EAC1D,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EAClC,0BAA0B,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,KAAK,IAAI;CAsBlG"}
|
|
@@ -123,7 +123,7 @@ class RehydratedLocalChannelContext extends LocalChannelContextBase {
|
|
|
123
123
|
if (this.channel === undefined) {
|
|
124
124
|
this.channel = await this.loadChannel()
|
|
125
125
|
.catch((err) => {
|
|
126
|
-
throw container_utils_1.
|
|
126
|
+
throw container_utils_1.DataProcessingError.wrapIfUnrecognized(err, "rehydratedLocalChannelContextFailedToLoadChannel", undefined);
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
return this.channel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelContext.js","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,sDAAsD;AACtD,iEAAyC;AAezC,+DAA4D;AAC5D,qEAAwE;AACxE,+DAA4D;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EACR,IAAI,CAAC,OAAO,EACZ,0BAA0B,EAC1B,cAAc,EACd,MAAM,CACT,CAAC;QACN,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;CACJ;AAtCD,kDAsCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// eslint-disable-next-line import/no-internal-modules\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannel,\n IFluidDataStoreRuntime,\n IChannelFactory,\n IChannelAttributes,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n IFluidDataStoreContext,\n IGarbageCollectionData,\n ISummarizeResult,\n} from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { CreateProcessingError } from \"@fluidframework/container-utils\";\nimport { assert, Lazy } from \"@fluidframework/common-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n createServiceEndpoints,\n IChannelContext,\n summarizeChannel,\n summarizeChannelAsync,\n} from \"./channelContext\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\nimport { ChannelStorageService } from \"./channelStorageService\";\n\n/**\n * Channel context for a locally created channel\n */\nexport abstract class LocalChannelContextBase implements IChannelContext {\n public channel: IChannel | undefined;\n private attached = false;\n protected readonly pending: ISequencedDocumentMessage[] = [];\n protected factory: IChannelFactory | undefined;\n constructor(\n protected readonly id: string,\n protected readonly registry: ISharedObjectRegistry,\n protected readonly runtime: IFluidDataStoreRuntime,\n private readonly servicesGetter: () => Lazy<{\n readonly deltaConnection: ChannelDeltaConnection,\n readonly objectStorage: ChannelStorageService,\n }>,\n ) {\n }\n\n public async getChannel(): Promise<IChannel> {\n assert(this.channel !== undefined, 0x207 /* \"Channel should be defined\" */);\n return this.channel;\n }\n\n public get isLoaded(): boolean {\n return this.channel !== undefined;\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n // Connection events are ignored if the data store is not yet attached or loaded\n if (this.attached && this.isLoaded) {\n this.servicesGetter().value.deltaConnection.setConnectionState(connected);\n }\n }\n\n public processOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n assert(this.attached, 0x188 /* \"Local channel must be attached when processing op\" */);\n\n // A local channel may not be loaded in case where we rehydrate the container from a snapshot because of\n // delay loading. So after the container is attached and some other client joins which start generating\n // ops for this channel. So not loaded local channel can still receive ops and we store them to process later.\n if (this.isLoaded) {\n this.servicesGetter().value.deltaConnection.process(message, local, localOpMetadata);\n } else {\n assert(local === false,\n 0x189 /* \"Should always be remote because a local dds shouldn't generate ops before loading\" */);\n this.pending.push(message);\n }\n }\n\n public reSubmit(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x18a /* \"Channel should be loaded to resubmit ops\" */);\n assert(this.attached, 0x18b /* \"Local channel must be attached when resubmitting op\" */);\n this.servicesGetter().value.deltaConnection.reSubmit(content, localOpMetadata);\n }\n\n public applyStashedOp() {\n throw new Error(\"no stashed ops on local channel\");\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n */\n public async summarize(fullTree: boolean = false, trackState: boolean = false): Promise<ISummarizeResult> {\n assert(this.isLoaded && this.channel !== undefined, 0x18c /* \"Channel should be loaded to summarize\" */);\n return summarizeChannelAsync(this.channel, fullTree, trackState);\n }\n\n public getAttachSummary(): ISummarizeResult {\n assert(this.isLoaded && this.channel !== undefined, 0x18d /* \"Channel should be loaded to take snapshot\" */);\n return summarizeChannel(this.channel, true /* fullTree */, false /* trackState */);\n }\n\n public markAttached(): void {\n if (this.attached) {\n throw new Error(\"Channel is already attached\");\n }\n\n if (this.isLoaded) {\n assert(!!this.channel, 0x192 /* \"Channel should be there if loaded!!\" */);\n this.channel.connect(this.servicesGetter().value);\n }\n this.attached = true;\n }\n\n /**\n * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n * Each node has a set of outbound routes to other GC nodes in the document. This should be called only after\n * the context has loaded.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n assert(this.isLoaded && this.channel !== undefined, 0x193 /* \"Channel should be loaded to run GC\" */);\n return this.channel.getGCData(fullGC);\n }\n\n public updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number) {\n /**\n * Currently, DDSs are always considered referenced and are not garbage collected.\n * Once we have GC at DDS level, this channel context's used routes will be updated as per the passed\n * value. See - https://github.com/microsoft/FluidFramework/issues/4611\n */\n }\n}\n\nexport class RehydratedLocalChannelContext extends LocalChannelContextBase {\n private readonly services: Lazy<{\n readonly deltaConnection: ChannelDeltaConnection,\n readonly objectStorage: ChannelStorageService,\n }>;\n\n private readonly dirtyFn: () => void;\n\n constructor(\n id: string,\n registry: ISharedObjectRegistry,\n runtime: IFluidDataStoreRuntime,\n dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n logger: ITelemetryLogger,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n private readonly snapshotTree: ISnapshotTree,\n ) {\n super(id, registry, runtime, () => this.services);\n const blobMap: Map<string, ArrayBufferLike> = new Map<string, ArrayBufferLike>();\n const clonedSnapshotTree = cloneDeep(this.snapshotTree);\n // 0.47 back-compat Need to sanitize if snapshotTree.blobs still contains blob contents too.\n // This is for older snapshot which is generated by loader <=0.47 version which still contains\n // the contents within blobs. After a couple of revisions we can remove it.\n if (this.isSnapshotInOldFormatAndCollectBlobs(clonedSnapshotTree, blobMap)) {\n this.sanitizeSnapshot(clonedSnapshotTree);\n }\n\n this.services = new Lazy(() => {\n return createServiceEndpoints(\n this.id,\n dataStoreContext.connected,\n submitFn,\n this.dirtyFn,\n addedGCOutboundReferenceFn,\n storageService,\n logger,\n clonedSnapshotTree,\n blobMap,\n );\n });\n this.dirtyFn = () => { dirtyFn(id); };\n }\n\n public async getChannel(): Promise<IChannel> {\n if (this.channel === undefined) {\n this.channel = await this.loadChannel()\n .catch((err) => {\n throw CreateProcessingError(err, \"rehydratedLocalChannelContextFailedToLoadChannel\", undefined);\n });\n }\n return this.channel;\n }\n\n private async loadChannel(): Promise<IChannel> {\n assert(!this.isLoaded, 0x18e /* \"Channel must not already be loaded when loading\" */);\n assert(await this.services.value.objectStorage.contains(\".attributes\"),\n 0x190 /* \".attributes blob should be present\" */);\n const attributes = await readAndParse<IChannelAttributes>(\n this.services.value.objectStorage,\n \".attributes\");\n\n assert(this.factory === undefined, 0x208 /* \"Factory should be undefined before loading\" */);\n this.factory = this.registry.get(attributes.type);\n if (this.factory === undefined) {\n throw new Error(`Channel Factory ${attributes.type} not registered`);\n }\n // Services will be assigned during this load.\n const channel = await this.factory.load(\n this.runtime,\n this.id,\n this.services.value,\n attributes);\n\n // Commit changes.\n this.channel = channel;\n\n // Send all pending messages to the channel\n for (const message of this.pending) {\n this.services.value.deltaConnection.process(message, false, undefined /* localOpMetadata */);\n }\n return this.channel;\n }\n\n private isSnapshotInOldFormatAndCollectBlobs(\n snapshotTree: ISnapshotTree,\n blobMap: Map<string, ArrayBufferLike>,\n ): boolean {\n let sanitize = false;\n const blobsContents: {[path: string]: ArrayBufferLike} = (snapshotTree as any).blobsContents;\n Object.entries(blobsContents).forEach(([key, value]) => {\n blobMap.set(key, value);\n if (snapshotTree.blobs[key] !== undefined) {\n sanitize = true;\n }\n });\n for (const value of Object.values(snapshotTree.trees)) {\n sanitize = sanitize || this.isSnapshotInOldFormatAndCollectBlobs(value, blobMap);\n }\n return sanitize;\n }\n\n private sanitizeSnapshot(snapshotTree: ISnapshotTree) {\n const blobMapInitial = new Map(Object.entries(snapshotTree.blobs));\n for (const [blobName, blobId] of blobMapInitial.entries()) {\n const blobValue = blobMapInitial.get(blobId);\n if (blobValue === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete snapshotTree.blobs[blobName];\n }\n }\n for (const value of Object.values(snapshotTree.trees)) {\n this.sanitizeSnapshot(value);\n }\n }\n}\n\nexport class LocalChannelContext extends LocalChannelContextBase {\n private readonly services: Lazy<{\n readonly deltaConnection: ChannelDeltaConnection,\n readonly objectStorage: ChannelStorageService,\n }>;\n private readonly dirtyFn: () => void;\n constructor(\n id: string,\n registry: ISharedObjectRegistry,\n type: string,\n runtime: IFluidDataStoreRuntime,\n dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n logger: ITelemetryLogger,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n ) {\n super(id, registry, runtime, () => this.services);\n assert(type !== undefined, 0x209 /* \"Factory Type should be defined\" */);\n this.factory = registry.get(type);\n if (this.factory === undefined) {\n throw new Error(`Channel Factory ${type} not registered`);\n }\n this.channel = this.factory.create(runtime, id);\n this.services = new Lazy(() => {\n return createServiceEndpoints(\n this.id,\n dataStoreContext.connected,\n submitFn,\n this.dirtyFn,\n addedGCOutboundReferenceFn,\n storageService,\n logger,\n );\n });\n this.dirtyFn = () => { dirtyFn(id); };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"localChannelContext.js","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,sDAAsD;AACtD,iEAAyC;AAezC,+DAA4D;AAC5D,qEAAsE;AACtE,+DAA4D;AAE5D,qDAK0B;AAK1B;;GAEG;AACH,MAAs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EACZ,0BAA0B,EAC1B,cAAc,EACd,MAAM,CACT,CAAC;QACN,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;CACJ;AAtCD,kDAsCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// eslint-disable-next-line import/no-internal-modules\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannel,\n IFluidDataStoreRuntime,\n IChannelFactory,\n IChannelAttributes,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n IFluidDataStoreContext,\n IGarbageCollectionData,\n ISummarizeResult,\n} from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { DataProcessingError } from \"@fluidframework/container-utils\";\nimport { assert, Lazy } from \"@fluidframework/common-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n createServiceEndpoints,\n IChannelContext,\n summarizeChannel,\n summarizeChannelAsync,\n} from \"./channelContext\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\nimport { ChannelStorageService } from \"./channelStorageService\";\n\n/**\n * Channel context for a locally created channel\n */\nexport abstract class LocalChannelContextBase implements IChannelContext {\n public channel: IChannel | undefined;\n private attached = false;\n protected readonly pending: ISequencedDocumentMessage[] = [];\n protected factory: IChannelFactory | undefined;\n constructor(\n protected readonly id: string,\n protected readonly registry: ISharedObjectRegistry,\n protected readonly runtime: IFluidDataStoreRuntime,\n private readonly servicesGetter: () => Lazy<{\n readonly deltaConnection: ChannelDeltaConnection,\n readonly objectStorage: ChannelStorageService,\n }>,\n ) {\n }\n\n public async getChannel(): Promise<IChannel> {\n assert(this.channel !== undefined, 0x207 /* \"Channel should be defined\" */);\n return this.channel;\n }\n\n public get isLoaded(): boolean {\n return this.channel !== undefined;\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n // Connection events are ignored if the data store is not yet attached or loaded\n if (this.attached && this.isLoaded) {\n this.servicesGetter().value.deltaConnection.setConnectionState(connected);\n }\n }\n\n public processOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n assert(this.attached, 0x188 /* \"Local channel must be attached when processing op\" */);\n\n // A local channel may not be loaded in case where we rehydrate the container from a snapshot because of\n // delay loading. So after the container is attached and some other client joins which start generating\n // ops for this channel. So not loaded local channel can still receive ops and we store them to process later.\n if (this.isLoaded) {\n this.servicesGetter().value.deltaConnection.process(message, local, localOpMetadata);\n } else {\n assert(local === false,\n 0x189 /* \"Should always be remote because a local dds shouldn't generate ops before loading\" */);\n this.pending.push(message);\n }\n }\n\n public reSubmit(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x18a /* \"Channel should be loaded to resubmit ops\" */);\n assert(this.attached, 0x18b /* \"Local channel must be attached when resubmitting op\" */);\n this.servicesGetter().value.deltaConnection.reSubmit(content, localOpMetadata);\n }\n\n public applyStashedOp() {\n throw new Error(\"no stashed ops on local channel\");\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n */\n public async summarize(fullTree: boolean = false, trackState: boolean = false): Promise<ISummarizeResult> {\n assert(this.isLoaded && this.channel !== undefined, 0x18c /* \"Channel should be loaded to summarize\" */);\n return summarizeChannelAsync(this.channel, fullTree, trackState);\n }\n\n public getAttachSummary(): ISummarizeResult {\n assert(this.isLoaded && this.channel !== undefined, 0x18d /* \"Channel should be loaded to take snapshot\" */);\n return summarizeChannel(this.channel, true /* fullTree */, false /* trackState */);\n }\n\n public markAttached(): void {\n if (this.attached) {\n throw new Error(\"Channel is already attached\");\n }\n\n if (this.isLoaded) {\n assert(!!this.channel, 0x192 /* \"Channel should be there if loaded!!\" */);\n this.channel.connect(this.servicesGetter().value);\n }\n this.attached = true;\n }\n\n /**\n * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n * Each node has a set of outbound routes to other GC nodes in the document. This should be called only after\n * the context has loaded.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n assert(this.isLoaded && this.channel !== undefined, 0x193 /* \"Channel should be loaded to run GC\" */);\n return this.channel.getGCData(fullGC);\n }\n\n public updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number) {\n /**\n * Currently, DDSs are always considered referenced and are not garbage collected.\n * Once we have GC at DDS level, this channel context's used routes will be updated as per the passed\n * value. See - https://github.com/microsoft/FluidFramework/issues/4611\n */\n }\n}\n\nexport class RehydratedLocalChannelContext extends LocalChannelContextBase {\n private readonly services: Lazy<{\n readonly deltaConnection: ChannelDeltaConnection,\n readonly objectStorage: ChannelStorageService,\n }>;\n\n private readonly dirtyFn: () => void;\n\n constructor(\n id: string,\n registry: ISharedObjectRegistry,\n runtime: IFluidDataStoreRuntime,\n dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n logger: ITelemetryLogger,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n private readonly snapshotTree: ISnapshotTree,\n ) {\n super(id, registry, runtime, () => this.services);\n const blobMap: Map<string, ArrayBufferLike> = new Map<string, ArrayBufferLike>();\n const clonedSnapshotTree = cloneDeep(this.snapshotTree);\n // 0.47 back-compat Need to sanitize if snapshotTree.blobs still contains blob contents too.\n // This is for older snapshot which is generated by loader <=0.47 version which still contains\n // the contents within blobs. After a couple of revisions we can remove it.\n if (this.isSnapshotInOldFormatAndCollectBlobs(clonedSnapshotTree, blobMap)) {\n this.sanitizeSnapshot(clonedSnapshotTree);\n }\n\n this.services = new Lazy(() => {\n return createServiceEndpoints(\n this.id,\n dataStoreContext.connected,\n submitFn,\n this.dirtyFn,\n addedGCOutboundReferenceFn,\n storageService,\n logger,\n clonedSnapshotTree,\n blobMap,\n );\n });\n this.dirtyFn = () => { dirtyFn(id); };\n }\n\n public async getChannel(): Promise<IChannel> {\n if (this.channel === undefined) {\n this.channel = await this.loadChannel()\n .catch((err) => {\n throw DataProcessingError.wrapIfUnrecognized(\n err, \"rehydratedLocalChannelContextFailedToLoadChannel\", undefined);\n });\n }\n return this.channel;\n }\n\n private async loadChannel(): Promise<IChannel> {\n assert(!this.isLoaded, 0x18e /* \"Channel must not already be loaded when loading\" */);\n assert(await this.services.value.objectStorage.contains(\".attributes\"),\n 0x190 /* \".attributes blob should be present\" */);\n const attributes = await readAndParse<IChannelAttributes>(\n this.services.value.objectStorage,\n \".attributes\");\n\n assert(this.factory === undefined, 0x208 /* \"Factory should be undefined before loading\" */);\n this.factory = this.registry.get(attributes.type);\n if (this.factory === undefined) {\n throw new Error(`Channel Factory ${attributes.type} not registered`);\n }\n // Services will be assigned during this load.\n const channel = await this.factory.load(\n this.runtime,\n this.id,\n this.services.value,\n attributes);\n\n // Commit changes.\n this.channel = channel;\n\n // Send all pending messages to the channel\n for (const message of this.pending) {\n this.services.value.deltaConnection.process(message, false, undefined /* localOpMetadata */);\n }\n return this.channel;\n }\n\n private isSnapshotInOldFormatAndCollectBlobs(\n snapshotTree: ISnapshotTree,\n blobMap: Map<string, ArrayBufferLike>,\n ): boolean {\n let sanitize = false;\n const blobsContents: {[path: string]: ArrayBufferLike} = (snapshotTree as any).blobsContents;\n Object.entries(blobsContents).forEach(([key, value]) => {\n blobMap.set(key, value);\n if (snapshotTree.blobs[key] !== undefined) {\n sanitize = true;\n }\n });\n for (const value of Object.values(snapshotTree.trees)) {\n sanitize = sanitize || this.isSnapshotInOldFormatAndCollectBlobs(value, blobMap);\n }\n return sanitize;\n }\n\n private sanitizeSnapshot(snapshotTree: ISnapshotTree) {\n const blobMapInitial = new Map(Object.entries(snapshotTree.blobs));\n for (const [blobName, blobId] of blobMapInitial.entries()) {\n const blobValue = blobMapInitial.get(blobId);\n if (blobValue === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete snapshotTree.blobs[blobName];\n }\n }\n for (const value of Object.values(snapshotTree.trees)) {\n this.sanitizeSnapshot(value);\n }\n }\n}\n\nexport class LocalChannelContext extends LocalChannelContextBase {\n private readonly services: Lazy<{\n readonly deltaConnection: ChannelDeltaConnection,\n readonly objectStorage: ChannelStorageService,\n }>;\n private readonly dirtyFn: () => void;\n constructor(\n id: string,\n registry: ISharedObjectRegistry,\n type: string,\n runtime: IFluidDataStoreRuntime,\n dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n logger: ITelemetryLogger,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n ) {\n super(id, registry, runtime, () => this.services);\n assert(type !== undefined, 0x209 /* \"Factory Type should be defined\" */);\n this.factory = registry.get(type);\n if (this.factory === undefined) {\n throw new Error(`Channel Factory ${type} not registered`);\n }\n this.channel = this.factory.create(runtime, id);\n this.services = new Lazy(() => {\n return createServiceEndpoints(\n this.id,\n dataStoreContext.connected,\n submitFn,\n this.dirtyFn,\n addedGCOutboundReferenceFn,\n storageService,\n logger,\n );\n });\n this.dirtyFn = () => { dirtyFn(id); };\n }\n}\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/datastore";
|
|
8
|
-
export declare const pkgVersion = "0.
|
|
8
|
+
export declare const pkgVersion = "0.58.0-55983";
|
|
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,8BAA8B,CAAC;AACnD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,8BAA8B,CAAC;AACnD,eAAO,MAAM,UAAU,iBAAiB,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/datastore";
|
|
11
|
-
exports.pkgVersion = "0.
|
|
11
|
+
exports.pkgVersion = "0.58.0-55983";
|
|
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,2BAA2B,CAAC;AACtC,QAAA,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,2BAA2B,CAAC;AACtC,QAAA,UAAU,GAAG,cAAc,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/datastore\";\nexport const pkgVersion = \"0.58.0-55983\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelDeltaConnection.d.ts","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,qBAAa,sBAAuB,YAAW,gBAAgB;IAYhD,QAAQ,EAAE,MAAM;IACvB,OAAO,CAAC,UAAU;aACF,MAAM,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI;aACrE,KAAK,EAAE,MAAM,IAAI;aACjB,wBAAwB,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,KAAK,IAAI;IAf7G,OAAO,CAAC,QAAQ,CAA4B;IAE5C,OAAO,KAAK,OAAO,GAGlB;IACD,IAAW,SAAS,IAAI,OAAO,CAE9B;gBAGU,QAAQ,EAAE,MAAM,EACf,UAAU,EAAE,OAAO,EACX,MAAM,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI,EACrE,KAAK,EAAE,MAAM,IAAI,EACjB,wBAAwB,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,KAAK,IAAI;IAGtG,MAAM,CAAC,OAAO,EAAE,aAAa;IAK7B,kBAAkB,CAAC,SAAS,EAAE,OAAO;IAKrC,OAAO,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"channelDeltaConnection.d.ts","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,qBAAa,sBAAuB,YAAW,gBAAgB;IAYhD,QAAQ,EAAE,MAAM;IACvB,OAAO,CAAC,UAAU;aACF,MAAM,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI;aACrE,KAAK,EAAE,MAAM,IAAI;aACjB,wBAAwB,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,KAAK,IAAI;IAf7G,OAAO,CAAC,QAAQ,CAA4B;IAE5C,OAAO,KAAK,OAAO,GAGlB;IACD,IAAW,SAAS,IAAI,OAAO,CAE9B;gBAGU,QAAQ,EAAE,MAAM,EACf,UAAU,EAAE,OAAO,EACX,MAAM,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI,EACrE,KAAK,EAAE,MAAM,IAAI,EACjB,wBAAwB,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,KAAK,IAAI;IAGtG,MAAM,CAAC,OAAO,EAAE,aAAa;IAK7B,kBAAkB,CAAC,SAAS,EAAE,OAAO;IAKrC,OAAO,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO;IAUpF,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAI/C,cAAc,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO;CAGrE"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { assert } from "@fluidframework/common-utils";
|
|
6
|
-
import {
|
|
6
|
+
import { DataProcessingError } from "@fluidframework/container-utils";
|
|
7
7
|
export class ChannelDeltaConnection {
|
|
8
8
|
constructor(objectId, _connected, submit, dirty, addedGCOutboundReference) {
|
|
9
9
|
this.objectId = objectId;
|
|
@@ -33,7 +33,7 @@ export class ChannelDeltaConnection {
|
|
|
33
33
|
this.handler.process(message, local, localOpMetadata);
|
|
34
34
|
}
|
|
35
35
|
catch (error) {
|
|
36
|
-
throw
|
|
36
|
+
throw DataProcessingError.wrapIfUnrecognized(error, "channelDeltaConnectionFailedToProcessMessage", message);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
reSubmit(content, localOpMetadata) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelDeltaConnection.js","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"channelDeltaConnection.js","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,MAAM,OAAO,sBAAsB;IAW/B,YACW,QAAgB,EACf,UAAmB,EACX,MAAqE,EACrE,KAAiB,EACjB,wBAAyF;QAJlG,aAAQ,GAAR,QAAQ,CAAQ;QACf,eAAU,GAAV,UAAU,CAAS;QACX,WAAM,GAAN,MAAM,CAA+D;QACrE,UAAK,GAAL,KAAK,CAAY;QACjB,6BAAwB,GAAxB,wBAAwB,CAAiE;IAC7G,CAAC;IAdD,IAAY,OAAO;QACf,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IACD,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAUM,MAAM,CAAC,OAAsB;QAChC,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QACnF,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAEM,kBAAkB,CAAC,SAAkB;QACxC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAEM,OAAO,CAAC,OAAkC,EAAE,KAAc,EAAE,eAAwB;QACvF,IAAI;YACA,sFAAsF;YACtF,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;SACzD;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,mBAAmB,CAAC,kBAAkB,CACxC,KAAK,EAAE,8CAA8C,EAAE,OAAO,CAAC,CAAC;SACvE;IACL,CAAC;IAEM,QAAQ,CAAC,OAAY,EAAE,eAAwB;QAClD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACpD,CAAC;IAEM,cAAc,CAAC,OAAkC;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IDocumentMessage, ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IDeltaConnection, IDeltaHandler } from \"@fluidframework/datastore-definitions\";\nimport { DataProcessingError } from \"@fluidframework/container-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\n\nexport class ChannelDeltaConnection implements IDeltaConnection {\n private _handler: IDeltaHandler | undefined;\n\n private get handler(): IDeltaHandler {\n assert(!!this._handler, 0x177 /* \"Missing delta handler\" */);\n return this._handler;\n }\n public get connected(): boolean {\n return this._connected;\n }\n\n constructor(\n public objectId: string,\n private _connected: boolean,\n public readonly submit: (message: IDocumentMessage, localOpMetadata: unknown) => void,\n public readonly dirty: () => void,\n public readonly addedGCOutboundReference: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void) {\n }\n\n public attach(handler: IDeltaHandler) {\n assert(this._handler === undefined, 0x178 /* \"Missing delta handler on attach\" */);\n this._handler = handler;\n }\n\n public setConnectionState(connected: boolean) {\n this._connected = connected;\n this.handler.setConnectionState(connected);\n }\n\n public process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n try {\n // catches as data processing error whether or not they come from async pending queues\n this.handler.process(message, local, localOpMetadata);\n } catch (error) {\n throw DataProcessingError.wrapIfUnrecognized(\n error, \"channelDeltaConnectionFailedToProcessMessage\", message);\n }\n }\n\n public reSubmit(content: any, localOpMetadata: unknown) {\n this.handler.reSubmit(content, localOpMetadata);\n }\n\n public applyStashedOp(message: ISequencedDocumentMessage): unknown {\n return this.handler.applyStashedOp(message);\n }\n}\n"]}
|
package/lib/dataStoreRuntime.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { BindState, AttachState, } from "@fluidframework/container-definitions";
|
|
6
|
-
import {
|
|
6
|
+
import { DataProcessingError } from "@fluidframework/container-utils";
|
|
7
7
|
import { assert, Deferred, LazyPromise, TypedEventEmitter, unreachableCase, } from "@fluidframework/common-utils";
|
|
8
8
|
import { ChildLogger, raiseConnectedEvent, } from "@fluidframework/telemetry-utils";
|
|
9
9
|
import { buildSnapshotTree } from "@fluidframework/driver-utils";
|
|
@@ -328,7 +328,7 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
|
328
328
|
this.emit("op", message);
|
|
329
329
|
}
|
|
330
330
|
catch (error) {
|
|
331
|
-
throw
|
|
331
|
+
throw DataProcessingError.wrapIfUnrecognized(error, "fluidDataStoreRuntimeFailedToProcessMessage", message);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
processSignal(message, local) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRuntime.js","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAGH,SAAS,EACT,WAAW,GAEd,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EACH,MAAM,EACN,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,eAAe,GAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACH,WAAW,EACX,mBAAmB,GACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAIH,WAAW,GAId,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,0BAA0B,GAS7B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,gCAAgC,EAChC,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACtB,MAAM,+BAA+B,CAAC;AAOvC,OAAO,EACH,aAAa,EACb,yBAAyB,EACzB,0BAA0B,GAC7B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAmB,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACpH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,CAAN,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC5B,wBAAw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;QAED,IAAI,IAAI,GAAgC;YACpC,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,OAAO;SACV,CAAC;QACF,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QAC9B,OAAO,CAAC,KAAK,CAAC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;QAE9C,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE;YAC/B,IAAI,GAAG;gBACH,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE;aACzB,CAAC;YACF,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;SACjC;QACD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,GAAG,IAAW;QAC1B,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,OAAO,KAAK,SAAS,EAAE;YACvB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;SACxD;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CAC4B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n IFluidHandle,\n IFluidHandleContext,\n IRequest,\n IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport {\n IAudience,\n IDeltaManager,\n BindState,\n AttachState,\n ILoaderOptions,\n} from \"@fluidframework/container-definitions\";\nimport { CreateProcessingError } from \"@fluidframework/container-utils\";\nimport {\n assert,\n Deferred,\n LazyPromise,\n TypedEventEmitter,\n unreachableCase,\n} from \"@fluidframework/common-utils\";\nimport {\n ChildLogger,\n raiseConnectedEvent,\n} from \"@fluidframework/telemetry-utils\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport {\n IClientDetails,\n IDocumentMessage,\n ISequencedDocumentMessage,\n SummaryType,\n ISummaryBlob,\n ISummaryTree,\n IQuorumClients,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n CreateSummarizerNodeSource,\n IAttachMessage,\n IEnvelope,\n IFluidDataStoreContext,\n IFluidDataStoreChannel,\n IGarbageCollectionData,\n IGarbageCollectionDetailsBase,\n IInboundSignalMessage,\n ISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n convertSnapshotTreeToSummaryTree,\n convertSummaryTreeToITree,\n generateHandleContextPath,\n RequestParser,\n SummaryTreeBuilder,\n create404Response,\n createResponseError,\n exceptionToResponse,\n} from \"@fluidframework/runtime-utils\";\nimport {\n IChannel,\n IFluidDataStoreRuntime,\n IFluidDataStoreRuntimeEvents,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n GCDataBuilder,\n unpackChildNodesGCDetails,\n unpackChildNodesUsedRoutes,\n} from \"@fluidframework/garbage-collector\";\nimport { v4 as uuid } from \"uuid\";\nimport { IChannelContext, summarizeChannel } from \"./channelContext\";\nimport { LocalChannelContext, LocalChannelContextBase, RehydratedLocalChannelContext } from \"./localChannelContext\";\nimport { RemoteChannelContext } from \"./remoteChannelContext\";\n\nexport enum DataStoreMessageType {\n // Creates a new channel\n Attach = \"attach\",\n ChannelOp = \"op\",\n}\n\nexport interface ISharedObjectRegistry {\n // TODO consider making this async. A consequence is that either the creation of a distributed data type\n // is async or we need a new API to split the synchronous vs. asynchronous creation.\n get(name: string): IChannelFactory | undefined;\n}\n\n/**\n * Base data store class\n */\nexport class FluidDataStoreRuntime extends\nTypedEventEmitter<IFluidDataStoreRuntimeEvents> implements\nIFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {\n /**\n * Loads the data store runtime\n * @param context - The data store context\n * @param sharedObjectRegistry - The registry of shared objects used by this data store\n * @param existing - If loading from an existing file.\n */\n public static load(\n context: IFluidDataStoreContext,\n sharedObjectRegistry: ISharedObjectRegistry,\n existing: boolean,\n ): FluidDataStoreRuntime {\n return new FluidDataStoreRuntime(context, sharedObjectRegistry, existing);\n }\n\n public get IFluidRouter() { return this; }\n\n public get connected(): boolean {\n return this.dataStoreContext.connected;\n }\n\n public get clientId(): string | undefined {\n return this.dataStoreContext.clientId;\n }\n\n public get clientDetails(): IClientDetails {\n return this.dataStoreContext.clientDetails;\n }\n\n public get isAttached(): boolean {\n return this.attachState !== AttachState.Detached;\n }\n\n public get attachState(): AttachState {\n return this._attachState;\n }\n\n public get absolutePath(): string {\n return generateHandleContextPath(this.id, this.routeContext);\n }\n\n public get routeContext(): IFluidHandleContext {\n return this.dataStoreContext.IFluidHandleContext;\n }\n\n public get IFluidHandleContext() { return this; }\n\n public get rootRoutingContext() { return this; }\n public get channelsRoutingContext() { return this; }\n public get objectsRoutingContext() { return this; }\n\n private _disposed = false;\n public get disposed() { return this._disposed; }\n\n private readonly contexts = new Map<string, IChannelContext>();\n private readonly contextsDeferred = new Map<string, Deferred<IChannelContext>>();\n private readonly pendingAttach = new Map<string, IAttachMessage>();\n\n private bindState: BindState;\n // For new data stores, this is used to break the recursion while attaching the graph. The graph must be attached\n // before the data store can move to Attached state (see _attachState) and become live.\n // For existing data stores, the graph is always attached.\n private graphAttachState: AttachState = AttachState.Detached;\n private readonly deferredAttached = new Deferred<void>();\n private readonly localChannelContextQueue = new Map<string, LocalChannelContextBase>();\n private readonly notBoundedChannelContextSet = new Set<string>();\n private boundhandles: Set<IFluidHandle> | undefined;\n private _attachState: AttachState;\n\n public readonly id: string;\n public readonly options: ILoaderOptions;\n public readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n private readonly quorum: IQuorumClients;\n private readonly audience: IAudience;\n public readonly logger: ITelemetryLogger;\n\n // A map of child channel context ids to the their base GC details. This is used to initialize the GC state of the\n // channel contexts.\n private readonly channelsBaseGCDetails: LazyPromise<Map<string, IGarbageCollectionDetailsBase>>;\n\n public constructor(\n private readonly dataStoreContext: IFluidDataStoreContext,\n private readonly sharedObjectRegistry: ISharedObjectRegistry,\n existing: boolean,\n ) {\n super();\n\n this.logger = ChildLogger.create(\n dataStoreContext.logger,\n \"FluidDataStoreRuntime\",\n {all:{ dataStoreId: uuid() }},\n );\n\n this.id = dataStoreContext.id;\n this.options = dataStoreContext.options;\n this.deltaManager = dataStoreContext.deltaManager;\n this.quorum = dataStoreContext.getQuorum();\n this.audience = dataStoreContext.getAudience();\n\n const tree = dataStoreContext.baseSnapshot;\n\n this.channelsBaseGCDetails = new LazyPromise(async () => {\n const baseGCDetails = await\n (this.dataStoreContext.getBaseGCDetails?.() ?? this.dataStoreContext.getInitialGCSummaryDetails());\n return unpackChildNodesGCDetails(baseGCDetails);\n });\n\n // Must always receive the data store type inside of the attributes\n if (tree?.trees !== undefined) {\n Object.keys(tree.trees).forEach((path) => {\n // Issue #4414\n if (path === \"_search\") { return; }\n\n let channelContext: IChannelContext;\n // If already exists on storage, then create a remote channel. However, if it is case of rehydrating a\n // container from snapshot where we load detached container from a snapshot, isLocalDataStore would be\n // true. In this case create a RehydratedLocalChannelContext.\n if (dataStoreContext.isLocalDataStore) {\n channelContext = new RehydratedLocalChannelContext(\n path,\n this.sharedObjectRegistry,\n this,\n this.dataStoreContext,\n this.dataStoreContext.storage,\n this.logger,\n (content, localOpMetadata) => this.submitChannelOp(path, content, localOpMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle),\n tree.trees[path]);\n // This is the case of rehydrating a detached container from snapshot. Now due to delay loading of\n // data store, if the data store is loaded after the container is attached, then we missed marking\n // the channel as attached. So mark it now. Otherwise add it to local channel context queue, so\n // that it can be mark attached later with the data store.\n if (dataStoreContext.attachState !== AttachState.Detached) {\n (channelContext as LocalChannelContextBase).markAttached();\n } else {\n this.localChannelContextQueue.set(path, channelContext as LocalChannelContextBase);\n }\n } else {\n channelContext = new RemoteChannelContext(\n this,\n dataStoreContext,\n dataStoreContext.storage,\n (content, localOpMetadata) => this.submitChannelOp(path, content, localOpMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle),\n path,\n tree.trees[path],\n this.sharedObjectRegistry,\n undefined /* extraBlobs */,\n this.dataStoreContext.getCreateChildSummarizerNodeFn(\n path,\n { type: CreateSummarizerNodeSource.FromSummary },\n ),\n async () => this.getChannelBaseGCDetails(path));\n }\n const deferred = new Deferred<IChannelContext>();\n deferred.resolve(channelContext);\n\n this.contexts.set(path, channelContext);\n this.contextsDeferred.set(path, deferred);\n });\n }\n\n this.attachListener();\n // If exists on storage or loaded from a snapshot, it should already be binded.\n this.bindState = existing ? BindState.Bound : BindState.NotBound;\n this._attachState = dataStoreContext.attachState;\n\n // If it's existing we know it has been attached.\n if (existing) {\n this.deferredAttached.resolve();\n }\n }\n\n public dispose(): void {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n\n this.emit(\"dispose\");\n this.removeAllListeners();\n }\n\n public async resolveHandle(request: IRequest): Promise<IResponse> {\n return this.request(request);\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n try {\n const parser = RequestParser.create(request);\n const id = parser.pathParts[0];\n\n if (id === \"_channels\" || id === \"_custom\") {\n return this.request(parser.createSubRequest(1));\n }\n\n // Check for a data type reference first\n if (this.contextsDeferred.has(id) && parser.isLeaf(1)) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const value = await this.contextsDeferred.get(id)!.promise;\n const channel = await value.getChannel();\n\n return { mimeType: \"fluid/object\", status: 200, value: channel };\n } catch (error) {\n this.logger.sendErrorEvent({ eventName: \"GetChannelFailedInRequest\" }, error);\n\n return createResponseError(500, `Failed to get Channel: ${error}`, request);\n }\n }\n\n // Otherwise defer to an attached request handler\n return create404Response(request);\n } catch (error) {\n return exceptionToResponse(error);\n }\n }\n\n public async getChannel(id: string): Promise<IChannel> {\n this.verifyNotClosed();\n\n // TODO we don't assume any channels (even root) in the runtime. If you request a channel that doesn't exist\n // we will never resolve the promise. May want a flag to getChannel that doesn't wait for the promise if\n // it doesn't exist\n if (!this.contextsDeferred.has(id)) {\n this.contextsDeferred.set(id, new Deferred<IChannelContext>());\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const context = await this.contextsDeferred.get(id)!.promise;\n const channel = await context.getChannel();\n\n return channel;\n }\n\n public createChannel(id: string = uuid(), type: string): IChannel {\n this.verifyNotClosed();\n\n assert(!this.contexts.has(id), 0x179 /* \"createChannel() with existing ID\" */);\n this.notBoundedChannelContextSet.add(id);\n const context = new LocalChannelContext(\n id,\n this.sharedObjectRegistry,\n type,\n this,\n this.dataStoreContext,\n this.dataStoreContext.storage,\n this.logger,\n (content, localOpMetadata) => this.submitChannelOp(id, content, localOpMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle));\n this.contexts.set(id, context);\n\n if (this.contextsDeferred.has(id)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.contextsDeferred.get(id)!.resolve(context);\n } else {\n const deferred = new Deferred<IChannelContext>();\n deferred.resolve(context);\n this.contextsDeferred.set(id, deferred);\n }\n\n assert(!!context.channel, 0x17a /* \"Channel should be loaded when created!!\" */);\n return context.channel;\n }\n\n /**\n * Binds a channel with the runtime. If the runtime is attached we will attach the channel right away.\n * If the runtime is not attached we will defer the attach until the runtime attaches.\n * @param channel - channel to be registered.\n */\n public bindChannel(channel: IChannel): void {\n assert(this.notBoundedChannelContextSet.has(channel.id),\n 0x17b /* \"Channel to be binded should be in not bounded set\" */);\n this.notBoundedChannelContextSet.delete(channel.id);\n // If our data store is attached, then attach the channel.\n if (this.isAttached) {\n this.attachChannel(channel);\n return;\n } else {\n this.bind(channel.handle);\n\n // If our data store is local then add the channel to the queue\n if (!this.localChannelContextQueue.has(channel.id)) {\n this.localChannelContextQueue.set(channel.id, this.contexts.get(channel.id) as LocalChannelContextBase);\n }\n }\n }\n\n public attachGraph() {\n if (this.graphAttachState !== AttachState.Detached) {\n return;\n }\n this.graphAttachState = AttachState.Attaching;\n if (this.boundhandles !== undefined) {\n this.boundhandles.forEach((handle) => {\n handle.attachGraph();\n });\n this.boundhandles = undefined;\n }\n\n // Flush the queue to set any pre-existing channels to local\n this.localChannelContextQueue.forEach((channel) => {\n // When we are attaching the data store we don't need to send attach for the registered services.\n // This is because they will be captured as part of the Attach data store snapshot\n channel.markAttached();\n });\n\n this.localChannelContextQueue.clear();\n this.bindToContext();\n this.graphAttachState = AttachState.Attached;\n }\n\n /**\n * Binds this runtime to the container\n * This includes the following:\n * 1. Sending an Attach op that includes all existing state\n * 2. Attaching the graph if the data store becomes attached.\n */\n public bindToContext() {\n if (this.bindState !== BindState.NotBound) {\n return;\n }\n this.bindState = BindState.Binding;\n this.dataStoreContext.bindToContext();\n this.bindState = BindState.Bound;\n }\n\n public bind(handle: IFluidHandle): void {\n // If the data store is already attached or its graph is already in attaching or attached state,\n // then attach the incoming handle too.\n if (this.isAttached || this.graphAttachState !== AttachState.Detached) {\n handle.attachGraph();\n return;\n }\n if (this.boundhandles === undefined) {\n this.boundhandles = new Set<IFluidHandle>();\n }\n\n this.boundhandles.add(handle);\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n this.verifyNotClosed();\n\n for (const [, object] of this.contexts) {\n object.setConnectionState(connected, clientId);\n }\n\n raiseConnectedEvent(this.logger, this, connected, clientId);\n }\n\n public getQuorum(): IQuorumClients {\n return this.quorum;\n }\n\n public getAudience(): IAudience {\n return this.audience;\n }\n\n public async uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n this.verifyNotClosed();\n\n return this.dataStoreContext.uploadBlob(blob);\n }\n\n public process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n this.verifyNotClosed();\n\n try {\n // catches as data processing error whether or not they come from async pending queues\n switch (message.type) {\n case DataStoreMessageType.Attach: {\n const attachMessage = message.contents as IAttachMessage;\n const id = attachMessage.id;\n\n // If a non-local operation then go and create the object\n // Otherwise mark it as officially attached.\n if (local) {\n assert(this.pendingAttach.has(id), 0x17c /* \"Unexpected attach (local) channel OP\" */);\n this.pendingAttach.delete(id);\n } else {\n assert(!this.contexts.has(id),\n 0x17d, /* `Unexpected attach channel OP,\n is in pendingAttach set: ${this.pendingAttach.has(id)},\n is local channel contexts: ${this.contexts.get(id) instanceof LocalChannelContextBase}` */);\n\n const flatBlobs = new Map<string, ArrayBufferLike>();\n const snapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatBlobs);\n\n const remoteChannelContext = new RemoteChannelContext(\n this,\n this.dataStoreContext,\n this.dataStoreContext.storage,\n (content, localContentMetadata) => this.submitChannelOp(id, content, localContentMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle),\n id,\n snapshotTree,\n this.sharedObjectRegistry,\n flatBlobs,\n this.dataStoreContext.getCreateChildSummarizerNodeFn(\n id,\n {\n type: CreateSummarizerNodeSource.FromAttach,\n sequenceNumber: message.sequenceNumber,\n snapshot: attachMessage.snapshot,\n },\n ),\n async () => this.getChannelBaseGCDetails(id),\n attachMessage.type);\n\n this.contexts.set(id, remoteChannelContext);\n if (this.contextsDeferred.has(id)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.contextsDeferred.get(id)!.resolve(remoteChannelContext);\n } else {\n const deferred = new Deferred<IChannelContext>();\n deferred.resolve(remoteChannelContext);\n this.contextsDeferred.set(id, deferred);\n }\n }\n break;\n }\n\n case DataStoreMessageType.ChannelOp:\n this.processChannelOp(message, local, localOpMetadata);\n break;\n default:\n }\n\n this.emit(\"op\", message);\n } catch (error) {\n throw CreateProcessingError(error, \"fluidDataStoreRuntimeFailedToProcessMessage\", message);\n }\n }\n\n public processSignal(message: IInboundSignalMessage, local: boolean) {\n this.emit(\"signal\", message, local);\n }\n\n private isChannelAttached(id: string): boolean {\n return (\n // Added in createChannel\n // Removed when bindChannel is called\n !this.notBoundedChannelContextSet.has(id)\n // Added in bindChannel only if this is not attached yet\n // Removed when this is attached by calling attachGraph\n && !this.localChannelContextQueue.has(id)\n // Added in attachChannel called by bindChannel\n // Removed when attach op is broadcast\n && !this.pendingAttach.has(id)\n );\n }\n\n /**\n * Returns the outbound routes of this channel. Currently, all contexts in this channel are considered\n * referenced and are hence outbound. This will change when we have root and non-root channel contexts.\n * The only root contexts will be considered as referenced.\n */\n private getOutboundRoutes(): string[] {\n const outboundRoutes: string[] = [];\n for (const [contextId] of this.contexts) {\n outboundRoutes.push(`${this.absolutePath}/${contextId}`);\n }\n return outboundRoutes;\n }\n\n /**\n * Updates the GC nodes of this channel. It does the following:\n * - Adds a back route to self to all its child GC nodes.\n * - Adds a node for this channel.\n * @param builder - The builder that contains the GC nodes for this channel's children.\n */\n private updateGCNodes(builder: GCDataBuilder) {\n // Add a back route to self in each child's GC nodes. If any child is referenced, then its parent should\n // be considered referenced as well.\n builder.addRouteToAllNodes(this.absolutePath);\n\n // Get the outbound routes and add a GC node for this channel.\n builder.addNode(\"/\", this.getOutboundRoutes());\n }\n\n /**\n * Generates data used for garbage collection. This includes a list of GC nodes that represent this channel\n * including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the\n * document. It does the following:\n * 1. Calls into each child context to get its GC data.\n * 2. Prefixs the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be\n * idenfied as belonging to the child.\n * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent\n * the GC data of this channel.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n const builder = new GCDataBuilder();\n // Iterate over each channel context and get their GC data.\n await Promise.all(Array.from(this.contexts)\n .filter(([contextId, _]) => {\n // Get GC data only for attached contexts. Detached contexts are not connected in the GC reference\n // graph so any references they might have won't be connected as well.\n return this.isChannelAttached(contextId);\n }).map(async ([contextId, context]) => {\n const contextGCData = await context.getGCData(fullGC);\n // Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.\n // This also gradually builds the id of each node to be a path from the root.\n builder.prefixAndAddNodes(contextId, contextGCData.gcNodes);\n }));\n\n this.updateGCNodes(builder);\n return builder.getGCData();\n }\n\n /**\n * After GC has run, called to notify this channel of routes that are used in it. It calls the child contexts to\n * update their used routes.\n * @param usedRoutes - The routes that are used in all contexts in this channel.\n * @param gcTimestamp - The time when GC was run that generated these used routes. If any node becomes unreferenced\n * as part of this GC run, this should be used to update the time when it happens.\n */\n public updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number) {\n // Get a map of channel ids to routes used in it.\n const usedContextRoutes = unpackChildNodesUsedRoutes(usedRoutes);\n\n // Verify that the used routes are correct.\n for (const [id] of usedContextRoutes) {\n assert(this.contexts.has(id), 0x17e /* \"Used route does not belong to any known context\" */);\n }\n\n // Update the used routes in each context. Used routes is empty for unused context.\n for (const [contextId, context] of this.contexts) {\n context.updateUsedRoutes(usedContextRoutes.get(contextId) ?? [], gcTimestamp);\n }\n }\n\n /**\n * Called when a new outbound reference is added to another node. This is used by garbage collection to identify\n * all references added in the system.\n * @param srcHandle - The handle of the node that added the reference.\n * @param outboundHandle - The handle of the outbound node that is referenced.\n */\n private addedGCOutboundReference(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) {\n this.dataStoreContext.addedGCOutboundReference?.(srcHandle, outboundHandle);\n }\n\n /**\n * Returns the base GC details for the channel with the given id. This is used to initialize its GC state.\n * @param channelId - The id of the channel context that is asked for the initial GC details.\n * @returns the requested channel's base GC details.\n */\n private async getChannelBaseGCDetails(channelId: string): Promise<IGarbageCollectionDetailsBase> {\n let channelBaseGCDetails = (await this.channelsBaseGCDetails).get(channelId);\n if (channelBaseGCDetails === undefined) {\n channelBaseGCDetails = {};\n }\n\n // Currently, channel context's are always considered used. So, it there are no used routes for it, we still\n // need to mark it as used. Add self-route (empty string) to the channel context's used routes.\n if (channelBaseGCDetails.usedRoutes === undefined || channelBaseGCDetails.usedRoutes.length === 0) {\n channelBaseGCDetails.usedRoutes = [\"\"];\n }\n return channelBaseGCDetails;\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n */\n public async summarize(fullTree: boolean = false, trackState: boolean = true): Promise<ISummaryTreeWithStats> {\n const summaryBuilder = new SummaryTreeBuilder();\n\n // Iterate over each data store and ask it to summarize\n await Promise.all(Array.from(this.contexts)\n .filter(([contextId, _]) => {\n const isAttached = this.isChannelAttached(contextId);\n // We are not expecting local dds! Summary may not capture local state.\n assert(isAttached, 0x17f /* \"Not expecting detached channels during summarize\" */);\n // If the object is registered - and we have received the sequenced op creating the object\n // (i.e. it has a base mapping) - then we go ahead and summarize\n return isAttached;\n }).map(async ([contextId, context]) => {\n // If BlobAggregationStorage is engaged, we have to write full summary for data stores\n // BlobAggregationStorage relies on this behavior, as it aggregates blobs across DDSs.\n // Not generating full summary will mean data loss, as we will overwrite aggregate blob in new summary,\n // and any virtual blobs that stayed (for unchanged DDSs) will need aggregate blob in previous summary\n // that is no longer present in this summary.\n // This is temporal limitation that can be lifted in future once BlobAggregationStorage becomes smarter.\n const contextSummary = await context.summarize(true /* fullTree */, trackState);\n summaryBuilder.addWithStats(contextId, contextSummary);\n }));\n\n return summaryBuilder.getSummaryTree();\n }\n\n public getAttachSummary(): ISummaryTreeWithStats {\n this.attachGraph();\n\n const summaryBuilder = new SummaryTreeBuilder();\n\n // Craft the .attributes file for each shared object\n for (const [contextId, context] of this.contexts) {\n if (!(context instanceof LocalChannelContextBase)) {\n throw new Error(\"Should only be called with local channel handles\");\n }\n\n if (!this.notBoundedChannelContextSet.has(contextId)) {\n let summaryTree: ISummaryTreeWithStats;\n if (context.isLoaded) {\n const contextSummary = context.getAttachSummary();\n assert(\n contextSummary.summary.type === SummaryType.Tree,\n 0x180 /* \"getAttachSummary should always return a tree\" */);\n summaryTree = { stats: contextSummary.stats, summary: contextSummary.summary };\n } else {\n // If this channel is not yet loaded, then there should be no changes in the snapshot from which\n // it was created as it is detached container. So just use the previous snapshot.\n assert(!!this.dataStoreContext.baseSnapshot,\n 0x181 /* \"BaseSnapshot should be there as detached container loaded from snapshot\" */);\n summaryTree = convertSnapshotTreeToSummaryTree(this.dataStoreContext.baseSnapshot.trees[contextId]);\n }\n summaryBuilder.addWithStats(contextId, summaryTree);\n }\n }\n\n return summaryBuilder.getSummaryTree();\n }\n\n public submitMessage(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n this.submit(type, content, localOpMetadata);\n }\n\n public submitSignal(type: string, content: any) {\n this.verifyNotClosed();\n return this.dataStoreContext.submitSignal(type, content);\n }\n\n /**\n * Will return when the data store is attached.\n */\n public async waitAttached(): Promise<void> {\n return this.deferredAttached.promise;\n }\n\n /**\n * Attach channel should only be called after the data store has been attached\n */\n private attachChannel(channel: IChannel): void {\n this.verifyNotClosed();\n // If this handle is already attached no need to attach again.\n if (channel.handle.isAttached) {\n return;\n }\n\n channel.handle.attachGraph();\n\n assert(this.isAttached, 0x182 /* \"Data store should be attached to attach the channel.\" */);\n // Get the object snapshot only if the data store is Bound and its graph is attached too,\n // because if the graph is attaching, then it would get included in the data store snapshot.\n if (this.bindState === BindState.Bound && this.graphAttachState === AttachState.Attached) {\n const summarizeResult = summarizeChannel(channel, true /* fullTree */, false /* trackState */);\n // Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.\n const snapshot = convertSummaryTreeToITree(summarizeResult.summary);\n\n const message: IAttachMessage = {\n id: channel.id,\n snapshot,\n type: channel.attributes.type,\n };\n this.pendingAttach.set(channel.id, message);\n this.submit(DataStoreMessageType.Attach, message);\n }\n\n const context = this.contexts.get(channel.id) as LocalChannelContextBase;\n context.markAttached();\n }\n\n private submitChannelOp(address: string, contents: any, localOpMetadata: unknown) {\n const envelope: IEnvelope = { address, contents };\n this.submit(DataStoreMessageType.ChannelOp, envelope, localOpMetadata);\n }\n\n private submit(\n type: DataStoreMessageType,\n content: any,\n localOpMetadata: unknown = undefined): void {\n this.verifyNotClosed();\n this.dataStoreContext.submitMessage(type, content, localOpMetadata);\n }\n\n /**\n * For messages of type MessageType.Operation, finds the right channel and asks it to resubmit the message.\n * For all other messages, just submit it again.\n * This typically happens when we reconnect and there are unacked messages.\n * @param content - The content of the original message.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n public reSubmit(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n this.verifyNotClosed();\n\n switch (type) {\n case DataStoreMessageType.ChannelOp:\n {\n // For Operations, find the right channel and trigger resubmission on it.\n const envelope = content as IEnvelope;\n const channelContext = this.contexts.get(envelope.address);\n assert(!!channelContext, 0x183 /* \"There should be a channel context for the op\" */);\n channelContext.reSubmit(envelope.contents, localOpMetadata);\n break;\n }\n case DataStoreMessageType.Attach:\n // For Attach messages, just submit them again.\n this.submit(type, content, localOpMetadata);\n break;\n default:\n unreachableCase(type);\n }\n }\n\n public async applyStashedOp(content: any): Promise<unknown> {\n const envelope = content as IEnvelope;\n const channelContext = this.contexts.get(envelope.address);\n assert(!!channelContext, 0x184 /* \"There should be a channel context for the op\" */);\n await channelContext.getChannel();\n return channelContext.applyStashedOp(envelope.contents);\n }\n\n private setChannelDirty(address: string): void {\n this.verifyNotClosed();\n this.dataStoreContext.setChannelDirty(address);\n }\n\n private processChannelOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n this.verifyNotClosed();\n\n const envelope = message.contents as IEnvelope;\n\n const transformed: ISequencedDocumentMessage = {\n ...message,\n contents: envelope.contents,\n };\n\n const channelContext = this.contexts.get(envelope.address);\n assert(!!channelContext, 0x185 /* \"Channel not found\" */);\n channelContext.processOp(transformed, local, localOpMetadata);\n\n return channelContext;\n }\n\n private attachListener() {\n this.setMaxListeners(Number.MAX_SAFE_INTEGER);\n this.dataStoreContext.once(\"attaching\", () => {\n assert(this.bindState !== BindState.NotBound,\n 0x186 /* \"Data store attaching should not occur if it is not bound\" */);\n this._attachState = AttachState.Attaching;\n // This promise resolution will be moved to attached event once we fix the scheduler.\n this.deferredAttached.resolve();\n this.emit(\"attaching\");\n });\n this.dataStoreContext.once(\"attached\", () => {\n assert(this.bindState === BindState.Bound,\n 0x187 /* \"Data store should only be attached after it is bound\" */);\n this._attachState = AttachState.Attached;\n this.emit(\"attached\");\n });\n }\n\n private verifyNotClosed() {\n if (this._disposed) {\n throw new Error(\"Runtime is closed\");\n }\n }\n}\n\n/**\n * Mixin class that adds request handler to FluidDataStoreRuntime\n * Request handler is only called when data store can't resolve request, i.e. for custom requests.\n * @param Base - base class, inherits from FluidDataStoreRuntime\n * @param requestHandler - request handler to mix in\n */\nexport const mixinRequestHandler = (\n requestHandler: (request: IRequest, runtime: FluidDataStoreRuntime) => Promise<IResponse>,\n Base: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n) => class RuntimeWithRequestHandler extends Base {\n public async request(request: IRequest) {\n const response = await super.request(request);\n if (response.status === 404) {\n return requestHandler(request, this);\n }\n return response;\n }\n } as typeof FluidDataStoreRuntime;\n\n/**\n * Mixin class that adds await for DataObject to finish initialization before we proceed to summary.\n * @param handler - handler that returns info about blob to be added to summary.\n * Or undefined not to add anything to summary.\n * @param Base - base class, inherits from FluidDataStoreRuntime\n */\nexport const mixinSummaryHandler = (\n handler: (runtime: FluidDataStoreRuntime) => Promise<{ path: string[], content: string } | undefined >,\n Base: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n) => class RuntimeWithSummarizerHandler extends Base {\n private addBlob(summary: ISummaryTreeWithStats, path: string[], content: string) {\n const firstName = path.shift();\n if (firstName === undefined) {\n throw new Error(\"Path can't be empty\");\n }\n\n let blob: ISummaryTree | ISummaryBlob = {\n type: SummaryType.Blob,\n content,\n };\n summary.stats.blobNodeCount++;\n summary.stats.totalBlobSize += content.length;\n\n for (const name of path.reverse()) {\n blob = {\n type: SummaryType.Tree,\n tree: { [name]: blob },\n };\n summary.stats.treeNodeCount++;\n }\n summary.summary.tree[firstName] = blob;\n }\n\n async summarize(...args: any[]) {\n const summary = await super.summarize(...args);\n const content = await handler(this);\n if (content !== undefined) {\n this.addBlob(summary, content.path, content.content);\n }\n return summary;\n }\n } as typeof FluidDataStoreRuntime;\n"]}
|
|
1
|
+
{"version":3,"file":"dataStoreRuntime.js","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAGH,SAAS,EACT,WAAW,GAEd,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EACH,MAAM,EACN,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,eAAe,GAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACH,WAAW,EACX,mBAAmB,GACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAIH,WAAW,GAId,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,0BAA0B,GAS7B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,gCAAgC,EAChC,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACtB,MAAM,+BAA+B,CAAC;AAOvC,OAAO,EACH,aAAa,EACb,yBAAyB,EACzB,0BAA0B,GAC7B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AACl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ACtG,OAAqC,qBAAqB,EAC5D,EAAE,CAAC,MAAM,4BAA6B,SAAQ,IAAI;IACpC,OAAO,CAAC,OAA8B,EAAE,IAAc,EAAE,OAAe;QAC3E,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,SAAS,KAAK,SAAS,EAAE;YACzB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;SAC1C;QAED,IAAI,IAAI,GAAgC;YACpC,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,OAAO;SACV,CAAC;QACF,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QAC9B,OAAO,CAAC,KAAK,CAAC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;QAE9C,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE;YAC/B,IAAI,GAAG;gBACH,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE;aACzB,CAAC;YACF,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;SACjC;QACD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,GAAG,IAAW;QAC1B,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,OAAO,KAAK,SAAS,EAAE;YACvB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;SACxD;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CAC4B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n IFluidHandle,\n IFluidHandleContext,\n IRequest,\n IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport {\n IAudience,\n IDeltaManager,\n BindState,\n AttachState,\n ILoaderOptions,\n} from \"@fluidframework/container-definitions\";\nimport { DataProcessingError } from \"@fluidframework/container-utils\";\nimport {\n assert,\n Deferred,\n LazyPromise,\n TypedEventEmitter,\n unreachableCase,\n} from \"@fluidframework/common-utils\";\nimport {\n ChildLogger,\n raiseConnectedEvent,\n} from \"@fluidframework/telemetry-utils\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport {\n IClientDetails,\n IDocumentMessage,\n ISequencedDocumentMessage,\n SummaryType,\n ISummaryBlob,\n ISummaryTree,\n IQuorumClients,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n CreateSummarizerNodeSource,\n IAttachMessage,\n IEnvelope,\n IFluidDataStoreContext,\n IFluidDataStoreChannel,\n IGarbageCollectionData,\n IGarbageCollectionDetailsBase,\n IInboundSignalMessage,\n ISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n convertSnapshotTreeToSummaryTree,\n convertSummaryTreeToITree,\n generateHandleContextPath,\n RequestParser,\n SummaryTreeBuilder,\n create404Response,\n createResponseError,\n exceptionToResponse,\n} from \"@fluidframework/runtime-utils\";\nimport {\n IChannel,\n IFluidDataStoreRuntime,\n IFluidDataStoreRuntimeEvents,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n GCDataBuilder,\n unpackChildNodesGCDetails,\n unpackChildNodesUsedRoutes,\n} from \"@fluidframework/garbage-collector\";\nimport { v4 as uuid } from \"uuid\";\nimport { IChannelContext, summarizeChannel } from \"./channelContext\";\nimport { LocalChannelContext, LocalChannelContextBase, RehydratedLocalChannelContext } from \"./localChannelContext\";\nimport { RemoteChannelContext } from \"./remoteChannelContext\";\n\nexport enum DataStoreMessageType {\n // Creates a new channel\n Attach = \"attach\",\n ChannelOp = \"op\",\n}\n\nexport interface ISharedObjectRegistry {\n // TODO consider making this async. A consequence is that either the creation of a distributed data type\n // is async or we need a new API to split the synchronous vs. asynchronous creation.\n get(name: string): IChannelFactory | undefined;\n}\n\n/**\n * Base data store class\n */\nexport class FluidDataStoreRuntime extends\nTypedEventEmitter<IFluidDataStoreRuntimeEvents> implements\nIFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {\n /**\n * Loads the data store runtime\n * @param context - The data store context\n * @param sharedObjectRegistry - The registry of shared objects used by this data store\n * @param existing - If loading from an existing file.\n */\n public static load(\n context: IFluidDataStoreContext,\n sharedObjectRegistry: ISharedObjectRegistry,\n existing: boolean,\n ): FluidDataStoreRuntime {\n return new FluidDataStoreRuntime(context, sharedObjectRegistry, existing);\n }\n\n public get IFluidRouter() { return this; }\n\n public get connected(): boolean {\n return this.dataStoreContext.connected;\n }\n\n public get clientId(): string | undefined {\n return this.dataStoreContext.clientId;\n }\n\n public get clientDetails(): IClientDetails {\n return this.dataStoreContext.clientDetails;\n }\n\n public get isAttached(): boolean {\n return this.attachState !== AttachState.Detached;\n }\n\n public get attachState(): AttachState {\n return this._attachState;\n }\n\n public get absolutePath(): string {\n return generateHandleContextPath(this.id, this.routeContext);\n }\n\n public get routeContext(): IFluidHandleContext {\n return this.dataStoreContext.IFluidHandleContext;\n }\n\n public get IFluidHandleContext() { return this; }\n\n public get rootRoutingContext() { return this; }\n public get channelsRoutingContext() { return this; }\n public get objectsRoutingContext() { return this; }\n\n private _disposed = false;\n public get disposed() { return this._disposed; }\n\n private readonly contexts = new Map<string, IChannelContext>();\n private readonly contextsDeferred = new Map<string, Deferred<IChannelContext>>();\n private readonly pendingAttach = new Map<string, IAttachMessage>();\n\n private bindState: BindState;\n // For new data stores, this is used to break the recursion while attaching the graph. The graph must be attached\n // before the data store can move to Attached state (see _attachState) and become live.\n // For existing data stores, the graph is always attached.\n private graphAttachState: AttachState = AttachState.Detached;\n private readonly deferredAttached = new Deferred<void>();\n private readonly localChannelContextQueue = new Map<string, LocalChannelContextBase>();\n private readonly notBoundedChannelContextSet = new Set<string>();\n private boundhandles: Set<IFluidHandle> | undefined;\n private _attachState: AttachState;\n\n public readonly id: string;\n public readonly options: ILoaderOptions;\n public readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n private readonly quorum: IQuorumClients;\n private readonly audience: IAudience;\n public readonly logger: ITelemetryLogger;\n\n // A map of child channel context ids to the their base GC details. This is used to initialize the GC state of the\n // channel contexts.\n private readonly channelsBaseGCDetails: LazyPromise<Map<string, IGarbageCollectionDetailsBase>>;\n\n public constructor(\n private readonly dataStoreContext: IFluidDataStoreContext,\n private readonly sharedObjectRegistry: ISharedObjectRegistry,\n existing: boolean,\n ) {\n super();\n\n this.logger = ChildLogger.create(\n dataStoreContext.logger,\n \"FluidDataStoreRuntime\",\n {all:{ dataStoreId: uuid() }},\n );\n\n this.id = dataStoreContext.id;\n this.options = dataStoreContext.options;\n this.deltaManager = dataStoreContext.deltaManager;\n this.quorum = dataStoreContext.getQuorum();\n this.audience = dataStoreContext.getAudience();\n\n const tree = dataStoreContext.baseSnapshot;\n\n this.channelsBaseGCDetails = new LazyPromise(async () => {\n const baseGCDetails = await\n (this.dataStoreContext.getBaseGCDetails?.() ?? this.dataStoreContext.getInitialGCSummaryDetails());\n return unpackChildNodesGCDetails(baseGCDetails);\n });\n\n // Must always receive the data store type inside of the attributes\n if (tree?.trees !== undefined) {\n Object.keys(tree.trees).forEach((path) => {\n // Issue #4414\n if (path === \"_search\") { return; }\n\n let channelContext: IChannelContext;\n // If already exists on storage, then create a remote channel. However, if it is case of rehydrating a\n // container from snapshot where we load detached container from a snapshot, isLocalDataStore would be\n // true. In this case create a RehydratedLocalChannelContext.\n if (dataStoreContext.isLocalDataStore) {\n channelContext = new RehydratedLocalChannelContext(\n path,\n this.sharedObjectRegistry,\n this,\n this.dataStoreContext,\n this.dataStoreContext.storage,\n this.logger,\n (content, localOpMetadata) => this.submitChannelOp(path, content, localOpMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle),\n tree.trees[path]);\n // This is the case of rehydrating a detached container from snapshot. Now due to delay loading of\n // data store, if the data store is loaded after the container is attached, then we missed marking\n // the channel as attached. So mark it now. Otherwise add it to local channel context queue, so\n // that it can be mark attached later with the data store.\n if (dataStoreContext.attachState !== AttachState.Detached) {\n (channelContext as LocalChannelContextBase).markAttached();\n } else {\n this.localChannelContextQueue.set(path, channelContext as LocalChannelContextBase);\n }\n } else {\n channelContext = new RemoteChannelContext(\n this,\n dataStoreContext,\n dataStoreContext.storage,\n (content, localOpMetadata) => this.submitChannelOp(path, content, localOpMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle),\n path,\n tree.trees[path],\n this.sharedObjectRegistry,\n undefined /* extraBlobs */,\n this.dataStoreContext.getCreateChildSummarizerNodeFn(\n path,\n { type: CreateSummarizerNodeSource.FromSummary },\n ),\n async () => this.getChannelBaseGCDetails(path));\n }\n const deferred = new Deferred<IChannelContext>();\n deferred.resolve(channelContext);\n\n this.contexts.set(path, channelContext);\n this.contextsDeferred.set(path, deferred);\n });\n }\n\n this.attachListener();\n // If exists on storage or loaded from a snapshot, it should already be binded.\n this.bindState = existing ? BindState.Bound : BindState.NotBound;\n this._attachState = dataStoreContext.attachState;\n\n // If it's existing we know it has been attached.\n if (existing) {\n this.deferredAttached.resolve();\n }\n }\n\n public dispose(): void {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n\n this.emit(\"dispose\");\n this.removeAllListeners();\n }\n\n public async resolveHandle(request: IRequest): Promise<IResponse> {\n return this.request(request);\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n try {\n const parser = RequestParser.create(request);\n const id = parser.pathParts[0];\n\n if (id === \"_channels\" || id === \"_custom\") {\n return this.request(parser.createSubRequest(1));\n }\n\n // Check for a data type reference first\n if (this.contextsDeferred.has(id) && parser.isLeaf(1)) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const value = await this.contextsDeferred.get(id)!.promise;\n const channel = await value.getChannel();\n\n return { mimeType: \"fluid/object\", status: 200, value: channel };\n } catch (error) {\n this.logger.sendErrorEvent({ eventName: \"GetChannelFailedInRequest\" }, error);\n\n return createResponseError(500, `Failed to get Channel: ${error}`, request);\n }\n }\n\n // Otherwise defer to an attached request handler\n return create404Response(request);\n } catch (error) {\n return exceptionToResponse(error);\n }\n }\n\n public async getChannel(id: string): Promise<IChannel> {\n this.verifyNotClosed();\n\n // TODO we don't assume any channels (even root) in the runtime. If you request a channel that doesn't exist\n // we will never resolve the promise. May want a flag to getChannel that doesn't wait for the promise if\n // it doesn't exist\n if (!this.contextsDeferred.has(id)) {\n this.contextsDeferred.set(id, new Deferred<IChannelContext>());\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const context = await this.contextsDeferred.get(id)!.promise;\n const channel = await context.getChannel();\n\n return channel;\n }\n\n public createChannel(id: string = uuid(), type: string): IChannel {\n this.verifyNotClosed();\n\n assert(!this.contexts.has(id), 0x179 /* \"createChannel() with existing ID\" */);\n this.notBoundedChannelContextSet.add(id);\n const context = new LocalChannelContext(\n id,\n this.sharedObjectRegistry,\n type,\n this,\n this.dataStoreContext,\n this.dataStoreContext.storage,\n this.logger,\n (content, localOpMetadata) => this.submitChannelOp(id, content, localOpMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle));\n this.contexts.set(id, context);\n\n if (this.contextsDeferred.has(id)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.contextsDeferred.get(id)!.resolve(context);\n } else {\n const deferred = new Deferred<IChannelContext>();\n deferred.resolve(context);\n this.contextsDeferred.set(id, deferred);\n }\n\n assert(!!context.channel, 0x17a /* \"Channel should be loaded when created!!\" */);\n return context.channel;\n }\n\n /**\n * Binds a channel with the runtime. If the runtime is attached we will attach the channel right away.\n * If the runtime is not attached we will defer the attach until the runtime attaches.\n * @param channel - channel to be registered.\n */\n public bindChannel(channel: IChannel): void {\n assert(this.notBoundedChannelContextSet.has(channel.id),\n 0x17b /* \"Channel to be binded should be in not bounded set\" */);\n this.notBoundedChannelContextSet.delete(channel.id);\n // If our data store is attached, then attach the channel.\n if (this.isAttached) {\n this.attachChannel(channel);\n return;\n } else {\n this.bind(channel.handle);\n\n // If our data store is local then add the channel to the queue\n if (!this.localChannelContextQueue.has(channel.id)) {\n this.localChannelContextQueue.set(channel.id, this.contexts.get(channel.id) as LocalChannelContextBase);\n }\n }\n }\n\n public attachGraph() {\n if (this.graphAttachState !== AttachState.Detached) {\n return;\n }\n this.graphAttachState = AttachState.Attaching;\n if (this.boundhandles !== undefined) {\n this.boundhandles.forEach((handle) => {\n handle.attachGraph();\n });\n this.boundhandles = undefined;\n }\n\n // Flush the queue to set any pre-existing channels to local\n this.localChannelContextQueue.forEach((channel) => {\n // When we are attaching the data store we don't need to send attach for the registered services.\n // This is because they will be captured as part of the Attach data store snapshot\n channel.markAttached();\n });\n\n this.localChannelContextQueue.clear();\n this.bindToContext();\n this.graphAttachState = AttachState.Attached;\n }\n\n /**\n * Binds this runtime to the container\n * This includes the following:\n * 1. Sending an Attach op that includes all existing state\n * 2. Attaching the graph if the data store becomes attached.\n */\n public bindToContext() {\n if (this.bindState !== BindState.NotBound) {\n return;\n }\n this.bindState = BindState.Binding;\n this.dataStoreContext.bindToContext();\n this.bindState = BindState.Bound;\n }\n\n public bind(handle: IFluidHandle): void {\n // If the data store is already attached or its graph is already in attaching or attached state,\n // then attach the incoming handle too.\n if (this.isAttached || this.graphAttachState !== AttachState.Detached) {\n handle.attachGraph();\n return;\n }\n if (this.boundhandles === undefined) {\n this.boundhandles = new Set<IFluidHandle>();\n }\n\n this.boundhandles.add(handle);\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n this.verifyNotClosed();\n\n for (const [, object] of this.contexts) {\n object.setConnectionState(connected, clientId);\n }\n\n raiseConnectedEvent(this.logger, this, connected, clientId);\n }\n\n public getQuorum(): IQuorumClients {\n return this.quorum;\n }\n\n public getAudience(): IAudience {\n return this.audience;\n }\n\n public async uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n this.verifyNotClosed();\n\n return this.dataStoreContext.uploadBlob(blob);\n }\n\n public process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n this.verifyNotClosed();\n\n try {\n // catches as data processing error whether or not they come from async pending queues\n switch (message.type) {\n case DataStoreMessageType.Attach: {\n const attachMessage = message.contents as IAttachMessage;\n const id = attachMessage.id;\n\n // If a non-local operation then go and create the object\n // Otherwise mark it as officially attached.\n if (local) {\n assert(this.pendingAttach.has(id), 0x17c /* \"Unexpected attach (local) channel OP\" */);\n this.pendingAttach.delete(id);\n } else {\n assert(!this.contexts.has(id),\n 0x17d, /* `Unexpected attach channel OP,\n is in pendingAttach set: ${this.pendingAttach.has(id)},\n is local channel contexts: ${this.contexts.get(id) instanceof LocalChannelContextBase}` */);\n\n const flatBlobs = new Map<string, ArrayBufferLike>();\n const snapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatBlobs);\n\n const remoteChannelContext = new RemoteChannelContext(\n this,\n this.dataStoreContext,\n this.dataStoreContext.storage,\n (content, localContentMetadata) => this.submitChannelOp(id, content, localContentMetadata),\n (address: string) => this.setChannelDirty(address),\n (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n this.addedGCOutboundReference(srcHandle, outboundHandle),\n id,\n snapshotTree,\n this.sharedObjectRegistry,\n flatBlobs,\n this.dataStoreContext.getCreateChildSummarizerNodeFn(\n id,\n {\n type: CreateSummarizerNodeSource.FromAttach,\n sequenceNumber: message.sequenceNumber,\n snapshot: attachMessage.snapshot,\n },\n ),\n async () => this.getChannelBaseGCDetails(id),\n attachMessage.type);\n\n this.contexts.set(id, remoteChannelContext);\n if (this.contextsDeferred.has(id)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.contextsDeferred.get(id)!.resolve(remoteChannelContext);\n } else {\n const deferred = new Deferred<IChannelContext>();\n deferred.resolve(remoteChannelContext);\n this.contextsDeferred.set(id, deferred);\n }\n }\n break;\n }\n\n case DataStoreMessageType.ChannelOp:\n this.processChannelOp(message, local, localOpMetadata);\n break;\n default:\n }\n\n this.emit(\"op\", message);\n } catch (error) {\n throw DataProcessingError.wrapIfUnrecognized(error, \"fluidDataStoreRuntimeFailedToProcessMessage\", message);\n }\n }\n\n public processSignal(message: IInboundSignalMessage, local: boolean) {\n this.emit(\"signal\", message, local);\n }\n\n private isChannelAttached(id: string): boolean {\n return (\n // Added in createChannel\n // Removed when bindChannel is called\n !this.notBoundedChannelContextSet.has(id)\n // Added in bindChannel only if this is not attached yet\n // Removed when this is attached by calling attachGraph\n && !this.localChannelContextQueue.has(id)\n // Added in attachChannel called by bindChannel\n // Removed when attach op is broadcast\n && !this.pendingAttach.has(id)\n );\n }\n\n /**\n * Returns the outbound routes of this channel. Currently, all contexts in this channel are considered\n * referenced and are hence outbound. This will change when we have root and non-root channel contexts.\n * The only root contexts will be considered as referenced.\n */\n private getOutboundRoutes(): string[] {\n const outboundRoutes: string[] = [];\n for (const [contextId] of this.contexts) {\n outboundRoutes.push(`${this.absolutePath}/${contextId}`);\n }\n return outboundRoutes;\n }\n\n /**\n * Updates the GC nodes of this channel. It does the following:\n * - Adds a back route to self to all its child GC nodes.\n * - Adds a node for this channel.\n * @param builder - The builder that contains the GC nodes for this channel's children.\n */\n private updateGCNodes(builder: GCDataBuilder) {\n // Add a back route to self in each child's GC nodes. If any child is referenced, then its parent should\n // be considered referenced as well.\n builder.addRouteToAllNodes(this.absolutePath);\n\n // Get the outbound routes and add a GC node for this channel.\n builder.addNode(\"/\", this.getOutboundRoutes());\n }\n\n /**\n * Generates data used for garbage collection. This includes a list of GC nodes that represent this channel\n * including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the\n * document. It does the following:\n * 1. Calls into each child context to get its GC data.\n * 2. Prefixs the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be\n * idenfied as belonging to the child.\n * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent\n * the GC data of this channel.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n const builder = new GCDataBuilder();\n // Iterate over each channel context and get their GC data.\n await Promise.all(Array.from(this.contexts)\n .filter(([contextId, _]) => {\n // Get GC data only for attached contexts. Detached contexts are not connected in the GC reference\n // graph so any references they might have won't be connected as well.\n return this.isChannelAttached(contextId);\n }).map(async ([contextId, context]) => {\n const contextGCData = await context.getGCData(fullGC);\n // Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.\n // This also gradually builds the id of each node to be a path from the root.\n builder.prefixAndAddNodes(contextId, contextGCData.gcNodes);\n }));\n\n this.updateGCNodes(builder);\n return builder.getGCData();\n }\n\n /**\n * After GC has run, called to notify this channel of routes that are used in it. It calls the child contexts to\n * update their used routes.\n * @param usedRoutes - The routes that are used in all contexts in this channel.\n * @param gcTimestamp - The time when GC was run that generated these used routes. If any node becomes unreferenced\n * as part of this GC run, this should be used to update the time when it happens.\n */\n public updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number) {\n // Get a map of channel ids to routes used in it.\n const usedContextRoutes = unpackChildNodesUsedRoutes(usedRoutes);\n\n // Verify that the used routes are correct.\n for (const [id] of usedContextRoutes) {\n assert(this.contexts.has(id), 0x17e /* \"Used route does not belong to any known context\" */);\n }\n\n // Update the used routes in each context. Used routes is empty for unused context.\n for (const [contextId, context] of this.contexts) {\n context.updateUsedRoutes(usedContextRoutes.get(contextId) ?? [], gcTimestamp);\n }\n }\n\n /**\n * Called when a new outbound reference is added to another node. This is used by garbage collection to identify\n * all references added in the system.\n * @param srcHandle - The handle of the node that added the reference.\n * @param outboundHandle - The handle of the outbound node that is referenced.\n */\n private addedGCOutboundReference(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) {\n this.dataStoreContext.addedGCOutboundReference?.(srcHandle, outboundHandle);\n }\n\n /**\n * Returns the base GC details for the channel with the given id. This is used to initialize its GC state.\n * @param channelId - The id of the channel context that is asked for the initial GC details.\n * @returns the requested channel's base GC details.\n */\n private async getChannelBaseGCDetails(channelId: string): Promise<IGarbageCollectionDetailsBase> {\n let channelBaseGCDetails = (await this.channelsBaseGCDetails).get(channelId);\n if (channelBaseGCDetails === undefined) {\n channelBaseGCDetails = {};\n }\n\n // Currently, channel context's are always considered used. So, it there are no used routes for it, we still\n // need to mark it as used. Add self-route (empty string) to the channel context's used routes.\n if (channelBaseGCDetails.usedRoutes === undefined || channelBaseGCDetails.usedRoutes.length === 0) {\n channelBaseGCDetails.usedRoutes = [\"\"];\n }\n return channelBaseGCDetails;\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n */\n public async summarize(fullTree: boolean = false, trackState: boolean = true): Promise<ISummaryTreeWithStats> {\n const summaryBuilder = new SummaryTreeBuilder();\n\n // Iterate over each data store and ask it to summarize\n await Promise.all(Array.from(this.contexts)\n .filter(([contextId, _]) => {\n const isAttached = this.isChannelAttached(contextId);\n // We are not expecting local dds! Summary may not capture local state.\n assert(isAttached, 0x17f /* \"Not expecting detached channels during summarize\" */);\n // If the object is registered - and we have received the sequenced op creating the object\n // (i.e. it has a base mapping) - then we go ahead and summarize\n return isAttached;\n }).map(async ([contextId, context]) => {\n // If BlobAggregationStorage is engaged, we have to write full summary for data stores\n // BlobAggregationStorage relies on this behavior, as it aggregates blobs across DDSs.\n // Not generating full summary will mean data loss, as we will overwrite aggregate blob in new summary,\n // and any virtual blobs that stayed (for unchanged DDSs) will need aggregate blob in previous summary\n // that is no longer present in this summary.\n // This is temporal limitation that can be lifted in future once BlobAggregationStorage becomes smarter.\n const contextSummary = await context.summarize(true /* fullTree */, trackState);\n summaryBuilder.addWithStats(contextId, contextSummary);\n }));\n\n return summaryBuilder.getSummaryTree();\n }\n\n public getAttachSummary(): ISummaryTreeWithStats {\n this.attachGraph();\n\n const summaryBuilder = new SummaryTreeBuilder();\n\n // Craft the .attributes file for each shared object\n for (const [contextId, context] of this.contexts) {\n if (!(context instanceof LocalChannelContextBase)) {\n throw new Error(\"Should only be called with local channel handles\");\n }\n\n if (!this.notBoundedChannelContextSet.has(contextId)) {\n let summaryTree: ISummaryTreeWithStats;\n if (context.isLoaded) {\n const contextSummary = context.getAttachSummary();\n assert(\n contextSummary.summary.type === SummaryType.Tree,\n 0x180 /* \"getAttachSummary should always return a tree\" */);\n summaryTree = { stats: contextSummary.stats, summary: contextSummary.summary };\n } else {\n // If this channel is not yet loaded, then there should be no changes in the snapshot from which\n // it was created as it is detached container. So just use the previous snapshot.\n assert(!!this.dataStoreContext.baseSnapshot,\n 0x181 /* \"BaseSnapshot should be there as detached container loaded from snapshot\" */);\n summaryTree = convertSnapshotTreeToSummaryTree(this.dataStoreContext.baseSnapshot.trees[contextId]);\n }\n summaryBuilder.addWithStats(contextId, summaryTree);\n }\n }\n\n return summaryBuilder.getSummaryTree();\n }\n\n public submitMessage(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n this.submit(type, content, localOpMetadata);\n }\n\n public submitSignal(type: string, content: any) {\n this.verifyNotClosed();\n return this.dataStoreContext.submitSignal(type, content);\n }\n\n /**\n * Will return when the data store is attached.\n */\n public async waitAttached(): Promise<void> {\n return this.deferredAttached.promise;\n }\n\n /**\n * Attach channel should only be called after the data store has been attached\n */\n private attachChannel(channel: IChannel): void {\n this.verifyNotClosed();\n // If this handle is already attached no need to attach again.\n if (channel.handle.isAttached) {\n return;\n }\n\n channel.handle.attachGraph();\n\n assert(this.isAttached, 0x182 /* \"Data store should be attached to attach the channel.\" */);\n // Get the object snapshot only if the data store is Bound and its graph is attached too,\n // because if the graph is attaching, then it would get included in the data store snapshot.\n if (this.bindState === BindState.Bound && this.graphAttachState === AttachState.Attached) {\n const summarizeResult = summarizeChannel(channel, true /* fullTree */, false /* trackState */);\n // Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.\n const snapshot = convertSummaryTreeToITree(summarizeResult.summary);\n\n const message: IAttachMessage = {\n id: channel.id,\n snapshot,\n type: channel.attributes.type,\n };\n this.pendingAttach.set(channel.id, message);\n this.submit(DataStoreMessageType.Attach, message);\n }\n\n const context = this.contexts.get(channel.id) as LocalChannelContextBase;\n context.markAttached();\n }\n\n private submitChannelOp(address: string, contents: any, localOpMetadata: unknown) {\n const envelope: IEnvelope = { address, contents };\n this.submit(DataStoreMessageType.ChannelOp, envelope, localOpMetadata);\n }\n\n private submit(\n type: DataStoreMessageType,\n content: any,\n localOpMetadata: unknown = undefined): void {\n this.verifyNotClosed();\n this.dataStoreContext.submitMessage(type, content, localOpMetadata);\n }\n\n /**\n * For messages of type MessageType.Operation, finds the right channel and asks it to resubmit the message.\n * For all other messages, just submit it again.\n * This typically happens when we reconnect and there are unacked messages.\n * @param content - The content of the original message.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n public reSubmit(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n this.verifyNotClosed();\n\n switch (type) {\n case DataStoreMessageType.ChannelOp:\n {\n // For Operations, find the right channel and trigger resubmission on it.\n const envelope = content as IEnvelope;\n const channelContext = this.contexts.get(envelope.address);\n assert(!!channelContext, 0x183 /* \"There should be a channel context for the op\" */);\n channelContext.reSubmit(envelope.contents, localOpMetadata);\n break;\n }\n case DataStoreMessageType.Attach:\n // For Attach messages, just submit them again.\n this.submit(type, content, localOpMetadata);\n break;\n default:\n unreachableCase(type);\n }\n }\n\n public async applyStashedOp(content: any): Promise<unknown> {\n const envelope = content as IEnvelope;\n const channelContext = this.contexts.get(envelope.address);\n assert(!!channelContext, 0x184 /* \"There should be a channel context for the op\" */);\n await channelContext.getChannel();\n return channelContext.applyStashedOp(envelope.contents);\n }\n\n private setChannelDirty(address: string): void {\n this.verifyNotClosed();\n this.dataStoreContext.setChannelDirty(address);\n }\n\n private processChannelOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n this.verifyNotClosed();\n\n const envelope = message.contents as IEnvelope;\n\n const transformed: ISequencedDocumentMessage = {\n ...message,\n contents: envelope.contents,\n };\n\n const channelContext = this.contexts.get(envelope.address);\n assert(!!channelContext, 0x185 /* \"Channel not found\" */);\n channelContext.processOp(transformed, local, localOpMetadata);\n\n return channelContext;\n }\n\n private attachListener() {\n this.setMaxListeners(Number.MAX_SAFE_INTEGER);\n this.dataStoreContext.once(\"attaching\", () => {\n assert(this.bindState !== BindState.NotBound,\n 0x186 /* \"Data store attaching should not occur if it is not bound\" */);\n this._attachState = AttachState.Attaching;\n // This promise resolution will be moved to attached event once we fix the scheduler.\n this.deferredAttached.resolve();\n this.emit(\"attaching\");\n });\n this.dataStoreContext.once(\"attached\", () => {\n assert(this.bindState === BindState.Bound,\n 0x187 /* \"Data store should only be attached after it is bound\" */);\n this._attachState = AttachState.Attached;\n this.emit(\"attached\");\n });\n }\n\n private verifyNotClosed() {\n if (this._disposed) {\n throw new Error(\"Runtime is closed\");\n }\n }\n}\n\n/**\n * Mixin class that adds request handler to FluidDataStoreRuntime\n * Request handler is only called when data store can't resolve request, i.e. for custom requests.\n * @param Base - base class, inherits from FluidDataStoreRuntime\n * @param requestHandler - request handler to mix in\n */\nexport const mixinRequestHandler = (\n requestHandler: (request: IRequest, runtime: FluidDataStoreRuntime) => Promise<IResponse>,\n Base: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n) => class RuntimeWithRequestHandler extends Base {\n public async request(request: IRequest) {\n const response = await super.request(request);\n if (response.status === 404) {\n return requestHandler(request, this);\n }\n return response;\n }\n } as typeof FluidDataStoreRuntime;\n\n/**\n * Mixin class that adds await for DataObject to finish initialization before we proceed to summary.\n * @param handler - handler that returns info about blob to be added to summary.\n * Or undefined not to add anything to summary.\n * @param Base - base class, inherits from FluidDataStoreRuntime\n */\nexport const mixinSummaryHandler = (\n handler: (runtime: FluidDataStoreRuntime) => Promise<{ path: string[], content: string } | undefined >,\n Base: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n) => class RuntimeWithSummarizerHandler extends Base {\n private addBlob(summary: ISummaryTreeWithStats, path: string[], content: string) {\n const firstName = path.shift();\n if (firstName === undefined) {\n throw new Error(\"Path can't be empty\");\n }\n\n let blob: ISummaryTree | ISummaryBlob = {\n type: SummaryType.Blob,\n content,\n };\n summary.stats.blobNodeCount++;\n summary.stats.totalBlobSize += content.length;\n\n for (const name of path.reverse()) {\n blob = {\n type: SummaryType.Tree,\n tree: { [name]: blob },\n };\n summary.stats.treeNodeCount++;\n }\n summary.summary.tree[firstName] = blob;\n }\n\n async summarize(...args: any[]) {\n const summary = await super.summarize(...args);\n const content = await handler(this);\n if (content !== undefined) {\n this.addBlob(summary, content.path, content.content);\n }\n return summary;\n }\n } as typeof FluidDataStoreRuntime;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelContext.d.ts","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,EACH,QAAQ,EACR,sBAAsB,EACtB,eAAe,EAElB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EACnB,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EAAU,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CA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AoB,SAAQ,uBAAuB;IAC5D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAGtB;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;gBAEjC,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,qBAAqB,EAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,sBAAsB,EAC/B,gBAAgB,EAAE,sBAAsB,EACxC,cAAc,EAAE,uBAAuB,EACvC,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI,EAC1D,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EAClC,0BAA0B,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,KAAK,IAAI;CAsBlG"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// eslint-disable-next-line import/no-internal-modules
|
|
6
6
|
import cloneDeep from "lodash/cloneDeep";
|
|
7
7
|
import { readAndParse } from "@fluidframework/driver-utils";
|
|
8
|
-
import {
|
|
8
|
+
import { DataProcessingError } from "@fluidframework/container-utils";
|
|
9
9
|
import { assert, Lazy } from "@fluidframework/common-utils";
|
|
10
10
|
import { createServiceEndpoints, summarizeChannel, summarizeChannelAsync, } from "./channelContext";
|
|
11
11
|
/**
|
|
@@ -116,7 +116,7 @@ export class RehydratedLocalChannelContext extends LocalChannelContextBase {
|
|
|
116
116
|
if (this.channel === undefined) {
|
|
117
117
|
this.channel = await this.loadChannel()
|
|
118
118
|
.catch((err) => {
|
|
119
|
-
throw
|
|
119
|
+
throw DataProcessingError.wrapIfUnrecognized(err, "rehydratedLocalChannelContextFailedToLoadChannel", undefined);
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
return this.channel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelContext.js","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAA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AiB,CAAC,CAAC;SAC7D;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE;YAC1B,OAAO,sBAAsB,CACzB,IAAI,CAAC,EAAE,EACP,gBAAgB,CAAC,SAAS,EAC1B,QAAQ,EACR,IAAI,CAAC,OAAO,EACZ,0BAA0B,EAC1B,cAAc,EACd,MAAM,CACT,CAAC;QACN,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// eslint-disable-next-line import/no-internal-modules\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannel,\n IFluidDataStoreRuntime,\n IChannelFactory,\n IChannelAttributes,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n IFluidDataStoreContext,\n IGarbageCollectionData,\n ISummarizeResult,\n} from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { CreateProcessingError } from \"@fluidframework/container-utils\";\nimport { assert, Lazy } from \"@fluidframework/common-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n createServiceEndpoints,\n IChannelContext,\n summarizeChannel,\n summarizeChannelAsync,\n} from \"./channelContext\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\nimport { ChannelStorageService } from \"./channelStorageService\";\n\n/**\n * Channel context for a locally created channel\n */\nexport abstract class LocalChannelContextBase implements IChannelContext {\n public channel: IChannel | undefined;\n private attached = false;\n protected readonly pending: ISequencedDocumentMessage[] = [];\n protected factory: IChannelFactory | undefined;\n constructor(\n protected readonly id: string,\n protected readonly registry: ISharedObjectRegistry,\n protected readonly runtime: IFluidDataStoreRuntime,\n private readonly servicesGetter: () => Lazy<{\n readonly deltaConnection: ChannelDeltaConnection,\n readonly objectStorage: ChannelStorageService,\n }>,\n ) {\n }\n\n public async getChannel(): Promise<IChannel> {\n assert(this.channel !== undefined, 0x207 /* \"Channel should be defined\" */);\n return this.channel;\n }\n\n public get isLoaded(): boolean {\n return this.channel !== undefined;\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n // Connection events are ignored if the data store is not yet attached or loaded\n if (this.attached && this.isLoaded) {\n this.servicesGetter().value.deltaConnection.setConnectionState(connected);\n }\n }\n\n public processOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n assert(this.attached, 0x188 /* \"Local channel must be attached when processing op\" */);\n\n // A local channel may not be loaded in case where we rehydrate the container from a snapshot because of\n // delay loading. So after the container is attached and some other client joins which start generating\n // ops for this channel. So not loaded local channel can still receive ops and we store them to process later.\n if (this.isLoaded) {\n this.servicesGetter().value.deltaConnection.process(message, local, localOpMetadata);\n } else {\n assert(local === false,\n 0x189 /* \"Should always be remote because a local dds shouldn't generate ops before loading\" */);\n this.pending.push(message);\n }\n }\n\n public reSubmit(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x18a /* \"Channel should be loaded to resubmit ops\" */);\n assert(this.attached, 0x18b /* \"Local channel must be attached when resubmitting op\" */);\n this.servicesGetter().value.deltaConnection.reSubmit(content, localOpMetadata);\n }\n\n public applyStashedOp() {\n throw new Error(\"no stashed ops on local channel\");\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n */\n public async summarize(fullTree: boolean = false, trackState: boolean = false): Promise<ISummarizeResult> {\n assert(this.isLoaded && this.channel !== undefined, 0x18c /* \"Channel should be loaded to summarize\" */);\n return summarizeChannelAsync(this.channel, fullTree, trackState);\n }\n\n public getAttachSummary(): ISummarizeResult {\n assert(this.isLoaded && this.channel !== undefined, 0x18d /* \"Channel should be loaded to take snapshot\" */);\n return summarizeChannel(this.channel, true /* fullTree */, false /* trackState */);\n }\n\n public markAttached(): void {\n if (this.attached) {\n throw new Error(\"Channel is already attached\");\n }\n\n if (this.isLoaded) {\n assert(!!this.channel, 0x192 /* \"Channel should be there if loaded!!\" */);\n this.channel.connect(this.servicesGetter().value);\n }\n this.attached = true;\n }\n\n /**\n * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n * Each node has a set of outbound routes to other GC nodes in the document. This should be called only after\n * the context has loaded.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n assert(this.isLoaded && this.channel !== undefined, 0x193 /* \"Channel should be loaded to run GC\" */);\n return this.channel.getGCData(fullGC);\n }\n\n public updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number) {\n /**\n * Currently, DDSs are always considered referenced and are not garbage collected.\n * Once we have GC at DDS level, this channel context's used routes will be updated as per the passed\n * value. See - https://github.com/microsoft/FluidFramework/issues/4611\n */\n }\n}\n\nexport class RehydratedLocalChannelContext extends LocalChannelContextBase {\n private readonly services: Lazy<{\n readonly deltaConnection: ChannelDeltaConnection,\n readonly objectStorage: ChannelStorageService,\n }>;\n\n private readonly dirtyFn: () => void;\n\n constructor(\n id: string,\n registry: ISharedObjectRegistry,\n runtime: IFluidDataStoreRuntime,\n dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n logger: ITelemetryLogger,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n private readonly snapshotTree: ISnapshotTree,\n ) {\n super(id, registry, runtime, () => this.services);\n const blobMap: Map<string, ArrayBufferLike> = new Map<string, ArrayBufferLike>();\n const clonedSnapshotTree = cloneDeep(this.snapshotTree);\n // 0.47 back-compat Need to sanitize if snapshotTree.blobs still contains blob contents too.\n // This is for older snapshot which is generated by loader <=0.47 version which still contains\n // the contents within blobs. After a couple of revisions we can remove it.\n if (this.isSnapshotInOldFormatAndCollectBlobs(clonedSnapshotTree, blobMap)) {\n this.sanitizeSnapshot(clonedSnapshotTree);\n }\n\n this.services = new Lazy(() => {\n return createServiceEndpoints(\n this.id,\n dataStoreContext.connected,\n submitFn,\n this.dirtyFn,\n addedGCOutboundReferenceFn,\n storageService,\n logger,\n clonedSnapshotTree,\n blobMap,\n );\n });\n this.dirtyFn = () => { dirtyFn(id); };\n }\n\n public async getChannel(): Promise<IChannel> {\n if (this.channel === undefined) {\n this.channel = await this.loadChannel()\n .catch((err) => {\n throw CreateProcessingError(err, \"rehydratedLocalChannelContextFailedToLoadChannel\", undefined);\n });\n }\n return this.channel;\n }\n\n private async loadChannel(): Promise<IChannel> {\n assert(!this.isLoaded, 0x18e /* \"Channel must not already be loaded when loading\" */);\n assert(await this.services.value.objectStorage.contains(\".attributes\"),\n 0x190 /* \".attributes blob should be present\" */);\n const attributes = await readAndParse<IChannelAttributes>(\n this.services.value.objectStorage,\n \".attributes\");\n\n assert(this.factory === undefined, 0x208 /* \"Factory should be undefined before loading\" */);\n this.factory = this.registry.get(attributes.type);\n if (this.factory === undefined) {\n throw new Error(`Channel Factory ${attributes.type} not registered`);\n }\n // Services will be assigned during this load.\n const channel = await this.factory.load(\n this.runtime,\n this.id,\n this.services.value,\n attributes);\n\n // Commit changes.\n this.channel = channel;\n\n // Send all pending messages to the channel\n for (const message of this.pending) {\n this.services.value.deltaConnection.process(message, false, undefined /* localOpMetadata */);\n }\n return this.channel;\n }\n\n private isSnapshotInOldFormatAndCollectBlobs(\n snapshotTree: ISnapshotTree,\n blobMap: Map<string, ArrayBufferLike>,\n ): boolean {\n let sanitize = false;\n const blobsContents: {[path: string]: ArrayBufferLike} = (snapshotTree as any).blobsContents;\n Object.entries(blobsContents).forEach(([key, value]) => {\n blobMap.set(key, value);\n if (snapshotTree.blobs[key] !== undefined) {\n sanitize = true;\n }\n });\n for (const value of Object.values(snapshotTree.trees)) {\n sanitize = sanitize || this.isSnapshotInOldFormatAndCollectBlobs(value, blobMap);\n }\n return sanitize;\n }\n\n private sanitizeSnapshot(snapshotTree: ISnapshotTree) {\n const blobMapInitial = new Map(Object.entries(snapshotTree.blobs));\n for (const [blobName, blobId] of blobMapInitial.entries()) {\n const blobValue = blobMapInitial.get(blobId);\n if (blobValue === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete snapshotTree.blobs[blobName];\n }\n }\n for (const value of Object.values(snapshotTree.trees)) {\n this.sanitizeSnapshot(value);\n }\n }\n}\n\nexport class LocalChannelContext extends LocalChannelContextBase {\n private readonly services: Lazy<{\n readonly deltaConnection: ChannelDeltaConnection,\n readonly objectStorage: ChannelStorageService,\n }>;\n private readonly dirtyFn: () => void;\n constructor(\n id: string,\n registry: ISharedObjectRegistry,\n type: string,\n runtime: IFluidDataStoreRuntime,\n dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n logger: ITelemetryLogger,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n ) {\n super(id, registry, runtime, () => this.services);\n assert(type !== undefined, 0x209 /* \"Factory Type should be defined\" */);\n this.factory = registry.get(type);\n if (this.factory === undefined) {\n throw new Error(`Channel Factory ${type} not registered`);\n }\n this.channel = this.factory.create(runtime, id);\n this.services = new Lazy(() => {\n return createServiceEndpoints(\n this.id,\n dataStoreContext.connected,\n submitFn,\n this.dirtyFn,\n addedGCOutboundReferenceFn,\n storageService,\n logger,\n );\n });\n this.dir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,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,iBAAiB,CAAC,CAAC;SAC7D;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE;YAC1B,OAAO,sBAAsB,CACzB,IAAI,CAAC,EAAE,EACP,gBAAgB,CAAC,SAAS,EAC1B,QAAQ,EACR,IAAI,CAAC,OAAO,EACZ,0BAA0B,EAC1B,cAAc,EACd,MAAM,CACT,CAAC;QACN,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// eslint-disable-next-line import/no-internal-modules\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannel,\n IFluidDataStoreRuntime,\n IChannelFactory,\n IChannelAttributes,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n IFluidDataStoreContext,\n IGarbageCollectionData,\n ISummarizeResult,\n} from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { DataProcessingError } from \"@fluidframework/container-utils\";\nimport { assert, Lazy } from \"@fluidframework/common-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n createServiceEndpoints,\n IChannelContext,\n summarizeChannel,\n summarizeChannelAsync,\n} from \"./channelContext\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\nimport { ChannelStorageService } from \"./channelStorageService\";\n\n/**\n * Channel context for a locally created channel\n */\nexport abstract class LocalChannelContextBase implements IChannelContext {\n public channel: IChannel | undefined;\n private attached = false;\n protected readonly pending: ISequencedDocumentMessage[] = [];\n protected factory: IChannelFactory | undefined;\n constructor(\n protected readonly id: string,\n protected readonly registry: ISharedObjectRegistry,\n protected readonly runtime: IFluidDataStoreRuntime,\n private readonly servicesGetter: () => Lazy<{\n readonly deltaConnection: ChannelDeltaConnection,\n readonly objectStorage: ChannelStorageService,\n }>,\n ) {\n }\n\n public async getChannel(): Promise<IChannel> {\n assert(this.channel !== undefined, 0x207 /* \"Channel should be defined\" */);\n return this.channel;\n }\n\n public get isLoaded(): boolean {\n return this.channel !== undefined;\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n // Connection events are ignored if the data store is not yet attached or loaded\n if (this.attached && this.isLoaded) {\n this.servicesGetter().value.deltaConnection.setConnectionState(connected);\n }\n }\n\n public processOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n assert(this.attached, 0x188 /* \"Local channel must be attached when processing op\" */);\n\n // A local channel may not be loaded in case where we rehydrate the container from a snapshot because of\n // delay loading. So after the container is attached and some other client joins which start generating\n // ops for this channel. So not loaded local channel can still receive ops and we store them to process later.\n if (this.isLoaded) {\n this.servicesGetter().value.deltaConnection.process(message, local, localOpMetadata);\n } else {\n assert(local === false,\n 0x189 /* \"Should always be remote because a local dds shouldn't generate ops before loading\" */);\n this.pending.push(message);\n }\n }\n\n public reSubmit(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x18a /* \"Channel should be loaded to resubmit ops\" */);\n assert(this.attached, 0x18b /* \"Local channel must be attached when resubmitting op\" */);\n this.servicesGetter().value.deltaConnection.reSubmit(content, localOpMetadata);\n }\n\n public applyStashedOp() {\n throw new Error(\"no stashed ops on local channel\");\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n */\n public async summarize(fullTree: boolean = false, trackState: boolean = false): Promise<ISummarizeResult> {\n assert(this.isLoaded && this.channel !== undefined, 0x18c /* \"Channel should be loaded to summarize\" */);\n return summarizeChannelAsync(this.channel, fullTree, trackState);\n }\n\n public getAttachSummary(): ISummarizeResult {\n assert(this.isLoaded && this.channel !== undefined, 0x18d /* \"Channel should be loaded to take snapshot\" */);\n return summarizeChannel(this.channel, true /* fullTree */, false /* trackState */);\n }\n\n public markAttached(): void {\n if (this.attached) {\n throw new Error(\"Channel is already attached\");\n }\n\n if (this.isLoaded) {\n assert(!!this.channel, 0x192 /* \"Channel should be there if loaded!!\" */);\n this.channel.connect(this.servicesGetter().value);\n }\n this.attached = true;\n }\n\n /**\n * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n * Each node has a set of outbound routes to other GC nodes in the document. This should be called only after\n * the context has loaded.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n assert(this.isLoaded && this.channel !== undefined, 0x193 /* \"Channel should be loaded to run GC\" */);\n return this.channel.getGCData(fullGC);\n }\n\n public updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number) {\n /**\n * Currently, DDSs are always considered referenced and are not garbage collected.\n * Once we have GC at DDS level, this channel context's used routes will be updated as per the passed\n * value. See - https://github.com/microsoft/FluidFramework/issues/4611\n */\n }\n}\n\nexport class RehydratedLocalChannelContext extends LocalChannelContextBase {\n private readonly services: Lazy<{\n readonly deltaConnection: ChannelDeltaConnection,\n readonly objectStorage: ChannelStorageService,\n }>;\n\n private readonly dirtyFn: () => void;\n\n constructor(\n id: string,\n registry: ISharedObjectRegistry,\n runtime: IFluidDataStoreRuntime,\n dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n logger: ITelemetryLogger,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n private readonly snapshotTree: ISnapshotTree,\n ) {\n super(id, registry, runtime, () => this.services);\n const blobMap: Map<string, ArrayBufferLike> = new Map<string, ArrayBufferLike>();\n const clonedSnapshotTree = cloneDeep(this.snapshotTree);\n // 0.47 back-compat Need to sanitize if snapshotTree.blobs still contains blob contents too.\n // This is for older snapshot which is generated by loader <=0.47 version which still contains\n // the contents within blobs. After a couple of revisions we can remove it.\n if (this.isSnapshotInOldFormatAndCollectBlobs(clonedSnapshotTree, blobMap)) {\n this.sanitizeSnapshot(clonedSnapshotTree);\n }\n\n this.services = new Lazy(() => {\n return createServiceEndpoints(\n this.id,\n dataStoreContext.connected,\n submitFn,\n this.dirtyFn,\n addedGCOutboundReferenceFn,\n storageService,\n logger,\n clonedSnapshotTree,\n blobMap,\n );\n });\n this.dirtyFn = () => { dirtyFn(id); };\n }\n\n public async getChannel(): Promise<IChannel> {\n if (this.channel === undefined) {\n this.channel = await this.loadChannel()\n .catch((err) => {\n throw DataProcessingError.wrapIfUnrecognized(\n err, \"rehydratedLocalChannelContextFailedToLoadChannel\", undefined);\n });\n }\n return this.channel;\n }\n\n private async loadChannel(): Promise<IChannel> {\n assert(!this.isLoaded, 0x18e /* \"Channel must not already be loaded when loading\" */);\n assert(await this.services.value.objectStorage.contains(\".attributes\"),\n 0x190 /* \".attributes blob should be present\" */);\n const attributes = await readAndParse<IChannelAttributes>(\n this.services.value.objectStorage,\n \".attributes\");\n\n assert(this.factory === undefined, 0x208 /* \"Factory should be undefined before loading\" */);\n this.factory = this.registry.get(attributes.type);\n if (this.factory === undefined) {\n throw new Error(`Channel Factory ${attributes.type} not registered`);\n }\n // Services will be assigned during this load.\n const channel = await this.factory.load(\n this.runtime,\n this.id,\n this.services.value,\n attributes);\n\n // Commit changes.\n this.channel = channel;\n\n // Send all pending messages to the channel\n for (const message of this.pending) {\n this.services.value.deltaConnection.process(message, false, undefined /* localOpMetadata */);\n }\n return this.channel;\n }\n\n private isSnapshotInOldFormatAndCollectBlobs(\n snapshotTree: ISnapshotTree,\n blobMap: Map<string, ArrayBufferLike>,\n ): boolean {\n let sanitize = false;\n const blobsContents: {[path: string]: ArrayBufferLike} = (snapshotTree as any).blobsContents;\n Object.entries(blobsContents).forEach(([key, value]) => {\n blobMap.set(key, value);\n if (snapshotTree.blobs[key] !== undefined) {\n sanitize = true;\n }\n });\n for (const value of Object.values(snapshotTree.trees)) {\n sanitize = sanitize || this.isSnapshotInOldFormatAndCollectBlobs(value, blobMap);\n }\n return sanitize;\n }\n\n private sanitizeSnapshot(snapshotTree: ISnapshotTree) {\n const blobMapInitial = new Map(Object.entries(snapshotTree.blobs));\n for (const [blobName, blobId] of blobMapInitial.entries()) {\n const blobValue = blobMapInitial.get(blobId);\n if (blobValue === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete snapshotTree.blobs[blobName];\n }\n }\n for (const value of Object.values(snapshotTree.trees)) {\n this.sanitizeSnapshot(value);\n }\n }\n}\n\nexport class LocalChannelContext extends LocalChannelContextBase {\n private readonly services: Lazy<{\n readonly deltaConnection: ChannelDeltaConnection,\n readonly objectStorage: ChannelStorageService,\n }>;\n private readonly dirtyFn: () => void;\n constructor(\n id: string,\n registry: ISharedObjectRegistry,\n type: string,\n runtime: IFluidDataStoreRuntime,\n dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n logger: ITelemetryLogger,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n ) {\n super(id, registry, runtime, () => this.services);\n assert(type !== undefined, 0x209 /* \"Factory Type should be defined\" */);\n this.factory = registry.get(type);\n if (this.factory === undefined) {\n throw new Error(`Channel Factory ${type} not registered`);\n }\n this.channel = this.factory.create(runtime, id);\n this.services = new Lazy(() => {\n return createServiceEndpoints(\n this.id,\n dataStoreContext.connected,\n submitFn,\n this.dirtyFn,\n addedGCOutboundReferenceFn,\n storageService,\n logger,\n );\n });\n this.dirtyFn = () => { dirtyFn(id); };\n }\n}\n"]}
|
package/lib/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/datastore";
|
|
8
|
-
export declare const pkgVersion = "0.
|
|
8
|
+
export declare const pkgVersion = "0.58.0-55983";
|
|
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,8BAA8B,CAAC;AACnD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,8BAA8B,CAAC;AACnD,eAAO,MAAM,UAAU,iBAAiB,CAAC"}
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,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/datastore\";\nexport const pkgVersion = \"0.58.0-55983\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/datastore",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.0-55983",
|
|
4
4
|
"description": "Fluid data store implementation",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": "https://github.com/microsoft/FluidFramework",
|
|
@@ -58,26 +58,26 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
60
60
|
"@fluidframework/common-utils": "^0.32.1",
|
|
61
|
-
"@fluidframework/container-definitions": "^0.
|
|
62
|
-
"@fluidframework/container-utils": "
|
|
61
|
+
"@fluidframework/container-definitions": "^0.47.0-0",
|
|
62
|
+
"@fluidframework/container-utils": "0.58.0-55983",
|
|
63
63
|
"@fluidframework/core-interfaces": "^0.42.0",
|
|
64
|
-
"@fluidframework/datastore-definitions": "
|
|
65
|
-
"@fluidframework/driver-definitions": "^0.
|
|
66
|
-
"@fluidframework/driver-utils": "
|
|
67
|
-
"@fluidframework/garbage-collector": "
|
|
68
|
-
"@fluidframework/protocol-base": "^0.
|
|
69
|
-
"@fluidframework/protocol-definitions": "^0.
|
|
70
|
-
"@fluidframework/runtime-definitions": "
|
|
71
|
-
"@fluidframework/runtime-utils": "
|
|
72
|
-
"@fluidframework/telemetry-utils": "
|
|
64
|
+
"@fluidframework/datastore-definitions": "0.58.0-55983",
|
|
65
|
+
"@fluidframework/driver-definitions": "^0.45.0-0",
|
|
66
|
+
"@fluidframework/driver-utils": "0.58.0-55983",
|
|
67
|
+
"@fluidframework/garbage-collector": "0.58.0-55983",
|
|
68
|
+
"@fluidframework/protocol-base": "^0.1035.0-0",
|
|
69
|
+
"@fluidframework/protocol-definitions": "^0.1027.0-0",
|
|
70
|
+
"@fluidframework/runtime-definitions": "0.58.0-55983",
|
|
71
|
+
"@fluidframework/runtime-utils": "0.58.0-55983",
|
|
72
|
+
"@fluidframework/telemetry-utils": "0.58.0-55983",
|
|
73
73
|
"lodash": "^4.17.21",
|
|
74
74
|
"uuid": "^8.3.1"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@fluidframework/build-common": "^0.23.0",
|
|
78
|
-
"@fluidframework/eslint-config-fluid": "^0.26.0",
|
|
79
|
-
"@fluidframework/mocha-test-setup": "
|
|
80
|
-
"@fluidframework/test-runtime-utils": "
|
|
78
|
+
"@fluidframework/eslint-config-fluid": "^0.26.0-0",
|
|
79
|
+
"@fluidframework/mocha-test-setup": "0.58.0-55983",
|
|
80
|
+
"@fluidframework/test-runtime-utils": "0.58.0-55983",
|
|
81
81
|
"@microsoft/api-extractor": "^7.16.1",
|
|
82
82
|
"@rushstack/eslint-config": "^2.5.1",
|
|
83
83
|
"@types/mocha": "^8.2.2",
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { assert } from "@fluidframework/common-utils";
|
|
7
7
|
import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
8
8
|
import { IDeltaConnection, IDeltaHandler } from "@fluidframework/datastore-definitions";
|
|
9
|
-
import {
|
|
9
|
+
import { DataProcessingError } from "@fluidframework/container-utils";
|
|
10
10
|
import { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
11
11
|
|
|
12
12
|
export class ChannelDeltaConnection implements IDeltaConnection {
|
|
@@ -43,7 +43,8 @@ export class ChannelDeltaConnection implements IDeltaConnection {
|
|
|
43
43
|
// catches as data processing error whether or not they come from async pending queues
|
|
44
44
|
this.handler.process(message, local, localOpMetadata);
|
|
45
45
|
} catch (error) {
|
|
46
|
-
throw
|
|
46
|
+
throw DataProcessingError.wrapIfUnrecognized(
|
|
47
|
+
error, "channelDeltaConnectionFailedToProcessMessage", message);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
|
package/src/dataStoreRuntime.ts
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
AttachState,
|
|
18
18
|
ILoaderOptions,
|
|
19
19
|
} from "@fluidframework/container-definitions";
|
|
20
|
-
import {
|
|
20
|
+
import { DataProcessingError } from "@fluidframework/container-utils";
|
|
21
21
|
import {
|
|
22
22
|
assert,
|
|
23
23
|
Deferred,
|
|
@@ -532,7 +532,7 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {
|
|
|
532
532
|
|
|
533
533
|
this.emit("op", message);
|
|
534
534
|
} catch (error) {
|
|
535
|
-
throw
|
|
535
|
+
throw DataProcessingError.wrapIfUnrecognized(error, "fluidDataStoreRuntimeFailedToProcessMessage", message);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
ISummarizeResult,
|
|
21
21
|
} from "@fluidframework/runtime-definitions";
|
|
22
22
|
import { readAndParse } from "@fluidframework/driver-utils";
|
|
23
|
-
import {
|
|
23
|
+
import { DataProcessingError } from "@fluidframework/container-utils";
|
|
24
24
|
import { assert, Lazy } from "@fluidframework/common-utils";
|
|
25
25
|
import { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
26
26
|
import {
|
|
@@ -190,7 +190,8 @@ export class RehydratedLocalChannelContext extends LocalChannelContextBase {
|
|
|
190
190
|
if (this.channel === undefined) {
|
|
191
191
|
this.channel = await this.loadChannel()
|
|
192
192
|
.catch((err) => {
|
|
193
|
-
throw
|
|
193
|
+
throw DataProcessingError.wrapIfUnrecognized(
|
|
194
|
+
err, "rehydratedLocalChannelContextFailedToLoadChannel", undefined);
|
|
194
195
|
});
|
|
195
196
|
}
|
|
196
197
|
return this.channel;
|
package/src/packageVersion.ts
CHANGED