@fluidframework/datastore 2.53.0 → 2.60.0
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/CHANGELOG.md +4 -0
- package/api-report/{datastore.legacy.alpha.api.md → datastore.legacy.beta.api.md} +7 -7
- package/dist/channelContext.d.ts +5 -5
- package/dist/channelContext.d.ts.map +1 -1
- package/dist/channelContext.js.map +1 -1
- package/dist/channelDeltaConnection.d.ts +1 -1
- package/dist/channelDeltaConnection.d.ts.map +1 -1
- package/dist/channelDeltaConnection.js.map +1 -1
- package/dist/channelStorageService.d.ts +3 -3
- package/dist/channelStorageService.d.ts.map +1 -1
- package/dist/channelStorageService.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts +15 -21
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +5 -26
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/fluidHandle.d.ts +3 -4
- package/dist/fluidHandle.d.ts.map +1 -1
- package/dist/fluidHandle.js +1 -2
- package/dist/fluidHandle.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/localChannelContext.d.ts +6 -6
- package/dist/localChannelContext.d.ts.map +1 -1
- package/dist/localChannelContext.js.map +1 -1
- package/dist/localChannelStorageService.d.ts +2 -2
- 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 +5 -5
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/remoteChannelContext.js.map +1 -1
- package/lib/channelContext.d.ts +5 -5
- package/lib/channelContext.d.ts.map +1 -1
- package/lib/channelContext.js.map +1 -1
- package/lib/channelDeltaConnection.d.ts +1 -1
- package/lib/channelDeltaConnection.d.ts.map +1 -1
- package/lib/channelDeltaConnection.js.map +1 -1
- package/lib/channelStorageService.d.ts +3 -3
- package/lib/channelStorageService.d.ts.map +1 -1
- package/lib/channelStorageService.js.map +1 -1
- package/lib/dataStoreRuntime.d.ts +15 -21
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +5 -26
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/fluidHandle.d.ts +3 -4
- package/lib/fluidHandle.d.ts.map +1 -1
- package/lib/fluidHandle.js +1 -2
- package/lib/fluidHandle.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/localChannelContext.d.ts +6 -6
- package/lib/localChannelContext.d.ts.map +1 -1
- package/lib/localChannelContext.js.map +1 -1
- package/lib/localChannelStorageService.d.ts +2 -2
- package/lib/localChannelStorageService.d.ts.map +1 -1
- package/lib/localChannelStorageService.js +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 +5 -5
- package/lib/remoteChannelContext.d.ts.map +1 -1
- package/lib/remoteChannelContext.js.map +1 -1
- package/package.json +16 -16
- package/src/channelContext.ts +7 -7
- package/src/channelDeltaConnection.ts +1 -1
- package/src/channelStorageService.ts +3 -3
- package/src/dataStoreRuntime.ts +38 -56
- package/src/fluidHandle.ts +3 -4
- package/src/index.ts +1 -1
- package/src/localChannelContext.ts +11 -11
- package/src/localChannelStorageService.ts +6 -2
- package/src/packageVersion.ts +1 -1
- package/src/remoteChannelContext.ts +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelContext.d.ts","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAU,IAAI,EAAe,MAAM,qCAAqC,CAAC;AAChF,OAAO,
|
|
1
|
+
{"version":3,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AC;QACrB,CAAC,CAAC;IACH,CAAC;IAEM,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACpD,CAAC;CACD;AAED;;;;;;;;GAQG;AACH,SAAS,iBAAiB,CAAC,IAAmB;IAC7C,MAAM,KAAK,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC/D,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISnapshotTreeWithBlobContents } from \"@fluidframework/container-definitions/internal\";\nimport { assert, Lazy, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tITelemetryContext,\n\tIFluidDataStoreContext,\n\tIGarbageCollectionData,\n\tISummarizeResult,\n\ttype IPendingMessagesState,\n\ttype IRuntimeMessageCollection,\n\ttype IRuntimeStorageService,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tDataProcessingError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tChannelServiceEndpoints,\n\tIChannelContext,\n\tcreateChannelServiceEndpoints,\n\tloadChannel,\n\tloadChannelFactoryAndAttributes,\n\tsummarizeChannel,\n\tsummarizeChannelAsync,\n} from \"./channelContext.js\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime.js\";\n\n/**\n * Channel context for a locally created channel\n */\nexport abstract class LocalChannelContextBase implements IChannelContext {\n\tprivate globallyVisible = false;\n\t/**\n\t * Tracks the messages for this channel that are sent while it's not loaded\n\t */\n\tprotected pendingMessagesState: IPendingMessagesState = {\n\t\tmessageCollections: [],\n\t\tpendingCount: 0,\n\t};\n\tconstructor(\n\t\tprotected readonly id: string,\n\t\tprotected readonly runtime: IFluidDataStoreRuntime,\n\t\tprotected readonly services: Lazy<ChannelServiceEndpoints>,\n\t\tprivate readonly channelP: Promise<IChannel>,\n\t\tprivate _channel?: IChannel,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x30f /* Channel context ID cannot contain slashes */);\n\t}\n\n\tprotected get isGloballyVisible(): boolean {\n\t\treturn this.globallyVisible;\n\t}\n\n\tpublic async getChannel(): Promise<IChannel> {\n\t\tif (this._channel === undefined) {\n\t\t\treturn this.channelP.then((c) => (this._channel = c));\n\t\t}\n\t\treturn this.channelP;\n\t}\n\n\tpublic get isLoaded(): boolean {\n\t\treturn this._channel !== undefined;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string): void {\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.services.value.deltaConnection.setConnectionState(connected);\n\t\t}\n\t}\n\n\t/**\n\t * Process messages for this channel context. The messages here are contiguous messages for this context in a batch.\n\t * @param messageCollection - The collection of messages to process.\n\t */\n\tprocessMessages(messageCollection: IRuntimeMessageCollection): 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.services.value.deltaConnection.processMessages(messageCollection);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\t!messageCollection.local,\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\tconst propsCopy = {\n\t\t\t\t...messageCollection,\n\t\t\t\tmessagesContent: [...messageCollection.messagesContent],\n\t\t\t};\n\t\t\tthis.pendingMessagesState.messageCollections.push(propsCopy);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: unknown, localOpMetadata: unknown, squash: boolean): void {\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.services.value.deltaConnection.reSubmit(content, localOpMetadata, squash);\n\t}\n\tpublic rollback(content: unknown, localOpMetadata: unknown): void {\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.services.value.deltaConnection.rollback(content, localOpMetadata);\n\t}\n\n\tpublic abstract applyStashedOp(content: unknown): unknown;\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\tconst channel = await this.getChannel();\n\t\treturn summarizeChannelAsync(channel, fullTree, trackState, telemetryContext);\n\t}\n\n\t/**\n\t * For crafting the DataStore attach op. Only to be called when the channel is loaded (if applicable).\n\t *\n\t * Synchronously generates the channel's attach summary to be joined with the same from the DataStore's other channels\n\t */\n\tpublic getAttachSummary(telemetryContext?: ITelemetryContext): ISummarizeResult {\n\t\tassert(\n\t\t\tthis._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\t/**\n\t * For crafting the DataStore attach op. Only to be called when the channel is loaded (if applicable).\n\t *\n\t * Synchronously generates the channel's attach GC data (set of outbound routes in the initial state)\n\t * to be joined with the same from the DataStore's other channels\n\t */\n\tpublic getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData {\n\t\tassert(\n\t\t\tthis._channel !== undefined,\n\t\t\t0x8fd /* Local Channel should be loaded before being attached */,\n\t\t);\n\n\t\t// We need the GC Data to detect references added in this attach op\n\t\treturn this._channel.getGCData(/* fullGC: */ true);\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.services.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\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]): void {\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 dirtyFn: () => void;\n\tconstructor(\n\t\tid: string,\n\t\tregistry: ISharedObjectRegistry,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IRuntimeStorageService,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tsubmitFn: (content: unknown, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\tprivate readonly snapshotTree: ISnapshotTree,\n\t\textraBlob?: Map<string, ArrayBufferLike>,\n\t) {\n\t\tsuper(\n\t\t\tid,\n\t\t\truntime,\n\t\t\tnew Lazy(() => {\n\t\t\t\tconst blobMap: Map<string, ArrayBufferLike> = new Map<string, ArrayBufferLike>(\n\t\t\t\t\textraBlob,\n\t\t\t\t);\n\t\t\t\tconst clonedSnapshotTree = cloneSnapshotTree(this.snapshotTree);\n\t\t\t\t// 0.47 back-compat Need to sanitize if snapshotTree.blobs still contains blob contents too.\n\t\t\t\t// This is for older snapshot which is generated by loader <=0.47 version which still contains\n\t\t\t\t// the contents within blobs. After a couple of revisions we can remove it.\n\t\t\t\tif (this.isSnapshotInOldFormatAndCollectBlobs(clonedSnapshotTree, blobMap)) {\n\t\t\t\t\tthis.sanitizeSnapshot(clonedSnapshotTree);\n\t\t\t\t}\n\t\t\t\treturn createChannelServiceEndpoints(\n\t\t\t\t\tdataStoreContext.connected,\n\t\t\t\t\tsubmitFn,\n\t\t\t\t\tthis.dirtyFn,\n\t\t\t\t\t() => this.isGloballyVisible,\n\t\t\t\t\tstorageService,\n\t\t\t\t\tlogger,\n\t\t\t\t\tclonedSnapshotTree,\n\t\t\t\t\tblobMap,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tnew LazyPromise<IChannel>(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst { attributes, factory } = await loadChannelFactoryAndAttributes(\n\t\t\t\t\t\tdataStoreContext,\n\t\t\t\t\t\tthis.services.value,\n\t\t\t\t\t\tthis.id,\n\t\t\t\t\t\tregistry,\n\t\t\t\t\t);\n\t\t\t\t\tconst channel = await loadChannel(\n\t\t\t\t\t\truntime,\n\t\t\t\t\t\tattributes,\n\t\t\t\t\t\tfactory,\n\t\t\t\t\t\tthis.services.value,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tthis.id,\n\t\t\t\t\t);\n\t\t\t\t\t// Send all pending messages to the channel\n\t\t\t\t\tfor (const messageCollection of this.pendingMessagesState.messageCollections) {\n\t\t\t\t\t\tthis.services.value.deltaConnection.processMessages(messageCollection);\n\t\t\t\t\t}\n\t\t\t\t\treturn channel;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow DataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\t\terror,\n\t\t\t\t\t\t\"rehydratedLocalChannelContextFailedToLoadChannel\",\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\tthis.dirtyFn = () => {\n\t\t\tdirtyFn(id);\n\t\t};\n\t}\n\n\tpublic override applyStashedOp(content: unknown): unknown {\n\t\treturn this.services.value.deltaConnection.applyStashedOp(content);\n\t}\n\n\tprivate isSnapshotInOldFormatAndCollectBlobs(\n\t\tsnapshotTree: ISnapshotTreeWithBlobContents,\n\t\tblobMap: Map<string, ArrayBufferLike>,\n\t): boolean {\n\t\tlet sanitize = false;\n\t\tconst blobsContents = snapshotTree.blobsContents;\n\t\tif (blobsContents !== undefined) {\n\t\t\tfor (const [key, value] of Object.entries(blobsContents)) {\n\t\t\t\tblobMap.set(key, value);\n\t\t\t\tif (snapshotTree.blobs[key] !== undefined) {\n\t\t\t\t\tsanitize = true;\n\t\t\t\t}\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): void {\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 dirtyFn: () => void;\n\tconstructor(\n\t\tpublic readonly channel: IChannel,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IRuntimeStorageService,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tsubmitFn: (content: unknown, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t) {\n\t\tsuper(\n\t\t\tchannel.id,\n\t\t\truntime,\n\t\t\tnew Lazy(() => {\n\t\t\t\treturn createChannelServiceEndpoints(\n\t\t\t\t\tdataStoreContext.connected,\n\t\t\t\t\tsubmitFn,\n\t\t\t\t\tthis.dirtyFn,\n\t\t\t\t\t() => this.isGloballyVisible,\n\t\t\t\t\tstorageService,\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tPromise.resolve(channel),\n\t\t\tchannel,\n\t\t);\n\t\tthis.channel = channel;\n\n\t\tthis.dirtyFn = () => {\n\t\t\tdirtyFn(channel.id);\n\t\t};\n\t}\n\n\tpublic applyStashedOp(): void {\n\t\tthrow new Error(\"no stashed ops on local channel\");\n\t}\n}\n\n/**\n * Deep clones a snapshot tree.\n *\n * TODO: Investigate replacing this with a deep clone utility.\n * This is a temporary solution to avoid issues with lodash deepClone and ungap structuredClone.\n * Using lodash caused a significant bundle size regression. structuredClone cannot be used since\n * it does not support ArrayBuffer data types, and ISnapshotTree can contain blobContents properties,\n * which are ArrayBuffer data types.\n */\nfunction cloneSnapshotTree(tree: ISnapshotTree): ISnapshotTree {\n\tconst clone = { ...tree, blobs: { ...tree.blobs }, trees: {} };\n\tfor (const [k, v] of Object.entries(tree.trees)) {\n\t\tclone.trees[k] = cloneSnapshotTree(v);\n\t}\n\treturn clone;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"localChannelContext.js","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAehF,OAAO,EAEN,mBAAmB,GACnB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAGN,6BAA6B,EAC7B,WAAW,EACX,+BAA+B,EAC/B,gBAAgB,EAChB,qBAAqB,GACrB,MAAM,qBAAqB,CAAC;AAG7B;;GAEG;AACH,MAAM,OAAgB,uBAAuB;IAS5C,YACoB,EAAU,EACV,OAA+B,EAC/B,QAAuC,EACzC,QAA2B,EACpC,QAAmB;QAJR,OAAE,GAAF,EAAE,CAAQ;QACV,YAAO,GAAP,OAAO,CAAwB;QAC/B,aAAQ,GAAR,QAAQ,CAA+B;QACzC,aAAQ,GAAR,QAAQ,CAAmB;QACpC,aAAQ,GAAR,QAAQ,CAAW;QAbpB,oBAAe,GAAG,KAAK,CAAC;QAChC;;WAEG;QACO,yBAAoB,GAA0B;YACvD,kBAAkB,EAAE,EAAE;YACtB,YAAY,EAAE,CAAC;SACf,CAAC;QAQD,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACvF,CAAC;IAED,IAAc,iBAAiB;QAC9B,OAAO,IAAI,CAAC,eAAe,CAAC;IAC7B,CAAC;IAEM,KAAK,CAAC,UAAU;QACtB,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;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AC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ISnapshotTreeWithBlobContents } from \"@fluidframework/container-definitions/internal\";\nimport { assert, Lazy, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tITelemetryContext,\n\tIFluidDataStoreContext,\n\tIGarbageCollectionData,\n\tISummarizeResult,\n\tIPendingMessagesState,\n\tIRuntimeMessageCollection,\n\tIRuntimeStorageService,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tDataProcessingError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype ChannelServiceEndpoints,\n\ttype IChannelContext,\n\tcreateChannelServiceEndpoints,\n\tloadChannel,\n\tloadChannelFactoryAndAttributes,\n\tsummarizeChannel,\n\tsummarizeChannelAsync,\n} from \"./channelContext.js\";\nimport type { ISharedObjectRegistry } from \"./dataStoreRuntime.js\";\n\n/**\n * Channel context for a locally created channel\n */\nexport abstract class LocalChannelContextBase implements IChannelContext {\n\tprivate globallyVisible = false;\n\t/**\n\t * Tracks the messages for this channel that are sent while it's not loaded\n\t */\n\tprotected pendingMessagesState: IPendingMessagesState = {\n\t\tmessageCollections: [],\n\t\tpendingCount: 0,\n\t};\n\tconstructor(\n\t\tprotected readonly id: string,\n\t\tprotected readonly runtime: IFluidDataStoreRuntime,\n\t\tprotected readonly services: Lazy<ChannelServiceEndpoints>,\n\t\tprivate readonly channelP: Promise<IChannel>,\n\t\tprivate _channel?: IChannel,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x30f /* Channel context ID cannot contain slashes */);\n\t}\n\n\tprotected get isGloballyVisible(): boolean {\n\t\treturn this.globallyVisible;\n\t}\n\n\tpublic async getChannel(): Promise<IChannel> {\n\t\tif (this._channel === undefined) {\n\t\t\treturn this.channelP.then((c) => (this._channel = c));\n\t\t}\n\t\treturn this.channelP;\n\t}\n\n\tpublic get isLoaded(): boolean {\n\t\treturn this._channel !== undefined;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string): void {\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.services.value.deltaConnection.setConnectionState(connected);\n\t\t}\n\t}\n\n\t/**\n\t * Process messages for this channel context. The messages here are contiguous messages for this context in a batch.\n\t * @param messageCollection - The collection of messages to process.\n\t */\n\tprocessMessages(messageCollection: IRuntimeMessageCollection): 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.services.value.deltaConnection.processMessages(messageCollection);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\t!messageCollection.local,\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\tconst propsCopy = {\n\t\t\t\t...messageCollection,\n\t\t\t\tmessagesContent: [...messageCollection.messagesContent],\n\t\t\t};\n\t\t\tthis.pendingMessagesState.messageCollections.push(propsCopy);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: unknown, localOpMetadata: unknown, squash: boolean): void {\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.services.value.deltaConnection.reSubmit(content, localOpMetadata, squash);\n\t}\n\tpublic rollback(content: unknown, localOpMetadata: unknown): void {\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.services.value.deltaConnection.rollback(content, localOpMetadata);\n\t}\n\n\tpublic abstract applyStashedOp(content: unknown): unknown;\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\tconst channel = await this.getChannel();\n\t\treturn summarizeChannelAsync(channel, fullTree, trackState, telemetryContext);\n\t}\n\n\t/**\n\t * For crafting the DataStore attach op. Only to be called when the channel is loaded (if applicable).\n\t *\n\t * Synchronously generates the channel's attach summary to be joined with the same from the DataStore's other channels\n\t */\n\tpublic getAttachSummary(telemetryContext?: ITelemetryContext): ISummarizeResult {\n\t\tassert(\n\t\t\tthis._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\t/**\n\t * For crafting the DataStore attach op. Only to be called when the channel is loaded (if applicable).\n\t *\n\t * Synchronously generates the channel's attach GC data (set of outbound routes in the initial state)\n\t * to be joined with the same from the DataStore's other channels\n\t */\n\tpublic getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData {\n\t\tassert(\n\t\t\tthis._channel !== undefined,\n\t\t\t0x8fd /* Local Channel should be loaded before being attached */,\n\t\t);\n\n\t\t// We need the GC Data to detect references added in this attach op\n\t\treturn this._channel.getGCData(/* fullGC: */ true);\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.services.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\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]): void {\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 dirtyFn: () => void;\n\tconstructor(\n\t\tid: string,\n\t\tregistry: ISharedObjectRegistry,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IRuntimeStorageService,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tsubmitFn: (content: unknown, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\tprivate readonly snapshotTree: ISnapshotTree,\n\t\textraBlob?: Map<string, ArrayBufferLike>,\n\t) {\n\t\tsuper(\n\t\t\tid,\n\t\t\truntime,\n\t\t\tnew Lazy(() => {\n\t\t\t\tconst blobMap: Map<string, ArrayBufferLike> = new Map<string, ArrayBufferLike>(\n\t\t\t\t\textraBlob,\n\t\t\t\t);\n\t\t\t\tconst clonedSnapshotTree = cloneSnapshotTree(this.snapshotTree);\n\t\t\t\t// 0.47 back-compat Need to sanitize if snapshotTree.blobs still contains blob contents too.\n\t\t\t\t// This is for older snapshot which is generated by loader <=0.47 version which still contains\n\t\t\t\t// the contents within blobs. After a couple of revisions we can remove it.\n\t\t\t\tif (this.isSnapshotInOldFormatAndCollectBlobs(clonedSnapshotTree, blobMap)) {\n\t\t\t\t\tthis.sanitizeSnapshot(clonedSnapshotTree);\n\t\t\t\t}\n\t\t\t\treturn createChannelServiceEndpoints(\n\t\t\t\t\tdataStoreContext.connected,\n\t\t\t\t\tsubmitFn,\n\t\t\t\t\tthis.dirtyFn,\n\t\t\t\t\t() => this.isGloballyVisible,\n\t\t\t\t\tstorageService,\n\t\t\t\t\tlogger,\n\t\t\t\t\tclonedSnapshotTree,\n\t\t\t\t\tblobMap,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tnew LazyPromise<IChannel>(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst { attributes, factory } = await loadChannelFactoryAndAttributes(\n\t\t\t\t\t\tdataStoreContext,\n\t\t\t\t\t\tthis.services.value,\n\t\t\t\t\t\tthis.id,\n\t\t\t\t\t\tregistry,\n\t\t\t\t\t);\n\t\t\t\t\tconst channel = await loadChannel(\n\t\t\t\t\t\truntime,\n\t\t\t\t\t\tattributes,\n\t\t\t\t\t\tfactory,\n\t\t\t\t\t\tthis.services.value,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tthis.id,\n\t\t\t\t\t);\n\t\t\t\t\t// Send all pending messages to the channel\n\t\t\t\t\tfor (const messageCollection of this.pendingMessagesState.messageCollections) {\n\t\t\t\t\t\tthis.services.value.deltaConnection.processMessages(messageCollection);\n\t\t\t\t\t}\n\t\t\t\t\treturn channel;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow DataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\t\terror,\n\t\t\t\t\t\t\"rehydratedLocalChannelContextFailedToLoadChannel\",\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\tthis.dirtyFn = () => {\n\t\t\tdirtyFn(id);\n\t\t};\n\t}\n\n\tpublic override applyStashedOp(content: unknown): unknown {\n\t\treturn this.services.value.deltaConnection.applyStashedOp(content);\n\t}\n\n\tprivate isSnapshotInOldFormatAndCollectBlobs(\n\t\tsnapshotTree: ISnapshotTreeWithBlobContents,\n\t\tblobMap: Map<string, ArrayBufferLike>,\n\t): boolean {\n\t\tlet sanitize = false;\n\t\tconst blobsContents = snapshotTree.blobsContents;\n\t\tif (blobsContents !== undefined) {\n\t\t\tfor (const [key, value] of Object.entries(blobsContents)) {\n\t\t\t\tblobMap.set(key, value);\n\t\t\t\tif (snapshotTree.blobs[key] !== undefined) {\n\t\t\t\t\tsanitize = true;\n\t\t\t\t}\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): void {\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 dirtyFn: () => void;\n\tconstructor(\n\t\tpublic readonly channel: IChannel,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IRuntimeStorageService,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tsubmitFn: (content: unknown, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t) {\n\t\tsuper(\n\t\t\tchannel.id,\n\t\t\truntime,\n\t\t\tnew Lazy(() => {\n\t\t\t\treturn createChannelServiceEndpoints(\n\t\t\t\t\tdataStoreContext.connected,\n\t\t\t\t\tsubmitFn,\n\t\t\t\t\tthis.dirtyFn,\n\t\t\t\t\t() => this.isGloballyVisible,\n\t\t\t\t\tstorageService,\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tPromise.resolve(channel),\n\t\t\tchannel,\n\t\t);\n\t\tthis.channel = channel;\n\n\t\tthis.dirtyFn = () => {\n\t\t\tdirtyFn(channel.id);\n\t\t};\n\t}\n\n\tpublic applyStashedOp(): void {\n\t\tthrow new Error(\"no stashed ops on local channel\");\n\t}\n}\n\n/**\n * Deep clones a snapshot tree.\n *\n * TODO: Investigate replacing this with a deep clone utility.\n * This is a temporary solution to avoid issues with lodash deepClone and ungap structuredClone.\n * Using lodash caused a significant bundle size regression. structuredClone cannot be used since\n * it does not support ArrayBuffer data types, and ISnapshotTree can contain blobContents properties,\n * which are ArrayBuffer data types.\n */\nfunction cloneSnapshotTree(tree: ISnapshotTree): ISnapshotTree {\n\tconst clone = { ...tree, blobs: { ...tree.blobs }, trees: {} };\n\tfor (const [k, v] of Object.entries(tree.trees)) {\n\t\tclone.trees[k] = cloneSnapshotTree(v);\n\t}\n\treturn clone;\n}\n"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
6
|
-
import { ITree } from "@fluidframework/driver-definitions/internal";
|
|
5
|
+
import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
6
|
+
import { type ITree } from "@fluidframework/driver-definitions/internal";
|
|
7
7
|
export declare class LocalChannelStorageService implements IChannelStorageService {
|
|
8
8
|
private readonly tree;
|
|
9
9
|
constructor(tree: ITree);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelStorageService.d.ts","sourceRoot":"","sources":["../src/localChannelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"localChannelStorageService.d.ts","sourceRoot":"","sources":["../src/localChannelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAEN,KAAK,KAAK,EAEV,MAAM,6CAA6C,CAAC;AAGrD,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;CAuB5B"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { stringToBuffer } from "@fluid-internal/client-utils";
|
|
6
|
-
import { TreeEntry } from "@fluidframework/driver-definitions/internal";
|
|
6
|
+
import { TreeEntry, } from "@fluidframework/driver-definitions/internal";
|
|
7
7
|
import { listBlobsAtTreePath } from "@fluidframework/runtime-utils/internal";
|
|
8
8
|
export class LocalChannelStorageService {
|
|
9
9
|
constructor(tree) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelStorageService.js","sourceRoot":"","sources":["../src/localChannelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,
|
|
1
|
+
{"version":3,"file":"localChannelStorageService.js","sourceRoot":"","sources":["../src/localChannelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAGN,SAAS,GACT,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAE7E,MAAM,OAAO,0BAA0B;IACtC,YAA6B,IAAW;QAAX,SAAI,GAAJ,IAAI,CAAO;IAAG,CAAC;IAErC,KAAK,CAAC,QAAQ,CAAC,IAAY;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,IAAY;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACrC,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC;IACjE,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,IAAY;QAC7B,OAAO,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;IAEO,YAAY,CAAC,IAAY;QAChC,OAAO,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;IAEO,oBAAoB,CAAC,IAAY,EAAE,IAAW;QACrD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;gBACpB,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;oBACrB,IAAI,IAAI,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC;wBACzB,OAAO,KAAK,CAAC,KAAK,CAAC;oBACpB,CAAC;oBACD,MAAM;gBACP,CAAC;gBAED,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;oBACrB,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;wBACjC,OAAO,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;oBAClF,CAAC;oBACD,MAAM;gBACP,CAAC;gBAED,QAAQ;YACT,CAAC;QACF,CAAC;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 { stringToBuffer } from \"@fluid-internal/client-utils\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\ttype IBlob,\n\ttype ITree,\n\tTreeEntry,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { listBlobsAtTreePath } from \"@fluidframework/runtime-utils/internal\";\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 ? false : blob.contents !== undefined;\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\t\t\t\t}\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(path.slice(entry.path.length + 1), entry.value);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\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
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/datastore\";\nexport const pkgVersion = \"2.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/datastore\";\nexport const pkgVersion = \"2.60.0\";\n"]}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IChannel, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions/internal";
|
|
6
|
-
import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
7
|
-
import { ITelemetryContext, IGarbageCollectionData, CreateChildSummarizerNodeFn, IFluidDataStoreContext, ISummarizeResult,
|
|
8
|
-
import { IChannelContext } from "./channelContext.js";
|
|
9
|
-
import { ISharedObjectRegistry } from "./dataStoreRuntime.js";
|
|
5
|
+
import type { IChannel, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions/internal";
|
|
6
|
+
import type { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import type { ITelemetryContext, IGarbageCollectionData, CreateChildSummarizerNodeFn, IFluidDataStoreContext, ISummarizeResult, IRuntimeMessageCollection, IRuntimeStorageService } from "@fluidframework/runtime-definitions/internal";
|
|
8
|
+
import { type IChannelContext } from "./channelContext.js";
|
|
9
|
+
import type { ISharedObjectRegistry } from "./dataStoreRuntime.js";
|
|
10
10
|
export declare class RemoteChannelContext implements IChannelContext {
|
|
11
11
|
private readonly id;
|
|
12
12
|
private isLoaded;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteChannelContext.d.ts","sourceRoot":"","sources":["../src/remote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AAC;IAC9C,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,iBAAiB,CAAC,SAAkB,KAAK;QACtD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAEM,gBAAgB,CAAC,UAAoB;QAC3C;;;;;WAKG;QACH,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;;AAvNuB,6CAAwB,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions/internal\";\nimport { assert, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIExperimentalIncrementalSummaryContext,\n\tITelemetryContext,\n\tIGarbageCollectionData,\n\tCreateChildSummarizerNodeFn,\n\tIFluidDataStoreContext,\n\tISummarizeInternalResult,\n\tISummarizeResult,\n\tISummarizerNodeWithGC,\n\ttype IPendingMessagesState,\n\ttype IRuntimeMessageCollection,\n\ttype IRuntimeStorageService,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tThresholdCounter,\n\tcreateChildLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tChannelServiceEndpoints,\n\tIChannelContext,\n\tcreateChannelServiceEndpoints,\n\tloadChannel,\n\tloadChannelFactoryAndAttributes,\n\tsummarizeChannelAsync,\n} from \"./channelContext.js\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime.js\";\n\nexport class RemoteChannelContext implements IChannelContext {\n\tprivate isLoaded = false;\n\t/**\n\t * Tracks the messages for this channel that are sent while it's not loaded\n\t */\n\tprivate pendingMessagesState: IPendingMessagesState | undefined = {\n\t\tmessageCollections: [],\n\t\tpendingCount: 0,\n\t};\n\tprivate readonly channelP: Promise<IChannel>;\n\tprivate channel: IChannel | undefined;\n\tprivate readonly services: ChannelServiceEndpoints;\n\tprivate readonly summarizerNode: ISummarizerNodeWithGC;\n\tprivate readonly subLogger: ITelemetryLoggerExt;\n\tprivate readonly thresholdOpsCounter: ThresholdCounter;\n\tprivate static readonly pendingOpsCountThreshold = 1000;\n\n\tconstructor(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IRuntimeStorageService,\n\t\tsubmitFn: (content: unknown, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\tprivate readonly id: string,\n\t\tbaseSnapshot: ISnapshotTree,\n\t\tregistry: ISharedObjectRegistry,\n\t\textraBlobs: Map<string, ArrayBufferLike> | undefined,\n\t\tcreateSummarizerNode: CreateChildSummarizerNodeFn,\n\t\tattachMessageType?: string,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x310 /* Channel context ID cannot contain slashes */);\n\n\t\tthis.subLogger = createChildLogger({\n\t\t\tlogger: runtime.logger,\n\t\t\tnamespace: \"RemoteChannelContext\",\n\t\t});\n\n\t\tthis.services = createChannelServiceEndpoints(\n\t\t\tdataStoreContext.connected,\n\t\t\tsubmitFn,\n\t\t\t() => dirtyFn(this.id),\n\t\t\t() => runtime.attachState !== AttachState.Detached,\n\t\t\tstorageService,\n\t\t\tthis.subLogger,\n\t\t\tbaseSnapshot,\n\t\t\textraBlobs,\n\t\t);\n\n\t\tthis.channelP = new LazyPromise<IChannel>(async () => {\n\t\t\tconst { attributes, factory } = await loadChannelFactoryAndAttributes(\n\t\t\t\tdataStoreContext,\n\t\t\t\tthis.services,\n\t\t\t\tthis.id,\n\t\t\t\tregistry,\n\t\t\t\tattachMessageType,\n\t\t\t);\n\n\t\t\tconst channel = await loadChannel(\n\t\t\t\truntime,\n\t\t\t\tattributes,\n\t\t\t\tfactory,\n\t\t\t\tthis.services,\n\t\t\t\tthis.subLogger,\n\t\t\t\tthis.id,\n\t\t\t);\n\n\t\t\tassert(\n\t\t\t\tthis.pendingMessagesState !== undefined,\n\t\t\t\t0xa6c /* pending messages state is undefined */,\n\t\t\t);\n\t\t\tfor (const messageCollection of this.pendingMessagesState.messageCollections) {\n\t\t\t\tthis.services.deltaConnection.processMessages(messageCollection);\n\t\t\t}\n\t\t\tthis.thresholdOpsCounter.send(\n\t\t\t\t\"ProcessPendingOps\",\n\t\t\t\tthis.pendingMessagesState.pendingCount,\n\t\t\t);\n\n\t\t\t// Commit changes.\n\t\t\tthis.channel = channel;\n\t\t\tthis.pendingMessagesState = undefined;\n\t\t\tthis.isLoaded = true;\n\n\t\t\t// Because have some await between we created the service and here, the connection state might have changed\n\t\t\t// and we don't propagate the connection state when we are not loaded. So we have to set it again here.\n\t\t\tthis.services.deltaConnection.setConnectionState(dataStoreContext.connected);\n\t\t\treturn this.channel;\n\t\t});\n\n\t\tthis.summarizerNode = createSummarizerNode(\n\t\t\tasync (\n\t\t\t\tfullTree,\n\t\t\t\ttrackState,\n\t\t\t\ttelemetryContext,\n\t\t\t\tincrementalSummaryContext,\n\t\t\t): Promise<ISummarizeInternalResult> =>\n\t\t\t\tthis.summarizeInternal(\n\t\t\t\t\tfullTree,\n\t\t\t\t\ttrackState,\n\t\t\t\t\ttelemetryContext,\n\t\t\t\t\tincrementalSummaryContext,\n\t\t\t\t),\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t);\n\n\t\tthis.thresholdOpsCounter = new ThresholdCounter(\n\t\t\tRemoteChannelContext.pendingOpsCountThreshold,\n\t\t\tthis.subLogger,\n\t\t);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tpublic getChannel(): Promise<IChannel> {\n\t\treturn this.channelP;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string): void {\n\t\t// Connection events are ignored if the data store is not yet loaded\n\t\tif (!this.isLoaded) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.services.deltaConnection.setConnectionState(connected);\n\t}\n\n\tpublic applyStashedOp(content: unknown): unknown {\n\t\tassert(this.isLoaded, 0x194 /* \"Remote channel must be loaded when rebasing op\" */);\n\t\treturn this.services.deltaConnection.applyStashedOp(content);\n\t}\n\n\t/**\n\t * Process messages for this channel context. The messages here are contiguous messages for this context in a batch.\n\t * @param messageCollection - The collection of messages to process.\n\t */\n\tpublic processMessages(messageCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, messagesContent, local } = messageCollection;\n\t\tthis.summarizerNode.invalidate(envelope.sequenceNumber);\n\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.deltaConnection.processMessages(messageCollection);\n\t\t} else {\n\t\t\tassert(!local, 0x195 /* \"Remote channel must not be local when processing op\" */);\n\t\t\tassert(\n\t\t\t\tthis.pendingMessagesState !== undefined,\n\t\t\t\t0xa6d /* pending messages queue is undefined */,\n\t\t\t);\n\t\t\tthis.pendingMessagesState.messageCollections.push({\n\t\t\t\t...messageCollection,\n\t\t\t\tmessagesContent: [...messagesContent],\n\t\t\t});\n\t\t\tthis.pendingMessagesState.pendingCount += messagesContent.length;\n\t\t\tthis.thresholdOpsCounter.sendIfMultiple(\n\t\t\t\t\"StorePendingOps\",\n\t\t\t\tthis.pendingMessagesState.pendingCount,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: unknown, localOpMetadata: unknown, squash: boolean): void {\n\t\tassert(this.isLoaded, 0x196 /* \"Remote channel must be loaded when resubmitting op\" */);\n\n\t\tthis.services.deltaConnection.reSubmit(content, localOpMetadata, squash);\n\t}\n\n\tpublic rollback(content: unknown, localOpMetadata: unknown): void {\n\t\tassert(this.isLoaded, 0x2f0 /* \"Remote channel must be loaded when rolling back op\" */);\n\n\t\tthis.services.deltaConnection.rollback(content, localOpMetadata);\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<ISummarizeResult> {\n\t\treturn this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n\t}\n\n\tprivate async summarizeInternal(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): Promise<ISummarizeInternalResult> {\n\t\tconst channel = await this.getChannel();\n\t\tconst summarizeResult = await summarizeChannelAsync(\n\t\t\tchannel,\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\t\treturn { ...summarizeResult, id: this.id };\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.\n\t * If there is no new data in this context since the last summary, previous GC data is used.\n\t * If there is new data, the GC data is generated again (by calling getGCDataInternal).\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\treturn this.summarizerNode.getGCData(fullGC);\n\t}\n\n\t/**\n\t * Generates the data used for garbage collection. This is called when there is new data since last summary. It\n\t * loads the context and calls into the channel to get its GC data.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tprivate async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]): void {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's\n\t\t * used routes to contain a route to this channel context.\n\t\t * Once we have GC at DDS level, this will be updated to use the passed usedRoutes. See -\n\t\t * https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t\tthis.summarizerNode.updateUsedRoutes([\"\"]);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"remoteChannelContext.js","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAmB1E,OAAO,EAEN,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAGN,6BAA6B,EAC7B,WAAW,EACX,+BAA+B,EAC/B,qBAAqB,GACrB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,OAAO,oBAAoB;IAiBhC,YACC,OAA+B,EAC/B,gBAAwC,EACxC,cAAsC,EACtC,QAA8D,EAC9D,OAAkC,EACjB,EAAU,EAC3B,YAA2B,EAC3B,QAA+B,EAC/B,UAAoD,EACpD,oBAAiD,EACjD,iBAA0B;QALT,OAAE,GAAF,EAAE,CAAQ;QAtBpB,aAAQ,GAAG,KAAK,CAAC;QACzB;;WAEG;QACK,yBAAoB,GAAsC;YACjE,kBAAkB,EAAE,EAAE;YACtB,YAAY,EAAE,CAAC;SACf,CAAC;QAsBD,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAEtF,IAAI,CAAC,SAAS,GAAG,iBAAiB,CAAC;YAClC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,SAAS,EAAE,sBAAsB;SACjC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,GAAG,6BAA6B,CAC5C,gBAAgB,CAAC,SAAS,EAC1B,QAAQ,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ACnB,gBAAoC,EACpC,yBAAkE;QAElE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,MAAM,eAAe,GAAG,MAAM,qBAAqB,CAClD,OAAO,EACP,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,yBAAyB,CACzB,CAAC;QACF,OAAO,EAAE,GAAG,eAAe,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,SAAS,CAAC,SAAkB,KAAK;QAC7C,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,iBAAiB,CAAC,SAAkB,KAAK;QACtD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAEM,gBAAgB,CAAC,UAAoB;QAC3C;;;;;WAKG;QACH,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;;AAvNuB,6CAAwB,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions/internal\";\nimport { assert, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tITelemetryContext,\n\tIGarbageCollectionData,\n\tCreateChildSummarizerNodeFn,\n\tIFluidDataStoreContext,\n\tISummarizeInternalResult,\n\tISummarizeResult,\n\tISummarizerNodeWithGC,\n\tIPendingMessagesState,\n\tIRuntimeMessageCollection,\n\tIRuntimeStorageService,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tThresholdCounter,\n\tcreateChildLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype ChannelServiceEndpoints,\n\ttype IChannelContext,\n\tcreateChannelServiceEndpoints,\n\tloadChannel,\n\tloadChannelFactoryAndAttributes,\n\tsummarizeChannelAsync,\n} from \"./channelContext.js\";\nimport type { ISharedObjectRegistry } from \"./dataStoreRuntime.js\";\n\nexport class RemoteChannelContext implements IChannelContext {\n\tprivate isLoaded = false;\n\t/**\n\t * Tracks the messages for this channel that are sent while it's not loaded\n\t */\n\tprivate pendingMessagesState: IPendingMessagesState | undefined = {\n\t\tmessageCollections: [],\n\t\tpendingCount: 0,\n\t};\n\tprivate readonly channelP: Promise<IChannel>;\n\tprivate channel: IChannel | undefined;\n\tprivate readonly services: ChannelServiceEndpoints;\n\tprivate readonly summarizerNode: ISummarizerNodeWithGC;\n\tprivate readonly subLogger: ITelemetryLoggerExt;\n\tprivate readonly thresholdOpsCounter: ThresholdCounter;\n\tprivate static readonly pendingOpsCountThreshold = 1000;\n\n\tconstructor(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IRuntimeStorageService,\n\t\tsubmitFn: (content: unknown, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\tprivate readonly id: string,\n\t\tbaseSnapshot: ISnapshotTree,\n\t\tregistry: ISharedObjectRegistry,\n\t\textraBlobs: Map<string, ArrayBufferLike> | undefined,\n\t\tcreateSummarizerNode: CreateChildSummarizerNodeFn,\n\t\tattachMessageType?: string,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x310 /* Channel context ID cannot contain slashes */);\n\n\t\tthis.subLogger = createChildLogger({\n\t\t\tlogger: runtime.logger,\n\t\t\tnamespace: \"RemoteChannelContext\",\n\t\t});\n\n\t\tthis.services = createChannelServiceEndpoints(\n\t\t\tdataStoreContext.connected,\n\t\t\tsubmitFn,\n\t\t\t() => dirtyFn(this.id),\n\t\t\t() => runtime.attachState !== AttachState.Detached,\n\t\t\tstorageService,\n\t\t\tthis.subLogger,\n\t\t\tbaseSnapshot,\n\t\t\textraBlobs,\n\t\t);\n\n\t\tthis.channelP = new LazyPromise<IChannel>(async () => {\n\t\t\tconst { attributes, factory } = await loadChannelFactoryAndAttributes(\n\t\t\t\tdataStoreContext,\n\t\t\t\tthis.services,\n\t\t\t\tthis.id,\n\t\t\t\tregistry,\n\t\t\t\tattachMessageType,\n\t\t\t);\n\n\t\t\tconst channel = await loadChannel(\n\t\t\t\truntime,\n\t\t\t\tattributes,\n\t\t\t\tfactory,\n\t\t\t\tthis.services,\n\t\t\t\tthis.subLogger,\n\t\t\t\tthis.id,\n\t\t\t);\n\n\t\t\tassert(\n\t\t\t\tthis.pendingMessagesState !== undefined,\n\t\t\t\t0xa6c /* pending messages state is undefined */,\n\t\t\t);\n\t\t\tfor (const messageCollection of this.pendingMessagesState.messageCollections) {\n\t\t\t\tthis.services.deltaConnection.processMessages(messageCollection);\n\t\t\t}\n\t\t\tthis.thresholdOpsCounter.send(\n\t\t\t\t\"ProcessPendingOps\",\n\t\t\t\tthis.pendingMessagesState.pendingCount,\n\t\t\t);\n\n\t\t\t// Commit changes.\n\t\t\tthis.channel = channel;\n\t\t\tthis.pendingMessagesState = undefined;\n\t\t\tthis.isLoaded = true;\n\n\t\t\t// Because have some await between we created the service and here, the connection state might have changed\n\t\t\t// and we don't propagate the connection state when we are not loaded. So we have to set it again here.\n\t\t\tthis.services.deltaConnection.setConnectionState(dataStoreContext.connected);\n\t\t\treturn this.channel;\n\t\t});\n\n\t\tthis.summarizerNode = createSummarizerNode(\n\t\t\tasync (\n\t\t\t\tfullTree,\n\t\t\t\ttrackState,\n\t\t\t\ttelemetryContext,\n\t\t\t\tincrementalSummaryContext,\n\t\t\t): Promise<ISummarizeInternalResult> =>\n\t\t\t\tthis.summarizeInternal(\n\t\t\t\t\tfullTree,\n\t\t\t\t\ttrackState,\n\t\t\t\t\ttelemetryContext,\n\t\t\t\t\tincrementalSummaryContext,\n\t\t\t\t),\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t);\n\n\t\tthis.thresholdOpsCounter = new ThresholdCounter(\n\t\t\tRemoteChannelContext.pendingOpsCountThreshold,\n\t\t\tthis.subLogger,\n\t\t);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tpublic getChannel(): Promise<IChannel> {\n\t\treturn this.channelP;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string): void {\n\t\t// Connection events are ignored if the data store is not yet loaded\n\t\tif (!this.isLoaded) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.services.deltaConnection.setConnectionState(connected);\n\t}\n\n\tpublic applyStashedOp(content: unknown): unknown {\n\t\tassert(this.isLoaded, 0x194 /* \"Remote channel must be loaded when rebasing op\" */);\n\t\treturn this.services.deltaConnection.applyStashedOp(content);\n\t}\n\n\t/**\n\t * Process messages for this channel context. The messages here are contiguous messages for this context in a batch.\n\t * @param messageCollection - The collection of messages to process.\n\t */\n\tpublic processMessages(messageCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, messagesContent, local } = messageCollection;\n\t\tthis.summarizerNode.invalidate(envelope.sequenceNumber);\n\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.deltaConnection.processMessages(messageCollection);\n\t\t} else {\n\t\t\tassert(!local, 0x195 /* \"Remote channel must not be local when processing op\" */);\n\t\t\tassert(\n\t\t\t\tthis.pendingMessagesState !== undefined,\n\t\t\t\t0xa6d /* pending messages queue is undefined */,\n\t\t\t);\n\t\t\tthis.pendingMessagesState.messageCollections.push({\n\t\t\t\t...messageCollection,\n\t\t\t\tmessagesContent: [...messagesContent],\n\t\t\t});\n\t\t\tthis.pendingMessagesState.pendingCount += messagesContent.length;\n\t\t\tthis.thresholdOpsCounter.sendIfMultiple(\n\t\t\t\t\"StorePendingOps\",\n\t\t\t\tthis.pendingMessagesState.pendingCount,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: unknown, localOpMetadata: unknown, squash: boolean): void {\n\t\tassert(this.isLoaded, 0x196 /* \"Remote channel must be loaded when resubmitting op\" */);\n\n\t\tthis.services.deltaConnection.reSubmit(content, localOpMetadata, squash);\n\t}\n\n\tpublic rollback(content: unknown, localOpMetadata: unknown): void {\n\t\tassert(this.isLoaded, 0x2f0 /* \"Remote channel must be loaded when rolling back op\" */);\n\n\t\tthis.services.deltaConnection.rollback(content, localOpMetadata);\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<ISummarizeResult> {\n\t\treturn this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n\t}\n\n\tprivate async summarizeInternal(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): Promise<ISummarizeInternalResult> {\n\t\tconst channel = await this.getChannel();\n\t\tconst summarizeResult = await summarizeChannelAsync(\n\t\t\tchannel,\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\t\treturn { ...summarizeResult, id: this.id };\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.\n\t * If there is no new data in this context since the last summary, previous GC data is used.\n\t * If there is new data, the GC data is generated again (by calling getGCDataInternal).\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\treturn this.summarizerNode.getGCData(fullGC);\n\t}\n\n\t/**\n\t * Generates the data used for garbage collection. This is called when there is new data since last summary. It\n\t * loads the context and calls into the channel to get its GC data.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tprivate async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]): void {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's\n\t\t * used routes to contain a route to this channel context.\n\t\t * Once we have GC at DDS level, this will be updated to use the passed usedRoutes. See -\n\t\t * https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t\tthis.summarizerNode.updateUsedRoutes([\"\"]);\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/datastore",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.60.0",
|
|
4
4
|
"description": "Fluid data store implementation",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,29 +69,29 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluid-internal/client-utils": "~2.
|
|
73
|
-
"@fluidframework/container-definitions": "~2.
|
|
74
|
-
"@fluidframework/core-interfaces": "~2.
|
|
75
|
-
"@fluidframework/core-utils": "~2.
|
|
76
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
77
|
-
"@fluidframework/driver-definitions": "~2.
|
|
78
|
-
"@fluidframework/driver-utils": "~2.
|
|
79
|
-
"@fluidframework/id-compressor": "~2.
|
|
80
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
81
|
-
"@fluidframework/runtime-utils": "~2.
|
|
82
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
72
|
+
"@fluid-internal/client-utils": "~2.60.0",
|
|
73
|
+
"@fluidframework/container-definitions": "~2.60.0",
|
|
74
|
+
"@fluidframework/core-interfaces": "~2.60.0",
|
|
75
|
+
"@fluidframework/core-utils": "~2.60.0",
|
|
76
|
+
"@fluidframework/datastore-definitions": "~2.60.0",
|
|
77
|
+
"@fluidframework/driver-definitions": "~2.60.0",
|
|
78
|
+
"@fluidframework/driver-utils": "~2.60.0",
|
|
79
|
+
"@fluidframework/id-compressor": "~2.60.0",
|
|
80
|
+
"@fluidframework/runtime-definitions": "~2.60.0",
|
|
81
|
+
"@fluidframework/runtime-utils": "~2.60.0",
|
|
82
|
+
"@fluidframework/telemetry-utils": "~2.60.0",
|
|
83
83
|
"uuid": "^11.1.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
87
87
|
"@biomejs/biome": "~1.9.3",
|
|
88
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
88
|
+
"@fluid-internal/mocha-test-setup": "~2.60.0",
|
|
89
89
|
"@fluid-tools/build-cli": "^0.57.0",
|
|
90
90
|
"@fluidframework/build-common": "^2.0.3",
|
|
91
91
|
"@fluidframework/build-tools": "^0.57.0",
|
|
92
|
-
"@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.
|
|
93
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
94
|
-
"@fluidframework/test-runtime-utils": "~2.
|
|
92
|
+
"@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.53.0",
|
|
93
|
+
"@fluidframework/eslint-config-fluid": "^6.0.0",
|
|
94
|
+
"@fluidframework/test-runtime-utils": "~2.60.0",
|
|
95
95
|
"@microsoft/api-extractor": "7.52.8",
|
|
96
96
|
"@types/lodash": "^4.14.118",
|
|
97
97
|
"@types/mocha": "^10.0.10",
|
package/src/channelContext.ts
CHANGED
|
@@ -3,34 +3,34 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import type {
|
|
7
7
|
IChannel,
|
|
8
8
|
IChannelAttributes,
|
|
9
9
|
IChannelFactory,
|
|
10
10
|
IFluidDataStoreRuntime,
|
|
11
11
|
} from "@fluidframework/datastore-definitions/internal";
|
|
12
|
-
import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
12
|
+
import type { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
13
13
|
import { readAndParse } from "@fluidframework/driver-utils/internal";
|
|
14
|
-
import {
|
|
14
|
+
import type {
|
|
15
15
|
IExperimentalIncrementalSummaryContext,
|
|
16
16
|
ISummaryTreeWithStats,
|
|
17
17
|
ITelemetryContext,
|
|
18
18
|
IGarbageCollectionData,
|
|
19
19
|
IFluidDataStoreContext,
|
|
20
20
|
ISummarizeResult,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
IRuntimeMessageCollection,
|
|
22
|
+
IRuntimeStorageService,
|
|
23
23
|
} from "@fluidframework/runtime-definitions/internal";
|
|
24
24
|
import { addBlobToSummary } from "@fluidframework/runtime-utils/internal";
|
|
25
25
|
import {
|
|
26
|
-
ITelemetryLoggerExt,
|
|
26
|
+
type ITelemetryLoggerExt,
|
|
27
27
|
DataCorruptionError,
|
|
28
28
|
tagCodeArtifacts,
|
|
29
29
|
} from "@fluidframework/telemetry-utils/internal";
|
|
30
30
|
|
|
31
31
|
import { ChannelDeltaConnection } from "./channelDeltaConnection.js";
|
|
32
32
|
import { ChannelStorageService } from "./channelStorageService.js";
|
|
33
|
-
import { ISharedObjectRegistry } from "./dataStoreRuntime.js";
|
|
33
|
+
import type { ISharedObjectRegistry } from "./dataStoreRuntime.js";
|
|
34
34
|
|
|
35
35
|
export const attributesBlobKey = ".attributes";
|
|
36
36
|
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
-
import { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
8
|
-
import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
8
|
+
import type { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
9
9
|
import type { IRuntimeStorageService } from "@fluidframework/runtime-definitions/internal";
|
|
10
10
|
import { getNormalizedObjectStoragePathParts } from "@fluidframework/runtime-utils/internal";
|
|
11
|
-
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
11
|
+
import type { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
12
12
|
|
|
13
13
|
export class ChannelStorageService implements IChannelStorageService {
|
|
14
14
|
private static flattenTree(
|
package/src/dataStoreRuntime.ts
CHANGED
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { TypedEventEmitter, type ILayerCompatDetails } from "@fluid-internal/client-utils";
|
|
7
|
-
import { AttachState, IAudience } from "@fluidframework/container-definitions";
|
|
8
|
-
import { IDeltaManager } from "@fluidframework/container-definitions/internal";
|
|
9
|
-
import {
|
|
7
|
+
import { AttachState, type IAudience } from "@fluidframework/container-definitions";
|
|
8
|
+
import type { IDeltaManager } from "@fluidframework/container-definitions/internal";
|
|
9
|
+
import type {
|
|
10
10
|
FluidObject,
|
|
11
11
|
IFluidHandle,
|
|
12
12
|
IRequest,
|
|
13
13
|
IResponse,
|
|
14
14
|
} from "@fluidframework/core-interfaces";
|
|
15
|
-
import {
|
|
16
|
-
|
|
15
|
+
import type {
|
|
16
|
+
IFluidHandleContext,
|
|
17
|
+
IFluidHandleInternal,
|
|
18
|
+
} from "@fluidframework/core-interfaces/internal";
|
|
17
19
|
import {
|
|
18
20
|
assert,
|
|
19
21
|
debugAssert,
|
|
@@ -21,42 +23,42 @@ import {
|
|
|
21
23
|
LazyPromise,
|
|
22
24
|
unreachableCase,
|
|
23
25
|
} from "@fluidframework/core-utils/internal";
|
|
24
|
-
import {
|
|
26
|
+
import type {
|
|
25
27
|
IChannel,
|
|
26
28
|
IChannelFactory,
|
|
27
29
|
IFluidDataStoreRuntime,
|
|
28
30
|
IFluidDataStoreRuntimeEvents,
|
|
29
|
-
|
|
31
|
+
IDeltaManagerErased,
|
|
30
32
|
// eslint-disable-next-line import/no-deprecated
|
|
31
|
-
|
|
33
|
+
IFluidDataStoreRuntimeExperimental,
|
|
32
34
|
} from "@fluidframework/datastore-definitions/internal";
|
|
33
35
|
import {
|
|
34
|
-
IClientDetails,
|
|
35
|
-
IQuorumClients,
|
|
36
|
-
ISummaryBlob,
|
|
37
|
-
ISummaryTree,
|
|
36
|
+
type IClientDetails,
|
|
37
|
+
type IQuorumClients,
|
|
38
|
+
type ISummaryBlob,
|
|
39
|
+
type ISummaryTree,
|
|
38
40
|
SummaryType,
|
|
39
41
|
} from "@fluidframework/driver-definitions";
|
|
40
|
-
import {
|
|
42
|
+
import type {
|
|
41
43
|
IDocumentMessage,
|
|
42
|
-
|
|
44
|
+
ISnapshotTree,
|
|
43
45
|
ISequencedDocumentMessage,
|
|
44
46
|
} from "@fluidframework/driver-definitions/internal";
|
|
45
47
|
import { buildSnapshotTree } from "@fluidframework/driver-utils/internal";
|
|
46
|
-
import { IIdCompressor } from "@fluidframework/id-compressor";
|
|
48
|
+
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
47
49
|
import {
|
|
48
|
-
ISummaryTreeWithStats,
|
|
49
|
-
ITelemetryContext,
|
|
50
|
-
IGarbageCollectionData,
|
|
51
|
-
CreateChildSummarizerNodeParam,
|
|
50
|
+
type ISummaryTreeWithStats,
|
|
51
|
+
type ITelemetryContext,
|
|
52
|
+
type IGarbageCollectionData,
|
|
53
|
+
type CreateChildSummarizerNodeParam,
|
|
52
54
|
CreateSummarizerNodeSource,
|
|
53
|
-
IAttachMessage,
|
|
54
|
-
IEnvelope,
|
|
55
|
-
IFluidDataStoreChannel,
|
|
56
|
-
IFluidDataStoreContext,
|
|
55
|
+
type IAttachMessage,
|
|
56
|
+
type IEnvelope,
|
|
57
|
+
type IFluidDataStoreChannel,
|
|
58
|
+
type IFluidDataStoreContext,
|
|
57
59
|
VisibilityState,
|
|
58
60
|
gcDataBlobKey,
|
|
59
|
-
IInboundSignalMessage,
|
|
61
|
+
type IInboundSignalMessage,
|
|
60
62
|
type IRuntimeMessageCollection,
|
|
61
63
|
type IRuntimeMessagesContent,
|
|
62
64
|
// eslint-disable-next-line import/no-deprecated
|
|
@@ -83,10 +85,10 @@ import {
|
|
|
83
85
|
encodeCompactIdToString,
|
|
84
86
|
} from "@fluidframework/runtime-utils/internal";
|
|
85
87
|
import {
|
|
86
|
-
ITelemetryLoggerExt,
|
|
88
|
+
type ITelemetryLoggerExt,
|
|
87
89
|
DataProcessingError,
|
|
88
90
|
LoggingError,
|
|
89
|
-
MonitoringContext,
|
|
91
|
+
type MonitoringContext,
|
|
90
92
|
UsageError,
|
|
91
93
|
createChildMonitoringContext,
|
|
92
94
|
generateStack,
|
|
@@ -95,7 +97,7 @@ import {
|
|
|
95
97
|
} from "@fluidframework/telemetry-utils/internal";
|
|
96
98
|
import { v4 as uuid } from "uuid";
|
|
97
99
|
|
|
98
|
-
import { IChannelContext, summarizeChannel } from "./channelContext.js";
|
|
100
|
+
import { type IChannelContext, summarizeChannel } from "./channelContext.js";
|
|
99
101
|
import {
|
|
100
102
|
dataStoreCompatDetailsForRuntime,
|
|
101
103
|
validateRuntimeCompatibility,
|
|
@@ -126,8 +128,7 @@ function contextSupportsFeature<K extends keyof IFluidDataStoreContextFeaturesTo
|
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
/**
|
|
129
|
-
* @legacy
|
|
130
|
-
* @alpha
|
|
131
|
+
* @legacy @beta
|
|
131
132
|
*/
|
|
132
133
|
export enum DataStoreMessageType {
|
|
133
134
|
// Creates a new channel
|
|
@@ -136,8 +137,7 @@ export enum DataStoreMessageType {
|
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
/**
|
|
139
|
-
* @legacy
|
|
140
|
-
* @alpha
|
|
140
|
+
* @legacy @beta
|
|
141
141
|
*/
|
|
142
142
|
export interface ISharedObjectRegistry {
|
|
143
143
|
// TODO consider making this async. A consequence is that either the creation of a distributed data type
|
|
@@ -167,8 +167,7 @@ function initializePendingOpCount(): { value: number } {
|
|
|
167
167
|
|
|
168
168
|
/**
|
|
169
169
|
* Base data store class
|
|
170
|
-
* @legacy
|
|
171
|
-
* @alpha
|
|
170
|
+
* @legacy @beta
|
|
172
171
|
*/
|
|
173
172
|
export class FluidDataStoreRuntime
|
|
174
173
|
extends TypedEventEmitter<IFluidDataStoreRuntimeEvents>
|
|
@@ -1129,25 +1128,10 @@ export class FluidDataStoreRuntime
|
|
|
1129
1128
|
private visitLocalBoundContextsDuringAttach(
|
|
1130
1129
|
visitor: (contextId: string, context: LocalChannelContextBase) => void,
|
|
1131
1130
|
): void {
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
*
|
|
1137
|
-
* 1. Before attaching the data store - When a detached container is attached.
|
|
1138
|
-
*
|
|
1139
|
-
* 2. After attaching the data store - When a data store is created and bound in an attached container.
|
|
1140
|
-
*
|
|
1141
|
-
* The basic idea is that all local object should become locally visible before they are globally visible.
|
|
1142
|
-
*/
|
|
1143
|
-
this.attachGraph();
|
|
1144
|
-
|
|
1145
|
-
// This assert cannot be added now due to back-compat. To be uncommented when the following issue is fixed -
|
|
1146
|
-
// https://github.com/microsoft/FluidFramework/issues/9688.
|
|
1147
|
-
//
|
|
1148
|
-
// assert(this.visibilityState === VisibilityState.LocallyVisible,
|
|
1149
|
-
// "The data store should be locally visible when generating attach summary",
|
|
1150
|
-
// );
|
|
1131
|
+
assert(
|
|
1132
|
+
this.visibilityState === VisibilityState.LocallyVisible,
|
|
1133
|
+
0xc2c /* The data store should be locally visible when generating attach summary */,
|
|
1134
|
+
);
|
|
1151
1135
|
|
|
1152
1136
|
const visitedContexts = new Set<string>();
|
|
1153
1137
|
let visitedLength = -1;
|
|
@@ -1511,8 +1495,7 @@ export class FluidDataStoreRuntime
|
|
|
1511
1495
|
* Request handler is only called when data store can't resolve request, i.e. for custom requests.
|
|
1512
1496
|
* @param Base - base class, inherits from FluidDataStoreRuntime
|
|
1513
1497
|
* @param requestHandler - request handler to mix in
|
|
1514
|
-
* @legacy
|
|
1515
|
-
* @alpha
|
|
1498
|
+
* @legacy @beta
|
|
1516
1499
|
*/
|
|
1517
1500
|
export const mixinRequestHandler = (
|
|
1518
1501
|
requestHandler: (request: IRequest, runtime: FluidDataStoreRuntime) => Promise<IResponse>,
|
|
@@ -1533,8 +1516,7 @@ export const mixinRequestHandler = (
|
|
|
1533
1516
|
* @param handler - handler that returns info about blob to be added to summary.
|
|
1534
1517
|
* Or undefined not to add anything to summary.
|
|
1535
1518
|
* @param Base - base class, inherits from FluidDataStoreRuntime
|
|
1536
|
-
* @legacy
|
|
1537
|
-
* @alpha
|
|
1519
|
+
* @legacy @beta
|
|
1538
1520
|
*/
|
|
1539
1521
|
export const mixinSummaryHandler = (
|
|
1540
1522
|
handler: (
|