@fluidframework/datastore 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.225277
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 +12 -0
- package/CHANGELOG.md +273 -0
- package/README.md +41 -0
- package/api-extractor-esm.json +4 -0
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/datastore.api.md +168 -0
- package/dist/channelContext.cjs +86 -0
- package/dist/channelContext.cjs.map +1 -0
- package/dist/channelContext.d.ts +15 -9
- package/dist/channelContext.d.ts.map +1 -1
- package/dist/{channelDeltaConnection.js → channelDeltaConnection.cjs} +14 -15
- package/dist/channelDeltaConnection.cjs.map +1 -0
- package/dist/channelDeltaConnection.d.ts +4 -5
- package/dist/channelDeltaConnection.d.ts.map +1 -1
- package/dist/{channelStorageService.js → channelStorageService.cjs} +13 -16
- package/dist/channelStorageService.cjs.map +1 -0
- package/dist/channelStorageService.d.ts +2 -2
- package/dist/channelStorageService.d.ts.map +1 -1
- package/dist/{dataStoreRuntime.js → dataStoreRuntime.cjs} +302 -225
- package/dist/dataStoreRuntime.cjs.map +1 -0
- package/dist/dataStoreRuntime.d.ts +81 -37
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/datastore-alpha.d.ts +317 -0
- package/dist/datastore-beta.d.ts +47 -0
- package/dist/datastore-public.d.ts +47 -0
- package/dist/datastore-untrimmed.d.ts +324 -0
- package/dist/{fluidHandle.js → fluidHandle.cjs} +44 -16
- package/dist/fluidHandle.cjs.map +1 -0
- package/dist/fluidHandle.d.ts +33 -6
- package/dist/fluidHandle.d.ts.map +1 -1
- package/dist/index.cjs +15 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/localChannelContext.cjs +190 -0
- package/dist/localChannelContext.cjs.map +1 -0
- package/dist/localChannelContext.d.ts +12 -21
- package/dist/localChannelContext.d.ts.map +1 -1
- package/dist/{localChannelStorageService.js → localChannelStorageService.cjs} +3 -3
- package/dist/localChannelStorageService.cjs.map +1 -0
- package/dist/localChannelStorageService.d.ts.map +1 -1
- package/dist/remoteChannelContext.cjs +124 -0
- package/dist/remoteChannelContext.cjs.map +1 -0
- package/dist/remoteChannelContext.d.ts +5 -10
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/{channelContext.d.ts → channelContext.d.mts} +17 -11
- package/lib/channelContext.d.mts.map +1 -0
- package/lib/channelContext.mjs +78 -0
- package/lib/channelContext.mjs.map +1 -0
- package/lib/{channelDeltaConnection.d.ts → channelDeltaConnection.d.mts} +5 -6
- package/lib/channelDeltaConnection.d.mts.map +1 -0
- package/lib/{channelDeltaConnection.js → channelDeltaConnection.mjs} +11 -12
- package/lib/channelDeltaConnection.mjs.map +1 -0
- package/lib/{channelStorageService.d.ts → channelStorageService.d.mts} +3 -3
- package/lib/channelStorageService.d.mts.map +1 -0
- package/lib/{channelStorageService.js → channelStorageService.mjs} +13 -16
- package/lib/channelStorageService.mjs.map +1 -0
- package/lib/{dataStoreRuntime.d.ts → dataStoreRuntime.d.mts} +82 -38
- package/lib/dataStoreRuntime.d.mts.map +1 -0
- package/lib/{dataStoreRuntime.js → dataStoreRuntime.mjs} +286 -209
- package/lib/dataStoreRuntime.mjs.map +1 -0
- package/lib/datastore-alpha.d.mts +317 -0
- package/lib/datastore-beta.d.mts +47 -0
- package/lib/datastore-public.d.mts +47 -0
- package/lib/datastore-untrimmed.d.mts +324 -0
- package/lib/fluidHandle.d.mts +57 -0
- package/lib/fluidHandle.d.mts.map +1 -0
- package/lib/{fluidHandle.js → fluidHandle.mjs} +44 -16
- package/lib/fluidHandle.mjs.map +1 -0
- package/lib/index.d.mts +7 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +7 -0
- package/lib/index.mjs.map +1 -0
- package/lib/{localChannelContext.d.ts → localChannelContext.d.mts} +14 -23
- package/lib/localChannelContext.d.mts.map +1 -0
- package/lib/{localChannelContext.js → localChannelContext.mjs} +73 -85
- package/lib/localChannelContext.mjs.map +1 -0
- package/lib/{localChannelStorageService.d.ts → localChannelStorageService.d.mts} +1 -1
- package/lib/localChannelStorageService.d.mts.map +1 -0
- package/lib/{localChannelStorageService.js → localChannelStorageService.mjs} +2 -2
- package/lib/localChannelStorageService.mjs.map +1 -0
- package/lib/{remoteChannelContext.d.ts → remoteChannelContext.d.mts} +8 -13
- package/lib/remoteChannelContext.d.mts.map +1 -0
- package/lib/remoteChannelContext.mjs +120 -0
- package/lib/remoteChannelContext.mjs.map +1 -0
- package/package.json +139 -71
- package/{lib/index.js → prettier.config.cjs} +4 -3
- package/src/channelContext.ts +168 -71
- package/src/channelDeltaConnection.ts +52 -47
- package/src/channelStorageService.ts +59 -55
- package/src/dataStoreRuntime.ts +1158 -983
- package/src/fluidHandle.ts +92 -64
- package/src/index.ts +8 -2
- package/src/localChannelContext.ts +278 -272
- package/src/localChannelStorageService.ts +48 -46
- package/src/remoteChannelContext.ts +237 -300
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +11 -13
- package/dist/channelContext.js +0 -35
- package/dist/channelContext.js.map +0 -1
- package/dist/channelDeltaConnection.js.map +0 -1
- package/dist/channelStorageService.js.map +0 -1
- package/dist/dataStoreRuntime.js.map +0 -1
- package/dist/fluidHandle.js.map +0 -1
- package/dist/index.js +0 -19
- package/dist/index.js.map +0 -1
- package/dist/localChannelContext.js +0 -202
- package/dist/localChannelContext.js.map +0 -1
- package/dist/localChannelStorageService.js.map +0 -1
- package/dist/packageVersion.d.ts +0 -9
- package/dist/packageVersion.d.ts.map +0 -1
- package/dist/packageVersion.js +0 -12
- package/dist/packageVersion.js.map +0 -1
- package/dist/remoteChannelContext.js +0 -207
- package/dist/remoteChannelContext.js.map +0 -1
- package/lib/channelContext.d.ts.map +0 -1
- package/lib/channelContext.js +0 -29
- package/lib/channelContext.js.map +0 -1
- package/lib/channelDeltaConnection.d.ts.map +0 -1
- package/lib/channelDeltaConnection.js.map +0 -1
- package/lib/channelStorageService.d.ts.map +0 -1
- package/lib/channelStorageService.js.map +0 -1
- package/lib/dataStoreRuntime.d.ts.map +0 -1
- package/lib/dataStoreRuntime.js.map +0 -1
- package/lib/fluidHandle.d.ts +0 -30
- package/lib/fluidHandle.d.ts.map +0 -1
- package/lib/fluidHandle.js.map +0 -1
- package/lib/index.d.ts +0 -7
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/localChannelContext.d.ts.map +0 -1
- package/lib/localChannelContext.js.map +0 -1
- package/lib/localChannelStorageService.d.ts.map +0 -1
- package/lib/localChannelStorageService.js.map +0 -1
- package/lib/packageVersion.d.ts +0 -9
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/packageVersion.js +0 -9
- package/lib/packageVersion.js.map +0 -1
- package/lib/remoteChannelContext.d.ts.map +0 -1
- package/lib/remoteChannelContext.js +0 -203
- package/lib/remoteChannelContext.js.map +0 -1
- package/src/packageVersion.ts +0 -9
- package/tsconfig.esnext.json +0 -7
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelContext.js","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sDAAsD;AACtD,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAgBzC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EACH,sBAAsB,EAEtB,gBAAgB,EAChB,qBAAqB,GACxB,MAAM,kBAAkB,CAAC;AAK1B;;GAEG;AACH,MAAM,OAAgB,uBAAuB;IAKzC,YACuB,EAAU,EACV,QAA+B,EAC/B,OAA+B,EACjC,cAGX;QANa,OAAE,GAA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,SAAS,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,iBAAiB,CAAC,CAAC;SAC7D;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE;YAC1B,OAAO,sBAAsB,CACzB,IAAI,CAAC,EAAE,EACP,gBAAgB,CAAC,SAAS,EAC1B,QAAQ,EACR,IAAI,CAAC,OAAO,EACZ,0BAA0B,EAC1B,cAAc,EACd,MAAM,CACT,CAAC;QACN,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// eslint-disable-next-line import/no-internal-modules\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannel,\n IFluidDataStoreRuntime,\n IChannelFactory,\n IChannelAttributes,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n IFluidDataStoreContext,\n IGarbageCollectionData,\n ISummarizeResult,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { DataProcessingError } from \"@fluidframework/container-utils\";\nimport { assert, Lazy } from \"@fluidframework/common-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n createServiceEndpoints,\n IChannelContext,\n summarizeChannel,\n summarizeChannelAsync,\n} from \"./channelContext\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\nimport { ChannelStorageService } from \"./channelStorageService\";\n\n/**\n * Channel context for a locally created channel\n */\nexport abstract class LocalChannelContextBase implements IChannelContext {\n public channel: IChannel | undefined;\n private globallyVisible = false;\n protected readonly pending: ISequencedDocumentMessage[] = [];\n protected factory: IChannelFactory | undefined;\n constructor(\n protected readonly id: string,\n protected readonly registry: ISharedObjectRegistry,\n protected readonly runtime: IFluidDataStoreRuntime,\n private readonly servicesGetter: () => Lazy<{\n readonly deltaConnection: ChannelDeltaConnection;\n readonly objectStorage: ChannelStorageService;\n }>,\n ) {\n assert(!this.id.includes(\"/\"), 0x30f /* Channel context ID cannot contain slashes */);\n }\n\n public async getChannel(): Promise<IChannel> {\n assert(this.channel !== undefined, 0x207 /* \"Channel should be defined\" */);\n return this.channel;\n }\n\n public get isLoaded(): boolean {\n return this.channel !== undefined;\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n // Connection events are ignored if the data store is not yet globallyVisible or loaded\n if (this.globallyVisible && this.isLoaded) {\n this.servicesGetter().value.deltaConnection.setConnectionState(connected);\n }\n }\n\n public processOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n assert(this.globallyVisible, 0x2d3 /* \"Local channel must be globally visible when processing op\" */);\n\n // A local channel may not be loaded in case where we rehydrate the container from a snapshot because of\n // delay loading. So after the container is attached and some other client joins which start generating\n // ops for this channel. So not loaded local channel can still receive ops and we store them to process later.\n if (this.isLoaded) {\n this.servicesGetter().value.deltaConnection.process(message, local, localOpMetadata);\n } else {\n assert(local === false,\n 0x189 /* \"Should always be remote because a local dds shouldn't generate ops before loading\" */);\n this.pending.push(message);\n }\n }\n\n public reSubmit(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x18a /* \"Channel should be loaded to resubmit ops\" */);\n assert(this.globallyVisible, 0x2d4 /* \"Local channel must be globally visible when resubmitting op\" */);\n this.servicesGetter().value.deltaConnection.reSubmit(content, localOpMetadata);\n }\n public rollback(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x2ee /* \"Channel should be loaded to rollback ops\" */);\n assert(this.globallyVisible, 0x2ef /* \"Local channel must be globally visible when rolling back op\" */);\n this.servicesGetter().value.deltaConnection.rollback(content, localOpMetadata);\n }\n\n public applyStashedOp() {\n throw new Error(\"no stashed ops on local channel\");\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n * @param telemetryContext - summary data passed through the layers for telemetry purposes\n */\n public async summarize(\n fullTree: boolean = false,\n trackState: boolean = false,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummarizeResult> {\n assert(this.isLoaded && this.channel !== undefined, 0x18c /* \"Channel should be loaded to summarize\" */);\n return summarizeChannelAsync(this.channel, fullTree, trackState, telemetryContext);\n }\n\n public getAttachSummary(telemetryContext?: ITelemetryContext): ISummarizeResult {\n assert(this.isLoaded && this.channel !== undefined, 0x18d /* \"Channel should be loaded to take snapshot\" */);\n return summarizeChannel(this.channel, true /* fullTree */, false /* trackState */, telemetryContext);\n }\n\n public makeVisible(): void {\n if (this.globallyVisible) {\n throw new Error(\"Channel is already globally visible\");\n }\n\n if (this.isLoaded) {\n assert(!!this.channel, 0x192 /* \"Channel should be there if loaded!!\" */);\n this.channel.connect(this.servicesGetter().value);\n }\n this.globallyVisible = true;\n }\n\n /**\n * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n * Each node has a set of outbound routes to other GC nodes in the document. This should be called only after\n * the context has loaded.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n assert(this.isLoaded && this.channel !== undefined, 0x193 /* \"Channel should be loaded to run GC\" */);\n return this.channel.getGCData(fullGC);\n }\n\n public updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number) {\n /**\n * Currently, DDSes are always considered referenced and are not garbage collected.\n * Once we have GC at DDS level, this channel context's used routes will be updated as per the passed\n * value. See - https://github.com/microsoft/FluidFramework/issues/4611\n */\n }\n}\n\nexport class RehydratedLocalChannelContext extends LocalChannelContextBase {\n private readonly services: Lazy<{\n readonly deltaConnection: ChannelDeltaConnection;\n readonly objectStorage: ChannelStorageService;\n }>;\n\n private readonly dirtyFn: () => void;\n\n constructor(\n id: string,\n registry: ISharedObjectRegistry,\n runtime: IFluidDataStoreRuntime,\n dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n logger: ITelemetryLogger,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n private readonly snapshotTree: ISnapshotTree,\n ) {\n super(id, registry, runtime, () => this.services);\n const blobMap: Map<string, ArrayBufferLike> = new Map<string, ArrayBufferLike>();\n const clonedSnapshotTree = cloneDeep(this.snapshotTree);\n // 0.47 back-compat Need to sanitize if snapshotTree.blobs still contains blob contents too.\n // This is for older snapshot which is generated by loader <=0.47 version which still contains\n // the contents within blobs. After a couple of revisions we can remove it.\n if (this.isSnapshotInOldFormatAndCollectBlobs(clonedSnapshotTree, blobMap)) {\n this.sanitizeSnapshot(clonedSnapshotTree);\n }\n\n this.services = new Lazy(() => {\n return createServiceEndpoints(\n this.id,\n dataStoreContext.connected,\n submitFn,\n this.dirtyFn,\n addedGCOutboundReferenceFn,\n storageService,\n logger,\n clonedSnapshotTree,\n blobMap,\n );\n });\n this.dirtyFn = () => { dirtyFn(id); };\n }\n\n public async getChannel(): Promise<IChannel> {\n if (this.channel === undefined) {\n this.channel = await this.loadChannel()\n .catch((err) => {\n throw DataProcessingError.wrapIfUnrecognized(\n err, \"rehydratedLocalChannelContextFailedToLoadChannel\", undefined);\n });\n }\n return this.channel;\n }\n\n private async loadChannel(): Promise<IChannel> {\n assert(!this.isLoaded, 0x18e /* \"Channel must not already be loaded when loading\" */);\n assert(await this.services.value.objectStorage.contains(\".attributes\"),\n 0x190 /* \".attributes blob should be present\" */);\n const attributes = await readAndParse<IChannelAttributes>(\n this.services.value.objectStorage,\n \".attributes\");\n\n assert(this.factory === undefined, 0x208 /* \"Factory should be undefined before loading\" */);\n this.factory = this.registry.get(attributes.type);\n if (this.factory === undefined) {\n throw new Error(`Channel Factory ${attributes.type} not registered`);\n }\n // Services will be assigned during this load.\n const channel = await this.factory.load(\n this.runtime,\n this.id,\n this.services.value,\n attributes);\n\n // Commit changes.\n this.channel = channel;\n\n // Send all pending messages to the channel\n for (const message of this.pending) {\n this.services.value.deltaConnection.process(message, false, undefined /* localOpMetadata */);\n }\n return this.channel;\n }\n\n private isSnapshotInOldFormatAndCollectBlobs(\n snapshotTree: ISnapshotTree,\n blobMap: Map<string, ArrayBufferLike>,\n ): boolean {\n let sanitize = false;\n const blobsContents: { [path: string]: ArrayBufferLike; } = (snapshotTree as any).blobsContents;\n Object.entries(blobsContents).forEach(([key, value]) => {\n blobMap.set(key, value);\n if (snapshotTree.blobs[key] !== undefined) {\n sanitize = true;\n }\n });\n for (const value of Object.values(snapshotTree.trees)) {\n sanitize = sanitize || this.isSnapshotInOldFormatAndCollectBlobs(value, blobMap);\n }\n return sanitize;\n }\n\n private sanitizeSnapshot(snapshotTree: ISnapshotTree) {\n const blobMapInitial = new Map(Object.entries(snapshotTree.blobs));\n for (const [blobName, blobId] of blobMapInitial.entries()) {\n const blobValue = blobMapInitial.get(blobId);\n if (blobValue === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete snapshotTree.blobs[blobName];\n }\n }\n for (const value of Object.values(snapshotTree.trees)) {\n this.sanitizeSnapshot(value);\n }\n }\n}\n\nexport class LocalChannelContext extends LocalChannelContextBase {\n private readonly services: Lazy<{\n readonly deltaConnection: ChannelDeltaConnection;\n readonly objectStorage: ChannelStorageService;\n }>;\n private readonly dirtyFn: () => void;\n constructor(\n id: string,\n registry: ISharedObjectRegistry,\n type: string,\n runtime: IFluidDataStoreRuntime,\n dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n logger: ITelemetryLogger,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n ) {\n super(id, registry, runtime, () => this.services);\n assert(type !== undefined, 0x209 /* \"Factory Type should be defined\" */);\n this.factory = registry.get(type);\n if (this.factory === undefined) {\n throw new Error(`Channel Factory ${type} not registered`);\n }\n this.channel = this.factory.create(runtime, id);\n this.services = new Lazy(() => {\n return createServiceEndpoints(\n this.id,\n dataStoreContext.connected,\n submitFn,\n this.dirtyFn,\n addedGCOutboundReferenceFn,\n storageService,\n logger,\n );\n });\n this.dirtyFn = () => { dirtyFn(id); };\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelStorageService.d.ts","sourceRoot":"","sources":["../src/localChannelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAS,KAAK,EAAa,MAAM,sCAAsC,CAAC;AAG/E,qBAAa,0BAA2B,YAAW,sBAAsB;IACzD,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,KAAK;IAG3B,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;CAqB/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelStorageService.js","sourceRoot":"","sources":["../src/localChannelStorageService.ts"],"names":[],"mappings":"AAAA;;;GA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CAAC,KAAK,CAAC;qBACtB;oBACD,MAAM;gBAEV,KAAK,SAAS,CAAC,IAAI;oBACf,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;wBAC7B,OAAO,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;qBACrF;oBACD,MAAM;gBAEV,QAAQ;aACX;SACJ;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IChannelStorageService } from \"@fluidframework/datastore-definitions\";\nimport { stringToBuffer } from \"@fluidframework/common-utils\";\nimport { IBlob, ITree, TreeEntry } from \"@fluidframework/protocol-definitions\";\nimport { listBlobsAtTreePath } from \"@fluidframework/runtime-utils\";\n\nexport class LocalChannelStorageService implements IChannelStorageService {\n constructor(private readonly tree: ITree) {\n }\n\n public async readBlob(path: string): Promise<ArrayBufferLike> {\n const blob = this.readBlobSync(path);\n if (blob === undefined) {\n throw new Error(\"Blob Not Found\");\n }\n return stringToBuffer(blob.contents, blob.encoding);\n }\n\n public async contains(path: string): Promise<boolean> {\n const blob = this.readBlobSync(path);\n return blob !== undefined ? blob.contents !== undefined : false;\n }\n\n public async list(path: string): Promise<string[]> {\n return listBlobsAtTreePath(this.tree, path);\n }\n\n private readBlobSync(path: string): IBlob | undefined {\n return this.readBlobSyncInternal(path, this.tree);\n }\n\n private readBlobSyncInternal(path: string, tree: ITree): IBlob | undefined {\n for (const entry of tree.entries) {\n switch (entry.type) {\n case TreeEntry.Blob:\n if (path === entry.path) {\n return entry.value;\n }\n break;\n\n case TreeEntry.Tree:\n if (path.startsWith(entry.path)) {\n return this.readBlobSyncInternal(path.substr(entry.path.length + 1), entry.value);\n }\n break;\n\n default:\n }\n }\n\n return undefined;\n }\n}\n"]}
|
package/lib/packageVersion.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
|
-
*/
|
|
7
|
-
export declare const pkgName = "@fluidframework/datastore";
|
|
8
|
-
export declare const pkgVersion = "1.4.0-121020";
|
|
9
|
-
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,8BAA8B,CAAC;AACnD,eAAO,MAAM,UAAU,iBAAiB,CAAC"}
|
package/lib/packageVersion.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
|
-
*/
|
|
7
|
-
export const pkgName = "@fluidframework/datastore";
|
|
8
|
-
export const pkgVersion = "1.4.0-121020";
|
|
9
|
-
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/datastore\";\nexport const pkgVersion = \"1.4.0-121020\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
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,EACH,QAAQ,EAER,sBAAsB,EAEzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,OAAO,EACH,yBAAyB,EACzB,aAAa,EAChB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAE7B,gBAAgB,EAEhB,iBAAiB,EACpB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAGH,eAAe,EAElB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,qBAAa,oBAAqB,YAAW,eAAe;IAepD,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;IA1BvC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAA+C;IAC9D,OAAO,CAAC,QAAQ,CAAgC;IAChD,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAGvB;IACF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAwB;IACvD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;IAC7C,OAAO,CAAC,QAAQ,CA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CAAC,MAAM,GAAE,OAAe,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAIhF;;;;OAIG;YACW,iBAAiB;IAKxB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,EAAE,MAAM;CASrE"}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { assert } from "@fluidframework/common-utils";
|
|
6
|
-
import { DataCorruptionError } from "@fluidframework/container-utils";
|
|
7
|
-
import { readAndParse } from "@fluidframework/driver-utils";
|
|
8
|
-
import { ChildLogger, TelemetryDataTag, ThresholdCounter } from "@fluidframework/telemetry-utils";
|
|
9
|
-
import { attributesBlobKey, createServiceEndpoints, summarizeChannelAsync, } from "./channelContext";
|
|
10
|
-
export class RemoteChannelContext {
|
|
11
|
-
constructor(runtime, dataStoreContext, storageService, submitFn, dirtyFn, addedGCOutboundReferenceFn, id, baseSnapshot, registry, extraBlobs, createSummarizerNode, getBaseGCDetails, attachMessageType) {
|
|
12
|
-
this.runtime = runtime;
|
|
13
|
-
this.dataStoreContext = dataStoreContext;
|
|
14
|
-
this.id = id;
|
|
15
|
-
this.registry = registry;
|
|
16
|
-
this.attachMessageType = attachMessageType;
|
|
17
|
-
this.isLoaded = false;
|
|
18
|
-
this.pending = [];
|
|
19
|
-
assert(!this.id.includes("/"), 0x310 /* Channel context ID cannot contain slashes */);
|
|
20
|
-
this.subLogger = ChildLogger.create(this.runtime.logger, "RemoteChannelContext");
|
|
21
|
-
this.services = createServiceEndpoints(this.id, this.dataStoreContext.connected, submitFn, () => dirtyFn(this.id), addedGCOutboundReferenceFn, storageService, this.subLogger, baseSnapshot, extraBlobs);
|
|
22
|
-
const thisSummarizeInternal = async (fullTree, trackState, telemetryContext) => this.summarizeInternal(fullTree, trackState, telemetryContext);
|
|
23
|
-
this.summarizerNode = createSummarizerNode(thisSummarizeInternal, async (fullGC) => this.getGCDataInternal(fullGC), async () => getBaseGCDetails());
|
|
24
|
-
this.thresholdOpsCounter = new ThresholdCounter(RemoteChannelContext.pendingOpsCountThreshold, this.subLogger);
|
|
25
|
-
}
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
27
|
-
getChannel() {
|
|
28
|
-
if (this.channelP === undefined) {
|
|
29
|
-
this.channelP = this.loadChannel();
|
|
30
|
-
}
|
|
31
|
-
return this.channelP;
|
|
32
|
-
}
|
|
33
|
-
setConnectionState(connected, clientId) {
|
|
34
|
-
// Connection events are ignored if the data store is not yet loaded
|
|
35
|
-
if (!this.isLoaded) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
this.services.deltaConnection.setConnectionState(connected);
|
|
39
|
-
}
|
|
40
|
-
applyStashedOp(message) {
|
|
41
|
-
assert(this.isLoaded, 0x194 /* "Remote channel must be loaded when rebasing op" */);
|
|
42
|
-
return this.services.deltaConnection.applyStashedOp(message);
|
|
43
|
-
}
|
|
44
|
-
processOp(message, local, localOpMetadata) {
|
|
45
|
-
this.summarizerNode.invalidate(message.sequenceNumber);
|
|
46
|
-
if (this.isLoaded) {
|
|
47
|
-
this.services.deltaConnection.process(message, local, localOpMetadata);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
assert(!local, 0x195 /* "Remote channel must not be local when processing op" */);
|
|
51
|
-
assert(this.pending !== undefined, 0x23e /* "pending is undefined" */);
|
|
52
|
-
this.pending.push(message);
|
|
53
|
-
this.thresholdOpsCounter.sendIfMultiple("StorePendingOps", this.pending.length);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
reSubmit(content, localOpMetadata) {
|
|
57
|
-
assert(this.isLoaded, 0x196 /* "Remote channel must be loaded when resubmitting op" */);
|
|
58
|
-
this.services.deltaConnection.reSubmit(content, localOpMetadata);
|
|
59
|
-
}
|
|
60
|
-
rollback(content, localOpMetadata) {
|
|
61
|
-
assert(this.isLoaded, 0x2f0 /* "Remote channel must be loaded when rolling back op" */);
|
|
62
|
-
this.services.deltaConnection.rollback(content, localOpMetadata);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Returns a summary at the current sequence number.
|
|
66
|
-
* @param fullTree - true to bypass optimizations and force a full summary tree
|
|
67
|
-
* @param trackState - This tells whether we should track state from this summary.
|
|
68
|
-
* @param telemetryContext - summary data passed through the layers for telemetry purposes
|
|
69
|
-
*/
|
|
70
|
-
async summarize(fullTree = false, trackState = true, telemetryContext) {
|
|
71
|
-
return this.summarizerNode.summarize(fullTree, trackState, telemetryContext);
|
|
72
|
-
}
|
|
73
|
-
async summarizeInternal(fullTree, trackState, telemetryContext) {
|
|
74
|
-
const channel = await this.getChannel();
|
|
75
|
-
const summarizeResult = await summarizeChannelAsync(channel, fullTree, trackState, telemetryContext);
|
|
76
|
-
return Object.assign(Object.assign({}, summarizeResult), { id: this.id });
|
|
77
|
-
}
|
|
78
|
-
async loadChannel() {
|
|
79
|
-
assert(!this.isLoaded, 0x197 /* "Remote channel must not already be loaded when loading" */);
|
|
80
|
-
let attributes;
|
|
81
|
-
if (await this.services.objectStorage.contains(attributesBlobKey)) {
|
|
82
|
-
attributes = await readAndParse(this.services.objectStorage, attributesBlobKey);
|
|
83
|
-
}
|
|
84
|
-
let factory;
|
|
85
|
-
// this is a backward compatibility case where
|
|
86
|
-
// the attach message doesn't include
|
|
87
|
-
// the attributes. Since old attach messages
|
|
88
|
-
// will not have attributes we need to keep
|
|
89
|
-
// this as long as we support old attach messages
|
|
90
|
-
if (attributes === undefined) {
|
|
91
|
-
if (this.attachMessageType === undefined) {
|
|
92
|
-
// TODO: dataStoreId may require a different tag from PackageData #7488
|
|
93
|
-
throw new DataCorruptionError("channelTypeNotAvailable", {
|
|
94
|
-
channelId: {
|
|
95
|
-
value: this.id,
|
|
96
|
-
tag: TelemetryDataTag.PackageData,
|
|
97
|
-
},
|
|
98
|
-
dataStoreId: {
|
|
99
|
-
value: this.dataStoreContext.id,
|
|
100
|
-
tag: TelemetryDataTag.PackageData,
|
|
101
|
-
},
|
|
102
|
-
dataStorePackagePath: this.dataStoreContext.packagePath.join("/"),
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
factory = this.registry.get(this.attachMessageType);
|
|
106
|
-
if (factory === undefined) {
|
|
107
|
-
// TODO: dataStoreId may require a different tag from PackageData #7488
|
|
108
|
-
throw new DataCorruptionError("channelFactoryNotRegisteredForAttachMessageType", {
|
|
109
|
-
channelId: {
|
|
110
|
-
value: this.id,
|
|
111
|
-
tag: TelemetryDataTag.PackageData,
|
|
112
|
-
},
|
|
113
|
-
dataStoreId: {
|
|
114
|
-
value: this.dataStoreContext.id,
|
|
115
|
-
tag: TelemetryDataTag.PackageData,
|
|
116
|
-
},
|
|
117
|
-
dataStorePackagePath: this.dataStoreContext.packagePath.join("/"),
|
|
118
|
-
channelFactoryType: this.attachMessageType,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
attributes = factory.attributes;
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
factory = this.registry.get(attributes.type);
|
|
125
|
-
if (factory === undefined) {
|
|
126
|
-
// TODO: dataStoreId may require a different tag from PackageData #7488
|
|
127
|
-
throw new DataCorruptionError("channelFactoryNotRegisteredForGivenType", {
|
|
128
|
-
channelId: {
|
|
129
|
-
value: this.id,
|
|
130
|
-
tag: TelemetryDataTag.PackageData,
|
|
131
|
-
},
|
|
132
|
-
dataStoreId: {
|
|
133
|
-
value: this.dataStoreContext.id,
|
|
134
|
-
tag: TelemetryDataTag.PackageData,
|
|
135
|
-
},
|
|
136
|
-
dataStorePackagePath: this.dataStoreContext.packagePath.join("/"),
|
|
137
|
-
channelFactoryType: attributes.type,
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
// Compare snapshot version to collaborative object version
|
|
142
|
-
if (attributes.snapshotFormatVersion !== undefined
|
|
143
|
-
&& attributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion) {
|
|
144
|
-
this.subLogger.sendTelemetryEvent({
|
|
145
|
-
eventName: "ChannelAttributesVersionMismatch",
|
|
146
|
-
channelType: { value: attributes.type, tag: TelemetryDataTag.PackageData },
|
|
147
|
-
channelSnapshotVersion: {
|
|
148
|
-
value: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,
|
|
149
|
-
tag: TelemetryDataTag.PackageData,
|
|
150
|
-
},
|
|
151
|
-
channelCodeVersion: {
|
|
152
|
-
value: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,
|
|
153
|
-
tag: TelemetryDataTag.PackageData,
|
|
154
|
-
},
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
const channel = await factory.load(this.runtime, this.id, this.services, attributes);
|
|
158
|
-
// Send all pending messages to the channel
|
|
159
|
-
assert(this.pending !== undefined, 0x23f /* "pending undefined" */);
|
|
160
|
-
for (const message of this.pending) {
|
|
161
|
-
this.services.deltaConnection.process(message, false, undefined /* localOpMetadata */);
|
|
162
|
-
}
|
|
163
|
-
this.thresholdOpsCounter.send("ProcessPendingOps", this.pending.length);
|
|
164
|
-
// Commit changes.
|
|
165
|
-
this.channel = channel;
|
|
166
|
-
this.pending = undefined;
|
|
167
|
-
this.isLoaded = true;
|
|
168
|
-
// Because have some await between we created the service and here, the connection state might have changed
|
|
169
|
-
// and we don't propagate the connection state when we are not loaded. So we have to set it again here.
|
|
170
|
-
this.services.deltaConnection.setConnectionState(this.dataStoreContext.connected);
|
|
171
|
-
return this.channel;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.
|
|
175
|
-
* Each node has a set of outbound routes to other GC nodes in the document.
|
|
176
|
-
* If there is no new data in this context since the last summary, previous GC data is used.
|
|
177
|
-
* If there is new data, the GC data is generated again (by calling getGCDataInternal).
|
|
178
|
-
* @param fullGC - true to bypass optimizations and force full generation of GC data.
|
|
179
|
-
*/
|
|
180
|
-
async getGCData(fullGC = false) {
|
|
181
|
-
return this.summarizerNode.getGCData(fullGC);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Generates the data used for garbage collection. This is called when there is new data since last summary. It
|
|
185
|
-
* loads the context and calls into the channel to get its GC data.
|
|
186
|
-
* @param fullGC - true to bypass optimizations and force full generation of GC data.
|
|
187
|
-
*/
|
|
188
|
-
async getGCDataInternal(fullGC = false) {
|
|
189
|
-
const channel = await this.getChannel();
|
|
190
|
-
return channel.getGCData(fullGC);
|
|
191
|
-
}
|
|
192
|
-
updateUsedRoutes(usedRoutes, gcTimestamp) {
|
|
193
|
-
/**
|
|
194
|
-
* Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's
|
|
195
|
-
* used routes to contain a route to this channel context.
|
|
196
|
-
* Once we have GC at DDS level, this will be updated to use the passed usedRoutes. See -
|
|
197
|
-
* https://github.com/microsoft/FluidFramework/issues/4611
|
|
198
|
-
*/
|
|
199
|
-
this.summarizerNode.updateUsedRoutes([""]);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
RemoteChannelContext.pendingOpsCountThreshold = 1000;
|
|
203
|
-
//# sourceMappingURL=remoteChannelContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAK1B,MAAM,OAA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CAAC;IACrC,CAAC;IAEM,gBAAgB,CAAC,UAAoB,EAAE,WAAoB;QAC9D;;;;;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.PackageData,\n },\n dataStoreId: {\n value: this.dataStoreContext.id,\n tag: TelemetryDataTag.PackageData,\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.PackageData,\n },\n dataStoreId: {\n value: this.dataStoreContext.id,\n tag: TelemetryDataTag.PackageData,\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.PackageData,\n },\n dataStoreId: {\n value: this.dataStoreContext.id,\n tag: TelemetryDataTag.PackageData,\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.PackageData },\n channelSnapshotVersion: {\n value: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,\n tag: TelemetryDataTag.PackageData,\n },\n channelCodeVersion: {\n value: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,\n tag: TelemetryDataTag.PackageData,\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[], gcTimestamp?: number) {\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"]}
|
package/src/packageVersion.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export const pkgName = "@fluidframework/datastore";
|
|
9
|
-
export const pkgVersion = "1.4.0-121020";
|