@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":"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,sBAAsB,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.0.0-internal.3.
|
|
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,sBAAsB,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.0.0-internal.3.1.1\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteChannelContext.d.ts","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"remoteChannelContext.d.ts","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACN,QAAQ,EAER,sBAAsB,EAEtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,EACN,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAE7B,gBAAgB,EAEhB,iBAAiB,EACjB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAGN,eAAe,EAEf,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,qBAAa,oBAAqB,YAAW,eAAe;IAe1D,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAKjC,OAAO,CAAC,QAAQ,CAAC,EAAE;IAEnB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAIzB,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IA1BpC,OAAO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E,OAAO;IAM/C,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAMtD;;;;;OAKG;IACU,SAAS,CACrB,QAAQ,GAAE,OAAe,EACzB,UAAU,GAAE,OAAc,EAC1B,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,gBAAgB,CAAC;YAId,iBAAiB;YAejB,WAAW;IA8GzB;;;;;;OAMG;IACU,SAAS,CAAC,MAAM,GAAE,OAAe,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAIhF;;;;OAIG;YACW,iBAAiB;IAKxB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE;CAS5C"}
|
|
@@ -139,8 +139,8 @@ export class RemoteChannelContext {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
// Compare snapshot version to collaborative object version
|
|
142
|
-
if (attributes.snapshotFormatVersion !== undefined
|
|
143
|
-
|
|
142
|
+
if (attributes.snapshotFormatVersion !== undefined &&
|
|
143
|
+
attributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion) {
|
|
144
144
|
this.subLogger.sendTelemetryEvent({
|
|
145
145
|
eventName: "ChannelAttributesVersionMismatch",
|
|
146
146
|
channelType: { value: attributes.type, tag: TelemetryDataTag.CodeArtifact },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteChannelContext.js","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAStE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAe5D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EACH,iBAAiB,EACjB,sBAAsB,EAEtB,qBAAqB,GACxB,MAAM,kBAAkB,CAAC;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AAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAEM,gBAAgB,CAAC,UAAoB;QACxC;;;;;WAKG;QACH,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;;AAnQuB,6CAAwB,GAAG,IAAI,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 { assert } from \"@fluidframework/common-utils\";\nimport { DataCorruptionError } from \"@fluidframework/container-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n IChannel,\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport {\n ISequencedDocumentMessage,\n ISnapshotTree,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n CreateChildSummarizerNodeFn,\n IFluidDataStoreContext,\n IGarbageCollectionData,\n IGarbageCollectionDetailsBase,\n ISummarizeInternalResult,\n ISummarizeResult,\n ISummarizerNodeWithGC,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { ChildLogger, TelemetryDataTag, ThresholdCounter } from \"@fluidframework/telemetry-utils\";\nimport {\n attributesBlobKey,\n createServiceEndpoints,\n IChannelContext,\n summarizeChannelAsync,\n} from \"./channelContext\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ChannelStorageService } from \"./channelStorageService\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\n\nexport class RemoteChannelContext implements IChannelContext {\n private isLoaded = false;\n private pending: ISequencedDocumentMessage[] | undefined = [];\n private channelP: Promise<IChannel> | undefined;\n private channel: IChannel | undefined;\n private readonly services: {\n readonly deltaConnection: ChannelDeltaConnection;\n readonly objectStorage: ChannelStorageService;\n };\n private readonly summarizerNode: ISummarizerNodeWithGC;\n private readonly subLogger: ITelemetryLogger;\n private readonly thresholdOpsCounter: ThresholdCounter;\n private static readonly pendingOpsCountThreshold = 1000;\n\n constructor(\n private readonly runtime: IFluidDataStoreRuntime,\n private readonly dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n private readonly id: string,\n baseSnapshot: ISnapshotTree,\n private readonly registry: ISharedObjectRegistry,\n extraBlobs: Map<string, ArrayBufferLike> | undefined,\n createSummarizerNode: CreateChildSummarizerNodeFn,\n getBaseGCDetails: () => Promise<IGarbageCollectionDetailsBase>,\n private readonly attachMessageType?: string,\n ) {\n assert(!this.id.includes(\"/\"), 0x310 /* Channel context ID cannot contain slashes */);\n\n this.subLogger = ChildLogger.create(this.runtime.logger, \"RemoteChannelContext\");\n\n this.services = createServiceEndpoints(\n this.id,\n this.dataStoreContext.connected,\n submitFn,\n () => dirtyFn(this.id),\n addedGCOutboundReferenceFn,\n storageService,\n this.subLogger,\n baseSnapshot,\n extraBlobs);\n\n const thisSummarizeInternal =\n async (fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext) =>\n this.summarizeInternal(fullTree, trackState, telemetryContext);\n\n this.summarizerNode = createSummarizerNode(\n thisSummarizeInternal,\n async (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n async () => getBaseGCDetails(),\n );\n\n this.thresholdOpsCounter = new ThresholdCounter(\n RemoteChannelContext.pendingOpsCountThreshold,\n this.subLogger,\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n public getChannel(): Promise<IChannel> {\n if (this.channelP === undefined) {\n this.channelP = this.loadChannel();\n }\n\n return this.channelP;\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n // Connection events are ignored if the data store is not yet loaded\n if (!this.isLoaded) {\n return;\n }\n\n this.services.deltaConnection.setConnectionState(connected);\n }\n\n public applyStashedOp(message: ISequencedDocumentMessage): unknown {\n assert(this.isLoaded, 0x194 /* \"Remote channel must be loaded when rebasing op\" */);\n return this.services.deltaConnection.applyStashedOp(message);\n }\n\n public processOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n this.summarizerNode.invalidate(message.sequenceNumber);\n\n if (this.isLoaded) {\n this.services.deltaConnection.process(message, local, localOpMetadata);\n } else {\n assert(!local, 0x195 /* \"Remote channel must not be local when processing op\" */);\n assert(this.pending !== undefined, 0x23e /* \"pending is undefined\" */);\n this.pending.push(message);\n this.thresholdOpsCounter.sendIfMultiple(\"StorePendingOps\", this.pending.length);\n }\n }\n\n public reSubmit(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x196 /* \"Remote channel must be loaded when resubmitting op\" */);\n\n this.services.deltaConnection.reSubmit(content, localOpMetadata);\n }\n\n public rollback(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x2f0 /* \"Remote channel must be loaded when rolling back op\" */);\n\n this.services.deltaConnection.rollback(content, localOpMetadata);\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<ISummarizeResult> {\n return this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n }\n\n private async summarizeInternal(\n fullTree: boolean,\n trackState: boolean,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummarizeInternalResult> {\n const channel = await this.getChannel();\n const summarizeResult = await summarizeChannelAsync(channel, fullTree, trackState, telemetryContext);\n return { ...summarizeResult, id: this.id };\n }\n\n private async loadChannel(): Promise<IChannel> {\n assert(!this.isLoaded, 0x197 /* \"Remote channel must not already be loaded when loading\" */);\n\n let attributes: IChannelAttributes | undefined;\n if (await this.services.objectStorage.contains(attributesBlobKey)) {\n attributes = await readAndParse<IChannelAttributes | undefined>(\n this.services.objectStorage,\n attributesBlobKey);\n }\n\n let factory: IChannelFactory | undefined;\n // this is a backward compatibility case where\n // the attach message doesn't include\n // the attributes. Since old attach messages\n // will not have attributes we need to keep\n // this as long as we support old attach messages\n if (attributes === undefined) {\n if (this.attachMessageType === undefined) {\n // TODO: dataStoreId may require a different tag from PackageData #7488\n throw new DataCorruptionError(\"channelTypeNotAvailable\", {\n channelId: {\n value: this.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStoreId: {\n value: this.dataStoreContext.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n });\n }\n factory = this.registry.get(this.attachMessageType);\n if (factory === undefined) {\n // TODO: dataStoreId may require a different tag from PackageData #7488\n throw new DataCorruptionError(\"channelFactoryNotRegisteredForAttachMessageType\", {\n channelId: {\n value: this.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStoreId: {\n value: this.dataStoreContext.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n channelFactoryType: this.attachMessageType,\n });\n }\n attributes = factory.attributes;\n } else {\n factory = this.registry.get(attributes.type);\n if (factory === undefined) {\n // TODO: dataStoreId may require a different tag from PackageData #7488\n throw new DataCorruptionError(\"channelFactoryNotRegisteredForGivenType\", {\n channelId: {\n value: this.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStoreId: {\n value: this.dataStoreContext.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n channelFactoryType: attributes.type,\n });\n }\n }\n\n // Compare snapshot version to collaborative object version\n if (attributes.snapshotFormatVersion !== undefined\n && attributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion) {\n this.subLogger.sendTelemetryEvent(\n {\n eventName: \"ChannelAttributesVersionMismatch\",\n channelType: { value: attributes.type, tag: TelemetryDataTag.CodeArtifact },\n channelSnapshotVersion: {\n value: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,\n tag: TelemetryDataTag.CodeArtifact,\n },\n channelCodeVersion: {\n value: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,\n tag: TelemetryDataTag.CodeArtifact,\n },\n },\n );\n }\n\n const channel = await factory.load(\n this.runtime,\n this.id,\n this.services,\n attributes);\n\n // Send all pending messages to the channel\n assert(this.pending !== undefined, 0x23f /* \"pending undefined\" */);\n for (const message of this.pending) {\n this.services.deltaConnection.process(message, false, undefined /* localOpMetadata */);\n }\n this.thresholdOpsCounter.send(\"ProcessPendingOps\", this.pending.length);\n\n // Commit changes.\n this.channel = channel;\n this.pending = undefined;\n this.isLoaded = true;\n\n // Because have some await between we created the service and here, the connection state might have changed\n // and we don't propagate the connection state when we are not loaded. So we have to set it again here.\n this.services.deltaConnection.setConnectionState(this.dataStoreContext.connected);\n return this.channel;\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.\n * If there is no new data in this context since the last summary, previous GC data is used.\n * If there is new data, the GC data is generated again (by calling getGCDataInternal).\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 return this.summarizerNode.getGCData(fullGC);\n }\n\n /**\n * Generates the data used for garbage collection. This is called when there is new data since last summary. It\n * loads the context and calls into the channel to get its GC data.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n private async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n const channel = await this.getChannel();\n return channel.getGCData(fullGC);\n }\n\n public updateUsedRoutes(usedRoutes: string[]) {\n /**\n * Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's\n * used routes to contain a route to this channel context.\n * Once we have GC at DDS level, this will be updated to use the passed usedRoutes. See -\n * https://github.com/microsoft/FluidFramework/issues/4611\n */\n this.summarizerNode.updateUsedRoutes([\"\"]);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"remoteChannelContext.js","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAStE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAY5D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EACN,iBAAiB,EACjB,sBAAsB,EAEtB,qBAAqB,GACrB,MAAM,kBAAkB,CAAC;AAK1B,MAAM,OAAO,oBAAoB;IAchC,YACkB,OAA+B,EAC/B,gBAAwC,EACzD,cAAuC,EACvC,QAA0D,EAC1D,OAAkC,EAClC,0BAA2F,EAC1E,EAAU,EAC3B,YAA2B,EACV,QAA+B,EAChD,UAAoD,EACpD,oBAAiD,EACjD,gBAA8D,EAC7C,iBAA0B;QAZ1B,YAAO,GAAP,OAAO,CAAwB;QAC/B,qBAAgB,GAAhB,gBAAgB,CAAwB;QAKxC,OAAE,GAAF,EAAE,CAAQ;QAEV,aAAQ,GAAR,QAAQ,CAAuB;QAI/B,sBAAiB,GAAjB,iBAAiB,CAAS;QA1BpC,aAAQ,GAAG,KAAK,CAAC;QACjB,YAAO,GAA4C,EAAE,CAAC;QA2B7D,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAEtF,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;QAEjF,IAAI,CAAC,QAAQ,G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IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,2GAA2G;QAC3G,wGAAwG;QACxG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAClF,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,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;;AA/QuB,6CAAwB,GAAG,IAAI,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 { assert } from \"@fluidframework/common-utils\";\nimport { DataCorruptionError } from \"@fluidframework/container-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n\tIChannel,\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tCreateChildSummarizerNodeFn,\n\tIFluidDataStoreContext,\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tISummarizeInternalResult,\n\tISummarizeResult,\n\tISummarizerNodeWithGC,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { ChildLogger, TelemetryDataTag, ThresholdCounter } from \"@fluidframework/telemetry-utils\";\nimport {\n\tattributesBlobKey,\n\tcreateServiceEndpoints,\n\tIChannelContext,\n\tsummarizeChannelAsync,\n} from \"./channelContext\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ChannelStorageService } from \"./channelStorageService\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\n\nexport class RemoteChannelContext implements IChannelContext {\n\tprivate isLoaded = false;\n\tprivate pending: ISequencedDocumentMessage[] | undefined = [];\n\tprivate channelP: Promise<IChannel> | undefined;\n\tprivate channel: IChannel | undefined;\n\tprivate readonly services: {\n\t\treadonly deltaConnection: ChannelDeltaConnection;\n\t\treadonly objectStorage: ChannelStorageService;\n\t};\n\tprivate readonly summarizerNode: ISummarizerNodeWithGC;\n\tprivate readonly subLogger: ITelemetryLogger;\n\tprivate readonly thresholdOpsCounter: ThresholdCounter;\n\tprivate static readonly pendingOpsCountThreshold = 1000;\n\n\tconstructor(\n\t\tprivate readonly runtime: IFluidDataStoreRuntime,\n\t\tprivate readonly dataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\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 id: string,\n\t\tbaseSnapshot: ISnapshotTree,\n\t\tprivate readonly registry: ISharedObjectRegistry,\n\t\textraBlobs: Map<string, ArrayBufferLike> | undefined,\n\t\tcreateSummarizerNode: CreateChildSummarizerNodeFn,\n\t\tgetBaseGCDetails: () => Promise<IGarbageCollectionDetailsBase>,\n\t\tprivate readonly attachMessageType?: string,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x310 /* Channel context ID cannot contain slashes */);\n\n\t\tthis.subLogger = ChildLogger.create(this.runtime.logger, \"RemoteChannelContext\");\n\n\t\tthis.services = createServiceEndpoints(\n\t\t\tthis.id,\n\t\t\tthis.dataStoreContext.connected,\n\t\t\tsubmitFn,\n\t\t\t() => dirtyFn(this.id),\n\t\t\taddedGCOutboundReferenceFn,\n\t\t\tstorageService,\n\t\t\tthis.subLogger,\n\t\t\tbaseSnapshot,\n\t\t\textraBlobs,\n\t\t);\n\n\t\tconst thisSummarizeInternal = async (\n\t\t\tfullTree: boolean,\n\t\t\ttrackState: boolean,\n\t\t\ttelemetryContext?: ITelemetryContext,\n\t\t) => this.summarizeInternal(fullTree, trackState, telemetryContext);\n\n\t\tthis.summarizerNode = createSummarizerNode(\n\t\t\tthisSummarizeInternal,\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t\tasync () => getBaseGCDetails(),\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\tif (this.channelP === undefined) {\n\t\t\tthis.channelP = this.loadChannel();\n\t\t}\n\n\t\treturn this.channelP;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\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(message: ISequencedDocumentMessage): unknown {\n\t\tassert(this.isLoaded, 0x194 /* \"Remote channel must be loaded when rebasing op\" */);\n\t\treturn this.services.deltaConnection.applyStashedOp(message);\n\t}\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.summarizerNode.invalidate(message.sequenceNumber);\n\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.deltaConnection.process(message, local, localOpMetadata);\n\t\t} else {\n\t\t\tassert(!local, 0x195 /* \"Remote channel must not be local when processing op\" */);\n\t\t\tassert(this.pending !== undefined, 0x23e /* \"pending is undefined\" */);\n\t\t\tthis.pending.push(message);\n\t\t\tthis.thresholdOpsCounter.sendIfMultiple(\"StorePendingOps\", this.pending.length);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x196 /* \"Remote channel must be loaded when resubmitting op\" */);\n\n\t\tthis.services.deltaConnection.reSubmit(content, localOpMetadata);\n\t}\n\n\tpublic rollback(content: any, localOpMetadata: unknown) {\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): 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);\n\t\treturn { ...summarizeResult, id: this.id };\n\t}\n\n\tprivate async loadChannel(): Promise<IChannel> {\n\t\tassert(\n\t\t\t!this.isLoaded,\n\t\t\t0x197 /* \"Remote channel must not already be loaded when loading\" */,\n\t\t);\n\n\t\tlet attributes: IChannelAttributes | undefined;\n\t\tif (await this.services.objectStorage.contains(attributesBlobKey)) {\n\t\t\tattributes = await readAndParse<IChannelAttributes | undefined>(\n\t\t\t\tthis.services.objectStorage,\n\t\t\t\tattributesBlobKey,\n\t\t\t);\n\t\t}\n\n\t\tlet factory: IChannelFactory | undefined;\n\t\t// this is a backward compatibility case where\n\t\t// the attach message doesn't include\n\t\t// the attributes. Since old attach messages\n\t\t// will not have attributes we need to keep\n\t\t// this as long as we support old attach messages\n\t\tif (attributes === undefined) {\n\t\t\tif (this.attachMessageType === undefined) {\n\t\t\t\t// TODO: dataStoreId may require a different tag from PackageData #7488\n\t\t\t\tthrow new DataCorruptionError(\"channelTypeNotAvailable\", {\n\t\t\t\t\tchannelId: {\n\t\t\t\t\t\tvalue: this.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStoreId: {\n\t\t\t\t\t\tvalue: this.dataStoreContext.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\t});\n\t\t\t}\n\t\t\tfactory = this.registry.get(this.attachMessageType);\n\t\t\tif (factory === undefined) {\n\t\t\t\t// TODO: dataStoreId may require a different tag from PackageData #7488\n\t\t\t\tthrow new DataCorruptionError(\"channelFactoryNotRegisteredForAttachMessageType\", {\n\t\t\t\t\tchannelId: {\n\t\t\t\t\t\tvalue: this.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStoreId: {\n\t\t\t\t\t\tvalue: this.dataStoreContext.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\t\tchannelFactoryType: this.attachMessageType,\n\t\t\t\t});\n\t\t\t}\n\t\t\tattributes = factory.attributes;\n\t\t} else {\n\t\t\tfactory = this.registry.get(attributes.type);\n\t\t\tif (factory === undefined) {\n\t\t\t\t// TODO: dataStoreId may require a different tag from PackageData #7488\n\t\t\t\tthrow new DataCorruptionError(\"channelFactoryNotRegisteredForGivenType\", {\n\t\t\t\t\tchannelId: {\n\t\t\t\t\t\tvalue: this.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStoreId: {\n\t\t\t\t\t\tvalue: this.dataStoreContext.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\t\tchannelFactoryType: attributes.type,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Compare snapshot version to collaborative object version\n\t\tif (\n\t\t\tattributes.snapshotFormatVersion !== undefined &&\n\t\t\tattributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion\n\t\t) {\n\t\t\tthis.subLogger.sendTelemetryEvent({\n\t\t\t\teventName: \"ChannelAttributesVersionMismatch\",\n\t\t\t\tchannelType: { value: attributes.type, tag: TelemetryDataTag.CodeArtifact },\n\t\t\t\tchannelSnapshotVersion: {\n\t\t\t\t\tvalue: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,\n\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t},\n\t\t\t\tchannelCodeVersion: {\n\t\t\t\t\tvalue: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,\n\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\tconst channel = await factory.load(this.runtime, this.id, this.services, attributes);\n\n\t\t// Send all pending messages to the channel\n\t\tassert(this.pending !== undefined, 0x23f /* \"pending undefined\" */);\n\t\tfor (const message of this.pending) {\n\t\t\tthis.services.deltaConnection.process(message, false, undefined /* localOpMetadata */);\n\t\t}\n\t\tthis.thresholdOpsCounter.send(\"ProcessPendingOps\", this.pending.length);\n\n\t\t// Commit changes.\n\t\tthis.channel = channel;\n\t\tthis.pending = undefined;\n\t\tthis.isLoaded = true;\n\n\t\t// Because have some await between we created the service and here, the connection state might have changed\n\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\tthis.services.deltaConnection.setConnectionState(this.dataStoreContext.connected);\n\t\treturn this.channel;\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[]) {\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,112 +1,113 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-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
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
2
|
+
"name": "@fluidframework/datastore",
|
|
3
|
+
"version": "2.0.0-internal.3.1.1",
|
|
4
|
+
"description": "Fluid data store implementation",
|
|
5
|
+
"homepage": "https://fluidframework.com",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/microsoft/FluidFramework.git",
|
|
9
|
+
"directory": "packages/runtime/datastore"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "Microsoft and contributors",
|
|
13
|
+
"sideEffects": false,
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"module": "lib/index.js",
|
|
16
|
+
"types": "dist/index.d.ts",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
|
|
19
|
+
"build:commonjs": "npm run tsc && npm run typetests:gen && npm run build:test",
|
|
20
|
+
"build:compile": "concurrently npm:build:commonjs npm:build:esnext",
|
|
21
|
+
"build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
|
|
22
|
+
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
23
|
+
"build:full": "npm run build",
|
|
24
|
+
"build:full:compile": "npm run build:compile",
|
|
25
|
+
"build:genver": "gen-version",
|
|
26
|
+
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
27
|
+
"ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
|
|
28
|
+
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
|
|
29
|
+
"eslint": "eslint --format stylish src",
|
|
30
|
+
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
31
|
+
"format": "npm run prettier:fix",
|
|
32
|
+
"lint": "npm run prettier && npm run eslint",
|
|
33
|
+
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
34
|
+
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
35
|
+
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
36
|
+
"test": "npm run test:mocha",
|
|
37
|
+
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
|
|
38
|
+
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test --exit -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
|
|
39
|
+
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
40
|
+
"tsc": "tsc",
|
|
41
|
+
"tsc:watch": "tsc --watch",
|
|
42
|
+
"typetests:gen": "flub generate typetests --generate --dir .",
|
|
43
|
+
"typetests:prepare": "flub generate typetests --prepare --dir . --pin"
|
|
44
|
+
},
|
|
45
|
+
"nyc": {
|
|
46
|
+
"all": true,
|
|
47
|
+
"cache-dir": "nyc/.cache",
|
|
48
|
+
"exclude": [
|
|
49
|
+
"src/test/**/*.ts",
|
|
50
|
+
"dist/test/**/*.js"
|
|
51
|
+
],
|
|
52
|
+
"exclude-after-remap": false,
|
|
53
|
+
"include": [
|
|
54
|
+
"src/**/*.ts",
|
|
55
|
+
"dist/**/*.js"
|
|
56
|
+
],
|
|
57
|
+
"report-dir": "nyc/report",
|
|
58
|
+
"reporter": [
|
|
59
|
+
"cobertura",
|
|
60
|
+
"html",
|
|
61
|
+
"text"
|
|
62
|
+
],
|
|
63
|
+
"temp-directory": "nyc/.nyc_output"
|
|
64
|
+
},
|
|
65
|
+
"dependencies": {
|
|
66
|
+
"@fluidframework/common-definitions": "^0.20.1",
|
|
67
|
+
"@fluidframework/common-utils": "^1.0.0",
|
|
68
|
+
"@fluidframework/container-definitions": ">=2.0.0-internal.3.1.1 <2.0.0-internal.4.0.0",
|
|
69
|
+
"@fluidframework/container-utils": ">=2.0.0-internal.3.1.1 <2.0.0-internal.4.0.0",
|
|
70
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.3.1.1 <2.0.0-internal.4.0.0",
|
|
71
|
+
"@fluidframework/datastore-definitions": ">=2.0.0-internal.3.1.1 <2.0.0-internal.4.0.0",
|
|
72
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.3.1.1 <2.0.0-internal.4.0.0",
|
|
73
|
+
"@fluidframework/driver-utils": ">=2.0.0-internal.3.1.1 <2.0.0-internal.4.0.0",
|
|
74
|
+
"@fluidframework/garbage-collector": ">=2.0.0-internal.3.1.1 <2.0.0-internal.4.0.0",
|
|
75
|
+
"@fluidframework/protocol-base": "^0.1038.2000",
|
|
76
|
+
"@fluidframework/protocol-definitions": "^1.1.0",
|
|
77
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-internal.3.1.1 <2.0.0-internal.4.0.0",
|
|
78
|
+
"@fluidframework/runtime-utils": ">=2.0.0-internal.3.1.1 <2.0.0-internal.4.0.0",
|
|
79
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.3.1.1 <2.0.0-internal.4.0.0",
|
|
80
|
+
"lodash": "^4.17.21",
|
|
81
|
+
"uuid": "^8.3.1"
|
|
82
|
+
},
|
|
83
|
+
"devDependencies": {
|
|
84
|
+
"@fluid-tools/build-cli": "^0.9.0",
|
|
85
|
+
"@fluidframework/build-common": "^1.1.0",
|
|
86
|
+
"@fluidframework/build-tools": "^0.9.0",
|
|
87
|
+
"@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.0.0-internal.3.0.1",
|
|
88
|
+
"@fluidframework/eslint-config-fluid": "^2.0.0",
|
|
89
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.3.1.1 <2.0.0-internal.4.0.0",
|
|
90
|
+
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.3.1.1 <2.0.0-internal.4.0.0",
|
|
91
|
+
"@microsoft/api-extractor": "^7.22.2",
|
|
92
|
+
"@rushstack/eslint-config": "^2.5.1",
|
|
93
|
+
"@types/mocha": "^9.1.1",
|
|
94
|
+
"@types/node": "^14.18.36",
|
|
95
|
+
"@types/uuid": "^8.3.0",
|
|
96
|
+
"concurrently": "^6.2.0",
|
|
97
|
+
"copyfiles": "^2.4.1",
|
|
98
|
+
"cross-env": "^7.0.2",
|
|
99
|
+
"eslint": "~8.6.0",
|
|
100
|
+
"mocha": "^10.0.0",
|
|
101
|
+
"nyc": "^15.0.0",
|
|
102
|
+
"prettier": "~2.6.2",
|
|
103
|
+
"rimraf": "^2.6.2",
|
|
104
|
+
"typescript": "~4.5.5"
|
|
105
|
+
},
|
|
106
|
+
"typeValidation": {
|
|
107
|
+
"version": "2.0.0-internal.3.1.1",
|
|
108
|
+
"previousVersionStyle": "~previousMinor",
|
|
109
|
+
"baselineRange": ">=2.0.0-internal.3.0.0 <2.0.0-internal.3.1.0",
|
|
110
|
+
"baselineVersion": "2.0.0-internal.3.0.1",
|
|
111
|
+
"broken": {}
|
|
112
|
+
}
|
|
112
113
|
}
|
package/prettier.config.cjs
CHANGED
package/src/channelContext.ts
CHANGED
|
@@ -9,10 +9,10 @@ import { IChannel } from "@fluidframework/datastore-definitions";
|
|
|
9
9
|
import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
10
10
|
import { ISequencedDocumentMessage, ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
IGarbageCollectionData,
|
|
13
|
+
ISummarizeResult,
|
|
14
|
+
ISummaryTreeWithStats,
|
|
15
|
+
ITelemetryContext,
|
|
16
16
|
} from "@fluidframework/runtime-definitions";
|
|
17
17
|
import { addBlobToSummary } from "@fluidframework/runtime-utils";
|
|
18
18
|
import { ChannelDeltaConnection } from "./channelDeltaConnection";
|
|
@@ -21,87 +21,88 @@ import { ChannelStorageService } from "./channelStorageService";
|
|
|
21
21
|
export const attributesBlobKey = ".attributes";
|
|
22
22
|
|
|
23
23
|
export interface IChannelContext {
|
|
24
|
-
|
|
24
|
+
getChannel(): Promise<IChannel>;
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
setConnectionState(connected: boolean, clientId?: string);
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
processOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata?: unknown): void;
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
summarize(
|
|
31
|
+
fullTree?: boolean,
|
|
32
|
+
trackState?: boolean,
|
|
33
|
+
telemetryContext?: ITelemetryContext,
|
|
34
|
+
): Promise<ISummarizeResult>;
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
reSubmit(content: any, localOpMetadata: unknown): void;
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
applyStashedOp(content: any): unknown;
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
rollback(message: any, localOpMetadata: unknown): void;
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Returns the data used for garbage collection. This includes a list of GC nodes that represent this context
|
|
44
|
+
* including any of its children. Each node has a set of outbound routes to other GC nodes in the document.
|
|
45
|
+
* @param fullGC - true to bypass optimizations and force full generation of GC data.
|
|
46
|
+
*/
|
|
47
|
+
getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
/**
|
|
50
|
+
* After GC has run, called to notify this context of routes that are used in it. These are used for the following:
|
|
51
|
+
* 1. To identify if this context is being referenced in the document or not.
|
|
52
|
+
* 2. To identify if this context or any of its children's used routes changed since last summary.
|
|
53
|
+
* 3. They are added to the summary generated by this context.
|
|
54
|
+
*/
|
|
55
|
+
updateUsedRoutes(usedRoutes: string[]): void;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export function createServiceEndpoints(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
id: string,
|
|
60
|
+
connected: boolean,
|
|
61
|
+
submitFn: (content: any, localOpMetadata: unknown) => void,
|
|
62
|
+
dirtyFn: () => void,
|
|
63
|
+
addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,
|
|
64
|
+
storageService: IDocumentStorageService,
|
|
65
|
+
logger: ITelemetryLogger,
|
|
66
|
+
tree?: ISnapshotTree,
|
|
67
|
+
extraBlobs?: Map<string, ArrayBufferLike>,
|
|
68
68
|
) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
69
|
+
const deltaConnection = new ChannelDeltaConnection(
|
|
70
|
+
id,
|
|
71
|
+
connected,
|
|
72
|
+
(message, localOpMetadata) => submitFn(message, localOpMetadata),
|
|
73
|
+
dirtyFn,
|
|
74
|
+
addedGCOutboundReferenceFn,
|
|
75
|
+
);
|
|
76
|
+
const objectStorage = new ChannelStorageService(tree, storageService, logger, extraBlobs);
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
deltaConnection,
|
|
80
|
+
objectStorage,
|
|
81
|
+
};
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
export function summarizeChannel(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
channel: IChannel,
|
|
86
|
+
fullTree: boolean = false,
|
|
87
|
+
trackState: boolean = false,
|
|
88
|
+
telemetryContext?: ITelemetryContext,
|
|
88
89
|
): ISummaryTreeWithStats {
|
|
89
|
-
|
|
90
|
+
const summarizeResult = channel.getAttachSummary(fullTree, trackState, telemetryContext);
|
|
90
91
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
// Add the channel attributes to the returned result.
|
|
93
|
+
addBlobToSummary(summarizeResult, attributesBlobKey, JSON.stringify(channel.attributes));
|
|
94
|
+
return summarizeResult;
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
export async function summarizeChannelAsync(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
channel: IChannel,
|
|
99
|
+
fullTree: boolean = false,
|
|
100
|
+
trackState: boolean = false,
|
|
101
|
+
telemetryContext?: ITelemetryContext,
|
|
101
102
|
): Promise<ISummaryTreeWithStats> {
|
|
102
|
-
|
|
103
|
+
const summarizeResult = await channel.summarize(fullTree, trackState, telemetryContext);
|
|
103
104
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
// Add the channel attributes to the returned result.
|
|
106
|
+
addBlobToSummary(summarizeResult, attributesBlobKey, JSON.stringify(channel.attributes));
|
|
107
|
+
return summarizeResult;
|
|
107
108
|
}
|