@fluidframework/datastore 2.0.0-internal.3.0.5 → 2.0.0-internal.3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +5 -7
- package/.mocharc.js +2 -2
- package/README.md +3 -0
- package/api-extractor.json +2 -2
- package/dist/channelContext.d.ts.map +1 -1
- package/dist/channelContext.js.map +1 -1
- package/dist/channelDeltaConnection.d.ts.map +1 -1
- package/dist/channelDeltaConnection.js.map +1 -1
- package/dist/channelStorageService.d.ts.map +1 -1
- package/dist/channelStorageService.js +1 -3
- package/dist/channelStorageService.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts +11 -24
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +68 -86
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/fluidHandle.d.ts.map +1 -1
- package/dist/fluidHandle.js.map +1 -1
- package/dist/localChannelContext.d.ts.map +1 -1
- package/dist/localChannelContext.js +9 -5
- package/dist/localChannelContext.js.map +1 -1
- package/dist/localChannelStorageService.d.ts.map +1 -1
- package/dist/localChannelStorageService.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/remoteChannelContext.js +2 -2
- package/dist/remoteChannelContext.js.map +1 -1
- package/lib/channelContext.d.ts.map +1 -1
- package/lib/channelContext.js.map +1 -1
- package/lib/channelDeltaConnection.d.ts.map +1 -1
- package/lib/channelDeltaConnection.js.map +1 -1
- package/lib/channelStorageService.d.ts.map +1 -1
- package/lib/channelStorageService.js +1 -3
- package/lib/channelStorageService.js.map +1 -1
- package/lib/dataStoreRuntime.d.ts +11 -24
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +71 -89
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/fluidHandle.d.ts.map +1 -1
- package/lib/fluidHandle.js.map +1 -1
- package/lib/localChannelContext.d.ts.map +1 -1
- package/lib/localChannelContext.js +9 -5
- package/lib/localChannelContext.js.map +1 -1
- package/lib/localChannelStorageService.d.ts.map +1 -1
- package/lib/localChannelStorageService.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/remoteChannelContext.d.ts.map +1 -1
- package/lib/remoteChannelContext.js +2 -2
- package/lib/remoteChannelContext.js.map +1 -1
- package/package.json +111 -110
- package/prettier.config.cjs +1 -1
- package/src/channelContext.ts +66 -65
- package/src/channelDeltaConnection.ts +50 -44
- package/src/channelStorageService.ts +58 -54
- package/src/dataStoreRuntime.ts +1122 -1086
- package/src/fluidHandle.ts +87 -91
- package/src/localChannelContext.ts +302 -255
- package/src/localChannelStorageService.ts +47 -45
- package/src/packageVersion.ts +1 -1
- package/src/remoteChannelContext.ts +300 -291
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +9 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRuntime.js","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EAGH,WAAW,GAEd,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EACH,MAAM,EACN,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,eAAe,GAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACH,WAAW,EACX,aAAa,EACb,YAAY,EACZ,yBAAyB,EAEzB,mBAAmB,EACnB,gBAAgB,GACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAIH,WAAW,GAId,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,SAAS,EACT,0BAA0B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K,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 FluidObject,\n IFluidHandle,\n IFluidHandleContext,\n IRequest,\n IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport {\n IAudience,\n IDeltaManager,\n AttachState,\n ILoaderOptions,\n} from \"@fluidframework/container-definitions\";\nimport { DataProcessingError, UsageError } from \"@fluidframework/container-utils\";\nimport {\n assert,\n Deferred,\n LazyPromise,\n TypedEventEmitter,\n unreachableCase,\n} from \"@fluidframework/common-utils\";\nimport {\n ChildLogger,\n generateStack,\n LoggingError,\n loggerToMonitoringContext,\n MonitoringContext,\n raiseConnectedEvent,\n TelemetryDataTag,\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 BindState,\n CreateSummarizerNodeSource,\n IAttachMessage,\n IEnvelope,\n IFluidDataStoreContext,\n IFluidDataStoreChannel,\n IGarbageCollectionData,\n IGarbageCollectionDetailsBase,\n IInboundSignalMessage,\n ISummaryTreeWithStats,\n VisibilityState,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n convertSnapshotTreeToSummaryTree,\n convertSummaryTreeToITree,\n generateHandleContextPath,\n RequestParser,\n SummaryTreeBuilder,\n create404Response,\n createResponseError,\n exceptionToResponse,\n requestFluidObject,\n packagePathToTelemetryProperty,\n} from \"@fluidframework/runtime-utils\";\nimport {\n IChannel,\n IFluidDataStoreRuntime,\n IFluidDataStoreRuntimeEvents,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n GCDataBuilder,\n removeRouteFromAllNodes,\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\";\nimport { FluidObjectHandle } from \"./fluidHandle\";\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\n TypedEventEmitter<IFluidDataStoreRuntimeEvents> implements\n IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {\n /**\n * @deprecated - Instantiate the class using its constructor instead.\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(\n context,\n sharedObjectRegistry,\n existing,\n async (dataStoreRuntime) => requestFluidObject(dataStoreRuntime, \"/\"));\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IFluidDataStoreRuntime.entryPoint}\n */\n public readonly entryPoint?: IFluidHandle<FluidObject>;\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 private readonly deferredAttached = new Deferred<void>();\n private readonly localChannelContextQueue = new Map<string, LocalChannelContextBase>();\n private readonly notBoundedChannelContextSet = new Set<string>();\n private _attachState: AttachState;\n public visibilityState: VisibilityState;\n // A list of handles that are bound when the data store is not visible. We have to make them visible when the data\n // store becomes visible.\n private readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();\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 private readonly mc: MonitoringContext;\n public get logger(): ITelemetryLogger {\n return this.mc.logger;\n }\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 /**\n * If the summarizer makes local changes, a telemetry event is logged. This has the potential to be very noisy.\n * So, adding a count of how many telemetry events are logged per data store context. This can be\n * controlled via feature flags.\n */\n private localChangesTelemetryCount: number;\n\n /**\n * Invokes the given callback and expects that no ops are submitted\n * until execution finishes. If an op is submitted, an error will be raised.\n *\n * Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`\n *\n * @param callback - the callback to be invoked\n */\n public ensureNoDataModelChanges<T>(callback: () => T): T {\n // back-compat ADO:2309\n return this.dataStoreContext.ensureNoDataModelChanges === undefined ?\n callback() :\n this.dataStoreContext.ensureNoDataModelChanges(callback);\n }\n\n /**\n * Create an instance of a DataStore runtime.\n *\n * @param dataStoreContext - Context object for the runtime.\n * @param sharedObjectRegistry - The registry of shared objects that this data store will be able to instantiate.\n * @param existing - Pass 'true' if loading this datastore from an existing file; pass 'false' otherwise.\n * @param initializeEntryPoint - Function to initialize the entryPoint object for the data store runtime. The\n * handle to this data store runtime will point to the object returned by this function. If this function is not\n * provided, the handle will be left undefined. This is here so we can start making handles a first-class citizen\n * and the primary way of interacting with some Fluid objects, and should be used if possible.\n */\n public constructor(\n private readonly dataStoreContext: IFluidDataStoreContext,\n private readonly sharedObjectRegistry: ISharedObjectRegistry,\n existing: boolean,\n initializeEntryPoint?: (runtime: IFluidDataStoreRuntime) => Promise<FluidObject>,\n ) {\n super();\n\n assert(!dataStoreContext.id.includes(\"/\"),\n 0x30e /* Id cannot contain slashes. DataStoreContext should have validated this. */);\n\n this.mc = loggerToMonitoringContext(\n ChildLogger.create(dataStoreContext.logger, \"FluidDataStoreRuntime\", {\n all: { dataStoreId: uuid() },\n }),\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 this.dataStoreContext.getBaseGCDetails();\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 making\n // the channel visible. So do it now. Otherwise, add it to local channel context queue, so\n // that it can be make it visible later with the data store.\n if (dataStoreContext.attachState !== AttachState.Detached) {\n (channelContext as LocalChannelContextBase).makeVisible();\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 if (initializeEntryPoint) {\n const promise = new LazyPromise(async () => initializeEntryPoint(this));\n this.entryPoint = new FluidObjectHandle<FluidObject>(promise, \"\", this.objectsRoutingContext);\n }\n\n this.attachListener();\n // If exists on storage or loaded from a snapshot, it should already be bound.\n this.bindState = existing ? BindState.Bound : BindState.NotBound;\n this._attachState = dataStoreContext.attachState;\n\n /**\n * If existing flag is false, this is a new data store and is not visible. The existing flag can be true in two\n * conditions:\n *\n * 1. It's a local data store that is created when a detached container is rehydrated. In this case, the data\n * store is locally visible because the snapshot it is loaded from contains locally visible data stores only.\n *\n * 2. It's a remote data store that is created when an attached container is loaded is loaded from snapshot or\n * when an attach op comes in. In both these cases, the data store is already globally visible.\n */\n if (existing) {\n this.visibilityState = dataStoreContext.attachState === AttachState.Detached\n ? VisibilityState.LocallyVisible : VisibilityState.GloballyVisible;\n } else {\n this.visibilityState = VisibilityState.NotVisible;\n }\n\n // If it's existing we know it has been attached.\n if (existing) {\n this.deferredAttached.resolve();\n }\n\n // By default, a data store can log maximum 10 local changes telemetry in summarizer.\n this.localChangesTelemetryCount =\n this.mc.config.getNumber(\"Fluid.Telemetry.LocalChangesTelemetryCount\") ?? 10;\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.mc.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 if (id.includes(\"/\")) {\n throw new UsageError(`Id cannot contain slashes: ${id}`);\n }\n\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 // Channels (DDS) should not be created in summarizer client.\n this.identifyLocalChangeInSummarizer(\"DDSCreatedInSummarizer\", id, type);\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 }\n\n /**\n * If this channel is already waiting to be made visible, do nothing. This can happen during attachGraph() when\n * a channel's graph is attached. It calls bindToContext on the shared object which will end up back here.\n */\n if (this.pendingHandlesToMakeVisible.has(channel.handle)) {\n return;\n }\n\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 * This function is called when a data store becomes root. It does the following:\n *\n * 1. Marks the data store locally visible in the container.\n *\n * 2. Attaches the graph of all the handles bound to it.\n *\n * 3. Calls into the data store context to mark it visible in the container too. If the container is globally\n * visible, it will mark us globally visible. Otherwise, it will mark us globally visible when it becomes\n * globally visible.\n */\n public makeVisibleAndAttachGraph() {\n if (this.visibilityState !== VisibilityState.NotVisible) {\n return;\n }\n this.visibilityState = VisibilityState.LocallyVisible;\n\n this.pendingHandlesToMakeVisible.forEach((handle) => {\n handle.attachGraph();\n });\n this.pendingHandlesToMakeVisible.clear();\n this.bindToContext();\n }\n\n /**\n * This function is called when a handle to this data store is added to a visible DDS.\n */\n public attachGraph() {\n this.makeVisibleAndAttachGraph();\n }\n\n /**\n * @deprecated - Not necessary if consumers add a new dataStore to the container by storing its handle.\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 visible, attach the incoming handle's graph. Else, this will be done when we become visible.\n if (this.visibilityState !== VisibilityState.NotVisible) {\n handle.attachGraph();\n return;\n }\n this.pendingHandlesToMakeVisible.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 *\n * 1. Calls into each child context to get its GC data.\n *\n * 2. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be\n * identified as belonging to the child.\n *\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 *\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 */\n public updateUsedRoutes(usedRoutes: string[]) {\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) ?? []);\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 } else if (channelBaseGCDetails.gcData?.gcNodes !== undefined) {\n // Note: if the child channel has an explicit handle route to its parent, it will be removed here and\n // expected to be added back by the parent when getGCData is called.\n removeRouteFromAllNodes(channelBaseGCDetails.gcData.gcNodes, this.absolutePath);\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 * @param telemetryContext - summary data passed through the layers for telemetry purposes\n */\n public async summarize(\n fullTree: boolean = false,\n trackState: boolean = true,\n telemetryContext?: ITelemetryContext,\n ): 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 const contextSummary = await context.summarize(fullTree, trackState, telemetryContext);\n summaryBuilder.addWithStats(contextId, contextSummary);\n }));\n\n return summaryBuilder.getSummaryTree();\n }\n\n public getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n /**\n * back-compat 0.59.1000 - getAttachSummary() is called when making a data store globally visible (previously\n * attaching state). Ideally, attachGraph() should have already be called making it locally visible. However,\n * before visibility state was added, this may not have been the case and getAttachSummary() could be called:\n *\n * 1. Before attaching the data store - When a detached container is attached.\n *\n * 2. After attaching the data store - When a data store is created and bound in an attached container.\n *\n * The basic idea is that all local object should become locally visible before they are globally visible.\n */\n this.attachGraph();\n\n // This assert cannot be added now due to back-compat. To be uncommented when the following issue is fixed -\n // https://github.com/microsoft/FluidFramework/issues/9688.\n //\n // assert(this.visibilityState === VisibilityState.LocallyVisible,\n // \"The data store should be locally visible when generating attach summary\",\n // );\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 LoggingError(\"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(telemetryContext);\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 assert(this.visibilityState === VisibilityState.GloballyVisible,\n 0x2d0 /* \"Data store should be globally visible to attach channels.\" */);\n\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 const context = this.contexts.get(channel.id) as LocalChannelContextBase;\n context.makeVisible();\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 /**\n * Revert a local op.\n * @param content - The content of the original message.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n public rollback?(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, 0x2ed /* \"There should be a channel context for the op\" */);\n channelContext.rollback(envelope.contents, localOpMetadata);\n break;\n }\n default:\n throw new LoggingError(`Can't rollback ${type} message`);\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 /**\n * back-compat 0.59.1000 - Ideally, attachGraph() should have already been called making the data store\n * locally visible. However, before visibility state was added, this may not have been the case and data\n * store can move to \"attaching\" state in 2 scenarios:\n * 1) Before attachGraph() is called - When a data store is created and bound in an attached container.\n * 2) After attachGraph() is called - When a detached container is attached.\n *\n * The basic idea is that all local object should become locally visible before they are globally visible.\n */\n this.attachGraph();\n\n this._attachState = AttachState.Attaching;\n\n assert(this.visibilityState === VisibilityState.LocallyVisible,\n 0x2d1 /* \"Data store should be locally visible before it can become globally visible.\" */);\n\n // Mark the data store globally visible and make its child channels visible as well.\n this.visibilityState = VisibilityState.GloballyVisible;\n this.localChannelContextQueue.forEach((channel) => {\n channel.makeVisible();\n });\n this.localChannelContextQueue.clear();\n\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.visibilityState === VisibilityState.GloballyVisible,\n 0x2d2 /* \"Data store should be globally visible when its attached.\" */);\n this._attachState = AttachState.Attached;\n this.emit(\"attached\");\n });\n }\n\n private verifyNotClosed() {\n if (this._disposed) {\n throw new LoggingError(\"Runtime is closed\");\n }\n }\n\n /**\n * Summarizer client should not have local changes. These changes can become part of the summary and can break\n * eventual consistency. For example, the next summary (say at ref seq# 100) may contain these changes whereas\n * other clients that are up-to-date till seq# 100 may not have them yet.\n */\n private identifyLocalChangeInSummarizer(\n eventName: string,\n channelId: string,\n channelType: string,\n ) {\n if (this.clientDetails.type !== \"summarizer\" || this.localChangesTelemetryCount <= 0) {\n return;\n }\n\n // Log a telemetry if there are local changes in the summarizer. This will give us data on how often\n // this is happening and which data stores do this. The eventual goal is to disallow local changes\n // in the summarizer and the data will help us plan this.\n this.mc.logger.sendTelemetryEvent({\n eventName,\n channelType,\n channelId: {\n value: channelId,\n tag: TelemetryDataTag.CodeArtifact,\n },\n fluidDataStoreId: {\n value: this.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n fluidDataStorePackagePath: packagePathToTelemetryProperty(\n this.dataStoreContext.packagePath,\n ),\n stack: generateStack(),\n });\n this.localChangesTelemetryCount--;\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 LoggingError(\"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;AAUH,OAAO,EAGN,WAAW,GAEX,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,eAAe,GACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAIN,WAAW,GAIX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,SAAS,EACT,0BAA0B,EAS1B,eAAe,GAEf,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACN,gCAAgC,EAChC,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,GAClB,MAAM,+BAA+B,CAAC;AAOvC,OAAO,EACN,aAAa,EACb,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,GAC1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAA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AAI,EAAE;aACtB,CAAC;YACF,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;SAC9B;QACD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,GAAG,IAAW;QAC7B,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;YAC1B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;SACrD;QACD,OAAO,OAAO,CAAC;IAChB,CAAC;CAC+B,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\tFluidObject,\n\tIFluidHandle,\n\tIFluidHandleContext,\n\tIRequest,\n\tIResponse,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tIAudience,\n\tIDeltaManager,\n\tAttachState,\n\tILoaderOptions,\n} from \"@fluidframework/container-definitions\";\nimport { DataProcessingError, UsageError } from \"@fluidframework/container-utils\";\nimport {\n\tassert,\n\tDeferred,\n\tLazyPromise,\n\tTypedEventEmitter,\n\tunreachableCase,\n} from \"@fluidframework/common-utils\";\nimport { ChildLogger, LoggingError, raiseConnectedEvent } from \"@fluidframework/telemetry-utils\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport {\n\tIClientDetails,\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tSummaryType,\n\tISummaryBlob,\n\tISummaryTree,\n\tIQuorumClients,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tBindState,\n\tCreateSummarizerNodeSource,\n\tIAttachMessage,\n\tIEnvelope,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreChannel,\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tIInboundSignalMessage,\n\tISummaryTreeWithStats,\n\tVisibilityState,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tgenerateHandleContextPath,\n\tRequestParser,\n\tSummaryTreeBuilder,\n\tcreate404Response,\n\tcreateResponseError,\n\texceptionToResponse,\n\trequestFluidObject,\n} from \"@fluidframework/runtime-utils\";\nimport {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n\tIFluidDataStoreRuntimeEvents,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n\tGCDataBuilder,\n\tremoveRouteFromAllNodes,\n\tunpackChildNodesGCDetails,\n\tunpackChildNodesUsedRoutes,\n} from \"@fluidframework/garbage-collector\";\nimport { v4 as uuid } from \"uuid\";\nimport { IChannelContext, summarizeChannel } from \"./channelContext\";\nimport {\n\tLocalChannelContext,\n\tLocalChannelContextBase,\n\tRehydratedLocalChannelContext,\n} from \"./localChannelContext\";\nimport { RemoteChannelContext } from \"./remoteChannelContext\";\nimport { FluidObjectHandle } from \"./fluidHandle\";\n\nexport enum DataStoreMessageType {\n\t// Creates a new channel\n\tAttach = \"attach\",\n\tChannelOp = \"op\",\n}\n\nexport interface ISharedObjectRegistry {\n\t// TODO consider making this async. A consequence is that either the creation of a distributed data type\n\t// is async or we need a new API to split the synchronous vs. asynchronous creation.\n\tget(name: string): IChannelFactory | undefined;\n}\n\n/**\n * Base data store class\n */\nexport class FluidDataStoreRuntime\n\textends TypedEventEmitter<IFluidDataStoreRuntimeEvents>\n\timplements IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext\n{\n\t/**\n\t * @deprecated - Instantiate the class using its constructor instead.\n\t *\n\t * Loads the data store runtime\n\t * @param context - The data store context\n\t * @param sharedObjectRegistry - The registry of shared objects used by this data store\n\t * @param existing - If loading from an existing file.\n\t */\n\tpublic static load(\n\t\tcontext: IFluidDataStoreContext,\n\t\tsharedObjectRegistry: ISharedObjectRegistry,\n\t\texisting: boolean,\n\t): FluidDataStoreRuntime {\n\t\treturn new FluidDataStoreRuntime(\n\t\t\tcontext,\n\t\t\tsharedObjectRegistry,\n\t\t\texisting,\n\t\t\tasync (dataStoreRuntime) => requestFluidObject(dataStoreRuntime, \"/\"),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IFluidDataStoreRuntime.entryPoint}\n\t */\n\tpublic readonly entryPoint?: IFluidHandle<FluidObject>;\n\n\tpublic get IFluidRouter() {\n\t\treturn this;\n\t}\n\n\tpublic get connected(): boolean {\n\t\treturn this.dataStoreContext.connected;\n\t}\n\n\tpublic get clientId(): string | undefined {\n\t\treturn this.dataStoreContext.clientId;\n\t}\n\n\tpublic get clientDetails(): IClientDetails {\n\t\treturn this.dataStoreContext.clientDetails;\n\t}\n\n\tpublic get isAttached(): boolean {\n\t\treturn this.attachState !== AttachState.Detached;\n\t}\n\n\tpublic get attachState(): AttachState {\n\t\treturn this._attachState;\n\t}\n\n\tpublic get absolutePath(): string {\n\t\treturn generateHandleContextPath(this.id, this.routeContext);\n\t}\n\n\tpublic get routeContext(): IFluidHandleContext {\n\t\treturn this.dataStoreContext.IFluidHandleContext;\n\t}\n\n\tpublic get IFluidHandleContext() {\n\t\treturn this;\n\t}\n\n\tpublic get rootRoutingContext() {\n\t\treturn this;\n\t}\n\tpublic get channelsRoutingContext() {\n\t\treturn this;\n\t}\n\tpublic get objectsRoutingContext() {\n\t\treturn this;\n\t}\n\n\tprivate _disposed = false;\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\n\tprivate readonly contexts = new Map<string, IChannelContext>();\n\tprivate readonly contextsDeferred = new Map<string, Deferred<IChannelContext>>();\n\tprivate readonly pendingAttach = new Map<string, IAttachMessage>();\n\n\tprivate bindState: BindState;\n\tprivate readonly deferredAttached = new Deferred<void>();\n\tprivate readonly localChannelContextQueue = new Map<string, LocalChannelContextBase>();\n\tprivate readonly notBoundedChannelContextSet = new Set<string>();\n\tprivate _attachState: AttachState;\n\tpublic visibilityState: VisibilityState;\n\t// A list of handles that are bound when the data store is not visible. We have to make them visible when the data\n\t// store becomes visible.\n\tprivate readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();\n\n\tpublic readonly id: string;\n\tpublic readonly options: ILoaderOptions;\n\tpublic readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\tprivate readonly quorum: IQuorumClients;\n\tprivate readonly audience: IAudience;\n\tpublic readonly logger: ITelemetryLogger;\n\n\t// A map of child channel context ids to the their base GC details. This is used to initialize the GC state of the\n\t// channel contexts.\n\tprivate readonly channelsBaseGCDetails: LazyPromise<Map<string, IGarbageCollectionDetailsBase>>;\n\n\t/**\n\t * Invokes the given callback and expects that no ops are submitted\n\t * until execution finishes. If an op is submitted, an error will be raised.\n\t *\n\t * Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`\n\t *\n\t * @param callback - the callback to be invoked\n\t */\n\tpublic ensureNoDataModelChanges<T>(callback: () => T): T {\n\t\t// back-compat ADO:2309\n\t\treturn this.dataStoreContext.ensureNoDataModelChanges === undefined\n\t\t\t? callback()\n\t\t\t: this.dataStoreContext.ensureNoDataModelChanges(callback);\n\t}\n\n\t/**\n\t * Create an instance of a DataStore runtime.\n\t *\n\t * @param dataStoreContext - Context object for the runtime.\n\t * @param sharedObjectRegistry - The registry of shared objects that this data store will be able to instantiate.\n\t * @param existing - Pass 'true' if loading this datastore from an existing file; pass 'false' otherwise.\n\t * @param initializeEntryPoint - Function to initialize the entryPoint object for the data store runtime. The\n\t * handle to this data store runtime will point to the object returned by this function. If this function is not\n\t * provided, the handle will be left undefined. This is here so we can start making handles a first-class citizen\n\t * and the primary way of interacting with some Fluid objects, and should be used if possible.\n\t */\n\tpublic constructor(\n\t\tprivate readonly dataStoreContext: IFluidDataStoreContext,\n\t\tprivate readonly sharedObjectRegistry: ISharedObjectRegistry,\n\t\texisting: boolean,\n\t\tinitializeEntryPoint?: (runtime: IFluidDataStoreRuntime) => Promise<FluidObject>,\n\t) {\n\t\tsuper();\n\n\t\tassert(\n\t\t\t!dataStoreContext.id.includes(\"/\"),\n\t\t\t0x30e /* Id cannot contain slashes. DataStoreContext should have validated this. */,\n\t\t);\n\n\t\tthis.logger = ChildLogger.create(dataStoreContext.logger, \"FluidDataStoreRuntime\", {\n\t\t\tall: { dataStoreId: uuid() },\n\t\t});\n\n\t\tthis.id = dataStoreContext.id;\n\t\tthis.options = dataStoreContext.options;\n\t\tthis.deltaManager = dataStoreContext.deltaManager;\n\t\tthis.quorum = dataStoreContext.getQuorum();\n\t\tthis.audience = dataStoreContext.getAudience();\n\n\t\tconst tree = dataStoreContext.baseSnapshot;\n\n\t\tthis.channelsBaseGCDetails = new LazyPromise(async () => {\n\t\t\tconst baseGCDetails = await this.dataStoreContext.getBaseGCDetails();\n\t\t\treturn unpackChildNodesGCDetails(baseGCDetails);\n\t\t});\n\n\t\t// Must always receive the data store type inside of the attributes\n\t\tif (tree?.trees !== undefined) {\n\t\t\tObject.keys(tree.trees).forEach((path) => {\n\t\t\t\t// Issue #4414\n\t\t\t\tif (path === \"_search\") {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet channelContext: IChannelContext;\n\t\t\t\t// If already exists on storage, then create a remote channel. However, if it is case of rehydrating a\n\t\t\t\t// container from snapshot where we load detached container from a snapshot, isLocalDataStore would be\n\t\t\t\t// true. In this case create a RehydratedLocalChannelContext.\n\t\t\t\tif (dataStoreContext.isLocalDataStore) {\n\t\t\t\t\tchannelContext = new RehydratedLocalChannelContext(\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\tthis.sharedObjectRegistry,\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tthis.dataStoreContext,\n\t\t\t\t\t\tthis.dataStoreContext.storage,\n\t\t\t\t\t\tthis.logger,\n\t\t\t\t\t\t(content, localOpMetadata) =>\n\t\t\t\t\t\t\tthis.submitChannelOp(path, content, localOpMetadata),\n\t\t\t\t\t\t(address: string) => this.setChannelDirty(address),\n\t\t\t\t\t\t(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n\t\t\t\t\t\t\tthis.addedGCOutboundReference(srcHandle, outboundHandle),\n\t\t\t\t\t\ttree.trees[path],\n\t\t\t\t\t);\n\t\t\t\t\t// This is the case of rehydrating a detached container from snapshot. Now due to delay loading of\n\t\t\t\t\t// data store, if the data store is loaded after the container is attached, then we missed making\n\t\t\t\t\t// the channel visible. So do it now. Otherwise, add it to local channel context queue, so\n\t\t\t\t\t// that it can be make it visible later with the data store.\n\t\t\t\t\tif (dataStoreContext.attachState !== AttachState.Detached) {\n\t\t\t\t\t\t(channelContext as LocalChannelContextBase).makeVisible();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.localChannelContextQueue.set(\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tchannelContext as LocalChannelContextBase,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tchannelContext = new RemoteChannelContext(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tdataStoreContext,\n\t\t\t\t\t\tdataStoreContext.storage,\n\t\t\t\t\t\t(content, localOpMetadata) =>\n\t\t\t\t\t\t\tthis.submitChannelOp(path, content, localOpMetadata),\n\t\t\t\t\t\t(address: string) => this.setChannelDirty(address),\n\t\t\t\t\t\t(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n\t\t\t\t\t\t\tthis.addedGCOutboundReference(srcHandle, outboundHandle),\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\ttree.trees[path],\n\t\t\t\t\t\tthis.sharedObjectRegistry,\n\t\t\t\t\t\tundefined /* extraBlobs */,\n\t\t\t\t\t\tthis.dataStoreContext.getCreateChildSummarizerNodeFn(path, {\n\t\t\t\t\t\t\ttype: CreateSummarizerNodeSource.FromSummary,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync () => this.getChannelBaseGCDetails(path),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst deferred = new Deferred<IChannelContext>();\n\t\t\t\tdeferred.resolve(channelContext);\n\n\t\t\t\tthis.contexts.set(path, channelContext);\n\t\t\t\tthis.contextsDeferred.set(path, deferred);\n\t\t\t});\n\t\t}\n\n\t\tif (initializeEntryPoint) {\n\t\t\tconst promise = new LazyPromise(async () => initializeEntryPoint(this));\n\t\t\tthis.entryPoint = new FluidObjectHandle<FluidObject>(\n\t\t\t\tpromise,\n\t\t\t\t\"\",\n\t\t\t\tthis.objectsRoutingContext,\n\t\t\t);\n\t\t}\n\n\t\tthis.attachListener();\n\t\t// If exists on storage or loaded from a snapshot, it should already be bound.\n\t\tthis.bindState = existing ? BindState.Bound : BindState.NotBound;\n\t\tthis._attachState = dataStoreContext.attachState;\n\n\t\t/**\n\t\t * If existing flag is false, this is a new data store and is not visible. The existing flag can be true in two\n\t\t * conditions:\n\t\t *\n\t\t * 1. It's a local data store that is created when a detached container is rehydrated. In this case, the data\n\t\t * store is locally visible because the snapshot it is loaded from contains locally visible data stores only.\n\t\t *\n\t\t * 2. It's a remote data store that is created when an attached container is loaded is loaded from snapshot or\n\t\t * when an attach op comes in. In both these cases, the data store is already globally visible.\n\t\t */\n\t\tif (existing) {\n\t\t\tthis.visibilityState =\n\t\t\t\tdataStoreContext.attachState === AttachState.Detached\n\t\t\t\t\t? VisibilityState.LocallyVisible\n\t\t\t\t\t: VisibilityState.GloballyVisible;\n\t\t} else {\n\t\t\tthis.visibilityState = VisibilityState.NotVisible;\n\t\t}\n\n\t\t// If it's existing we know it has been attached.\n\t\tif (existing) {\n\t\t\tthis.deferredAttached.resolve();\n\t\t}\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._disposed = true;\n\n\t\tthis.emit(\"dispose\");\n\t\tthis.removeAllListeners();\n\t}\n\n\tpublic async resolveHandle(request: IRequest): Promise<IResponse> {\n\t\treturn this.request(request);\n\t}\n\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\ttry {\n\t\t\tconst parser = RequestParser.create(request);\n\t\t\tconst id = parser.pathParts[0];\n\n\t\t\tif (id === \"_channels\" || id === \"_custom\") {\n\t\t\t\treturn this.request(parser.createSubRequest(1));\n\t\t\t}\n\n\t\t\t// Check for a data type reference first\n\t\t\tif (this.contextsDeferred.has(id) && parser.isLeaf(1)) {\n\t\t\t\ttry {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst value = await this.contextsDeferred.get(id)!.promise;\n\t\t\t\t\tconst channel = await value.getChannel();\n\n\t\t\t\t\treturn { mimeType: \"fluid/object\", status: 200, value: channel };\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"GetChannelFailedInRequest\" }, error);\n\n\t\t\t\t\treturn createResponseError(500, `Failed to get Channel: ${error}`, request);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Otherwise defer to an attached request handler\n\t\t\treturn create404Response(request);\n\t\t} catch (error) {\n\t\t\treturn exceptionToResponse(error);\n\t\t}\n\t}\n\n\tpublic async getChannel(id: string): Promise<IChannel> {\n\t\tthis.verifyNotClosed();\n\n\t\t// TODO we don't assume any channels (even root) in the runtime. If you request a channel that doesn't exist\n\t\t// we will never resolve the promise. May want a flag to getChannel that doesn't wait for the promise if\n\t\t// it doesn't exist\n\t\tif (!this.contextsDeferred.has(id)) {\n\t\t\tthis.contextsDeferred.set(id, new Deferred<IChannelContext>());\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tconst context = await this.contextsDeferred.get(id)!.promise;\n\t\tconst channel = await context.getChannel();\n\n\t\treturn channel;\n\t}\n\n\tpublic createChannel(id: string = uuid(), type: string): IChannel {\n\t\tif (id.includes(\"/\")) {\n\t\t\tthrow new UsageError(`Id cannot contain slashes: ${id}`);\n\t\t}\n\n\t\tthis.verifyNotClosed();\n\n\t\tassert(!this.contexts.has(id), 0x179 /* \"createChannel() with existing ID\" */);\n\t\tthis.notBoundedChannelContextSet.add(id);\n\t\tconst context = new LocalChannelContext(\n\t\t\tid,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\ttype,\n\t\t\tthis,\n\t\t\tthis.dataStoreContext,\n\t\t\tthis.dataStoreContext.storage,\n\t\t\tthis.logger,\n\t\t\t(content, localOpMetadata) => this.submitChannelOp(id, content, localOpMetadata),\n\t\t\t(address: string) => this.setChannelDirty(address),\n\t\t\t(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n\t\t\t\tthis.addedGCOutboundReference(srcHandle, outboundHandle),\n\t\t);\n\t\tthis.contexts.set(id, context);\n\n\t\tif (this.contextsDeferred.has(id)) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.contextsDeferred.get(id)!.resolve(context);\n\t\t} else {\n\t\t\tconst deferred = new Deferred<IChannelContext>();\n\t\t\tdeferred.resolve(context);\n\t\t\tthis.contextsDeferred.set(id, deferred);\n\t\t}\n\n\t\tassert(!!context.channel, 0x17a /* \"Channel should be loaded when created!!\" */);\n\t\treturn context.channel;\n\t}\n\n\t/**\n\t * Binds a channel with the runtime. If the runtime is attached we will attach the channel right away.\n\t * If the runtime is not attached we will defer the attach until the runtime attaches.\n\t * @param channel - channel to be registered.\n\t */\n\tpublic bindChannel(channel: IChannel): void {\n\t\tassert(\n\t\t\tthis.notBoundedChannelContextSet.has(channel.id),\n\t\t\t0x17b /* \"Channel to be binded should be in not bounded set\" */,\n\t\t);\n\t\tthis.notBoundedChannelContextSet.delete(channel.id);\n\t\t// If our data store is attached, then attach the channel.\n\t\tif (this.isAttached) {\n\t\t\tthis.attachChannel(channel);\n\t\t\treturn;\n\t\t}\n\n\t\t/**\n\t\t * If this channel is already waiting to be made visible, do nothing. This can happen during attachGraph() when\n\t\t * a channel's graph is attached. It calls bindToContext on the shared object which will end up back here.\n\t\t */\n\t\tif (this.pendingHandlesToMakeVisible.has(channel.handle)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.bind(channel.handle);\n\n\t\t// If our data store is local then add the channel to the queue\n\t\tif (!this.localChannelContextQueue.has(channel.id)) {\n\t\t\tthis.localChannelContextQueue.set(\n\t\t\t\tchannel.id,\n\t\t\t\tthis.contexts.get(channel.id) as LocalChannelContextBase,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * This function is called when a data store becomes root. It does the following:\n\t *\n\t * 1. Marks the data store locally visible in the container.\n\t *\n\t * 2. Attaches the graph of all the handles bound to it.\n\t *\n\t * 3. Calls into the data store context to mark it visible in the container too. If the container is globally\n\t * visible, it will mark us globally visible. Otherwise, it will mark us globally visible when it becomes\n\t * globally visible.\n\t */\n\tpublic makeVisibleAndAttachGraph() {\n\t\tif (this.visibilityState !== VisibilityState.NotVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis.visibilityState = VisibilityState.LocallyVisible;\n\n\t\tthis.pendingHandlesToMakeVisible.forEach((handle) => {\n\t\t\thandle.attachGraph();\n\t\t});\n\t\tthis.pendingHandlesToMakeVisible.clear();\n\t\tthis.bindToContext();\n\t}\n\n\t/**\n\t * This function is called when a handle to this data store is added to a visible DDS.\n\t */\n\tpublic attachGraph() {\n\t\tthis.makeVisibleAndAttachGraph();\n\t}\n\n\t/**\n\t * @deprecated - Not necessary if consumers add a new dataStore to the container by storing its handle.\n\t * Binds this runtime to the container\n\t * This includes the following:\n\t * 1. Sending an Attach op that includes all existing state\n\t * 2. Attaching the graph if the data store becomes attached.\n\t */\n\tpublic bindToContext() {\n\t\tif (this.bindState !== BindState.NotBound) {\n\t\t\treturn;\n\t\t}\n\t\tthis.bindState = BindState.Binding;\n\t\tthis.dataStoreContext.bindToContext();\n\t\tthis.bindState = BindState.Bound;\n\t}\n\n\tpublic bind(handle: IFluidHandle): void {\n\t\t// If visible, attach the incoming handle's graph. Else, this will be done when we become visible.\n\t\tif (this.visibilityState !== VisibilityState.NotVisible) {\n\t\t\thandle.attachGraph();\n\t\t\treturn;\n\t\t}\n\t\tthis.pendingHandlesToMakeVisible.add(handle);\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\tthis.verifyNotClosed();\n\n\t\tfor (const [, object] of this.contexts) {\n\t\t\tobject.setConnectionState(connected, clientId);\n\t\t}\n\n\t\traiseConnectedEvent(this.logger, this, connected, clientId);\n\t}\n\n\tpublic getQuorum(): IQuorumClients {\n\t\treturn this.quorum;\n\t}\n\n\tpublic getAudience(): IAudience {\n\t\treturn this.audience;\n\t}\n\n\tpublic async uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n\t\tthis.verifyNotClosed();\n\n\t\treturn this.dataStoreContext.uploadBlob(blob);\n\t}\n\n\tpublic process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n\t\tthis.verifyNotClosed();\n\n\t\ttry {\n\t\t\t// catches as data processing error whether or not they come from async pending queues\n\t\t\tswitch (message.type) {\n\t\t\t\tcase DataStoreMessageType.Attach: {\n\t\t\t\t\tconst attachMessage = message.contents as IAttachMessage;\n\t\t\t\t\tconst id = attachMessage.id;\n\n\t\t\t\t\t// If a non-local operation then go and create the object\n\t\t\t\t\t// Otherwise mark it as officially attached.\n\t\t\t\t\tif (local) {\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tthis.pendingAttach.has(id),\n\t\t\t\t\t\t\t0x17c /* \"Unexpected attach (local) channel OP\" */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.pendingAttach.delete(id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t!this.contexts.has(id),\n\t\t\t\t\t\t\t0x17d /* `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\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst flatBlobs = new Map<string, ArrayBufferLike>();\n\t\t\t\t\t\tconst snapshotTree = buildSnapshotTree(\n\t\t\t\t\t\t\tattachMessage.snapshot.entries,\n\t\t\t\t\t\t\tflatBlobs,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst remoteChannelContext = new RemoteChannelContext(\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\tthis.dataStoreContext,\n\t\t\t\t\t\t\tthis.dataStoreContext.storage,\n\t\t\t\t\t\t\t(content, localContentMetadata) =>\n\t\t\t\t\t\t\t\tthis.submitChannelOp(id, content, localContentMetadata),\n\t\t\t\t\t\t\t(address: string) => this.setChannelDirty(address),\n\t\t\t\t\t\t\t(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n\t\t\t\t\t\t\t\tthis.addedGCOutboundReference(srcHandle, outboundHandle),\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\tsnapshotTree,\n\t\t\t\t\t\t\tthis.sharedObjectRegistry,\n\t\t\t\t\t\t\tflatBlobs,\n\t\t\t\t\t\t\tthis.dataStoreContext.getCreateChildSummarizerNodeFn(id, {\n\t\t\t\t\t\t\t\ttype: CreateSummarizerNodeSource.FromAttach,\n\t\t\t\t\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\t\t\t\t\tsnapshot: attachMessage.snapshot,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tasync () => this.getChannelBaseGCDetails(id),\n\t\t\t\t\t\t\tattachMessage.type,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tthis.contexts.set(id, remoteChannelContext);\n\t\t\t\t\t\tif (this.contextsDeferred.has(id)) {\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\t\tthis.contextsDeferred.get(id)!.resolve(remoteChannelContext);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst deferred = new Deferred<IChannelContext>();\n\t\t\t\t\t\t\tdeferred.resolve(remoteChannelContext);\n\t\t\t\t\t\t\tthis.contextsDeferred.set(id, deferred);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase DataStoreMessageType.ChannelOp:\n\t\t\t\t\tthis.processChannelOp(message, local, localOpMetadata);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t}\n\n\t\t\tthis.emit(\"op\", message);\n\t\t} catch (error) {\n\t\t\tthrow DataProcessingError.wrapIfUnrecognized(\n\t\t\t\terror,\n\t\t\t\t\"fluidDataStoreRuntimeFailedToProcessMessage\",\n\t\t\t\tmessage,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic processSignal(message: IInboundSignalMessage, local: boolean) {\n\t\tthis.emit(\"signal\", message, local);\n\t}\n\n\tprivate isChannelAttached(id: string): boolean {\n\t\treturn (\n\t\t\t// Added in createChannel\n\t\t\t// Removed when bindChannel is called\n\t\t\t!this.notBoundedChannelContextSet.has(id) &&\n\t\t\t// Added in bindChannel only if this is not attached yet\n\t\t\t// Removed when this is attached by calling attachGraph\n\t\t\t!this.localChannelContextQueue.has(id) &&\n\t\t\t// Added in attachChannel called by bindChannel\n\t\t\t// Removed when attach op is broadcast\n\t\t\t!this.pendingAttach.has(id)\n\t\t);\n\t}\n\n\t/**\n\t * Returns the outbound routes of this channel. Currently, all contexts in this channel are considered\n\t * referenced and are hence outbound. This will change when we have root and non-root channel contexts.\n\t * The only root contexts will be considered as referenced.\n\t */\n\tprivate getOutboundRoutes(): string[] {\n\t\tconst outboundRoutes: string[] = [];\n\t\tfor (const [contextId] of this.contexts) {\n\t\t\toutboundRoutes.push(`${this.absolutePath}/${contextId}`);\n\t\t}\n\t\treturn outboundRoutes;\n\t}\n\n\t/**\n\t * Updates the GC nodes of this channel. It does the following:\n\t * - Adds a back route to self to all its child GC nodes.\n\t * - Adds a node for this channel.\n\t * @param builder - The builder that contains the GC nodes for this channel's children.\n\t */\n\tprivate updateGCNodes(builder: GCDataBuilder) {\n\t\t// Add a back route to self in each child's GC nodes. If any child is referenced, then its parent should\n\t\t// be considered referenced as well.\n\t\tbuilder.addRouteToAllNodes(this.absolutePath);\n\n\t\t// Get the outbound routes and add a GC node for this channel.\n\t\tbuilder.addNode(\"/\", this.getOutboundRoutes());\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. This includes a list of GC nodes that represent this channel\n\t * including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the\n\t * document. It does the following:\n\t *\n\t * 1. Calls into each child context to get its GC data.\n\t *\n\t * 2. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be\n\t * identified as belonging to the child.\n\t *\n\t * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent\n\t * the GC data of this channel.\n\t *\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst builder = new GCDataBuilder();\n\t\t// Iterate over each channel context and get their GC data.\n\t\tawait Promise.all(\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(([contextId, _]) => {\n\t\t\t\t\t// Get GC data only for attached contexts. Detached contexts are not connected in the GC reference\n\t\t\t\t\t// graph so any references they might have won't be connected as well.\n\t\t\t\t\treturn this.isChannelAttached(contextId);\n\t\t\t\t})\n\t\t\t\t.map(async ([contextId, context]) => {\n\t\t\t\t\tconst contextGCData = await context.getGCData(fullGC);\n\t\t\t\t\t// Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.\n\t\t\t\t\t// This also gradually builds the id of each node to be a path from the root.\n\t\t\t\t\tbuilder.prefixAndAddNodes(contextId, contextGCData.gcNodes);\n\t\t\t\t}),\n\t\t);\n\n\t\tthis.updateGCNodes(builder);\n\t\treturn builder.getGCData();\n\t}\n\n\t/**\n\t * After GC has run, called to notify this channel of routes that are used in it. It calls the child contexts to\n\t * update their used routes.\n\t * @param usedRoutes - The routes that are used in all contexts in this channel.\n\t */\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t// Get a map of channel ids to routes used in it.\n\t\tconst usedContextRoutes = unpackChildNodesUsedRoutes(usedRoutes);\n\n\t\t// Verify that the used routes are correct.\n\t\tfor (const [id] of usedContextRoutes) {\n\t\t\tassert(\n\t\t\t\tthis.contexts.has(id),\n\t\t\t\t0x17e /* \"Used route does not belong to any known context\" */,\n\t\t\t);\n\t\t}\n\n\t\t// Update the used routes in each context. Used routes is empty for unused context.\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tcontext.updateUsedRoutes(usedContextRoutes.get(contextId) ?? []);\n\t\t}\n\t}\n\n\t/**\n\t * Called when a new outbound reference is added to another node. This is used by garbage collection to identify\n\t * all references added in the system.\n\t * @param srcHandle - The handle of the node that added the reference.\n\t * @param outboundHandle - The handle of the outbound node that is referenced.\n\t */\n\tprivate addedGCOutboundReference(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) {\n\t\tthis.dataStoreContext.addedGCOutboundReference?.(srcHandle, outboundHandle);\n\t}\n\n\t/**\n\t * Returns the base GC details for the channel with the given id. This is used to initialize its GC state.\n\t * @param channelId - The id of the channel context that is asked for the initial GC details.\n\t * @returns the requested channel's base GC details.\n\t */\n\tprivate async getChannelBaseGCDetails(\n\t\tchannelId: string,\n\t): Promise<IGarbageCollectionDetailsBase> {\n\t\tlet channelBaseGCDetails = (await this.channelsBaseGCDetails).get(channelId);\n\t\tif (channelBaseGCDetails === undefined) {\n\t\t\tchannelBaseGCDetails = {};\n\t\t} else if (channelBaseGCDetails.gcData?.gcNodes !== undefined) {\n\t\t\t// Note: if the child channel has an explicit handle route to its parent, it will be removed here and\n\t\t\t// expected to be added back by the parent when getGCData is called.\n\t\t\tremoveRouteFromAllNodes(channelBaseGCDetails.gcData.gcNodes, this.absolutePath);\n\t\t}\n\n\t\t// Currently, channel context's are always considered used. So, it there are no used routes for it, we still\n\t\t// need to mark it as used. Add self-route (empty string) to the channel context's used routes.\n\t\tif (\n\t\t\tchannelBaseGCDetails.usedRoutes === undefined ||\n\t\t\tchannelBaseGCDetails.usedRoutes.length === 0\n\t\t) {\n\t\t\tchannelBaseGCDetails.usedRoutes = [\"\"];\n\t\t}\n\t\treturn channelBaseGCDetails;\n\t}\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\tconst summaryBuilder = new SummaryTreeBuilder();\n\n\t\t// Iterate over each data store and ask it to summarize\n\t\tawait Promise.all(\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(([contextId, _]) => {\n\t\t\t\t\tconst isAttached = this.isChannelAttached(contextId);\n\t\t\t\t\t// We are not expecting local dds! Summary may not capture local state.\n\t\t\t\t\tassert(\n\t\t\t\t\t\tisAttached,\n\t\t\t\t\t\t0x17f /* \"Not expecting detached channels during summarize\" */,\n\t\t\t\t\t);\n\t\t\t\t\t// If the object is registered - and we have received the sequenced op creating the object\n\t\t\t\t\t// (i.e. it has a base mapping) - then we go ahead and summarize\n\t\t\t\t\treturn isAttached;\n\t\t\t\t})\n\t\t\t\t.map(async ([contextId, context]) => {\n\t\t\t\t\tconst contextSummary = await context.summarize(\n\t\t\t\t\t\tfullTree,\n\t\t\t\t\t\ttrackState,\n\t\t\t\t\t\ttelemetryContext,\n\t\t\t\t\t);\n\t\t\t\t\tsummaryBuilder.addWithStats(contextId, contextSummary);\n\t\t\t\t}),\n\t\t);\n\n\t\treturn summaryBuilder.getSummaryTree();\n\t}\n\n\tpublic getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\t/**\n\t\t * back-compat 0.59.1000 - getAttachSummary() is called when making a data store globally visible (previously\n\t\t * attaching state). Ideally, attachGraph() should have already be called making it locally visible. However,\n\t\t * before visibility state was added, this may not have been the case and getAttachSummary() could be called:\n\t\t *\n\t\t * 1. Before attaching the data store - When a detached container is attached.\n\t\t *\n\t\t * 2. After attaching the data store - When a data store is created and bound in an attached container.\n\t\t *\n\t\t * The basic idea is that all local object should become locally visible before they are globally visible.\n\t\t */\n\t\tthis.attachGraph();\n\n\t\t// This assert cannot be added now due to back-compat. To be uncommented when the following issue is fixed -\n\t\t// https://github.com/microsoft/FluidFramework/issues/9688.\n\t\t//\n\t\t// assert(this.visibilityState === VisibilityState.LocallyVisible,\n\t\t// \"The data store should be locally visible when generating attach summary\",\n\t\t// );\n\n\t\tconst summaryBuilder = new SummaryTreeBuilder();\n\n\t\t// Craft the .attributes file for each shared object\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tif (!(context instanceof LocalChannelContextBase)) {\n\t\t\t\tthrow new LoggingError(\"Should only be called with local channel handles\");\n\t\t\t}\n\n\t\t\tif (!this.notBoundedChannelContextSet.has(contextId)) {\n\t\t\t\tlet summaryTree: ISummaryTreeWithStats;\n\t\t\t\tif (context.isLoaded) {\n\t\t\t\t\tconst contextSummary = context.getAttachSummary(telemetryContext);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcontextSummary.summary.type === SummaryType.Tree,\n\t\t\t\t\t\t0x180 /* \"getAttachSummary should always return a tree\" */,\n\t\t\t\t\t);\n\t\t\t\t\tsummaryTree = { stats: contextSummary.stats, summary: contextSummary.summary };\n\t\t\t\t} else {\n\t\t\t\t\t// If this channel is not yet loaded, then there should be no changes in the snapshot from which\n\t\t\t\t\t// it was created as it is detached container. So just use the previous snapshot.\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!this.dataStoreContext.baseSnapshot,\n\t\t\t\t\t\t0x181 /* \"BaseSnapshot should be there as detached container loaded from snapshot\" */,\n\t\t\t\t\t);\n\t\t\t\t\tsummaryTree = convertSnapshotTreeToSummaryTree(\n\t\t\t\t\t\tthis.dataStoreContext.baseSnapshot.trees[contextId],\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tsummaryBuilder.addWithStats(contextId, summaryTree);\n\t\t\t}\n\t\t}\n\n\t\treturn summaryBuilder.getSummaryTree();\n\t}\n\n\tpublic submitMessage(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n\t\tthis.submit(type, content, localOpMetadata);\n\t}\n\n\tpublic submitSignal(type: string, content: any) {\n\t\tthis.verifyNotClosed();\n\t\treturn this.dataStoreContext.submitSignal(type, content);\n\t}\n\n\t/**\n\t * Will return when the data store is attached.\n\t */\n\tpublic async waitAttached(): Promise<void> {\n\t\treturn this.deferredAttached.promise;\n\t}\n\n\t/**\n\t * Attach channel should only be called after the data store has been attached\n\t */\n\tprivate attachChannel(channel: IChannel): void {\n\t\tthis.verifyNotClosed();\n\t\t// If this handle is already attached no need to attach again.\n\t\tif (channel.handle.isAttached) {\n\t\t\treturn;\n\t\t}\n\n\t\tchannel.handle.attachGraph();\n\n\t\tassert(this.isAttached, 0x182 /* \"Data store should be attached to attach the channel.\" */);\n\t\tassert(\n\t\t\tthis.visibilityState === VisibilityState.GloballyVisible,\n\t\t\t0x2d0 /* \"Data store should be globally visible to attach channels.\" */,\n\t\t);\n\n\t\tconst summarizeResult = summarizeChannel(\n\t\t\tchannel,\n\t\t\ttrue /* fullTree */,\n\t\t\tfalse /* trackState */,\n\t\t);\n\t\t// Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.\n\t\tconst snapshot = convertSummaryTreeToITree(summarizeResult.summary);\n\n\t\tconst message: IAttachMessage = {\n\t\t\tid: channel.id,\n\t\t\tsnapshot,\n\t\t\ttype: channel.attributes.type,\n\t\t};\n\t\tthis.pendingAttach.set(channel.id, message);\n\t\tthis.submit(DataStoreMessageType.Attach, message);\n\n\t\tconst context = this.contexts.get(channel.id) as LocalChannelContextBase;\n\t\tcontext.makeVisible();\n\t}\n\n\tprivate submitChannelOp(address: string, contents: any, localOpMetadata: unknown) {\n\t\tconst envelope: IEnvelope = { address, contents };\n\t\tthis.submit(DataStoreMessageType.ChannelOp, envelope, localOpMetadata);\n\t}\n\n\tprivate submit(\n\t\ttype: DataStoreMessageType,\n\t\tcontent: any,\n\t\tlocalOpMetadata: unknown = undefined,\n\t): void {\n\t\tthis.verifyNotClosed();\n\t\tthis.dataStoreContext.submitMessage(type, content, localOpMetadata);\n\t}\n\n\t/**\n\t * For messages of type MessageType.Operation, finds the right channel and asks it to resubmit the message.\n\t * For all other messages, just submit it again.\n\t * This typically happens when we reconnect and there are unacked messages.\n\t * @param content - The content of the original message.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\tpublic reSubmit(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n\t\tthis.verifyNotClosed();\n\n\t\tswitch (type) {\n\t\t\tcase DataStoreMessageType.ChannelOp: {\n\t\t\t\t// For Operations, find the right channel and trigger resubmission on it.\n\t\t\t\tconst envelope = content as IEnvelope;\n\t\t\t\tconst channelContext = this.contexts.get(envelope.address);\n\t\t\t\tassert(\n\t\t\t\t\t!!channelContext,\n\t\t\t\t\t0x183 /* \"There should be a channel context for the op\" */,\n\t\t\t\t);\n\t\t\t\tchannelContext.reSubmit(envelope.contents, localOpMetadata);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase DataStoreMessageType.Attach:\n\t\t\t\t// For Attach messages, just submit them again.\n\t\t\t\tthis.submit(type, content, localOpMetadata);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunreachableCase(type);\n\t\t}\n\t}\n\n\t/**\n\t * Revert a local op.\n\t * @param content - The content of the original message.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\tpublic rollback?(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n\t\tthis.verifyNotClosed();\n\n\t\tswitch (type) {\n\t\t\tcase DataStoreMessageType.ChannelOp: {\n\t\t\t\t// For Operations, find the right channel and trigger resubmission on it.\n\t\t\t\tconst envelope = content as IEnvelope;\n\t\t\t\tconst channelContext = this.contexts.get(envelope.address);\n\t\t\t\tassert(\n\t\t\t\t\t!!channelContext,\n\t\t\t\t\t0x2ed /* \"There should be a channel context for the op\" */,\n\t\t\t\t);\n\t\t\t\tchannelContext.rollback(envelope.contents, localOpMetadata);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new LoggingError(`Can't rollback ${type} message`);\n\t\t}\n\t}\n\n\tpublic async applyStashedOp(content: any): Promise<unknown> {\n\t\tconst envelope = content as IEnvelope;\n\t\tconst channelContext = this.contexts.get(envelope.address);\n\t\tassert(!!channelContext, 0x184 /* \"There should be a channel context for the op\" */);\n\t\tawait channelContext.getChannel();\n\t\treturn channelContext.applyStashedOp(envelope.contents);\n\t}\n\n\tprivate setChannelDirty(address: string): void {\n\t\tthis.verifyNotClosed();\n\t\tthis.dataStoreContext.setChannelDirty(address);\n\t}\n\n\tprivate processChannelOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tthis.verifyNotClosed();\n\n\t\tconst envelope = message.contents as IEnvelope;\n\n\t\tconst transformed: ISequencedDocumentMessage = {\n\t\t\t...message,\n\t\t\tcontents: envelope.contents,\n\t\t};\n\n\t\tconst channelContext = this.contexts.get(envelope.address);\n\t\tassert(!!channelContext, 0x185 /* \"Channel not found\" */);\n\t\tchannelContext.processOp(transformed, local, localOpMetadata);\n\n\t\treturn channelContext;\n\t}\n\n\tprivate attachListener() {\n\t\tthis.setMaxListeners(Number.MAX_SAFE_INTEGER);\n\t\tthis.dataStoreContext.once(\"attaching\", () => {\n\t\t\t/**\n\t\t\t * back-compat 0.59.1000 - Ideally, attachGraph() should have already been called making the data store\n\t\t\t * locally visible. However, before visibility state was added, this may not have been the case and data\n\t\t\t * store can move to \"attaching\" state in 2 scenarios:\n\t\t\t * 1) Before attachGraph() is called - When a data store is created and bound in an attached container.\n\t\t\t * 2) After attachGraph() is called - When a detached container is attached.\n\t\t\t *\n\t\t\t * The basic idea is that all local object should become locally visible before they are globally visible.\n\t\t\t */\n\t\t\tthis.attachGraph();\n\n\t\t\tthis._attachState = AttachState.Attaching;\n\n\t\t\tassert(\n\t\t\t\tthis.visibilityState === VisibilityState.LocallyVisible,\n\t\t\t\t0x2d1 /* \"Data store should be locally visible before it can become globally visible.\" */,\n\t\t\t);\n\n\t\t\t// Mark the data store globally visible and make its child channels visible as well.\n\t\t\tthis.visibilityState = VisibilityState.GloballyVisible;\n\t\t\tthis.localChannelContextQueue.forEach((channel) => {\n\t\t\t\tchannel.makeVisible();\n\t\t\t});\n\t\t\tthis.localChannelContextQueue.clear();\n\n\t\t\t// This promise resolution will be moved to attached event once we fix the scheduler.\n\t\t\tthis.deferredAttached.resolve();\n\t\t\tthis.emit(\"attaching\");\n\t\t});\n\t\tthis.dataStoreContext.once(\"attached\", () => {\n\t\t\tassert(\n\t\t\t\tthis.visibilityState === VisibilityState.GloballyVisible,\n\t\t\t\t0x2d2 /* \"Data store should be globally visible when its attached.\" */,\n\t\t\t);\n\t\t\tthis._attachState = AttachState.Attached;\n\t\t\tthis.emit(\"attached\");\n\t\t});\n\t}\n\n\tprivate verifyNotClosed() {\n\t\tif (this._disposed) {\n\t\t\tthrow new LoggingError(\"Runtime is closed\");\n\t\t}\n\t}\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\trequestHandler: (request: IRequest, runtime: FluidDataStoreRuntime) => Promise<IResponse>,\n\tBase: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n) =>\n\tclass RuntimeWithRequestHandler extends Base {\n\t\tpublic async request(request: IRequest) {\n\t\t\tconst response = await super.request(request);\n\t\t\tif (response.status === 404) {\n\t\t\t\treturn requestHandler(request, this);\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t} 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\thandler: (\n\t\truntime: FluidDataStoreRuntime,\n\t) => Promise<{ path: string[]; content: string } | undefined>,\n\tBase: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n) =>\n\tclass RuntimeWithSummarizerHandler extends Base {\n\t\tprivate addBlob(summary: ISummaryTreeWithStats, path: string[], content: string) {\n\t\t\tconst firstName = path.shift();\n\t\t\tif (firstName === undefined) {\n\t\t\t\tthrow new LoggingError(\"Path can't be empty\");\n\t\t\t}\n\n\t\t\tlet blob: ISummaryTree | ISummaryBlob = {\n\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\tcontent,\n\t\t\t};\n\t\t\tsummary.stats.blobNodeCount++;\n\t\t\tsummary.stats.totalBlobSize += content.length;\n\n\t\t\tfor (const name of path.reverse()) {\n\t\t\t\tblob = {\n\t\t\t\t\ttype: SummaryType.Tree,\n\t\t\t\t\ttree: { [name]: blob },\n\t\t\t\t};\n\t\t\t\tsummary.stats.treeNodeCount++;\n\t\t\t}\n\t\t\tsummary.summary.tree[firstName] = blob;\n\t\t}\n\n\t\tasync summarize(...args: any[]) {\n\t\t\tconst summary = await super.summarize(...args);\n\t\t\tconst content = await handler(this);\n\t\t\tif (content !== undefined) {\n\t\t\t\tthis.addBlob(summary, content.path, content.content);\n\t\t\t}\n\t\t\treturn summary;\n\t\t}\n\t} as typeof FluidDataStoreRuntime;\n"]}
|
package/lib/fluidHandle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidHandle.d.ts","sourceRoot":"","sources":["../src/fluidHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"fluidHandle.d.ts","sourceRoot":"","sources":["../src/fluidHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAGjG;;GAEG;AACH,qBAAa,iBAAiB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,CAAE,YAAW,YAAY;IAuDzF,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;aACxB,IAAI,EAAE,MAAM;aACZ,YAAY,EAAE,mBAAmB;IAxDlD,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAgC;IAE5E;;OAEG;IACH,SAAgB,YAAY,EAAE,MAAM,CAAC;IAErC;;OAEG;IACH,IAAW,YAAY,IAAI,YAAY,CAEtC;IAED;;OAEG;IACH,IAAW,UAAU,IAAI,OAAO,CAE/B;IAED;;OAEG;IACH,OAAO,KAAK,OAAO,GAclB;IAED;;OAEG;IACH,OAAO,CAAC,cAAc,CAAkB;IAExC;;;;;;;OAOG;gBAEiB,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EACxB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,mBAAmB;IAKlD;;OAEG;IACU,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IAKhC;;OAEG;IACI,WAAW,IAAI,IAAI;IAa1B;;OAEG;IACI,IAAI,CAAC,MAAM,EAAE,YAAY;CAQhC"}
|
package/lib/fluidHandle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidHandle.js","sourceRoot":"","sources":["../src/fluidHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"fluidHandle.js","sourceRoot":"","sources":["../src/fluidHandle.ts"],"names":[],"mappings":"AA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AC/B,8EAA8E;QAC9E,IAAI,IAAI,CAAC,OAAO,EAAE;YACjB,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO;SACP;QACD,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle, IFluidHandleContext, FluidObject } from \"@fluidframework/core-interfaces\";\nimport { generateHandleContextPath } from \"@fluidframework/runtime-utils\";\n\n/**\n * Handle for a shared {@link @fluidframework/core-interfaces#FluidObject}.\n */\nexport class FluidObjectHandle<T extends FluidObject = FluidObject> implements IFluidHandle {\n\tprivate readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.absolutePath}\n\t */\n\tpublic readonly absolutePath: string;\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}\n\t */\n\tpublic get IFluidHandle(): IFluidHandle {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.isAttached}\n\t */\n\tpublic get isAttached(): boolean {\n\t\treturn this.routeContext.isAttached;\n\t}\n\n\t/**\n\t * Tells whether the object of this handle is visible in the container locally or globally.\n\t */\n\tprivate get visible(): boolean {\n\t\t/**\n\t\t * If the object of this handle is attached, it is visible in the container. Ideally, checking local visibility\n\t\t * should be enough for a handle. However, there are scenarios where the object becomes locally visible but the\n\t\t * handle does not know this - This will happen is attachGraph is never called on the handle. Couple of examples\n\t\t * where this can happen:\n\t\t *\n\t\t * 1. Handles to DDS other than the default handle won't know if the DDS becomes visible after the handle was\n\t\t * created.\n\t\t *\n\t\t * 2. Handles to root data stores will never know that it was visible because the handle will not be stores in\n\t\t * another DDS and so, attachGraph will never be called on it.\n\t\t */\n\t\treturn this.isAttached || this.locallyVisible;\n\t}\n\n\t/**\n\t * Tracks whether this handle is locally visible in the container.\n\t */\n\tprivate locallyVisible: boolean = false;\n\n\t/**\n\t * Creates a new `FluidObjectHandle`.\n\t *\n\t * @param value - The {@link @fluidframework/core-interfaces#FluidObject} object this handle is for.\n\t * @param path - The path to this handle relative to the `routeContext`.\n\t * @param routeContext - The parent {@link @fluidframework/core-interfaces#IFluidHandleContext} that has a route\n\t * to this handle.\n\t */\n\tconstructor(\n\t\tprotected readonly value: T | Promise<T>,\n\t\tpublic readonly path: string,\n\t\tpublic readonly routeContext: IFluidHandleContext,\n\t) {\n\t\tthis.absolutePath = generateHandleContextPath(path, this.routeContext);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.get}\n\t */\n\tpublic async get(): Promise<any> {\n\t\t// Note that this return works whether we received a T or a Promise<T> for this.value in the constructor.\n\t\treturn this.value;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.attachGraph }\n\t */\n\tpublic attachGraph(): void {\n\t\tif (this.visible) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.locallyVisible = true;\n\t\tthis.pendingHandlesToMakeVisible.forEach((handle) => {\n\t\t\thandle.attachGraph();\n\t\t});\n\t\tthis.pendingHandlesToMakeVisible.clear();\n\t\tthis.routeContext.attachGraph();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.bind}\n\t */\n\tpublic bind(handle: IFluidHandle) {\n\t\t// If this handle is visible, attach the graph of the incoming handle as well.\n\t\tif (this.visible) {\n\t\t\thandle.attachGraph();\n\t\t\treturn;\n\t\t}\n\t\tthis.pendingHandlesToMakeVisible.add(handle);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelContext.d.ts","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,gBAAgB,EAAE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,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;gBAGpC,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,qBAAqB,EAC/B,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,EAC1E,YAAY,EAAE,aAAa;IA8BhC,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC;YAa9B,WAAW;IAyCzB,OAAO,CAAC,oCAAoC;IAmB5C,OAAO,CAAC,gBAAgB;CAaxB;AAED,qBAAa,mBAAoB,SAAQ,uBAAuB;IAC/D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAGtB;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;gBAEpC,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;CAwB5F"}
|
|
@@ -117,12 +117,13 @@ export class RehydratedLocalChannelContext extends LocalChannelContextBase {
|
|
|
117
117
|
this.services = new Lazy(() => {
|
|
118
118
|
return createServiceEndpoints(this.id, dataStoreContext.connected, submitFn, this.dirtyFn, addedGCOutboundReferenceFn, storageService, logger, clonedSnapshotTree, blobMap);
|
|
119
119
|
});
|
|
120
|
-
this.dirtyFn = () => {
|
|
120
|
+
this.dirtyFn = () => {
|
|
121
|
+
dirtyFn(id);
|
|
122
|
+
};
|
|
121
123
|
}
|
|
122
124
|
async getChannel() {
|
|
123
125
|
if (this.channel === undefined) {
|
|
124
|
-
this.channel = await this.loadChannel()
|
|
125
|
-
.catch((err) => {
|
|
126
|
+
this.channel = await this.loadChannel().catch((err) => {
|
|
126
127
|
throw DataProcessingError.wrapIfUnrecognized(err, "rehydratedLocalChannelContextFailedToLoadChannel", undefined);
|
|
127
128
|
});
|
|
128
129
|
}
|
|
@@ -149,7 +150,8 @@ export class RehydratedLocalChannelContext extends LocalChannelContextBase {
|
|
|
149
150
|
}
|
|
150
151
|
isSnapshotInOldFormatAndCollectBlobs(snapshotTree, blobMap) {
|
|
151
152
|
let sanitize = false;
|
|
152
|
-
const blobsContents = snapshotTree
|
|
153
|
+
const blobsContents = snapshotTree
|
|
154
|
+
.blobsContents;
|
|
153
155
|
Object.entries(blobsContents).forEach(([key, value]) => {
|
|
154
156
|
blobMap.set(key, value);
|
|
155
157
|
if (snapshotTree.blobs[key] !== undefined) {
|
|
@@ -187,7 +189,9 @@ export class LocalChannelContext extends LocalChannelContextBase {
|
|
|
187
189
|
this.services = new Lazy(() => {
|
|
188
190
|
return createServiceEndpoints(this.id, dataStoreContext.connected, submitFn, this.dirtyFn, addedGCOutboundReferenceFn, storageService, logger);
|
|
189
191
|
});
|
|
190
|
-
this.dirtyFn = () => {
|
|
192
|
+
this.dirtyFn = () => {
|
|
193
|
+
dirtyFn(id);
|
|
194
|
+
};
|
|
191
195
|
}
|
|
192
196
|
}
|
|
193
197
|
//# sourceMappingURL=localChannelContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelContext.js","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"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,EAAU,EACV,QAA+B,EAC/B,IAAY,EACZ,OAA+B,EAC/B,gBAAwC,EACxC,cAAuC,EACvC,MAAwB,EACxB,QAA0D,EAC1D,OAAkC,EAClC,0BAA2F;QAE3F,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,sCAAsC,CAAC,CAAC;QACzE,IAAI,CAAC,OAAO,GAAG,QAAQ,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 ITelemetryContext,\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 globallyVisible = 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 assert(!this.id.includes(\"/\"), 0x30f /* Channel context ID cannot contain slashes */);\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 globallyVisible or loaded\n if (this.globallyVisible && 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.globallyVisible, 0x2d3 /* \"Local channel must be globally visible 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.globallyVisible, 0x2d4 /* \"Local channel must be globally visible when resubmitting op\" */);\n this.servicesGetter().value.deltaConnection.reSubmit(content, localOpMetadata);\n }\n public rollback(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x2ee /* \"Channel should be loaded to rollback ops\" */);\n assert(this.globallyVisible, 0x2ef /* \"Local channel must be globally visible when rolling back op\" */);\n this.servicesGetter().value.deltaConnection.rollback(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 * @param telemetryContext - summary data passed through the layers for telemetry purposes\n */\n public async summarize(\n fullTree: boolean = false,\n trackState: boolean = false,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummarizeResult> {\n assert(this.isLoaded && this.channel !== undefined, 0x18c /* \"Channel should be loaded to summarize\" */);\n return summarizeChannelAsync(this.channel, fullTree, trackState, telemetryContext);\n }\n\n public getAttachSummary(telemetryContext?: ITelemetryContext): 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 */, telemetryContext);\n }\n\n public makeVisible(): void {\n if (this.globallyVisible) {\n throw new Error(\"Channel is already globally visible\");\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.globallyVisible = 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[]) {\n /**\n * Currently, DDSes 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"]}
|
|
1
|
+
{"version":3,"file":"localChannelContext.js","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sDAAsD;AACtD,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAgBzC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAE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AAK,SAAS,EAAE,KAAK,CAAC,sCAAsC,CAAC,CAAC;QACzE,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;YAC/B,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,iBAAiB,CAAC,CAAC;SAC1D;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;YAC7B,OAAO,sBAAsB,CAC5B,IAAI,CAAC,EAAE,EACP,gBAAgB,CAAC,SAAS,EAC1B,QAAQ,EACR,IAAI,CAAC,OAAO,EACZ,0BAA0B,EAC1B,cAAc,EACd,MAAM,CACN,CAAC;QACH,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE;YACnB,OAAO,CAAC,EAAE,CAAC,CAAC;QACb,CAAC,CAAC;IACH,CAAC;CACD","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\tIChannel,\n\tIFluidDataStoreRuntime,\n\tIChannelFactory,\n\tIChannelAttributes,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n\tIFluidDataStoreContext,\n\tIGarbageCollectionData,\n\tISummarizeResult,\n\tITelemetryContext,\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\tcreateServiceEndpoints,\n\tIChannelContext,\n\tsummarizeChannel,\n\tsummarizeChannelAsync,\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\tpublic channel: IChannel | undefined;\n\tprivate globallyVisible = false;\n\tprotected readonly pending: ISequencedDocumentMessage[] = [];\n\tprotected factory: IChannelFactory | undefined;\n\tconstructor(\n\t\tprotected readonly id: string,\n\t\tprotected readonly registry: ISharedObjectRegistry,\n\t\tprotected readonly runtime: IFluidDataStoreRuntime,\n\t\tprivate readonly servicesGetter: () => Lazy<{\n\t\t\treadonly deltaConnection: ChannelDeltaConnection;\n\t\t\treadonly objectStorage: ChannelStorageService;\n\t\t}>,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x30f /* Channel context ID cannot contain slashes */);\n\t}\n\n\tpublic async getChannel(): Promise<IChannel> {\n\t\tassert(this.channel !== undefined, 0x207 /* \"Channel should be defined\" */);\n\t\treturn this.channel;\n\t}\n\n\tpublic get isLoaded(): boolean {\n\t\treturn this.channel !== undefined;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\t// Connection events are ignored if the data store is not yet globallyVisible or loaded\n\t\tif (this.globallyVisible && this.isLoaded) {\n\t\t\tthis.servicesGetter().value.deltaConnection.setConnectionState(connected);\n\t\t}\n\t}\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2d3 /* \"Local channel must be globally visible when processing op\" */,\n\t\t);\n\n\t\t// A local channel may not be loaded in case where we rehydrate the container from a snapshot because of\n\t\t// delay loading. So after the container is attached and some other client joins which start generating\n\t\t// ops for this channel. So not loaded local channel can still receive ops and we store them to process later.\n\t\tif (this.isLoaded) {\n\t\t\tthis.servicesGetter().value.deltaConnection.process(message, local, localOpMetadata);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tlocal === false,\n\t\t\t\t0x189 /* \"Should always be remote because a local dds shouldn't generate ops before loading\" */,\n\t\t\t);\n\t\t\tthis.pending.push(message);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x18a /* \"Channel should be loaded to resubmit ops\" */);\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2d4 /* \"Local channel must be globally visible when resubmitting op\" */,\n\t\t);\n\t\tthis.servicesGetter().value.deltaConnection.reSubmit(content, localOpMetadata);\n\t}\n\tpublic rollback(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x2ee /* \"Channel should be loaded to rollback ops\" */);\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2ef /* \"Local channel must be globally visible when rolling back op\" */,\n\t\t);\n\t\tthis.servicesGetter().value.deltaConnection.rollback(content, localOpMetadata);\n\t}\n\n\tpublic applyStashedOp() {\n\t\tthrow new Error(\"no stashed ops on local channel\");\n\t}\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = false,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\tassert(\n\t\t\tthis.isLoaded && this.channel !== undefined,\n\t\t\t0x18c /* \"Channel should be loaded to summarize\" */,\n\t\t);\n\t\treturn summarizeChannelAsync(this.channel, fullTree, trackState, telemetryContext);\n\t}\n\n\tpublic getAttachSummary(telemetryContext?: ITelemetryContext): ISummarizeResult {\n\t\tassert(\n\t\t\tthis.isLoaded && this.channel !== undefined,\n\t\t\t0x18d /* \"Channel should be loaded to take snapshot\" */,\n\t\t);\n\t\treturn summarizeChannel(\n\t\t\tthis.channel,\n\t\t\ttrue /* fullTree */,\n\t\t\tfalse /* trackState */,\n\t\t\ttelemetryContext,\n\t\t);\n\t}\n\n\tpublic makeVisible(): void {\n\t\tif (this.globallyVisible) {\n\t\t\tthrow new Error(\"Channel is already globally visible\");\n\t\t}\n\n\t\tif (this.isLoaded) {\n\t\t\tassert(!!this.channel, 0x192 /* \"Channel should be there if loaded!!\" */);\n\t\t\tthis.channel.connect(this.servicesGetter().value);\n\t\t}\n\t\tthis.globallyVisible = true;\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n\t * Each node has a set of outbound routes to other GC nodes in the document. This should be called only after\n\t * the context has loaded.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tassert(\n\t\t\tthis.isLoaded && this.channel !== undefined,\n\t\t\t0x193 /* \"Channel should be loaded to run GC\" */,\n\t\t);\n\t\treturn this.channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected.\n\t\t * Once we have GC at DDS level, this channel context's used routes will be updated as per the passed\n\t\t * value. See - https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t}\n}\n\nexport class RehydratedLocalChannelContext extends LocalChannelContextBase {\n\tprivate readonly services: Lazy<{\n\t\treadonly deltaConnection: ChannelDeltaConnection;\n\t\treadonly objectStorage: ChannelStorageService;\n\t}>;\n\n\tprivate readonly dirtyFn: () => void;\n\n\tconstructor(\n\t\tid: string,\n\t\tregistry: ISharedObjectRegistry,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tlogger: ITelemetryLogger,\n\t\tsubmitFn: (content: any, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\taddedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n\t\tprivate readonly snapshotTree: ISnapshotTree,\n\t) {\n\t\tsuper(id, registry, runtime, () => this.services);\n\t\tconst blobMap: Map<string, ArrayBufferLike> = new Map<string, ArrayBufferLike>();\n\t\tconst clonedSnapshotTree = cloneDeep(this.snapshotTree);\n\t\t// 0.47 back-compat Need to sanitize if snapshotTree.blobs still contains blob contents too.\n\t\t// This is for older snapshot which is generated by loader <=0.47 version which still contains\n\t\t// the contents within blobs. After a couple of revisions we can remove it.\n\t\tif (this.isSnapshotInOldFormatAndCollectBlobs(clonedSnapshotTree, blobMap)) {\n\t\t\tthis.sanitizeSnapshot(clonedSnapshotTree);\n\t\t}\n\n\t\tthis.services = new Lazy(() => {\n\t\t\treturn createServiceEndpoints(\n\t\t\t\tthis.id,\n\t\t\t\tdataStoreContext.connected,\n\t\t\t\tsubmitFn,\n\t\t\t\tthis.dirtyFn,\n\t\t\t\taddedGCOutboundReferenceFn,\n\t\t\t\tstorageService,\n\t\t\t\tlogger,\n\t\t\t\tclonedSnapshotTree,\n\t\t\t\tblobMap,\n\t\t\t);\n\t\t});\n\t\tthis.dirtyFn = () => {\n\t\t\tdirtyFn(id);\n\t\t};\n\t}\n\n\tpublic async getChannel(): Promise<IChannel> {\n\t\tif (this.channel === undefined) {\n\t\t\tthis.channel = await this.loadChannel().catch((err) => {\n\t\t\t\tthrow DataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\terr,\n\t\t\t\t\t\"rehydratedLocalChannelContextFailedToLoadChannel\",\n\t\t\t\t\tundefined,\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\t\treturn this.channel;\n\t}\n\n\tprivate async loadChannel(): Promise<IChannel> {\n\t\tassert(!this.isLoaded, 0x18e /* \"Channel must not already be loaded when loading\" */);\n\t\tassert(\n\t\t\tawait this.services.value.objectStorage.contains(\".attributes\"),\n\t\t\t0x190 /* \".attributes blob should be present\" */,\n\t\t);\n\t\tconst attributes = await readAndParse<IChannelAttributes>(\n\t\t\tthis.services.value.objectStorage,\n\t\t\t\".attributes\",\n\t\t);\n\n\t\tassert(\n\t\t\tthis.factory === undefined,\n\t\t\t0x208 /* \"Factory should be undefined before loading\" */,\n\t\t);\n\t\tthis.factory = this.registry.get(attributes.type);\n\t\tif (this.factory === undefined) {\n\t\t\tthrow new Error(`Channel Factory ${attributes.type} not registered`);\n\t\t}\n\t\t// Services will be assigned during this load.\n\t\tconst channel = await this.factory.load(\n\t\t\tthis.runtime,\n\t\t\tthis.id,\n\t\t\tthis.services.value,\n\t\t\tattributes,\n\t\t);\n\n\t\t// Commit changes.\n\t\tthis.channel = channel;\n\n\t\t// Send all pending messages to the channel\n\t\tfor (const message of this.pending) {\n\t\t\tthis.services.value.deltaConnection.process(\n\t\t\t\tmessage,\n\t\t\t\tfalse,\n\t\t\t\tundefined /* localOpMetadata */,\n\t\t\t);\n\t\t}\n\t\treturn this.channel;\n\t}\n\n\tprivate isSnapshotInOldFormatAndCollectBlobs(\n\t\tsnapshotTree: ISnapshotTree,\n\t\tblobMap: Map<string, ArrayBufferLike>,\n\t): boolean {\n\t\tlet sanitize = false;\n\t\tconst blobsContents: { [path: string]: ArrayBufferLike } = (snapshotTree as any)\n\t\t\t.blobsContents;\n\t\tObject.entries(blobsContents).forEach(([key, value]) => {\n\t\t\tblobMap.set(key, value);\n\t\t\tif (snapshotTree.blobs[key] !== undefined) {\n\t\t\t\tsanitize = true;\n\t\t\t}\n\t\t});\n\t\tfor (const value of Object.values(snapshotTree.trees)) {\n\t\t\tsanitize = sanitize || this.isSnapshotInOldFormatAndCollectBlobs(value, blobMap);\n\t\t}\n\t\treturn sanitize;\n\t}\n\n\tprivate sanitizeSnapshot(snapshotTree: ISnapshotTree) {\n\t\tconst blobMapInitial = new Map(Object.entries(snapshotTree.blobs));\n\t\tfor (const [blobName, blobId] of blobMapInitial.entries()) {\n\t\t\tconst blobValue = blobMapInitial.get(blobId);\n\t\t\tif (blobValue === undefined) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete snapshotTree.blobs[blobName];\n\t\t\t}\n\t\t}\n\t\tfor (const value of Object.values(snapshotTree.trees)) {\n\t\t\tthis.sanitizeSnapshot(value);\n\t\t}\n\t}\n}\n\nexport class LocalChannelContext extends LocalChannelContextBase {\n\tprivate readonly services: Lazy<{\n\t\treadonly deltaConnection: ChannelDeltaConnection;\n\t\treadonly objectStorage: ChannelStorageService;\n\t}>;\n\tprivate readonly dirtyFn: () => void;\n\tconstructor(\n\t\tid: string,\n\t\tregistry: ISharedObjectRegistry,\n\t\ttype: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tlogger: ITelemetryLogger,\n\t\tsubmitFn: (content: any, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\taddedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n\t) {\n\t\tsuper(id, registry, runtime, () => this.services);\n\t\tassert(type !== undefined, 0x209 /* \"Factory Type should be defined\" */);\n\t\tthis.factory = registry.get(type);\n\t\tif (this.factory === undefined) {\n\t\t\tthrow new Error(`Channel Factory ${type} not registered`);\n\t\t}\n\t\tthis.channel = this.factory.create(runtime, id);\n\t\tthis.services = new Lazy(() => {\n\t\t\treturn createServiceEndpoints(\n\t\t\t\tthis.id,\n\t\t\t\tdataStoreContext.connected,\n\t\t\t\tsubmitFn,\n\t\t\t\tthis.dirtyFn,\n\t\t\t\taddedGCOutboundReferenceFn,\n\t\t\t\tstorageService,\n\t\t\t\tlogger,\n\t\t\t);\n\t\t});\n\t\tthis.dirtyFn = () => {\n\t\t\tdirtyFn(id);\n\t\t};\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelStorageService.d.ts","sourceRoot":"","sources":["../src/localChannelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAS,KAAK,EAAa,MAAM,sCAAsC,CAAC;AAG/E,qBAAa,0BAA2B,YAAW,sBAAsB;
|
|
1
|
+
{"version":3,"file":"localChannelStorageService.d.ts","sourceRoot":"","sources":["../src/localChannelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAS,KAAK,EAAa,MAAM,sCAAsC,CAAC;AAG/E,qBAAa,0BAA2B,YAAW,sBAAsB;IAC5D,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,KAAK;IAE3B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAQhD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAIlD,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,oBAAoB;CAwB5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelStorageService.js","sourceRoot":"","sources":["../src/localChannelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAgB,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,MAAM,OAAO,0BAA0B;
|
|
1
|
+
{"version":3,"file":"localChann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AClB,IAAI,IAAI,KAAK,KAAK,CAAC,IAAI,EAAE;wBACxB,OAAO,KAAK,CAAC,KAAK,CAAC;qBACnB;oBACD,MAAM;gBAEP,KAAK,SAAS,CAAC,IAAI;oBAClB,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;wBAChC,OAAO,IAAI,CAAC,oBAAoB,CAC/B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,EAClC,KAAK,CAAC,KAAK,CACX,CAAC;qBACF;oBACD,MAAM;gBAEP,QAAQ;aACR;SACD;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IChannelStorageService } from \"@fluidframework/datastore-definitions\";\nimport { stringToBuffer } from \"@fluidframework/common-utils\";\nimport { IBlob, ITree, TreeEntry } from \"@fluidframework/protocol-definitions\";\nimport { listBlobsAtTreePath } from \"@fluidframework/runtime-utils\";\n\nexport class LocalChannelStorageService implements IChannelStorageService {\n\tconstructor(private readonly tree: ITree) {}\n\n\tpublic async readBlob(path: string): Promise<ArrayBufferLike> {\n\t\tconst blob = this.readBlobSync(path);\n\t\tif (blob === undefined) {\n\t\t\tthrow new Error(\"Blob Not Found\");\n\t\t}\n\t\treturn stringToBuffer(blob.contents, blob.encoding);\n\t}\n\n\tpublic async contains(path: string): Promise<boolean> {\n\t\tconst blob = this.readBlobSync(path);\n\t\treturn blob !== undefined ? blob.contents !== undefined : false;\n\t}\n\n\tpublic async list(path: string): Promise<string[]> {\n\t\treturn listBlobsAtTreePath(this.tree, path);\n\t}\n\n\tprivate readBlobSync(path: string): IBlob | undefined {\n\t\treturn this.readBlobSyncInternal(path, this.tree);\n\t}\n\n\tprivate readBlobSyncInternal(path: string, tree: ITree): IBlob | undefined {\n\t\tfor (const entry of tree.entries) {\n\t\t\tswitch (entry.type) {\n\t\t\t\tcase TreeEntry.Blob:\n\t\t\t\t\tif (path === entry.path) {\n\t\t\t\t\t\treturn entry.value;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase TreeEntry.Tree:\n\t\t\t\t\tif (path.startsWith(entry.path)) {\n\t\t\t\t\t\treturn this.readBlobSyncInternal(\n\t\t\t\t\t\t\tpath.substr(entry.path.length + 1),\n\t\t\t\t\t\t\tentry.value,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\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 = "2.0.0-internal.3.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.3.1.1";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export const pkgName = "@fluidframework/datastore";
|
|
8
|
-
export const pkgVersion = "2.0.0-internal.3.
|
|
8
|
+
export const pkgVersion = "2.0.0-internal.3.1.1";
|
|
9
9
|
//# sourceMappingURL=packageVersion.js.map
|