@fluidframework/datastore 2.0.0-internal.5.4.2 → 2.0.0-internal.6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/channelContext.js +9 -6
- package/dist/channelContext.js.map +1 -1
- package/dist/channelStorageService.js +1 -2
- package/dist/channelStorageService.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts +6 -1
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +31 -49
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/remoteChannelContext.js +1 -1
- package/dist/remoteChannelContext.js.map +1 -1
- package/lib/channelContext.js +9 -6
- package/lib/channelContext.js.map +1 -1
- package/lib/channelStorageService.js +1 -2
- package/lib/channelStorageService.js.map +1 -1
- package/lib/dataStoreRuntime.d.ts +6 -1
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +31 -49
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/remoteChannelContext.js +1 -1
- package/lib/remoteChannelContext.js.map +1 -1
- package/package.json +16 -16
- package/src/dataStoreRuntime.ts +13 -35
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @fluidframework/datastore
|
|
2
2
|
|
|
3
|
+
## 2.0.0-internal.6.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Request APIs deprecated from many places [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
8
|
+
|
|
9
|
+
The `request` API (associated with the `IFluidRouter` interface) has been deprecated on a number of classes and interfaces. The following are impacted:
|
|
10
|
+
|
|
11
|
+
- `IRuntime` and `ContainerRuntime`
|
|
12
|
+
- `IFluidDataStoreRuntime` and `FluidDataStoreRuntime`
|
|
13
|
+
- `IFluidDataStoreChannel`
|
|
14
|
+
- `MockFluidDataStoreRuntime`
|
|
15
|
+
- `TestFluidObject`
|
|
16
|
+
|
|
17
|
+
Please migrate usage to the corresponding `entryPoint` or `getEntryPoint()` of the object. The value for these "entryPoint" related APIs is determined from factories (for `IRuntime` and `IFluidDataStoreRuntime`) via the `initializeEntryPoint` method. If no method is passed to the factory, the corresponding `entryPoint` and `getEntryPoint()` will be undefined.
|
|
18
|
+
|
|
19
|
+
For an example implementation of `initializeEntryPoint`, see [pureDataObjectFactory.ts](https://github.com/microsoft/FluidFramework/blob/next/packages/framework/aqueduct/src/data-object-factories/pureDataObjectFactory.ts#L84).
|
|
20
|
+
|
|
21
|
+
More information of the migration off the request pattern, and current status of its removal, is documented in [Removing-IFluidRouter.md](https://github.com/microsoft/FluidFramework/blob/main/packages/common/core-interfaces/Removing-IFluidRouter.md).
|
|
22
|
+
|
|
23
|
+
- `initializeEntryPoint` will become required [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
24
|
+
|
|
25
|
+
The optional `initializeEntryPoint` method has been added to a number of constructors. **This method argument will become required in an upcoming release** and a value will need to be provided to the following classes:
|
|
26
|
+
|
|
27
|
+
- `BaseContainerRuntimeFactory`
|
|
28
|
+
- `ContainerRuntimeFactoryWithDefaultDataStore`
|
|
29
|
+
- `RuntimeFactory`
|
|
30
|
+
- `ContainerRuntime` (constructor and `loadRuntime`)
|
|
31
|
+
- `FluidDataStoreRuntime`
|
|
32
|
+
|
|
33
|
+
For an example implementation of `initializeEntryPoint`, see [pureDataObjectFactory.ts](https://github.com/microsoft/FluidFramework/blob/main/packages/framework/aqueduct/src/data-object-factories/pureDataObjectFactory.ts#L84).
|
|
34
|
+
|
|
35
|
+
This work will replace the request pattern. See [Removing-IFluidRouter.md](https://github.com/microsoft/FluidFramework/blob/main/packages/common/core-interfaces/Removing-IFluidRouter.md) for more info on this effort.
|
|
36
|
+
|
|
37
|
+
- FluidDataStoreRuntime.getChannel throws for channels that do not exist [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
38
|
+
|
|
39
|
+
Previously, calling `FluidDataStoreRuntime.getChannel(id)` for a channel that does not exist would wait for the channel to be created (possibly waiting indefinitely if never created). However, there is no safe means to dynamically create a channel in this manner without risking data corruption. The call will instead now throw for non-existent channels.
|
|
40
|
+
|
|
41
|
+
- Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
42
|
+
|
|
43
|
+
Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
|
|
44
|
+
|
|
45
|
+
- IDeltaManager members disposed and dispose() removed [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
46
|
+
|
|
47
|
+
IDeltaManager members disposed and dispose() were deprecated in 2.0.0-internal.5.3.0 and have now been removed.
|
|
48
|
+
|
|
3
49
|
## 2.0.0-internal.5.4.0
|
|
4
50
|
|
|
5
51
|
Dependency updates only.
|
package/dist/channelContext.js
CHANGED
|
@@ -64,7 +64,7 @@ async function loadChannelFactoryAndAttributes(dataStoreContext, services, chann
|
|
|
64
64
|
}
|
|
65
65
|
// This is a backward compatibility case where the attach message doesn't include attributes. Get the attributes
|
|
66
66
|
// from the factory.
|
|
67
|
-
attributes = attributes
|
|
67
|
+
attributes = attributes ?? factory.attributes;
|
|
68
68
|
return { factory, attributes };
|
|
69
69
|
}
|
|
70
70
|
exports.loadChannelFactoryAndAttributes = loadChannelFactoryAndAttributes;
|
|
@@ -72,11 +72,14 @@ async function loadChannel(dataStoreRuntime, attributes, factory, services, logg
|
|
|
72
72
|
// Compare snapshot version to collaborative object version
|
|
73
73
|
if (attributes.snapshotFormatVersion !== undefined &&
|
|
74
74
|
attributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion) {
|
|
75
|
-
logger.sendTelemetryEvent(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
logger.sendTelemetryEvent({
|
|
76
|
+
eventName: "ChannelAttributesVersionMismatch",
|
|
77
|
+
...(0, telemetry_utils_1.tagCodeArtifacts)({
|
|
78
|
+
channelType: attributes.type,
|
|
79
|
+
channelSnapshotVersion: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,
|
|
80
|
+
channelCodeVersion: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,
|
|
81
|
+
}),
|
|
82
|
+
});
|
|
80
83
|
}
|
|
81
84
|
return factory.load(dataStoreRuntime, channelId, services, attributes);
|
|
82
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelContext.js","sourceRoot":"","sources":["../src/channelContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAAwF;AAkBxF,iEAAiE;AACjE,qEAAsE;AACtE,+DAA4D;AAC5D,mEAAgE;AAChE,qEAAkE;AAGrD,QAAA,iBAAiB,GAAG,aAAa,CAAC;AA0C/C,SAAgB,6BAA6B,CAC5C,SAAkB,EAClB,QAA0D,EAC1D,OAAmB,EACnB,0BAA2F,EAC3F,cAAuC,EACvC,MAA2B,EAC3B,IAAoB,EACpB,UAAyC;IAEzC,MAAM,eAAe,GAAG,IAAI,+CAAsB,CACjD,SAAS,EACT,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,EAChE,OAAO,EACP,0BAA0B,CAC1B,CAAC;IACF,MAAM,aAAa,GAAG,IAAI,6CAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;IAE1F,OA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AU,CAAC,qBAAqB,IAAI,UAAU,CAAC,cAAc,EAAE;YAC1F,kBAAkB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,qBAAqB,IAAI,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE;SACtG,CAAC,EACD,CAAC;KACH;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AACxE,CAAC;AAxBD,kCAwBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt, tagCodeArtifacts } from \"@fluidframework/telemetry-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n\tIChannel,\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIGarbageCollectionData,\n\tIExperimentalIncrementalSummaryContext,\n\tISummarizeResult,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tIFluidDataStoreContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { addBlobToSummary } from \"@fluidframework/runtime-utils\";\nimport { DataCorruptionError } from \"@fluidframework/container-utils\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { ChannelStorageService } from \"./channelStorageService\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\n\nexport const attributesBlobKey = \".attributes\";\n\nexport interface IChannelContext {\n\tgetChannel(): Promise<IChannel>;\n\n\tsetConnectionState(connected: boolean, clientId?: string);\n\n\tprocessOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata?: unknown): void;\n\n\tsummarize(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult>;\n\n\treSubmit(content: any, localOpMetadata: unknown): void;\n\n\tapplyStashedOp(content: any): unknown;\n\n\trollback(message: any, 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: any, localOpMetadata: unknown) => void,\n\tdirtyFn: () => void,\n\taddedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\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\taddedGCOutboundReferenceFn,\n\t);\n\tconst objectStorage = new ChannelStorageService(tree, storageService, logger, extraBlobs);\n\n\treturn {\n\t\tdeltaConnection,\n\t\tobjectStorage,\n\t};\n}\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;;;AAEH,qEAAwF;AAkBxF,iEAAiE;AACjE,qEAAsE;AACtE,+DAA4D;AAC5D,mEAAgE;AAChE,qEAAkE;AAGrD,QAAA,iBAAiB,GAAG,aAAa,CAAC;AA0C/C,SAAgB,6BAA6B,CAC5C,SAAkB,EAClB,QAA0D,EAC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B,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;QACD,MAAM,CAAC,kBAAkB,CAAC;YACzB,SAAS,EAAE,kCAAkC;YAC7C,GAAG,IAAA,kCAAgB,EAAC;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;KACH;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AACxE,CAAC;AAxBD,kCAwBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt, tagCodeArtifacts } from \"@fluidframework/telemetry-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n\tIChannel,\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIGarbageCollectionData,\n\tIExperimentalIncrementalSummaryContext,\n\tISummarizeResult,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tIFluidDataStoreContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { addBlobToSummary } from \"@fluidframework/runtime-utils\";\nimport { DataCorruptionError } from \"@fluidframework/container-utils\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { ChannelStorageService } from \"./channelStorageService\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\n\nexport const attributesBlobKey = \".attributes\";\n\nexport interface IChannelContext {\n\tgetChannel(): Promise<IChannel>;\n\n\tsetConnectionState(connected: boolean, clientId?: string);\n\n\tprocessOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata?: unknown): void;\n\n\tsummarize(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult>;\n\n\treSubmit(content: any, localOpMetadata: unknown): void;\n\n\tapplyStashedOp(content: any): unknown;\n\n\trollback(message: any, 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: any, localOpMetadata: unknown) => void,\n\tdirtyFn: () => void,\n\taddedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\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\taddedGCOutboundReferenceFn,\n\t);\n\tconst objectStorage = new ChannelStorageService(tree, storageService, logger, extraBlobs);\n\n\treturn {\n\t\tdeltaConnection,\n\t\tobjectStorage,\n\t};\n}\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"]}
|
|
@@ -42,7 +42,6 @@ class ChannelStorageService {
|
|
|
42
42
|
return blobP;
|
|
43
43
|
}
|
|
44
44
|
async list(path) {
|
|
45
|
-
var _a;
|
|
46
45
|
let tree = this.tree;
|
|
47
46
|
const pathParts = (0, runtime_utils_1.getNormalizedObjectStoragePathParts)(path);
|
|
48
47
|
while (tree !== undefined && pathParts.length > 0) {
|
|
@@ -53,7 +52,7 @@ class ChannelStorageService {
|
|
|
53
52
|
if (tree === undefined || pathParts.length !== 0) {
|
|
54
53
|
throw new Error("path does not exist");
|
|
55
54
|
}
|
|
56
|
-
return Object.keys(
|
|
55
|
+
return Object.keys(tree?.blobs ?? {});
|
|
57
56
|
}
|
|
58
57
|
async getIdForPath(path) {
|
|
59
58
|
return this.flattenedTree[path];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelStorageService.js","sourceRoot":"","sources":["../src/channelStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,iEAAoF;AAGpF,MAAa,qBAAqB;IAmBjC,YACkB,IAA+B,EAC/B,OAAkD,EAClD,MAA2B,EAC3B,UAAyC;QAHzC,SAAI,GAAJ,IAAI,CAA2B;QAC/B,YAAO,GAAP,OAAO,CAA2C;QAClD,WAAM,GAAN,MAAM,CAAqB;QAC3B,eAAU,GAAV,UAAU,CAA+B;QAE1D,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,mCAAmC;QACnC,IAAI,IAAI,KAAK,SAAS,EAAE;YACvB,qBAAqB,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;SAChE;IACF,CAAC;IA7BO,MAAM,CAAC,WAAW,CACzB,IAAY,EACZ,IAAmB,EACnB,OAAmC;QAEnC,8DAA8D;QAC9D,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KA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I,IAAI,KAAK,SAAS,EAAE;YACvB,OAAO,IAAI,CAAC;SACZ;QACD,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,IAAA,mDAAmC,EAAC,IAAI,CAAC,CAAC;QAC5D,OAAO,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YAClD,oEAAoE;YACpE,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAG,CAAC;YAChC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACxB;QACD,IAAI,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YACjD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;SACvC;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,IAAY;QACtC,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;CACD;AArED,sDAqEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { IChannelStorageService } from \"@fluidframework/datastore-definitions\";\nimport { getNormalizedObjectStoragePathParts } from \"@fluidframework/runtime-utils\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\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) {\n\t\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\t\tfor (const path in tree.trees) {\n\t\t\tChannelStorageService.flattenTree(`${base}${path}/`, tree.trees[path], results);\n\t\t}\n\n\t\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\t\tfor (const blob in tree.blobs) {\n\t\t\tresults[`${base}${blob}`] = tree.blobs[blob];\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<IDocumentStorageService, \"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\tconst blob = this.extraBlobs !== undefined ? this.extraBlobs.get(id) : undefined;\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\tprivate async getIdForPath(path: string): Promise<string> {\n\t\treturn this.flattenedTree[path];\n\t}\n}\n"]}
|
|
@@ -35,6 +35,9 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
35
35
|
* {@inheritDoc @fluidframework/datastore-definitions#IFluidDataStoreRuntime.entryPoint}
|
|
36
36
|
*/
|
|
37
37
|
readonly entryPoint?: IFluidHandle<FluidObject>;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
40
|
+
*/
|
|
38
41
|
get IFluidRouter(): this;
|
|
39
42
|
get connected(): boolean;
|
|
40
43
|
get clientId(): string | undefined;
|
|
@@ -51,7 +54,6 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
51
54
|
private _disposed;
|
|
52
55
|
get disposed(): boolean;
|
|
53
56
|
private readonly contexts;
|
|
54
|
-
private readonly contextsDeferred;
|
|
55
57
|
private readonly pendingAttach;
|
|
56
58
|
private readonly deferredAttached;
|
|
57
59
|
private readonly localChannelContextQueue;
|
|
@@ -95,6 +97,9 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
95
97
|
constructor(dataStoreContext: IFluidDataStoreContext, sharedObjectRegistry: ISharedObjectRegistry, existing: boolean, initializeEntryPoint?: (runtime: IFluidDataStoreRuntime) => Promise<FluidObject>);
|
|
96
98
|
dispose(): void;
|
|
97
99
|
resolveHandle(request: IRequest): Promise<IResponse>;
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
102
|
+
*/
|
|
98
103
|
request(request: IRequest): Promise<IResponse>;
|
|
99
104
|
getChannel(id: string): Promise<IChannel>;
|
|
100
105
|
createChannel(id: string | undefined, type: string): IChannel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EAOnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACd,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAoB,iBAAiB,EAAmB,MAAM,8BAA8B,CAAC;AAEpG,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EAIzB,cAAc,EACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAIN,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,MAAM,qCAAqC,CAAC;AAc7C,OAAO,EACN,QAAQ,EACR,sBAAsB,EACtB,4BAA4B,EAC5B,eAAe,EACf,MAAM,uCAAuC,CAAC;AAW/C,oBAAY,oBAAoB;IAE/B,MAAM,WAAW;IACjB,SAAS,OAAO;CAChB;AAED,MAAM,WAAW,qBAAqB;IAGrC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;CAC/C;AAED;;GAEG;AACH,qBAAa,qBACZ,SAAQ,iBAAiB,CAAC,4BAA4B,CACtD,YAAW,sBAAsB,EAAE,sBAAsB,EAAE,mBA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IG;IACH,OAAO,CAAC,+BAA+B;CAwBvC;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,6BACL,QAAQ,WAAW,qBAAqB,KAAK,QAAQ,SAAS,CAAC,SACnF,4BAA4B,iCAUD,CAAC;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,sBAErB,qBAAqB,KAC1B,QAAQ;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAC,SACvD,4BAA4B,iCAkCD,CAAC"}
|
package/dist/dataStoreRuntime.js
CHANGED
|
@@ -41,13 +41,11 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
41
41
|
* and the primary way of interacting with some Fluid objects, and should be used if possible.
|
|
42
42
|
*/
|
|
43
43
|
constructor(dataStoreContext, sharedObjectRegistry, existing, initializeEntryPoint) {
|
|
44
|
-
var _a;
|
|
45
44
|
super();
|
|
46
45
|
this.dataStoreContext = dataStoreContext;
|
|
47
46
|
this.sharedObjectRegistry = sharedObjectRegistry;
|
|
48
47
|
this._disposed = false;
|
|
49
48
|
this.contexts = new Map();
|
|
50
|
-
this.contextsDeferred = new Map();
|
|
51
49
|
this.pendingAttach = new Map();
|
|
52
50
|
this.deferredAttached = new common_utils_1.Deferred();
|
|
53
51
|
this.localChannelContextQueue = new Map();
|
|
@@ -70,7 +68,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
70
68
|
this.audience = dataStoreContext.getAudience();
|
|
71
69
|
const tree = dataStoreContext.baseSnapshot;
|
|
72
70
|
// Must always receive the data store type inside of the attributes
|
|
73
|
-
if (
|
|
71
|
+
if (tree?.trees !== undefined) {
|
|
74
72
|
Object.keys(tree.trees).forEach((path) => {
|
|
75
73
|
// Issue #4414
|
|
76
74
|
if (path === "_search") {
|
|
@@ -98,10 +96,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
98
96
|
type: runtime_definitions_1.CreateSummarizerNodeSource.FromSummary,
|
|
99
97
|
}));
|
|
100
98
|
}
|
|
101
|
-
const deferred = new common_utils_1.Deferred();
|
|
102
|
-
deferred.resolve(channelContext);
|
|
103
99
|
this.contexts.set(path, channelContext);
|
|
104
|
-
this.contextsDeferred.set(path, deferred);
|
|
105
100
|
});
|
|
106
101
|
}
|
|
107
102
|
if (initializeEntryPoint) {
|
|
@@ -135,7 +130,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
135
130
|
}
|
|
136
131
|
// By default, a data store can log maximum 10 local changes telemetry in summarizer.
|
|
137
132
|
this.localChangesTelemetryCount =
|
|
138
|
-
|
|
133
|
+
this.mc.config.getNumber("Fluid.Telemetry.LocalChangesTelemetryCount") ?? 10;
|
|
139
134
|
}
|
|
140
135
|
/**
|
|
141
136
|
* @deprecated - Instantiate the class using its constructor instead.
|
|
@@ -148,6 +143,9 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
148
143
|
static load(context, sharedObjectRegistry, existing) {
|
|
149
144
|
return new FluidDataStoreRuntime(context, sharedObjectRegistry, existing, async (dataStoreRuntime) => (0, runtime_utils_1.requestFluidObject)(dataStoreRuntime, "/"));
|
|
150
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
148
|
+
*/
|
|
151
149
|
get IFluidRouter() {
|
|
152
150
|
return this;
|
|
153
151
|
}
|
|
@@ -218,6 +216,9 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
218
216
|
async resolveHandle(request) {
|
|
219
217
|
return this.request(request);
|
|
220
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
221
|
+
*/
|
|
221
222
|
async request(request) {
|
|
222
223
|
try {
|
|
223
224
|
const parser = runtime_utils_1.RequestParser.create(request);
|
|
@@ -226,11 +227,10 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
226
227
|
return this.request(parser.createSubRequest(1));
|
|
227
228
|
}
|
|
228
229
|
// Check for a data type reference first
|
|
229
|
-
|
|
230
|
+
const context = this.contexts.get(id);
|
|
231
|
+
if (context !== undefined && parser.isLeaf(1)) {
|
|
230
232
|
try {
|
|
231
|
-
|
|
232
|
-
const value = await this.contextsDeferred.get(id).promise;
|
|
233
|
-
const channel = await value.getChannel();
|
|
233
|
+
const channel = await context.getChannel();
|
|
234
234
|
return { mimeType: "fluid/object", status: 200, value: channel };
|
|
235
235
|
}
|
|
236
236
|
catch (error) {
|
|
@@ -247,16 +247,11 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
247
247
|
}
|
|
248
248
|
async getChannel(id) {
|
|
249
249
|
this.verifyNotClosed();
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
if (!this.contextsDeferred.has(id)) {
|
|
254
|
-
this.contextsDeferred.set(id, new common_utils_1.Deferred());
|
|
250
|
+
const context = this.contexts.get(id);
|
|
251
|
+
if (context === undefined) {
|
|
252
|
+
throw new telemetry_utils_1.LoggingError("Channel does not exist");
|
|
255
253
|
}
|
|
256
|
-
|
|
257
|
-
const context = await this.contextsDeferred.get(id).promise;
|
|
258
|
-
const channel = await context.getChannel();
|
|
259
|
-
return channel;
|
|
254
|
+
return context.getChannel();
|
|
260
255
|
}
|
|
261
256
|
createChannel(id = (0, uuid_1.v4)(), type) {
|
|
262
257
|
if (id.includes("/")) {
|
|
@@ -267,15 +262,6 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
267
262
|
this.notBoundedChannelContextSet.add(id);
|
|
268
263
|
const context = new localChannelContext_1.LocalChannelContext(id, this.sharedObjectRegistry, type, this, this.dataStoreContext, this.dataStoreContext.storage, this.logger, (content, localOpMetadata) => this.submitChannelOp(id, content, localOpMetadata), (address) => this.setChannelDirty(address), (srcHandle, outboundHandle) => this.addedGCOutboundReference(srcHandle, outboundHandle));
|
|
269
264
|
this.contexts.set(id, context);
|
|
270
|
-
if (this.contextsDeferred.has(id)) {
|
|
271
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
272
|
-
this.contextsDeferred.get(id).resolve(context);
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
const deferred = new common_utils_1.Deferred();
|
|
276
|
-
deferred.resolve(context);
|
|
277
|
-
this.contextsDeferred.set(id, deferred);
|
|
278
|
-
}
|
|
279
265
|
// Channels (DDS) should not be created in summarizer client.
|
|
280
266
|
this.identifyLocalChangeInSummarizer("DDSCreatedInSummarizer", id, type);
|
|
281
267
|
return context.channel;
|
|
@@ -393,15 +379,6 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
393
379
|
snapshot: attachMessage.snapshot,
|
|
394
380
|
}), attachMessage.type);
|
|
395
381
|
this.contexts.set(id, remoteChannelContext);
|
|
396
|
-
if (this.contextsDeferred.has(id)) {
|
|
397
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
398
|
-
this.contextsDeferred.get(id).resolve(remoteChannelContext);
|
|
399
|
-
}
|
|
400
|
-
else {
|
|
401
|
-
const deferred = new common_utils_1.Deferred();
|
|
402
|
-
deferred.resolve(remoteChannelContext);
|
|
403
|
-
this.contextsDeferred.set(id, deferred);
|
|
404
|
-
}
|
|
405
382
|
}
|
|
406
383
|
break;
|
|
407
384
|
}
|
|
@@ -495,7 +472,6 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
495
472
|
* @param usedRoutes - The routes that are used in all contexts in this channel.
|
|
496
473
|
*/
|
|
497
474
|
updateUsedRoutes(usedRoutes) {
|
|
498
|
-
var _a;
|
|
499
475
|
// Get a map of channel ids to routes used in it.
|
|
500
476
|
const usedContextRoutes = (0, runtime_utils_1.unpackChildNodesUsedRoutes)(usedRoutes);
|
|
501
477
|
// Verify that the used routes are correct.
|
|
@@ -504,7 +480,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
504
480
|
}
|
|
505
481
|
// Update the used routes in each context. Used routes is empty for unused context.
|
|
506
482
|
for (const [contextId, context] of this.contexts) {
|
|
507
|
-
context.updateUsedRoutes(
|
|
483
|
+
context.updateUsedRoutes(usedContextRoutes.get(contextId) ?? []);
|
|
508
484
|
}
|
|
509
485
|
}
|
|
510
486
|
/**
|
|
@@ -514,8 +490,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
514
490
|
* @param outboundHandle - The handle of the outbound node that is referenced.
|
|
515
491
|
*/
|
|
516
492
|
addedGCOutboundReference(srcHandle, outboundHandle) {
|
|
517
|
-
|
|
518
|
-
(_b = (_a = this.dataStoreContext).addedGCOutboundReference) === null || _b === void 0 ? void 0 : _b.call(_a, srcHandle, outboundHandle);
|
|
493
|
+
this.dataStoreContext.addedGCOutboundReference?.(srcHandle, outboundHandle);
|
|
519
494
|
}
|
|
520
495
|
/**
|
|
521
496
|
* Returns a summary at the current sequence number.
|
|
@@ -690,7 +665,10 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
690
665
|
processChannelOp(message, local, localOpMetadata) {
|
|
691
666
|
this.verifyNotClosed();
|
|
692
667
|
const envelope = message.contents;
|
|
693
|
-
const transformed =
|
|
668
|
+
const transformed = {
|
|
669
|
+
...message,
|
|
670
|
+
contents: envelope.contents,
|
|
671
|
+
};
|
|
694
672
|
const channelContext = this.contexts.get(envelope.address);
|
|
695
673
|
(0, common_utils_1.assert)(!!channelContext, 0x185 /* "Channel not found" */);
|
|
696
674
|
channelContext.processOp(transformed, local, localOpMetadata);
|
|
@@ -744,12 +722,16 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
744
722
|
// Log a telemetry if there are local changes in the summarizer. This will give us data on how often
|
|
745
723
|
// this is happening and which data stores do this. The eventual goal is to disallow local changes
|
|
746
724
|
// in the summarizer and the data will help us plan this.
|
|
747
|
-
this.mc.logger.sendTelemetryEvent(
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
725
|
+
this.mc.logger.sendTelemetryEvent({
|
|
726
|
+
eventName,
|
|
727
|
+
...(0, telemetry_utils_1.tagCodeArtifacts)({
|
|
728
|
+
channelType,
|
|
729
|
+
channelId,
|
|
730
|
+
fluidDataStoreId: this.id,
|
|
731
|
+
fluidDataStorePackagePath: this.dataStoreContext.packagePath.join("/"),
|
|
732
|
+
}),
|
|
733
|
+
stack: (0, telemetry_utils_1.generateStack)(),
|
|
734
|
+
});
|
|
753
735
|
this.localChangesTelemetryCount--;
|
|
754
736
|
}
|
|
755
737
|
}
|