@fluidframework/datastore 2.51.0 → 2.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/channelContext.d.ts +3 -3
- package/dist/channelContext.d.ts.map +1 -1
- package/dist/channelContext.js.map +1 -1
- package/dist/channelStorageService.d.ts +3 -2
- package/dist/channelStorageService.d.ts.map +1 -1
- package/dist/channelStorageService.js.map +1 -1
- package/dist/localChannelContext.d.ts +4 -4
- package/dist/localChannelContext.d.ts.map +1 -1
- package/dist/localChannelContext.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 +3 -3
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/remoteChannelContext.js +14 -14
- package/dist/remoteChannelContext.js.map +1 -1
- package/lib/channelContext.d.ts +3 -3
- package/lib/channelContext.d.ts.map +1 -1
- package/lib/channelContext.js.map +1 -1
- package/lib/channelStorageService.d.ts +3 -2
- package/lib/channelStorageService.d.ts.map +1 -1
- package/lib/channelStorageService.js.map +1 -1
- package/lib/localChannelContext.d.ts +4 -4
- package/lib/localChannelContext.d.ts.map +1 -1
- package/lib/localChannelContext.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 +3 -3
- package/lib/remoteChannelContext.d.ts.map +1 -1
- package/lib/remoteChannelContext.js +1 -1
- package/lib/remoteChannelContext.js.map +1 -1
- package/package.json +17 -17
- package/src/channelContext.ts +3 -5
- package/src/channelStorageService.ts +3 -5
- package/src/localChannelContext.ts +4 -6
- package/src/packageVersion.ts +1 -1
- package/src/remoteChannelContext.ts +4 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelContext.js","sourceRoot":"","sources":["../src/channelContext.ts"],"names":[],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B,yCAAyC,EACzC,gBAAgB,CAAC;YAChB,SAAS;YACT,WAAW,EAAE,gBAAgB,CAAC,EAAE;YAChC,oBAAoB,EAAE,gBAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;YAC5D,kBAAkB;SAClB,CAAC,CACF,CAAC;IACH,CAAC;IACD,gHAAgH;IAChH,oBAAoB;IACpB,UAAU,GAAG,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC;IAC9C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAChC,gBAAwC,EACxC,UAA8B,EAC9B,OAAwB,EACxB,QAAiC,EACjC,MAA2B,EAC3B,SAAiB;IAEjB,2DAA2D;IAC3D,IACC,UAAU,CAAC,qBAAqB,KAAK,SAAS;QAC9C,UAAU,CAAC,qBAAqB,KAAK,OAAO,CAAC,UAAU,CAAC,qBAAqB,EAC5E,CAAC;QACF,MAAM,CAAC,kBAAkB,CAAC;YACzB,SAAS,EAAE,kCAAkC;YAC7C,GAAG,gBAAgB,CAAC;gBACnB,WAAW,EAAE,UAAU,CAAC,IAAI;gBAC5B,sBAAsB,EAAE,GAAG,UAAU,CAAC,qBAAqB,IAAI,UAAU,CAAC,cAAc,EAAE;gBAC1F,kBAAkB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,qBAAqB,IAAI,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE;aACtG,CAAC;SACF,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIChannel,\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tIDocumentStorageService,\n\tISnapshotTree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tIExperimentalIncrementalSummaryContext,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tIGarbageCollectionData,\n\tIFluidDataStoreContext,\n\tISummarizeResult,\n\ttype IRuntimeMessageCollection,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { addBlobToSummary } from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tDataCorruptionError,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection.js\";\nimport { ChannelStorageService } from \"./channelStorageService.js\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime.js\";\n\nexport const attributesBlobKey = \".attributes\";\n\nexport interface IChannelContext {\n\tgetChannel(): Promise<IChannel>;\n\n\tsetConnectionState(connected: boolean, clientId?: string);\n\n\t/**\n\t * Process messages for this channel context. The messages here are contiguous messages for this context in a batch.\n\t * @param messageCollection - The collection of messages to process.\n\t */\n\tprocessMessages(messageCollection: IRuntimeMessageCollection): void;\n\n\tsummarize(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult>;\n\n\treSubmit(content: unknown, localOpMetadata: unknown, squash?: boolean): void;\n\n\tapplyStashedOp(content: unknown): unknown;\n\n\trollback(message: unknown, localOpMetadata: unknown): void;\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 * including any of its children. Each node has a set of outbound routes to other GC nodes in the document.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tgetGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;\n\n\t/**\n\t * After GC has run, called to notify this context of routes that are used in it. These are used for the following:\n\t * 1. To identify if this context is being referenced in the document or not.\n\t * 2. To identify if this context or any of its children's used routes changed since last summary.\n\t * 3. They are added to the summary generated by this context.\n\t */\n\tupdateUsedRoutes(usedRoutes: string[]): void;\n}\n\nexport interface ChannelServiceEndpoints {\n\tdeltaConnection: ChannelDeltaConnection;\n\tobjectStorage: ChannelStorageService;\n}\n\nexport function createChannelServiceEndpoints(\n\tconnected: boolean,\n\tsubmitFn: (content: unknown, localOpMetadata: unknown) => void,\n\tdirtyFn: () => void,\n\tisAttachedAndVisible: () => boolean,\n\tstorageService: IDocumentStorageService,\n\tlogger: ITelemetryLoggerExt,\n\ttree?: ISnapshotTree,\n\textraBlobs?: Map<string, ArrayBufferLike>,\n): ChannelServiceEndpoints {\n\tconst deltaConnection = new ChannelDeltaConnection(\n\t\tconnected,\n\t\t(message, localOpMetadata) => submitFn(message, localOpMetadata),\n\t\tdirtyFn,\n\t\tisAttachedAndVisible,\n\t);\n\tconst objectStorage = new ChannelStorageService(tree, storageService, logger, extraBlobs);\n\n\treturn {\n\t\tdeltaConnection,\n\t\tobjectStorage,\n\t};\n}\n\n/**\n * Used to get the channel's summary for the DDS or DataStore attach op.\n */\nexport function summarizeChannel(\n\tchannel: IChannel,\n\tfullTree: boolean = false,\n\ttrackState: boolean = false,\n\ttelemetryContext?: ITelemetryContext,\n): ISummaryTreeWithStats {\n\tconst summarizeResult = channel.getAttachSummary(fullTree, trackState, telemetryContext);\n\n\t// Add the channel attributes to the returned result.\n\taddBlobToSummary(summarizeResult, attributesBlobKey, JSON.stringify(channel.attributes));\n\treturn summarizeResult;\n}\n\nexport async function summarizeChannelAsync(\n\tchannel: IChannel,\n\tfullTree: boolean = false,\n\ttrackState: boolean = false,\n\ttelemetryContext?: ITelemetryContext,\n\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n): Promise<ISummaryTreeWithStats> {\n\tconst summarizeResult = await channel.summarize(\n\t\tfullTree,\n\t\ttrackState,\n\t\ttelemetryContext,\n\t\tincrementalSummaryContext,\n\t);\n\n\t// Add the channel attributes to the returned result.\n\taddBlobToSummary(summarizeResult, attributesBlobKey, JSON.stringify(channel.attributes));\n\treturn summarizeResult;\n}\n\nexport async function loadChannelFactoryAndAttributes(\n\tdataStoreContext: IFluidDataStoreContext,\n\tservices: ChannelServiceEndpoints,\n\tchannelId: string,\n\tregistry: ISharedObjectRegistry,\n\tattachMessageType?: string,\n): Promise<{ factory: IChannelFactory; attributes: IChannelAttributes }> {\n\tlet attributes: IChannelAttributes | undefined;\n\tif (await services.objectStorage.contains(attributesBlobKey)) {\n\t\tattributes = await readAndParse<IChannelAttributes | undefined>(\n\t\t\tservices.objectStorage,\n\t\t\tattributesBlobKey,\n\t\t);\n\t}\n\n\t// This is a backward compatibility case where the attach message doesn't include attributes. They must\n\t// include attach message type.\n\t// Since old attach messages will not have attributes, we need to keep this as long as we support old attach\n\t// messages.\n\tconst channelFactoryType = attributes ? attributes.type : attachMessageType;\n\tif (channelFactoryType === undefined) {\n\t\tthrow new DataCorruptionError(\n\t\t\t\"channelTypeNotAvailable\",\n\t\t\ttagCodeArtifacts({\n\t\t\t\tchannelId,\n\t\t\t\tdataStoreId: dataStoreContext.id,\n\t\t\t\tdataStorePackagePath: dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\tchannelFactoryType,\n\t\t\t}),\n\t\t);\n\t}\n\tconst factory = registry.get(channelFactoryType);\n\tif (factory === undefined) {\n\t\tthrow new DataCorruptionError(\n\t\t\t\"channelFactoryNotRegisteredForGivenType\",\n\t\t\ttagCodeArtifacts({\n\t\t\t\tchannelId,\n\t\t\t\tdataStoreId: dataStoreContext.id,\n\t\t\t\tdataStorePackagePath: dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\tchannelFactoryType,\n\t\t\t}),\n\t\t);\n\t}\n\t// This is a backward compatibility case where the attach message doesn't include attributes. Get the attributes\n\t// from the factory.\n\tattributes = attributes ?? factory.attributes;\n\treturn { factory, attributes };\n}\n\nexport async function loadChannel(\n\tdataStoreRuntime: IFluidDataStoreRuntime,\n\tattributes: IChannelAttributes,\n\tfactory: IChannelFactory,\n\tservices: ChannelServiceEndpoints,\n\tlogger: ITelemetryLoggerExt,\n\tchannelId: string,\n): Promise<IChannel> {\n\t// Compare snapshot version to collaborative object version\n\tif (\n\t\tattributes.snapshotFormatVersion !== undefined &&\n\t\tattributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion\n\t) {\n\t\tlogger.sendTelemetryEvent({\n\t\t\teventName: \"ChannelAttributesVersionMismatch\",\n\t\t\t...tagCodeArtifacts({\n\t\t\t\tchannelType: attributes.type,\n\t\t\t\tchannelSnapshotVersion: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,\n\t\t\t\tchannelCodeVersion: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,\n\t\t\t}),\n\t\t});\n\t}\n\n\treturn factory.load(dataStoreRuntime, channelId, services, attributes);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"channelContext.js","sourceRoot":"","sources":["../src/channelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAWrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAEN,mBAAmB,EACnB,gBAAgB,GAChB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AA8C/C,MAAM,UAAU,6BAA6B,CAC5C,SAAkB,EAClB,QAA8D,EAC9D,OAAmB,EACnB,oBAAmC,EACnC,cAAsC,EACtC,MAA2B,EAC3B,IAAoB,EACpB,UAAyC;IAEzC,MAAM,eAAe,GAAG,IAAI,sBAAsB,CACjD,SAAS,EACT,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,EA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C;YACzB,SAAS,EAAE,kCAAkC;YAC7C,GAAG,gBAAgB,CAAC;gBACnB,WAAW,EAAE,UAAU,CAAC,IAAI;gBAC5B,sBAAsB,EAAE,GAAG,UAAU,CAAC,qBAAqB,IAAI,UAAU,CAAC,cAAc,EAAE;gBAC1F,kBAAkB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,qBAAqB,IAAI,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE;aACtG,CAAC;SACF,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIChannel,\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tIExperimentalIncrementalSummaryContext,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tIGarbageCollectionData,\n\tIFluidDataStoreContext,\n\tISummarizeResult,\n\ttype IRuntimeMessageCollection,\n\ttype IRuntimeStorageService,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { addBlobToSummary } from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tDataCorruptionError,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection.js\";\nimport { ChannelStorageService } from \"./channelStorageService.js\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime.js\";\n\nexport const attributesBlobKey = \".attributes\";\n\nexport interface IChannelContext {\n\tgetChannel(): Promise<IChannel>;\n\n\tsetConnectionState(connected: boolean, clientId?: string);\n\n\t/**\n\t * Process messages for this channel context. The messages here are contiguous messages for this context in a batch.\n\t * @param messageCollection - The collection of messages to process.\n\t */\n\tprocessMessages(messageCollection: IRuntimeMessageCollection): void;\n\n\tsummarize(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult>;\n\n\treSubmit(content: unknown, localOpMetadata: unknown, squash?: boolean): void;\n\n\tapplyStashedOp(content: unknown): unknown;\n\n\trollback(message: unknown, localOpMetadata: unknown): void;\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 * including any of its children. Each node has a set of outbound routes to other GC nodes in the document.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tgetGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;\n\n\t/**\n\t * After GC has run, called to notify this context of routes that are used in it. These are used for the following:\n\t * 1. To identify if this context is being referenced in the document or not.\n\t * 2. To identify if this context or any of its children's used routes changed since last summary.\n\t * 3. They are added to the summary generated by this context.\n\t */\n\tupdateUsedRoutes(usedRoutes: string[]): void;\n}\n\nexport interface ChannelServiceEndpoints {\n\tdeltaConnection: ChannelDeltaConnection;\n\tobjectStorage: ChannelStorageService;\n}\n\nexport function createChannelServiceEndpoints(\n\tconnected: boolean,\n\tsubmitFn: (content: unknown, localOpMetadata: unknown) => void,\n\tdirtyFn: () => void,\n\tisAttachedAndVisible: () => boolean,\n\tstorageService: IRuntimeStorageService,\n\tlogger: ITelemetryLoggerExt,\n\ttree?: ISnapshotTree,\n\textraBlobs?: Map<string, ArrayBufferLike>,\n): ChannelServiceEndpoints {\n\tconst deltaConnection = new ChannelDeltaConnection(\n\t\tconnected,\n\t\t(message, localOpMetadata) => submitFn(message, localOpMetadata),\n\t\tdirtyFn,\n\t\tisAttachedAndVisible,\n\t);\n\tconst objectStorage = new ChannelStorageService(tree, storageService, logger, extraBlobs);\n\n\treturn {\n\t\tdeltaConnection,\n\t\tobjectStorage,\n\t};\n}\n\n/**\n * Used to get the channel's summary for the DDS or DataStore attach op.\n */\nexport function summarizeChannel(\n\tchannel: IChannel,\n\tfullTree: boolean = false,\n\ttrackState: boolean = false,\n\ttelemetryContext?: ITelemetryContext,\n): ISummaryTreeWithStats {\n\tconst summarizeResult = channel.getAttachSummary(fullTree, trackState, telemetryContext);\n\n\t// Add the channel attributes to the returned result.\n\taddBlobToSummary(summarizeResult, attributesBlobKey, JSON.stringify(channel.attributes));\n\treturn summarizeResult;\n}\n\nexport async function summarizeChannelAsync(\n\tchannel: IChannel,\n\tfullTree: boolean = false,\n\ttrackState: boolean = false,\n\ttelemetryContext?: ITelemetryContext,\n\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n): Promise<ISummaryTreeWithStats> {\n\tconst summarizeResult = await channel.summarize(\n\t\tfullTree,\n\t\ttrackState,\n\t\ttelemetryContext,\n\t\tincrementalSummaryContext,\n\t);\n\n\t// Add the channel attributes to the returned result.\n\taddBlobToSummary(summarizeResult, attributesBlobKey, JSON.stringify(channel.attributes));\n\treturn summarizeResult;\n}\n\nexport async function loadChannelFactoryAndAttributes(\n\tdataStoreContext: IFluidDataStoreContext,\n\tservices: ChannelServiceEndpoints,\n\tchannelId: string,\n\tregistry: ISharedObjectRegistry,\n\tattachMessageType?: string,\n): Promise<{ factory: IChannelFactory; attributes: IChannelAttributes }> {\n\tlet attributes: IChannelAttributes | undefined;\n\tif (await services.objectStorage.contains(attributesBlobKey)) {\n\t\tattributes = await readAndParse<IChannelAttributes | undefined>(\n\t\t\tservices.objectStorage,\n\t\t\tattributesBlobKey,\n\t\t);\n\t}\n\n\t// This is a backward compatibility case where the attach message doesn't include attributes. They must\n\t// include attach message type.\n\t// Since old attach messages will not have attributes, we need to keep this as long as we support old attach\n\t// messages.\n\tconst channelFactoryType = attributes ? attributes.type : attachMessageType;\n\tif (channelFactoryType === undefined) {\n\t\tthrow new DataCorruptionError(\n\t\t\t\"channelTypeNotAvailable\",\n\t\t\ttagCodeArtifacts({\n\t\t\t\tchannelId,\n\t\t\t\tdataStoreId: dataStoreContext.id,\n\t\t\t\tdataStorePackagePath: dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\tchannelFactoryType,\n\t\t\t}),\n\t\t);\n\t}\n\tconst factory = registry.get(channelFactoryType);\n\tif (factory === undefined) {\n\t\tthrow new DataCorruptionError(\n\t\t\t\"channelFactoryNotRegisteredForGivenType\",\n\t\t\ttagCodeArtifacts({\n\t\t\t\tchannelId,\n\t\t\t\tdataStoreId: dataStoreContext.id,\n\t\t\t\tdataStorePackagePath: dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\tchannelFactoryType,\n\t\t\t}),\n\t\t);\n\t}\n\t// This is a backward compatibility case where the attach message doesn't include attributes. Get the attributes\n\t// from the factory.\n\tattributes = attributes ?? factory.attributes;\n\treturn { factory, attributes };\n}\n\nexport async function loadChannel(\n\tdataStoreRuntime: IFluidDataStoreRuntime,\n\tattributes: IChannelAttributes,\n\tfactory: IChannelFactory,\n\tservices: ChannelServiceEndpoints,\n\tlogger: ITelemetryLoggerExt,\n\tchannelId: string,\n): Promise<IChannel> {\n\t// Compare snapshot version to collaborative object version\n\tif (\n\t\tattributes.snapshotFormatVersion !== undefined &&\n\t\tattributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion\n\t) {\n\t\tlogger.sendTelemetryEvent({\n\t\t\teventName: \"ChannelAttributesVersionMismatch\",\n\t\t\t...tagCodeArtifacts({\n\t\t\t\tchannelType: attributes.type,\n\t\t\t\tchannelSnapshotVersion: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,\n\t\t\t\tchannelCodeVersion: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,\n\t\t\t}),\n\t\t});\n\t}\n\n\treturn factory.load(dataStoreRuntime, channelId, services, attributes);\n}\n"]}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
6
|
-
import {
|
|
6
|
+
import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import type { IRuntimeStorageService } from "@fluidframework/runtime-definitions/internal";
|
|
7
8
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
8
9
|
export declare class ChannelStorageService implements IChannelStorageService {
|
|
9
10
|
private readonly tree;
|
|
@@ -12,7 +13,7 @@ export declare class ChannelStorageService implements IChannelStorageService {
|
|
|
12
13
|
private readonly extraBlobs?;
|
|
13
14
|
private static flattenTree;
|
|
14
15
|
private readonly flattenedTree;
|
|
15
|
-
constructor(tree: ISnapshotTree | undefined, storage: Pick<
|
|
16
|
+
constructor(tree: ISnapshotTree | undefined, storage: Pick<IRuntimeStorageService, "readBlob">, logger: ITelemetryLoggerExt, extraBlobs?: Map<string, ArrayBufferLike> | undefined);
|
|
16
17
|
contains(path: string): Promise<boolean>;
|
|
17
18
|
readBlob(path: string): Promise<ArrayBufferLike>;
|
|
18
19
|
list(path: string): Promise<string[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelStorageService.d.ts","sourceRoot":"","sources":["../src/channelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,
|
|
1
|
+
{"version":3,"file":"channelStorageService.d.ts","sourceRoot":"","sources":["../src/channelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAE3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,qBAAa,qBAAsB,YAAW,sBAAsB;IAkBlE,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;IApB7B,OAAO,CAAC,MAAM,CAAC,WAAW;IAc1B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA6B;gBAGzC,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,OAAO,EAAE,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,EACjD,MAAM,EAAE,mBAAmB,EAC3B,UAAU,CAAC,0CAA8B;IAS9C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAgBhD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAe3C,eAAe,IAAI,aAAa,GAAG,SAAS;YAIrC,YAAY;CAG1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelStorageService.js","sourceRoot":"","sources":["../src/channelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"channelStorageService.js","sourceRoot":"","sources":["../src/channelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAI7D,OAAO,EAAE,mCAAmC,EAAE,MAAM,wCAAwC,CAAC;AAG7F,MAAM,OAAO,qBAAqB;IACzB,MAAM,CAAC,WAAW,CACzB,IAAY,EACZ,IAAmB,EACnB,OAAmC;QAEnC,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1D,qBAAqB,CAAC,WA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D,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACxC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CACrB,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,yBAAyB,EAAE,EAAE,KAAK,CAAC,CAC3E,CAAC;QAEF,OAAO,KAAK,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,IAAY;QAC7B,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACrB,MAAM,SAAS,GAAG,mCAAmC,CAAC,IAAI,CAAC,CAAC;QAC5D,OAAO,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnD,oEAAoE;YACpE,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAG,CAAC;YAChC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACxC,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;IAEM,eAAe;QACrB,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,IAAY;QACtC,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport type { IRuntimeStorageService } from \"@fluidframework/runtime-definitions/internal\";\nimport { getNormalizedObjectStoragePathParts } from \"@fluidframework/runtime-utils/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nexport class ChannelStorageService implements IChannelStorageService {\n\tprivate static flattenTree(\n\t\tbase: string,\n\t\ttree: ISnapshotTree,\n\t\tresults: { [path: string]: string },\n\t): void {\n\t\tfor (const [path, subtree] of Object.entries(tree.trees)) {\n\t\t\tChannelStorageService.flattenTree(`${base}${path}/`, subtree, results);\n\t\t}\n\n\t\tfor (const [blobName, blobId] of Object.entries(tree.blobs)) {\n\t\t\tresults[`${base}${blobName}`] = blobId;\n\t\t}\n\t}\n\n\tprivate readonly flattenedTree: { [path: string]: string };\n\n\tconstructor(\n\t\tprivate readonly tree: ISnapshotTree | undefined,\n\t\tprivate readonly storage: Pick<IRuntimeStorageService, \"readBlob\">,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly extraBlobs?: Map<string, ArrayBufferLike>,\n\t) {\n\t\tthis.flattenedTree = {};\n\t\t// Create a map from paths to blobs\n\t\tif (tree !== undefined) {\n\t\t\tChannelStorageService.flattenTree(\"\", tree, this.flattenedTree);\n\t\t}\n\t}\n\n\tpublic async contains(path: string): Promise<boolean> {\n\t\treturn this.flattenedTree[path] !== undefined;\n\t}\n\n\tpublic async readBlob(path: string): Promise<ArrayBufferLike> {\n\t\tconst id = await this.getIdForPath(path);\n\t\tassert(id !== undefined, 0x9d7 /* id is undefined in ChannelStorageService.readBlob() */);\n\t\tconst blob = this.extraBlobs === undefined ? undefined : this.extraBlobs.get(id);\n\n\t\tif (blob !== undefined) {\n\t\t\treturn blob;\n\t\t}\n\t\tconst blobP = this.storage.readBlob(id);\n\t\tblobP.catch((error) =>\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"ChannelStorageBlobError\" }, error),\n\t\t);\n\n\t\treturn blobP;\n\t}\n\n\tpublic async list(path: string): Promise<string[]> {\n\t\tlet tree = this.tree;\n\t\tconst pathParts = getNormalizedObjectStoragePathParts(path);\n\t\twhile (tree !== undefined && pathParts.length > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst part = pathParts.shift()!;\n\t\t\ttree = tree.trees[part];\n\t\t}\n\t\tif (tree === undefined || pathParts.length > 0) {\n\t\t\tthrow new Error(\"path does not exist\");\n\t\t}\n\n\t\treturn Object.keys(tree?.blobs ?? {});\n\t}\n\n\tpublic getSnapshotTree(): ISnapshotTree | undefined {\n\t\treturn this.tree;\n\t}\n\n\tprivate async getIdForPath(path: string): Promise<string | undefined> {\n\t\treturn this.flattenedTree[path];\n\t}\n}\n"]}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Lazy } from "@fluidframework/core-utils/internal";
|
|
6
6
|
import { IChannel, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions/internal";
|
|
7
|
-
import {
|
|
8
|
-
import { ITelemetryContext, IFluidDataStoreContext, IGarbageCollectionData, ISummarizeResult, type IPendingMessagesState, type IRuntimeMessageCollection } from "@fluidframework/runtime-definitions/internal";
|
|
7
|
+
import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
8
|
+
import { ITelemetryContext, IFluidDataStoreContext, IGarbageCollectionData, ISummarizeResult, type IPendingMessagesState, type IRuntimeMessageCollection, type IRuntimeStorageService } from "@fluidframework/runtime-definitions/internal";
|
|
9
9
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
10
10
|
import { ChannelServiceEndpoints, IChannelContext } from "./channelContext.js";
|
|
11
11
|
import { ISharedObjectRegistry } from "./dataStoreRuntime.js";
|
|
@@ -69,7 +69,7 @@ export declare abstract class LocalChannelContextBase implements IChannelContext
|
|
|
69
69
|
export declare class RehydratedLocalChannelContext extends LocalChannelContextBase {
|
|
70
70
|
private readonly snapshotTree;
|
|
71
71
|
private readonly dirtyFn;
|
|
72
|
-
constructor(id: string, registry: ISharedObjectRegistry, runtime: IFluidDataStoreRuntime, dataStoreContext: IFluidDataStoreContext, storageService:
|
|
72
|
+
constructor(id: string, registry: ISharedObjectRegistry, runtime: IFluidDataStoreRuntime, dataStoreContext: IFluidDataStoreContext, storageService: IRuntimeStorageService, logger: ITelemetryLoggerExt, submitFn: (content: unknown, localOpMetadata: unknown) => void, dirtyFn: (address: string) => void, snapshotTree: ISnapshotTree, extraBlob?: Map<string, ArrayBufferLike>);
|
|
73
73
|
applyStashedOp(content: unknown): unknown;
|
|
74
74
|
private isSnapshotInOldFormatAndCollectBlobs;
|
|
75
75
|
private sanitizeSnapshot;
|
|
@@ -77,7 +77,7 @@ export declare class RehydratedLocalChannelContext extends LocalChannelContextBa
|
|
|
77
77
|
export declare class LocalChannelContext extends LocalChannelContextBase {
|
|
78
78
|
readonly channel: IChannel;
|
|
79
79
|
private readonly dirtyFn;
|
|
80
|
-
constructor(channel: IChannel, runtime: IFluidDataStoreRuntime, dataStoreContext: IFluidDataStoreContext, storageService:
|
|
80
|
+
constructor(channel: IChannel, runtime: IFluidDataStoreRuntime, dataStoreContext: IFluidDataStoreContext, storageService: IRuntimeStorageService, logger: ITelemetryLoggerExt, submitFn: (content: unknown, localOpMetadata: unknown) => void, dirtyFn: (address: string) => void);
|
|
81
81
|
applyStashedOp(): void;
|
|
82
82
|
}
|
|
83
83
|
//# sourceMappingURL=localChannelContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelContext.d.ts","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAU,IAAI,EAAe,MAAM,qCAAqC,CAAC;AAChF,OAAO,EACN,QAAQ,EACR,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"localChannelContext.d.ts","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OA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;CACD;AAED;;;;;;;;GAQG;AACH,SAAS,iBAAiB,CAAC,IAAmB;IAC7C,MAAM,KAAK,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC/D,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISnapshotTreeWithBlobContents } from \"@fluidframework/container-definitions/internal\";\nimport { assert, Lazy, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tIDocumentStorageService,\n\tISnapshotTree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tITelemetryContext,\n\tIFluidDataStoreContext,\n\tIGarbageCollectionData,\n\tISummarizeResult,\n\ttype IPendingMessagesState,\n\ttype IRuntimeMessageCollection,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tDataProcessingError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tChannelServiceEndpoints,\n\tIChannelContext,\n\tcreateChannelServiceEndpoints,\n\tloadChannel,\n\tloadChannelFactoryAndAttributes,\n\tsummarizeChannel,\n\tsummarizeChannelAsync,\n} from \"./channelContext.js\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime.js\";\n\n/**\n * Channel context for a locally created channel\n */\nexport abstract class LocalChannelContextBase implements IChannelContext {\n\tprivate globallyVisible = false;\n\t/**\n\t * Tracks the messages for this channel that are sent while it's not loaded\n\t */\n\tprotected pendingMessagesState: IPendingMessagesState = {\n\t\tmessageCollections: [],\n\t\tpendingCount: 0,\n\t};\n\tconstructor(\n\t\tprotected readonly id: string,\n\t\tprotected readonly runtime: IFluidDataStoreRuntime,\n\t\tprotected readonly services: Lazy<ChannelServiceEndpoints>,\n\t\tprivate readonly channelP: Promise<IChannel>,\n\t\tprivate _channel?: IChannel,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x30f /* Channel context ID cannot contain slashes */);\n\t}\n\n\tprotected get isGloballyVisible(): boolean {\n\t\treturn this.globallyVisible;\n\t}\n\n\tpublic async getChannel(): Promise<IChannel> {\n\t\tif (this._channel === undefined) {\n\t\t\treturn this.channelP.then((c) => (this._channel = c));\n\t\t}\n\t\treturn this.channelP;\n\t}\n\n\tpublic get isLoaded(): boolean {\n\t\treturn this._channel !== undefined;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string): void {\n\t\t// Connection events are ignored if the data store is not yet globallyVisible or loaded\n\t\tif (this.globallyVisible && this.isLoaded) {\n\t\t\tthis.services.value.deltaConnection.setConnectionState(connected);\n\t\t}\n\t}\n\n\t/**\n\t * Process messages for this channel context. The messages here are contiguous messages for this context in a batch.\n\t * @param messageCollection - The collection of messages to process.\n\t */\n\tprocessMessages(messageCollection: IRuntimeMessageCollection): void {\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2d3 /* \"Local channel must be globally visible when processing op\" */,\n\t\t);\n\n\t\t// A local channel may not be loaded in case where we rehydrate the container from a snapshot because of\n\t\t// delay loading. So after the container is attached and some other client joins which start generating\n\t\t// ops for this channel. So not loaded local channel can still receive ops and we store them to process later.\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.value.deltaConnection.processMessages(messageCollection);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\t!messageCollection.local,\n\t\t\t\t0x189 /* \"Should always be remote because a local dds shouldn't generate ops before loading\" */,\n\t\t\t);\n\t\t\tconst propsCopy = {\n\t\t\t\t...messageCollection,\n\t\t\t\tmessagesContent: [...messageCollection.messagesContent],\n\t\t\t};\n\t\t\tthis.pendingMessagesState.messageCollections.push(propsCopy);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: unknown, localOpMetadata: unknown, squash: boolean): void {\n\t\tassert(this.isLoaded, 0x18a /* \"Channel should be loaded to resubmit ops\" */);\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2d4 /* \"Local channel must be globally visible when resubmitting op\" */,\n\t\t);\n\t\tthis.services.value.deltaConnection.reSubmit(content, localOpMetadata, squash);\n\t}\n\tpublic rollback(content: unknown, localOpMetadata: unknown): void {\n\t\tassert(this.isLoaded, 0x2ee /* \"Channel should be loaded to rollback ops\" */);\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2ef /* \"Local channel must be globally visible when rolling back op\" */,\n\t\t);\n\t\tthis.services.value.deltaConnection.rollback(content, localOpMetadata);\n\t}\n\n\tpublic abstract applyStashedOp(content: unknown): unknown;\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = false,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\tconst channel = await this.getChannel();\n\t\treturn summarizeChannelAsync(channel, fullTree, trackState, telemetryContext);\n\t}\n\n\t/**\n\t * For crafting the DataStore attach op. Only to be called when the channel is loaded (if applicable).\n\t *\n\t * Synchronously generates the channel's attach summary to be joined with the same from the DataStore's other channels\n\t */\n\tpublic getAttachSummary(telemetryContext?: ITelemetryContext): ISummarizeResult {\n\t\tassert(\n\t\t\tthis._channel !== undefined,\n\t\t\t0x18d /* \"Channel should be loaded to take snapshot\" */,\n\t\t);\n\t\treturn summarizeChannel(\n\t\t\tthis._channel,\n\t\t\ttrue /* fullTree */,\n\t\t\tfalse /* trackState */,\n\t\t\ttelemetryContext,\n\t\t);\n\t}\n\n\t/**\n\t * For crafting the DataStore attach op. Only to be called when the channel is loaded (if applicable).\n\t *\n\t * Synchronously generates the channel's attach GC data (set of outbound routes in the initial state)\n\t * to be joined with the same from the DataStore's other channels\n\t */\n\tpublic getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData {\n\t\tassert(\n\t\t\tthis._channel !== undefined,\n\t\t\t0x8fd /* Local Channel should be loaded before being attached */,\n\t\t);\n\n\t\t// We need the GC Data to detect references added in this attach op\n\t\treturn this._channel.getGCData(/* fullGC: */ true);\n\t}\n\n\tpublic makeVisible(): void {\n\t\tif (this.globallyVisible) {\n\t\t\tthrow new Error(\"Channel is already globally visible\");\n\t\t}\n\n\t\tif (this.isLoaded) {\n\t\t\tassert(!!this._channel, 0x192 /* \"Channel should be there if loaded!!\" */);\n\t\t\tthis._channel.connect(this.services.value);\n\t\t}\n\t\tthis.globallyVisible = true;\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n\t * Each node has a set of outbound routes to other GC nodes in the document. This should be called only after\n\t * the context has loaded.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]): void {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected.\n\t\t * Once we have GC at DDS level, this channel context's used routes will be updated as per the passed\n\t\t * value. See - https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t}\n}\n\nexport class RehydratedLocalChannelContext extends LocalChannelContextBase {\n\tprivate readonly dirtyFn: () => void;\n\tconstructor(\n\t\tid: string,\n\t\tregistry: ISharedObjectRegistry,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tsubmitFn: (content: unknown, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\tprivate readonly snapshotTree: ISnapshotTree,\n\t\textraBlob?: Map<string, ArrayBufferLike>,\n\t) {\n\t\tsuper(\n\t\t\tid,\n\t\t\truntime,\n\t\t\tnew Lazy(() => {\n\t\t\t\tconst blobMap: Map<string, ArrayBufferLike> = new Map<string, ArrayBufferLike>(\n\t\t\t\t\textraBlob,\n\t\t\t\t);\n\t\t\t\tconst clonedSnapshotTree = cloneSnapshotTree(this.snapshotTree);\n\t\t\t\t// 0.47 back-compat Need to sanitize if snapshotTree.blobs still contains blob contents too.\n\t\t\t\t// This is for older snapshot which is generated by loader <=0.47 version which still contains\n\t\t\t\t// the contents within blobs. After a couple of revisions we can remove it.\n\t\t\t\tif (this.isSnapshotInOldFormatAndCollectBlobs(clonedSnapshotTree, blobMap)) {\n\t\t\t\t\tthis.sanitizeSnapshot(clonedSnapshotTree);\n\t\t\t\t}\n\t\t\t\treturn createChannelServiceEndpoints(\n\t\t\t\t\tdataStoreContext.connected,\n\t\t\t\t\tsubmitFn,\n\t\t\t\t\tthis.dirtyFn,\n\t\t\t\t\t() => this.isGloballyVisible,\n\t\t\t\t\tstorageService,\n\t\t\t\t\tlogger,\n\t\t\t\t\tclonedSnapshotTree,\n\t\t\t\t\tblobMap,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tnew LazyPromise<IChannel>(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst { attributes, factory } = await loadChannelFactoryAndAttributes(\n\t\t\t\t\t\tdataStoreContext,\n\t\t\t\t\t\tthis.services.value,\n\t\t\t\t\t\tthis.id,\n\t\t\t\t\t\tregistry,\n\t\t\t\t\t);\n\t\t\t\t\tconst channel = await loadChannel(\n\t\t\t\t\t\truntime,\n\t\t\t\t\t\tattributes,\n\t\t\t\t\t\tfactory,\n\t\t\t\t\t\tthis.services.value,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tthis.id,\n\t\t\t\t\t);\n\t\t\t\t\t// Send all pending messages to the channel\n\t\t\t\t\tfor (const messageCollection of this.pendingMessagesState.messageCollections) {\n\t\t\t\t\t\tthis.services.value.deltaConnection.processMessages(messageCollection);\n\t\t\t\t\t}\n\t\t\t\t\treturn channel;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow DataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\t\terror,\n\t\t\t\t\t\t\"rehydratedLocalChannelContextFailedToLoadChannel\",\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\tthis.dirtyFn = () => {\n\t\t\tdirtyFn(id);\n\t\t};\n\t}\n\n\tpublic override applyStashedOp(content: unknown): unknown {\n\t\treturn this.services.value.deltaConnection.applyStashedOp(content);\n\t}\n\n\tprivate isSnapshotInOldFormatAndCollectBlobs(\n\t\tsnapshotTree: ISnapshotTreeWithBlobContents,\n\t\tblobMap: Map<string, ArrayBufferLike>,\n\t): boolean {\n\t\tlet sanitize = false;\n\t\tconst blobsContents = snapshotTree.blobsContents;\n\t\tif (blobsContents !== undefined) {\n\t\t\tfor (const [key, value] of Object.entries(blobsContents)) {\n\t\t\t\tblobMap.set(key, value);\n\t\t\t\tif (snapshotTree.blobs[key] !== undefined) {\n\t\t\t\t\tsanitize = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const value of Object.values(snapshotTree.trees)) {\n\t\t\tsanitize = sanitize || this.isSnapshotInOldFormatAndCollectBlobs(value, blobMap);\n\t\t}\n\t\treturn sanitize;\n\t}\n\n\tprivate sanitizeSnapshot(snapshotTree: ISnapshotTree): void {\n\t\tconst blobMapInitial = new Map(Object.entries(snapshotTree.blobs));\n\t\tfor (const [blobName, blobId] of blobMapInitial.entries()) {\n\t\t\tconst blobValue = blobMapInitial.get(blobId);\n\t\t\tif (blobValue === undefined) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete snapshotTree.blobs[blobName];\n\t\t\t}\n\t\t}\n\t\tfor (const value of Object.values(snapshotTree.trees)) {\n\t\t\tthis.sanitizeSnapshot(value);\n\t\t}\n\t}\n}\n\nexport class LocalChannelContext extends LocalChannelContextBase {\n\tprivate readonly dirtyFn: () => void;\n\tconstructor(\n\t\tpublic readonly channel: IChannel,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tsubmitFn: (content: unknown, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t) {\n\t\tsuper(\n\t\t\tchannel.id,\n\t\t\truntime,\n\t\t\tnew Lazy(() => {\n\t\t\t\treturn createChannelServiceEndpoints(\n\t\t\t\t\tdataStoreContext.connected,\n\t\t\t\t\tsubmitFn,\n\t\t\t\t\tthis.dirtyFn,\n\t\t\t\t\t() => this.isGloballyVisible,\n\t\t\t\t\tstorageService,\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tPromise.resolve(channel),\n\t\t\tchannel,\n\t\t);\n\t\tthis.channel = channel;\n\n\t\tthis.dirtyFn = () => {\n\t\t\tdirtyFn(channel.id);\n\t\t};\n\t}\n\n\tpublic applyStashedOp(): void {\n\t\tthrow new Error(\"no stashed ops on local channel\");\n\t}\n}\n\n/**\n * Deep clones a snapshot tree.\n *\n * TODO: Investigate replacing this with a deep clone utility.\n * This is a temporary solution to avoid issues with lodash deepClone and ungap structuredClone.\n * Using lodash caused a significant bundle size regression. structuredClone cannot be used since\n * it does not support ArrayBuffer data types, and ISnapshotTree can contain blobContents properties,\n * which are ArrayBuffer data types.\n */\nfunction cloneSnapshotTree(tree: ISnapshotTree): ISnapshotTree {\n\tconst clone = { ...tree, blobs: { ...tree.blobs }, trees: {} };\n\tfor (const [k, v] of Object.entries(tree.trees)) {\n\t\tclone.trees[k] = cloneSnapshotTree(v);\n\t}\n\treturn clone;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"localChannelContext.js","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAehF,OAAO,EAEN,mBAAmB,GACnB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAGN,6BAA6B,EAC7B,WAAW,EACX,+BAA+B,EAC/B,gBAAgB,EAChB,qBAAqB,GACrB,MAAM,qBAAqB,CAAC;AAG7B;;GAEG;AACH,MAAM,OAAgB,uBAAuB;IAS5C,YACoB,EAAU,EACV,OAA+B,EAC/B,QAAuC,EACzC,QAA2B,EACpC,QAAmB;QAJR,OAAE,GAAF,EAAE,CAAQ;QACV,YAAO,GAAP,OAAO,CAAwB;QAC/B,aAAQ,GAAR,QAAQ,CAA+B;QACzC,aAAQ,GAAR,QAAQ,CAAmB;QACpC,aAAQ,GAAR,QAAQ,CAAW;QAbpB,oBAAe,GAAG,KAAK,CAAC;QAChC;;WAEG;QACO,yBAAoB,GAA0B;YACvD,kBAAkB,EAAE,EAAE;YACtB,YAAY,EAAE,CAAC;SACf,CAAC;QAQD,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACvF,CAAC;IAED,IAAc,iBAAiB;QAC9B,OAAO,IAAI,CAAC,eAAe,CAAC;IAC7B,CAAC;IAEM,KAAK,CAAC,UAAU;QACtB,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,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M,OAAO,mBAAoB,SAAQ,uBAAuB;IAE/D,YACiB,OAAiB,EACjC,OAA+B,EAC/B,gBAAwC,EACxC,cAAsC,EACtC,MAA2B,EAC3B,QAA8D,EAC9D,OAAkC;QAElC,KAAK,CACJ,OAAO,CAAC,EAAE,EACV,OAAO,EACP,IAAI,IAAI,CAAC,GAAG,EAAE;YACb,OAAO,6BAA6B,CACnC,gBAAgB,CAAC,SAAS,EAC1B,QAAQ,EACR,IAAI,CAAC,OAAO,EACZ,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAC5B,cAAc,EACd,MAAM,CACN,CAAC;QACH,CAAC,CAAC,EACF,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EACxB,OAAO,CACP,CAAC;QAvBc,YAAO,GAAP,OAAO,CAAU;QAwBjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE;YACnB,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC,CAAC;IACH,CAAC;IAEM,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACpD,CAAC;CACD;AAED;;;;;;;;GAQG;AACH,SAAS,iBAAiB,CAAC,IAAmB;IAC7C,MAAM,KAAK,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC/D,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISnapshotTreeWithBlobContents } from \"@fluidframework/container-definitions/internal\";\nimport { assert, Lazy, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tITelemetryContext,\n\tIFluidDataStoreContext,\n\tIGarbageCollectionData,\n\tISummarizeResult,\n\ttype IPendingMessagesState,\n\ttype IRuntimeMessageCollection,\n\ttype IRuntimeStorageService,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tDataProcessingError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tChannelServiceEndpoints,\n\tIChannelContext,\n\tcreateChannelServiceEndpoints,\n\tloadChannel,\n\tloadChannelFactoryAndAttributes,\n\tsummarizeChannel,\n\tsummarizeChannelAsync,\n} from \"./channelContext.js\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime.js\";\n\n/**\n * Channel context for a locally created channel\n */\nexport abstract class LocalChannelContextBase implements IChannelContext {\n\tprivate globallyVisible = false;\n\t/**\n\t * Tracks the messages for this channel that are sent while it's not loaded\n\t */\n\tprotected pendingMessagesState: IPendingMessagesState = {\n\t\tmessageCollections: [],\n\t\tpendingCount: 0,\n\t};\n\tconstructor(\n\t\tprotected readonly id: string,\n\t\tprotected readonly runtime: IFluidDataStoreRuntime,\n\t\tprotected readonly services: Lazy<ChannelServiceEndpoints>,\n\t\tprivate readonly channelP: Promise<IChannel>,\n\t\tprivate _channel?: IChannel,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x30f /* Channel context ID cannot contain slashes */);\n\t}\n\n\tprotected get isGloballyVisible(): boolean {\n\t\treturn this.globallyVisible;\n\t}\n\n\tpublic async getChannel(): Promise<IChannel> {\n\t\tif (this._channel === undefined) {\n\t\t\treturn this.channelP.then((c) => (this._channel = c));\n\t\t}\n\t\treturn this.channelP;\n\t}\n\n\tpublic get isLoaded(): boolean {\n\t\treturn this._channel !== undefined;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string): void {\n\t\t// Connection events are ignored if the data store is not yet globallyVisible or loaded\n\t\tif (this.globallyVisible && this.isLoaded) {\n\t\t\tthis.services.value.deltaConnection.setConnectionState(connected);\n\t\t}\n\t}\n\n\t/**\n\t * Process messages for this channel context. The messages here are contiguous messages for this context in a batch.\n\t * @param messageCollection - The collection of messages to process.\n\t */\n\tprocessMessages(messageCollection: IRuntimeMessageCollection): void {\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2d3 /* \"Local channel must be globally visible when processing op\" */,\n\t\t);\n\n\t\t// A local channel may not be loaded in case where we rehydrate the container from a snapshot because of\n\t\t// delay loading. So after the container is attached and some other client joins which start generating\n\t\t// ops for this channel. So not loaded local channel can still receive ops and we store them to process later.\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.value.deltaConnection.processMessages(messageCollection);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\t!messageCollection.local,\n\t\t\t\t0x189 /* \"Should always be remote because a local dds shouldn't generate ops before loading\" */,\n\t\t\t);\n\t\t\tconst propsCopy = {\n\t\t\t\t...messageCollection,\n\t\t\t\tmessagesContent: [...messageCollection.messagesContent],\n\t\t\t};\n\t\t\tthis.pendingMessagesState.messageCollections.push(propsCopy);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: unknown, localOpMetadata: unknown, squash: boolean): void {\n\t\tassert(this.isLoaded, 0x18a /* \"Channel should be loaded to resubmit ops\" */);\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2d4 /* \"Local channel must be globally visible when resubmitting op\" */,\n\t\t);\n\t\tthis.services.value.deltaConnection.reSubmit(content, localOpMetadata, squash);\n\t}\n\tpublic rollback(content: unknown, localOpMetadata: unknown): void {\n\t\tassert(this.isLoaded, 0x2ee /* \"Channel should be loaded to rollback ops\" */);\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2ef /* \"Local channel must be globally visible when rolling back op\" */,\n\t\t);\n\t\tthis.services.value.deltaConnection.rollback(content, localOpMetadata);\n\t}\n\n\tpublic abstract applyStashedOp(content: unknown): unknown;\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = false,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\tconst channel = await this.getChannel();\n\t\treturn summarizeChannelAsync(channel, fullTree, trackState, telemetryContext);\n\t}\n\n\t/**\n\t * For crafting the DataStore attach op. Only to be called when the channel is loaded (if applicable).\n\t *\n\t * Synchronously generates the channel's attach summary to be joined with the same from the DataStore's other channels\n\t */\n\tpublic getAttachSummary(telemetryContext?: ITelemetryContext): ISummarizeResult {\n\t\tassert(\n\t\t\tthis._channel !== undefined,\n\t\t\t0x18d /* \"Channel should be loaded to take snapshot\" */,\n\t\t);\n\t\treturn summarizeChannel(\n\t\t\tthis._channel,\n\t\t\ttrue /* fullTree */,\n\t\t\tfalse /* trackState */,\n\t\t\ttelemetryContext,\n\t\t);\n\t}\n\n\t/**\n\t * For crafting the DataStore attach op. Only to be called when the channel is loaded (if applicable).\n\t *\n\t * Synchronously generates the channel's attach GC data (set of outbound routes in the initial state)\n\t * to be joined with the same from the DataStore's other channels\n\t */\n\tpublic getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData {\n\t\tassert(\n\t\t\tthis._channel !== undefined,\n\t\t\t0x8fd /* Local Channel should be loaded before being attached */,\n\t\t);\n\n\t\t// We need the GC Data to detect references added in this attach op\n\t\treturn this._channel.getGCData(/* fullGC: */ true);\n\t}\n\n\tpublic makeVisible(): void {\n\t\tif (this.globallyVisible) {\n\t\t\tthrow new Error(\"Channel is already globally visible\");\n\t\t}\n\n\t\tif (this.isLoaded) {\n\t\t\tassert(!!this._channel, 0x192 /* \"Channel should be there if loaded!!\" */);\n\t\t\tthis._channel.connect(this.services.value);\n\t\t}\n\t\tthis.globallyVisible = true;\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n\t * Each node has a set of outbound routes to other GC nodes in the document. This should be called only after\n\t * the context has loaded.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]): void {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected.\n\t\t * Once we have GC at DDS level, this channel context's used routes will be updated as per the passed\n\t\t * value. See - https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t}\n}\n\nexport class RehydratedLocalChannelContext extends LocalChannelContextBase {\n\tprivate readonly dirtyFn: () => void;\n\tconstructor(\n\t\tid: string,\n\t\tregistry: ISharedObjectRegistry,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IRuntimeStorageService,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tsubmitFn: (content: unknown, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\tprivate readonly snapshotTree: ISnapshotTree,\n\t\textraBlob?: Map<string, ArrayBufferLike>,\n\t) {\n\t\tsuper(\n\t\t\tid,\n\t\t\truntime,\n\t\t\tnew Lazy(() => {\n\t\t\t\tconst blobMap: Map<string, ArrayBufferLike> = new Map<string, ArrayBufferLike>(\n\t\t\t\t\textraBlob,\n\t\t\t\t);\n\t\t\t\tconst clonedSnapshotTree = cloneSnapshotTree(this.snapshotTree);\n\t\t\t\t// 0.47 back-compat Need to sanitize if snapshotTree.blobs still contains blob contents too.\n\t\t\t\t// This is for older snapshot which is generated by loader <=0.47 version which still contains\n\t\t\t\t// the contents within blobs. After a couple of revisions we can remove it.\n\t\t\t\tif (this.isSnapshotInOldFormatAndCollectBlobs(clonedSnapshotTree, blobMap)) {\n\t\t\t\t\tthis.sanitizeSnapshot(clonedSnapshotTree);\n\t\t\t\t}\n\t\t\t\treturn createChannelServiceEndpoints(\n\t\t\t\t\tdataStoreContext.connected,\n\t\t\t\t\tsubmitFn,\n\t\t\t\t\tthis.dirtyFn,\n\t\t\t\t\t() => this.isGloballyVisible,\n\t\t\t\t\tstorageService,\n\t\t\t\t\tlogger,\n\t\t\t\t\tclonedSnapshotTree,\n\t\t\t\t\tblobMap,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tnew LazyPromise<IChannel>(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst { attributes, factory } = await loadChannelFactoryAndAttributes(\n\t\t\t\t\t\tdataStoreContext,\n\t\t\t\t\t\tthis.services.value,\n\t\t\t\t\t\tthis.id,\n\t\t\t\t\t\tregistry,\n\t\t\t\t\t);\n\t\t\t\t\tconst channel = await loadChannel(\n\t\t\t\t\t\truntime,\n\t\t\t\t\t\tattributes,\n\t\t\t\t\t\tfactory,\n\t\t\t\t\t\tthis.services.value,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tthis.id,\n\t\t\t\t\t);\n\t\t\t\t\t// Send all pending messages to the channel\n\t\t\t\t\tfor (const messageCollection of this.pendingMessagesState.messageCollections) {\n\t\t\t\t\t\tthis.services.value.deltaConnection.processMessages(messageCollection);\n\t\t\t\t\t}\n\t\t\t\t\treturn channel;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow DataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\t\terror,\n\t\t\t\t\t\t\"rehydratedLocalChannelContextFailedToLoadChannel\",\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\tthis.dirtyFn = () => {\n\t\t\tdirtyFn(id);\n\t\t};\n\t}\n\n\tpublic override applyStashedOp(content: unknown): unknown {\n\t\treturn this.services.value.deltaConnection.applyStashedOp(content);\n\t}\n\n\tprivate isSnapshotInOldFormatAndCollectBlobs(\n\t\tsnapshotTree: ISnapshotTreeWithBlobContents,\n\t\tblobMap: Map<string, ArrayBufferLike>,\n\t): boolean {\n\t\tlet sanitize = false;\n\t\tconst blobsContents = snapshotTree.blobsContents;\n\t\tif (blobsContents !== undefined) {\n\t\t\tfor (const [key, value] of Object.entries(blobsContents)) {\n\t\t\t\tblobMap.set(key, value);\n\t\t\t\tif (snapshotTree.blobs[key] !== undefined) {\n\t\t\t\t\tsanitize = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const value of Object.values(snapshotTree.trees)) {\n\t\t\tsanitize = sanitize || this.isSnapshotInOldFormatAndCollectBlobs(value, blobMap);\n\t\t}\n\t\treturn sanitize;\n\t}\n\n\tprivate sanitizeSnapshot(snapshotTree: ISnapshotTree): void {\n\t\tconst blobMapInitial = new Map(Object.entries(snapshotTree.blobs));\n\t\tfor (const [blobName, blobId] of blobMapInitial.entries()) {\n\t\t\tconst blobValue = blobMapInitial.get(blobId);\n\t\t\tif (blobValue === undefined) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete snapshotTree.blobs[blobName];\n\t\t\t}\n\t\t}\n\t\tfor (const value of Object.values(snapshotTree.trees)) {\n\t\t\tthis.sanitizeSnapshot(value);\n\t\t}\n\t}\n}\n\nexport class LocalChannelContext extends LocalChannelContextBase {\n\tprivate readonly dirtyFn: () => void;\n\tconstructor(\n\t\tpublic readonly channel: IChannel,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IRuntimeStorageService,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tsubmitFn: (content: unknown, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t) {\n\t\tsuper(\n\t\t\tchannel.id,\n\t\t\truntime,\n\t\t\tnew Lazy(() => {\n\t\t\t\treturn createChannelServiceEndpoints(\n\t\t\t\t\tdataStoreContext.connected,\n\t\t\t\t\tsubmitFn,\n\t\t\t\t\tthis.dirtyFn,\n\t\t\t\t\t() => this.isGloballyVisible,\n\t\t\t\t\tstorageService,\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tPromise.resolve(channel),\n\t\t\tchannel,\n\t\t);\n\t\tthis.channel = channel;\n\n\t\tthis.dirtyFn = () => {\n\t\t\tdirtyFn(channel.id);\n\t\t};\n\t}\n\n\tpublic applyStashedOp(): void {\n\t\tthrow new Error(\"no stashed ops on local channel\");\n\t}\n}\n\n/**\n * Deep clones a snapshot tree.\n *\n * TODO: Investigate replacing this with a deep clone utility.\n * This is a temporary solution to avoid issues with lodash deepClone and ungap structuredClone.\n * Using lodash caused a significant bundle size regression. structuredClone cannot be used since\n * it does not support ArrayBuffer data types, and ISnapshotTree can contain blobContents properties,\n * which are ArrayBuffer data types.\n */\nfunction cloneSnapshotTree(tree: ISnapshotTree): ISnapshotTree {\n\tconst clone = { ...tree, blobs: { ...tree.blobs }, trees: {} };\n\tfor (const [k, v] of Object.entries(tree.trees)) {\n\t\tclone.trees[k] = cloneSnapshotTree(v);\n\t}\n\treturn clone;\n}\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/datastore\";\nexport const pkgVersion = \"2.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/datastore\";\nexport const pkgVersion = \"2.52.0\";\n"]}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IChannel, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions/internal";
|
|
6
|
-
import {
|
|
7
|
-
import { ITelemetryContext, IGarbageCollectionData, CreateChildSummarizerNodeFn, IFluidDataStoreContext, ISummarizeResult, type IRuntimeMessageCollection } from "@fluidframework/runtime-definitions/internal";
|
|
6
|
+
import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import { ITelemetryContext, IGarbageCollectionData, CreateChildSummarizerNodeFn, IFluidDataStoreContext, ISummarizeResult, type IRuntimeMessageCollection, type IRuntimeStorageService } from "@fluidframework/runtime-definitions/internal";
|
|
8
8
|
import { IChannelContext } from "./channelContext.js";
|
|
9
9
|
import { ISharedObjectRegistry } from "./dataStoreRuntime.js";
|
|
10
10
|
export declare class RemoteChannelContext implements IChannelContext {
|
|
@@ -21,7 +21,7 @@ export declare class RemoteChannelContext implements IChannelContext {
|
|
|
21
21
|
private readonly subLogger;
|
|
22
22
|
private readonly thresholdOpsCounter;
|
|
23
23
|
private static readonly pendingOpsCountThreshold;
|
|
24
|
-
constructor(runtime: IFluidDataStoreRuntime, dataStoreContext: IFluidDataStoreContext, storageService:
|
|
24
|
+
constructor(runtime: IFluidDataStoreRuntime, dataStoreContext: IFluidDataStoreContext, storageService: IRuntimeStorageService, submitFn: (content: unknown, localOpMetadata: unknown) => void, dirtyFn: (address: string) => void, id: string, baseSnapshot: ISnapshotTree, registry: ISharedObjectRegistry, extraBlobs: Map<string, ArrayBufferLike> | undefined, createSummarizerNode: CreateChildSummarizerNodeFn, attachMessageType?: string);
|
|
25
25
|
getChannel(): Promise<IChannel>;
|
|
26
26
|
setConnectionState(connected: boolean, clientId?: string): void;
|
|
27
27
|
applyStashedOp(content: unknown): unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteChannelContext.d.ts","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,QAAQ,EACR,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"remoteChannelContext.d.ts","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,QAAQ,EACR,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAEN,iBAAiB,EACjB,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EAEtB,gBAAgB,EAGhB,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,MAAM,8CAA8C,CAAC;AAOtD,OAAO,EAEN,eAAe,EAKf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,qBAAa,oBAAqB,YAAW,eAAe;IAuB1D,OAAO,CAAC,QAAQ,CAAC,EAAE;IAtBpB,OAAO,CAAC,QAAQ,CAAS;IACzB;;OAEG;IACH,OAAO,CAAC,oBAAoB,CAG1B;IACF,OAAO,CAAC,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,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,gBAAgB,CAAC;YAId,iBAAiB;IAiB/B;;;;;;OAMG;IACU,SAAS,CAAC,MAAM,GAAE,OAAe,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAIhF;;;;OAIG;YACW,iBAAiB;IAKxB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI;CASnD"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { AttachState } from "@fluidframework/container-definitions";
|
|
5
|
+
import { AttachState } from "@fluidframework/container-definitions/internal";
|
|
6
6
|
import { assert, LazyPromise } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { ThresholdCounter, createChildLogger, } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
import { createChannelServiceEndpoints, loadChannel, loadChannelFactoryAndAttributes, summarizeChannelAsync, } from "./channelContext.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteChannelContext.js","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAqB1E,OAAO,EAEN,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAGN,6BAA6B,EAC7B,WAAW,EACX,+BAA+B,EAC/B,qBAAqB,GACrB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,OAAO,oBAAoB;IAiBhC,YACC,OAA+B,EAC/B,gBAAwC,EACxC,cAAuC,EACvC,QAA8D,EAC9D,OAAkC,EACjB,EAAU,EAC3B,YAA2B,EAC3B,QAA+B,EAC/B,UAAoD,EACpD,oBAAiD,EACjD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CAAC;;AAvNuB,6CAAwB,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { assert, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tIDocumentStorageService,\n\tISnapshotTree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIExperimentalIncrementalSummaryContext,\n\tITelemetryContext,\n\tIGarbageCollectionData,\n\tCreateChildSummarizerNodeFn,\n\tIFluidDataStoreContext,\n\tISummarizeInternalResult,\n\tISummarizeResult,\n\tISummarizerNodeWithGC,\n\ttype IPendingMessagesState,\n\ttype IRuntimeMessageCollection,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tThresholdCounter,\n\tcreateChildLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tChannelServiceEndpoints,\n\tIChannelContext,\n\tcreateChannelServiceEndpoints,\n\tloadChannel,\n\tloadChannelFactoryAndAttributes,\n\tsummarizeChannelAsync,\n} from \"./channelContext.js\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime.js\";\n\nexport class RemoteChannelContext implements IChannelContext {\n\tprivate isLoaded = false;\n\t/**\n\t * Tracks the messages for this channel that are sent while it's not loaded\n\t */\n\tprivate pendingMessagesState: IPendingMessagesState | undefined = {\n\t\tmessageCollections: [],\n\t\tpendingCount: 0,\n\t};\n\tprivate readonly channelP: Promise<IChannel>;\n\tprivate channel: IChannel | undefined;\n\tprivate readonly services: ChannelServiceEndpoints;\n\tprivate readonly summarizerNode: ISummarizerNodeWithGC;\n\tprivate readonly subLogger: ITelemetryLoggerExt;\n\tprivate readonly thresholdOpsCounter: ThresholdCounter;\n\tprivate static readonly pendingOpsCountThreshold = 1000;\n\n\tconstructor(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tsubmitFn: (content: unknown, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\tprivate readonly id: string,\n\t\tbaseSnapshot: ISnapshotTree,\n\t\tregistry: ISharedObjectRegistry,\n\t\textraBlobs: Map<string, ArrayBufferLike> | undefined,\n\t\tcreateSummarizerNode: CreateChildSummarizerNodeFn,\n\t\tattachMessageType?: string,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x310 /* Channel context ID cannot contain slashes */);\n\n\t\tthis.subLogger = createChildLogger({\n\t\t\tlogger: runtime.logger,\n\t\t\tnamespace: \"RemoteChannelContext\",\n\t\t});\n\n\t\tthis.services = createChannelServiceEndpoints(\n\t\t\tdataStoreContext.connected,\n\t\t\tsubmitFn,\n\t\t\t() => dirtyFn(this.id),\n\t\t\t() => runtime.attachState !== AttachState.Detached,\n\t\t\tstorageService,\n\t\t\tthis.subLogger,\n\t\t\tbaseSnapshot,\n\t\t\textraBlobs,\n\t\t);\n\n\t\tthis.channelP = new LazyPromise<IChannel>(async () => {\n\t\t\tconst { attributes, factory } = await loadChannelFactoryAndAttributes(\n\t\t\t\tdataStoreContext,\n\t\t\t\tthis.services,\n\t\t\t\tthis.id,\n\t\t\t\tregistry,\n\t\t\t\tattachMessageType,\n\t\t\t);\n\n\t\t\tconst channel = await loadChannel(\n\t\t\t\truntime,\n\t\t\t\tattributes,\n\t\t\t\tfactory,\n\t\t\t\tthis.services,\n\t\t\t\tthis.subLogger,\n\t\t\t\tthis.id,\n\t\t\t);\n\n\t\t\tassert(\n\t\t\t\tthis.pendingMessagesState !== undefined,\n\t\t\t\t0xa6c /* pending messages state is undefined */,\n\t\t\t);\n\t\t\tfor (const messageCollection of this.pendingMessagesState.messageCollections) {\n\t\t\t\tthis.services.deltaConnection.processMessages(messageCollection);\n\t\t\t}\n\t\t\tthis.thresholdOpsCounter.send(\n\t\t\t\t\"ProcessPendingOps\",\n\t\t\t\tthis.pendingMessagesState.pendingCount,\n\t\t\t);\n\n\t\t\t// Commit changes.\n\t\t\tthis.channel = channel;\n\t\t\tthis.pendingMessagesState = undefined;\n\t\t\tthis.isLoaded = true;\n\n\t\t\t// Because have some await between we created the service and here, the connection state might have changed\n\t\t\t// and we don't propagate the connection state when we are not loaded. So we have to set it again here.\n\t\t\tthis.services.deltaConnection.setConnectionState(dataStoreContext.connected);\n\t\t\treturn this.channel;\n\t\t});\n\n\t\tthis.summarizerNode = createSummarizerNode(\n\t\t\tasync (\n\t\t\t\tfullTree,\n\t\t\t\ttrackState,\n\t\t\t\ttelemetryContext,\n\t\t\t\tincrementalSummaryContext,\n\t\t\t): Promise<ISummarizeInternalResult> =>\n\t\t\t\tthis.summarizeInternal(\n\t\t\t\t\tfullTree,\n\t\t\t\t\ttrackState,\n\t\t\t\t\ttelemetryContext,\n\t\t\t\t\tincrementalSummaryContext,\n\t\t\t\t),\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t);\n\n\t\tthis.thresholdOpsCounter = new ThresholdCounter(\n\t\t\tRemoteChannelContext.pendingOpsCountThreshold,\n\t\t\tthis.subLogger,\n\t\t);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tpublic getChannel(): Promise<IChannel> {\n\t\treturn this.channelP;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string): void {\n\t\t// Connection events are ignored if the data store is not yet loaded\n\t\tif (!this.isLoaded) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.services.deltaConnection.setConnectionState(connected);\n\t}\n\n\tpublic applyStashedOp(content: unknown): unknown {\n\t\tassert(this.isLoaded, 0x194 /* \"Remote channel must be loaded when rebasing op\" */);\n\t\treturn this.services.deltaConnection.applyStashedOp(content);\n\t}\n\n\t/**\n\t * Process messages for this channel context. The messages here are contiguous messages for this context in a batch.\n\t * @param messageCollection - The collection of messages to process.\n\t */\n\tpublic processMessages(messageCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, messagesContent, local } = messageCollection;\n\t\tthis.summarizerNode.invalidate(envelope.sequenceNumber);\n\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.deltaConnection.processMessages(messageCollection);\n\t\t} else {\n\t\t\tassert(!local, 0x195 /* \"Remote channel must not be local when processing op\" */);\n\t\t\tassert(\n\t\t\t\tthis.pendingMessagesState !== undefined,\n\t\t\t\t0xa6d /* pending messages queue is undefined */,\n\t\t\t);\n\t\t\tthis.pendingMessagesState.messageCollections.push({\n\t\t\t\t...messageCollection,\n\t\t\t\tmessagesContent: [...messagesContent],\n\t\t\t});\n\t\t\tthis.pendingMessagesState.pendingCount += messagesContent.length;\n\t\t\tthis.thresholdOpsCounter.sendIfMultiple(\n\t\t\t\t\"StorePendingOps\",\n\t\t\t\tthis.pendingMessagesState.pendingCount,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: unknown, localOpMetadata: unknown, squash: boolean): void {\n\t\tassert(this.isLoaded, 0x196 /* \"Remote channel must be loaded when resubmitting op\" */);\n\n\t\tthis.services.deltaConnection.reSubmit(content, localOpMetadata, squash);\n\t}\n\n\tpublic rollback(content: unknown, localOpMetadata: unknown): void {\n\t\tassert(this.isLoaded, 0x2f0 /* \"Remote channel must be loaded when rolling back op\" */);\n\n\t\tthis.services.deltaConnection.rollback(content, localOpMetadata);\n\t}\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\treturn this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n\t}\n\n\tprivate async summarizeInternal(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): Promise<ISummarizeInternalResult> {\n\t\tconst channel = await this.getChannel();\n\t\tconst summarizeResult = await summarizeChannelAsync(\n\t\t\tchannel,\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\t\treturn { ...summarizeResult, id: this.id };\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n\t * Each node has a set of outbound routes to other GC nodes in the document.\n\t * If there is no new data in this context since the last summary, previous GC data is used.\n\t * If there is new data, the GC data is generated again (by calling getGCDataInternal).\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\treturn this.summarizerNode.getGCData(fullGC);\n\t}\n\n\t/**\n\t * Generates the data used for garbage collection. This is called when there is new data since last summary. It\n\t * loads the context and calls into the channel to get its GC data.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tprivate async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]): void {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's\n\t\t * used routes to contain a route to this channel context.\n\t\t * Once we have GC at DDS level, this will be updated to use the passed usedRoutes. See -\n\t\t * https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t\tthis.summarizerNode.updateUsedRoutes([\"\"]);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"remoteChannelContext.js","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gDAAgD,CA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CAAC,SAAkB,KAAK;QAC7C,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,iBAAiB,CAAC,SAAkB,KAAK;QACtD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAEM,gBAAgB,CAAC,UAAoB;QAC3C;;;;;WAKG;QACH,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;;AAvNuB,6CAAwB,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions/internal\";\nimport { assert, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIExperimentalIncrementalSummaryContext,\n\tITelemetryContext,\n\tIGarbageCollectionData,\n\tCreateChildSummarizerNodeFn,\n\tIFluidDataStoreContext,\n\tISummarizeInternalResult,\n\tISummarizeResult,\n\tISummarizerNodeWithGC,\n\ttype IPendingMessagesState,\n\ttype IRuntimeMessageCollection,\n\ttype IRuntimeStorageService,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tThresholdCounter,\n\tcreateChildLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tChannelServiceEndpoints,\n\tIChannelContext,\n\tcreateChannelServiceEndpoints,\n\tloadChannel,\n\tloadChannelFactoryAndAttributes,\n\tsummarizeChannelAsync,\n} from \"./channelContext.js\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime.js\";\n\nexport class RemoteChannelContext implements IChannelContext {\n\tprivate isLoaded = false;\n\t/**\n\t * Tracks the messages for this channel that are sent while it's not loaded\n\t */\n\tprivate pendingMessagesState: IPendingMessagesState | undefined = {\n\t\tmessageCollections: [],\n\t\tpendingCount: 0,\n\t};\n\tprivate readonly channelP: Promise<IChannel>;\n\tprivate channel: IChannel | undefined;\n\tprivate readonly services: ChannelServiceEndpoints;\n\tprivate readonly summarizerNode: ISummarizerNodeWithGC;\n\tprivate readonly subLogger: ITelemetryLoggerExt;\n\tprivate readonly thresholdOpsCounter: ThresholdCounter;\n\tprivate static readonly pendingOpsCountThreshold = 1000;\n\n\tconstructor(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IRuntimeStorageService,\n\t\tsubmitFn: (content: unknown, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\tprivate readonly id: string,\n\t\tbaseSnapshot: ISnapshotTree,\n\t\tregistry: ISharedObjectRegistry,\n\t\textraBlobs: Map<string, ArrayBufferLike> | undefined,\n\t\tcreateSummarizerNode: CreateChildSummarizerNodeFn,\n\t\tattachMessageType?: string,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x310 /* Channel context ID cannot contain slashes */);\n\n\t\tthis.subLogger = createChildLogger({\n\t\t\tlogger: runtime.logger,\n\t\t\tnamespace: \"RemoteChannelContext\",\n\t\t});\n\n\t\tthis.services = createChannelServiceEndpoints(\n\t\t\tdataStoreContext.connected,\n\t\t\tsubmitFn,\n\t\t\t() => dirtyFn(this.id),\n\t\t\t() => runtime.attachState !== AttachState.Detached,\n\t\t\tstorageService,\n\t\t\tthis.subLogger,\n\t\t\tbaseSnapshot,\n\t\t\textraBlobs,\n\t\t);\n\n\t\tthis.channelP = new LazyPromise<IChannel>(async () => {\n\t\t\tconst { attributes, factory } = await loadChannelFactoryAndAttributes(\n\t\t\t\tdataStoreContext,\n\t\t\t\tthis.services,\n\t\t\t\tthis.id,\n\t\t\t\tregistry,\n\t\t\t\tattachMessageType,\n\t\t\t);\n\n\t\t\tconst channel = await loadChannel(\n\t\t\t\truntime,\n\t\t\t\tattributes,\n\t\t\t\tfactory,\n\t\t\t\tthis.services,\n\t\t\t\tthis.subLogger,\n\t\t\t\tthis.id,\n\t\t\t);\n\n\t\t\tassert(\n\t\t\t\tthis.pendingMessagesState !== undefined,\n\t\t\t\t0xa6c /* pending messages state is undefined */,\n\t\t\t);\n\t\t\tfor (const messageCollection of this.pendingMessagesState.messageCollections) {\n\t\t\t\tthis.services.deltaConnection.processMessages(messageCollection);\n\t\t\t}\n\t\t\tthis.thresholdOpsCounter.send(\n\t\t\t\t\"ProcessPendingOps\",\n\t\t\t\tthis.pendingMessagesState.pendingCount,\n\t\t\t);\n\n\t\t\t// Commit changes.\n\t\t\tthis.channel = channel;\n\t\t\tthis.pendingMessagesState = undefined;\n\t\t\tthis.isLoaded = true;\n\n\t\t\t// Because have some await between we created the service and here, the connection state might have changed\n\t\t\t// and we don't propagate the connection state when we are not loaded. So we have to set it again here.\n\t\t\tthis.services.deltaConnection.setConnectionState(dataStoreContext.connected);\n\t\t\treturn this.channel;\n\t\t});\n\n\t\tthis.summarizerNode = createSummarizerNode(\n\t\t\tasync (\n\t\t\t\tfullTree,\n\t\t\t\ttrackState,\n\t\t\t\ttelemetryContext,\n\t\t\t\tincrementalSummaryContext,\n\t\t\t): Promise<ISummarizeInternalResult> =>\n\t\t\t\tthis.summarizeInternal(\n\t\t\t\t\tfullTree,\n\t\t\t\t\ttrackState,\n\t\t\t\t\ttelemetryContext,\n\t\t\t\t\tincrementalSummaryContext,\n\t\t\t\t),\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t);\n\n\t\tthis.thresholdOpsCounter = new ThresholdCounter(\n\t\t\tRemoteChannelContext.pendingOpsCountThreshold,\n\t\t\tthis.subLogger,\n\t\t);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tpublic getChannel(): Promise<IChannel> {\n\t\treturn this.channelP;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string): void {\n\t\t// Connection events are ignored if the data store is not yet loaded\n\t\tif (!this.isLoaded) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.services.deltaConnection.setConnectionState(connected);\n\t}\n\n\tpublic applyStashedOp(content: unknown): unknown {\n\t\tassert(this.isLoaded, 0x194 /* \"Remote channel must be loaded when rebasing op\" */);\n\t\treturn this.services.deltaConnection.applyStashedOp(content);\n\t}\n\n\t/**\n\t * Process messages for this channel context. The messages here are contiguous messages for this context in a batch.\n\t * @param messageCollection - The collection of messages to process.\n\t */\n\tpublic processMessages(messageCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, messagesContent, local } = messageCollection;\n\t\tthis.summarizerNode.invalidate(envelope.sequenceNumber);\n\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.deltaConnection.processMessages(messageCollection);\n\t\t} else {\n\t\t\tassert(!local, 0x195 /* \"Remote channel must not be local when processing op\" */);\n\t\t\tassert(\n\t\t\t\tthis.pendingMessagesState !== undefined,\n\t\t\t\t0xa6d /* pending messages queue is undefined */,\n\t\t\t);\n\t\t\tthis.pendingMessagesState.messageCollections.push({\n\t\t\t\t...messageCollection,\n\t\t\t\tmessagesContent: [...messagesContent],\n\t\t\t});\n\t\t\tthis.pendingMessagesState.pendingCount += messagesContent.length;\n\t\t\tthis.thresholdOpsCounter.sendIfMultiple(\n\t\t\t\t\"StorePendingOps\",\n\t\t\t\tthis.pendingMessagesState.pendingCount,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: unknown, localOpMetadata: unknown, squash: boolean): void {\n\t\tassert(this.isLoaded, 0x196 /* \"Remote channel must be loaded when resubmitting op\" */);\n\n\t\tthis.services.deltaConnection.reSubmit(content, localOpMetadata, squash);\n\t}\n\n\tpublic rollback(content: unknown, localOpMetadata: unknown): void {\n\t\tassert(this.isLoaded, 0x2f0 /* \"Remote channel must be loaded when rolling back op\" */);\n\n\t\tthis.services.deltaConnection.rollback(content, localOpMetadata);\n\t}\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\treturn this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n\t}\n\n\tprivate async summarizeInternal(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): Promise<ISummarizeInternalResult> {\n\t\tconst channel = await this.getChannel();\n\t\tconst summarizeResult = await summarizeChannelAsync(\n\t\t\tchannel,\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\t\treturn { ...summarizeResult, id: this.id };\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n\t * Each node has a set of outbound routes to other GC nodes in the document.\n\t * If there is no new data in this context since the last summary, previous GC data is used.\n\t * If there is new data, the GC data is generated again (by calling getGCDataInternal).\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\treturn this.summarizerNode.getGCData(fullGC);\n\t}\n\n\t/**\n\t * Generates the data used for garbage collection. This is called when there is new data since last summary. It\n\t * loads the context and calls into the channel to get its GC data.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tprivate async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]): void {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's\n\t\t * used routes to contain a route to this channel context.\n\t\t * Once we have GC at DDS level, this will be updated to use the passed usedRoutes. See -\n\t\t * https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t\tthis.summarizerNode.updateUsedRoutes([\"\"]);\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/datastore",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.52.0",
|
|
4
4
|
"description": "Fluid data store implementation",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,29 +69,29 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluid-internal/client-utils": "~2.
|
|
73
|
-
"@fluidframework/container-definitions": "~2.
|
|
74
|
-
"@fluidframework/core-interfaces": "~2.
|
|
75
|
-
"@fluidframework/core-utils": "~2.
|
|
76
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
77
|
-
"@fluidframework/driver-definitions": "~2.
|
|
78
|
-
"@fluidframework/driver-utils": "~2.
|
|
79
|
-
"@fluidframework/id-compressor": "~2.
|
|
80
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
81
|
-
"@fluidframework/runtime-utils": "~2.
|
|
82
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
72
|
+
"@fluid-internal/client-utils": "~2.52.0",
|
|
73
|
+
"@fluidframework/container-definitions": "~2.52.0",
|
|
74
|
+
"@fluidframework/core-interfaces": "~2.52.0",
|
|
75
|
+
"@fluidframework/core-utils": "~2.52.0",
|
|
76
|
+
"@fluidframework/datastore-definitions": "~2.52.0",
|
|
77
|
+
"@fluidframework/driver-definitions": "~2.52.0",
|
|
78
|
+
"@fluidframework/driver-utils": "~2.52.0",
|
|
79
|
+
"@fluidframework/id-compressor": "~2.52.0",
|
|
80
|
+
"@fluidframework/runtime-definitions": "~2.52.0",
|
|
81
|
+
"@fluidframework/runtime-utils": "~2.52.0",
|
|
82
|
+
"@fluidframework/telemetry-utils": "~2.52.0",
|
|
83
83
|
"uuid": "^11.1.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
87
87
|
"@biomejs/biome": "~1.9.3",
|
|
88
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
89
|
-
"@fluid-tools/build-cli": "^0.
|
|
88
|
+
"@fluid-internal/mocha-test-setup": "~2.52.0",
|
|
89
|
+
"@fluid-tools/build-cli": "^0.57.0",
|
|
90
90
|
"@fluidframework/build-common": "^2.0.3",
|
|
91
|
-
"@fluidframework/build-tools": "^0.
|
|
92
|
-
"@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.
|
|
91
|
+
"@fluidframework/build-tools": "^0.57.0",
|
|
92
|
+
"@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.51.0",
|
|
93
93
|
"@fluidframework/eslint-config-fluid": "^5.7.4",
|
|
94
|
-
"@fluidframework/test-runtime-utils": "~2.
|
|
94
|
+
"@fluidframework/test-runtime-utils": "~2.52.0",
|
|
95
95
|
"@microsoft/api-extractor": "7.52.8",
|
|
96
96
|
"@types/lodash": "^4.14.118",
|
|
97
97
|
"@types/mocha": "^10.0.10",
|
package/src/channelContext.ts
CHANGED
|
@@ -9,10 +9,7 @@ import {
|
|
|
9
9
|
IChannelFactory,
|
|
10
10
|
IFluidDataStoreRuntime,
|
|
11
11
|
} from "@fluidframework/datastore-definitions/internal";
|
|
12
|
-
import {
|
|
13
|
-
IDocumentStorageService,
|
|
14
|
-
ISnapshotTree,
|
|
15
|
-
} from "@fluidframework/driver-definitions/internal";
|
|
12
|
+
import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
16
13
|
import { readAndParse } from "@fluidframework/driver-utils/internal";
|
|
17
14
|
import {
|
|
18
15
|
IExperimentalIncrementalSummaryContext,
|
|
@@ -22,6 +19,7 @@ import {
|
|
|
22
19
|
IFluidDataStoreContext,
|
|
23
20
|
ISummarizeResult,
|
|
24
21
|
type IRuntimeMessageCollection,
|
|
22
|
+
type IRuntimeStorageService,
|
|
25
23
|
} from "@fluidframework/runtime-definitions/internal";
|
|
26
24
|
import { addBlobToSummary } from "@fluidframework/runtime-utils/internal";
|
|
27
25
|
import {
|
|
@@ -85,7 +83,7 @@ export function createChannelServiceEndpoints(
|
|
|
85
83
|
submitFn: (content: unknown, localOpMetadata: unknown) => void,
|
|
86
84
|
dirtyFn: () => void,
|
|
87
85
|
isAttachedAndVisible: () => boolean,
|
|
88
|
-
storageService:
|
|
86
|
+
storageService: IRuntimeStorageService,
|
|
89
87
|
logger: ITelemetryLoggerExt,
|
|
90
88
|
tree?: ISnapshotTree,
|
|
91
89
|
extraBlobs?: Map<string, ArrayBufferLike>,
|
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
ISnapshotTree,
|
|
11
|
-
} from "@fluidframework/driver-definitions/internal";
|
|
8
|
+
import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
9
|
+
import type { IRuntimeStorageService } from "@fluidframework/runtime-definitions/internal";
|
|
12
10
|
import { getNormalizedObjectStoragePathParts } from "@fluidframework/runtime-utils/internal";
|
|
13
11
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
14
12
|
|
|
@@ -31,7 +29,7 @@ export class ChannelStorageService implements IChannelStorageService {
|
|
|
31
29
|
|
|
32
30
|
constructor(
|
|
33
31
|
private readonly tree: ISnapshotTree | undefined,
|
|
34
|
-
private readonly storage: Pick<
|
|
32
|
+
private readonly storage: Pick<IRuntimeStorageService, "readBlob">,
|
|
35
33
|
private readonly logger: ITelemetryLoggerExt,
|
|
36
34
|
private readonly extraBlobs?: Map<string, ArrayBufferLike>,
|
|
37
35
|
) {
|
|
@@ -9,10 +9,7 @@ import {
|
|
|
9
9
|
IChannel,
|
|
10
10
|
IFluidDataStoreRuntime,
|
|
11
11
|
} from "@fluidframework/datastore-definitions/internal";
|
|
12
|
-
import {
|
|
13
|
-
IDocumentStorageService,
|
|
14
|
-
ISnapshotTree,
|
|
15
|
-
} from "@fluidframework/driver-definitions/internal";
|
|
12
|
+
import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
16
13
|
import {
|
|
17
14
|
ITelemetryContext,
|
|
18
15
|
IFluidDataStoreContext,
|
|
@@ -20,6 +17,7 @@ import {
|
|
|
20
17
|
ISummarizeResult,
|
|
21
18
|
type IPendingMessagesState,
|
|
22
19
|
type IRuntimeMessageCollection,
|
|
20
|
+
type IRuntimeStorageService,
|
|
23
21
|
} from "@fluidframework/runtime-definitions/internal";
|
|
24
22
|
import {
|
|
25
23
|
ITelemetryLoggerExt,
|
|
@@ -216,7 +214,7 @@ export class RehydratedLocalChannelContext extends LocalChannelContextBase {
|
|
|
216
214
|
registry: ISharedObjectRegistry,
|
|
217
215
|
runtime: IFluidDataStoreRuntime,
|
|
218
216
|
dataStoreContext: IFluidDataStoreContext,
|
|
219
|
-
storageService:
|
|
217
|
+
storageService: IRuntimeStorageService,
|
|
220
218
|
logger: ITelemetryLoggerExt,
|
|
221
219
|
submitFn: (content: unknown, localOpMetadata: unknown) => void,
|
|
222
220
|
dirtyFn: (address: string) => void,
|
|
@@ -329,7 +327,7 @@ export class LocalChannelContext extends LocalChannelContextBase {
|
|
|
329
327
|
public readonly channel: IChannel,
|
|
330
328
|
runtime: IFluidDataStoreRuntime,
|
|
331
329
|
dataStoreContext: IFluidDataStoreContext,
|
|
332
|
-
storageService:
|
|
330
|
+
storageService: IRuntimeStorageService,
|
|
333
331
|
logger: ITelemetryLoggerExt,
|
|
334
332
|
submitFn: (content: unknown, localOpMetadata: unknown) => void,
|
|
335
333
|
dirtyFn: (address: string) => void,
|
package/src/packageVersion.ts
CHANGED
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { AttachState } from "@fluidframework/container-definitions";
|
|
6
|
+
import { AttachState } from "@fluidframework/container-definitions/internal";
|
|
7
7
|
import { assert, LazyPromise } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import {
|
|
9
9
|
IChannel,
|
|
10
10
|
IFluidDataStoreRuntime,
|
|
11
11
|
} from "@fluidframework/datastore-definitions/internal";
|
|
12
|
-
import {
|
|
13
|
-
IDocumentStorageService,
|
|
14
|
-
ISnapshotTree,
|
|
15
|
-
} from "@fluidframework/driver-definitions/internal";
|
|
12
|
+
import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
16
13
|
import {
|
|
17
14
|
IExperimentalIncrementalSummaryContext,
|
|
18
15
|
ITelemetryContext,
|
|
@@ -24,6 +21,7 @@ import {
|
|
|
24
21
|
ISummarizerNodeWithGC,
|
|
25
22
|
type IPendingMessagesState,
|
|
26
23
|
type IRuntimeMessageCollection,
|
|
24
|
+
type IRuntimeStorageService,
|
|
27
25
|
} from "@fluidframework/runtime-definitions/internal";
|
|
28
26
|
import {
|
|
29
27
|
ITelemetryLoggerExt,
|
|
@@ -61,7 +59,7 @@ export class RemoteChannelContext implements IChannelContext {
|
|
|
61
59
|
constructor(
|
|
62
60
|
runtime: IFluidDataStoreRuntime,
|
|
63
61
|
dataStoreContext: IFluidDataStoreContext,
|
|
64
|
-
storageService:
|
|
62
|
+
storageService: IRuntimeStorageService,
|
|
65
63
|
submitFn: (content: unknown, localOpMetadata: unknown) => void,
|
|
66
64
|
dirtyFn: (address: string) => void,
|
|
67
65
|
private readonly id: string,
|