@fluidframework/datastore 2.0.0-internal.5.3.2 → 2.0.0-internal.6.0.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 +50 -0
- package/dist/channelContext.d.ts.map +1 -1
- package/dist/channelContext.js +15 -32
- 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 +7 -2
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +36 -58
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/remoteChannelContext.js +5 -2
- package/dist/remoteChannelContext.js.map +1 -1
- package/lib/channelContext.d.ts.map +1 -1
- package/lib/channelContext.js +16 -33
- 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 +7 -2
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +38 -60
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/remoteChannelContext.d.ts.map +1 -1
- package/lib/remoteChannelContext.js +6 -3
- package/lib/remoteChannelContext.js.map +1 -1
- package/package.json +22 -18
- package/src/channelContext.ts +24 -35
- package/src/dataStoreRuntime.ts +32 -57
- package/src/remoteChannelContext.ts +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
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
|
+
|
|
49
|
+
## 2.0.0-internal.5.4.0
|
|
50
|
+
|
|
51
|
+
Dependency updates only.
|
|
52
|
+
|
|
3
53
|
## 2.0.0-internal.5.3.0
|
|
4
54
|
|
|
5
55
|
Dependency updates only.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelContext.d.ts","sourceRoot":"","sources":["../src/channelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAA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AC,qBAAqB,CAAC,CAWhC;AAED,wBAAsB,+BAA+B,CACpD,gBAAgB,EAAE,sBAAsB,EACxC,QAAQ,EAAE,uBAAuB,EACjC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,qBAAqB,EAC/B,iBAAiB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC;IAAE,OAAO,EAAE,eAAe,CAAC;IAAC,UAAU,EAAE,kBAAkB,CAAA;CAAE,CAAC,CAyCvE;AAED,wBAAsB,WAAW,CAChC,gBAAgB,EAAE,sBAAsB,EACxC,UAAU,EAAE,kBAAkB,EAC9B,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,uBAAuB,EACjC,MAAM,EAAE,mBAAmB,EAC3B,SAAS,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CAiBnB"}
|
package/dist/channelContext.js
CHANGED
|
@@ -46,38 +46,25 @@ async function loadChannelFactoryAndAttributes(dataStoreContext, services, chann
|
|
|
46
46
|
// messages.
|
|
47
47
|
const channelFactoryType = attributes ? attributes.type : attachMessageType;
|
|
48
48
|
if (channelFactoryType === undefined) {
|
|
49
|
-
throw new container_utils_1.DataCorruptionError("channelTypeNotAvailable", {
|
|
50
|
-
channelId
|
|
51
|
-
|
|
52
|
-
tag: telemetry_utils_1.TelemetryDataTag.CodeArtifact,
|
|
53
|
-
},
|
|
54
|
-
dataStoreId: {
|
|
55
|
-
value: dataStoreContext.id,
|
|
56
|
-
tag: telemetry_utils_1.TelemetryDataTag.CodeArtifact,
|
|
57
|
-
},
|
|
49
|
+
throw new container_utils_1.DataCorruptionError("channelTypeNotAvailable", (0, telemetry_utils_1.tagCodeArtifacts)({
|
|
50
|
+
channelId,
|
|
51
|
+
dataStoreId: dataStoreContext.id,
|
|
58
52
|
dataStorePackagePath: dataStoreContext.packagePath.join("/"),
|
|
59
|
-
channelFactoryType
|
|
60
|
-
});
|
|
53
|
+
channelFactoryType,
|
|
54
|
+
}));
|
|
61
55
|
}
|
|
62
56
|
const factory = registry.get(channelFactoryType);
|
|
63
57
|
if (factory === undefined) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
value: channelId,
|
|
68
|
-
tag: telemetry_utils_1.TelemetryDataTag.CodeArtifact,
|
|
69
|
-
},
|
|
70
|
-
dataStoreId: {
|
|
71
|
-
value: dataStoreContext.id,
|
|
72
|
-
tag: telemetry_utils_1.TelemetryDataTag.CodeArtifact,
|
|
73
|
-
},
|
|
58
|
+
throw new container_utils_1.DataCorruptionError("channelFactoryNotRegisteredForGivenType", (0, telemetry_utils_1.tagCodeArtifacts)({
|
|
59
|
+
channelId,
|
|
60
|
+
dataStoreId: dataStoreContext.id,
|
|
74
61
|
dataStorePackagePath: dataStoreContext.packagePath.join("/"),
|
|
75
62
|
channelFactoryType,
|
|
76
|
-
});
|
|
63
|
+
}));
|
|
77
64
|
}
|
|
78
65
|
// This is a backward compatibility case where the attach message doesn't include attributes. Get the attributes
|
|
79
66
|
// from the factory.
|
|
80
|
-
attributes = attributes
|
|
67
|
+
attributes = attributes ?? factory.attributes;
|
|
81
68
|
return { factory, attributes };
|
|
82
69
|
}
|
|
83
70
|
exports.loadChannelFactoryAndAttributes = loadChannelFactoryAndAttributes;
|
|
@@ -87,15 +74,11 @@ async function loadChannel(dataStoreRuntime, attributes, factory, services, logg
|
|
|
87
74
|
attributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion) {
|
|
88
75
|
logger.sendTelemetryEvent({
|
|
89
76
|
eventName: "ChannelAttributesVersionMismatch",
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
channelCodeVersion: {
|
|
96
|
-
value: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,
|
|
97
|
-
tag: telemetry_utils_1.TelemetryDataTag.CodeArtifact,
|
|
98
|
-
},
|
|
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
|
+
}),
|
|
99
82
|
});
|
|
100
83
|
}
|
|
101
84
|
return factory.load(dataStoreRuntime, channelId, services, attributes);
|
|
@@ -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,OAAO;QACN,eAAe;QACf,aAAa;KACb,CAAC;AACH,CAAC;AAtBD,sEAsBC;AAED,SAAgB,gBAAgB,CAC/B,OAAiB,EACjB,WAAoB,KAAK,EACzB,aAAsB,KAAK,EAC3B,gBAAoC;IAEpC,MAAM,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC;IAEzF,qDAAqD;IACrD,IAAA,gCAAgB,EAAC,eAAe,EAAE,yBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC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,cAAc,EAAE;gBACzE,GAAG,EAAE,kCAAgB,CAAC,YAAY;aAClC;YACD,kBAAkB,EAAE;gBACnB,KAAK,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,qBAAqB,IAAI,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE;gBACzF,GAAG,EAAE,kCAAgB,CAAC,YAAY;aAClC;SACD,CAAC,CAAC;KACH;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AACxE,CAAC;AA5BD,kCA4BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt, TelemetryDataTag } 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(\"channelTypeNotAvailable\", {\n\t\t\tchannelId: {\n\t\t\t\tvalue: channelId,\n\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t},\n\t\t\tdataStoreId: {\n\t\t\t\tvalue: dataStoreContext.id,\n\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t},\n\t\t\tdataStorePackagePath: dataStoreContext.packagePath.join(\"/\"),\n\t\t\tchannelFactoryType: attachMessageType,\n\t\t});\n\t}\n\tconst factory = registry.get(channelFactoryType);\n\tif (factory === undefined) {\n\t\t// TODO: dataStoreId may require a different tag from PackageData #7488\n\t\tthrow new DataCorruptionError(\"channelFactoryNotRegisteredForGivenType\", {\n\t\t\tchannelId: {\n\t\t\t\tvalue: channelId,\n\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t},\n\t\t\tdataStoreId: {\n\t\t\t\tvalue: dataStoreContext.id,\n\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t},\n\t\t\tdataStorePackagePath: dataStoreContext.packagePath.join(\"/\"),\n\t\t\tchannelFactoryType,\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\tchannelType: { value: attributes.type, tag: TelemetryDataTag.CodeArtifact },\n\t\t\tchannelSnapshotVersion: {\n\t\t\t\tvalue: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,\n\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t},\n\t\t\tchannelCodeVersion: {\n\t\t\t\tvalue: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,\n\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\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,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,OAAO;QACN,eAAe;QACf,aAAa;KACb,CAAC;AACH,CAAC;AAtBD,sEAsBC;AAED,SAAgB,gBAAgB,CAC/B,OAAiB,EACjB,WAAoB,KAAK,EACzB,aAAsB,KAAK,EAC3B,gBAAoC;IAEpC,MAAM,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC;IAEzF,qDAAqD;IACrD,IAAA,gCAAgB,EAAC,eAAe,EAAE,yBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IACzF,OAAO,eAAe,CAAC;AACxB,CAAC;AAXD,4CAWC;AAEM,KAAK,UAAU,qBAAqB,CAC1C,OAAiB,EACj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EACzC,IAAA,kCAAgB,EAAC;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;KACF;IACD,gHAAgH;IAChH,oBAAoB;IACpB,UAAU,GAAG,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC;IAC9C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AAChC,CAAC;AA/CD,0EA+CC;AAEM,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;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,O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C,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;
|
|
@@ -132,7 +137,7 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
132
137
|
setConnectionState(connected: boolean, clientId?: string): void;
|
|
133
138
|
getQuorum(): IQuorumClients;
|
|
134
139
|
getAudience(): IAudience;
|
|
135
|
-
uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
|
|
140
|
+
uploadBlob(blob: ArrayBufferLike, signal?: AbortSignal): Promise<IFluidHandle<ArrayBufferLike>>;
|
|
136
141
|
process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
|
|
137
142
|
processSignal(message: IInboundSignalMessage, local: boolean): void;
|
|
138
143
|
private isChannelAttached;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,
|
|
1
|
+
{"version":3,"file":"d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wBvC;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();
|
|
@@ -56,9 +54,13 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
56
54
|
// store becomes visible.
|
|
57
55
|
this.pendingHandlesToMakeVisible = new Set();
|
|
58
56
|
(0, common_utils_1.assert)(!dataStoreContext.id.includes("/"), 0x30e /* Id cannot contain slashes. DataStoreContext should have validated this. */);
|
|
59
|
-
this.mc = (0, telemetry_utils_1.
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
this.mc = (0, telemetry_utils_1.createChildMonitoringContext)({
|
|
58
|
+
logger: dataStoreContext.logger,
|
|
59
|
+
namespace: "FluidDataStoreRuntime",
|
|
60
|
+
properties: {
|
|
61
|
+
all: { dataStoreId: (0, uuid_1.v4)() },
|
|
62
|
+
},
|
|
63
|
+
});
|
|
62
64
|
this.id = dataStoreContext.id;
|
|
63
65
|
this.options = dataStoreContext.options;
|
|
64
66
|
this.deltaManager = dataStoreContext.deltaManager;
|
|
@@ -66,7 +68,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
66
68
|
this.audience = dataStoreContext.getAudience();
|
|
67
69
|
const tree = dataStoreContext.baseSnapshot;
|
|
68
70
|
// Must always receive the data store type inside of the attributes
|
|
69
|
-
if (
|
|
71
|
+
if (tree?.trees !== undefined) {
|
|
70
72
|
Object.keys(tree.trees).forEach((path) => {
|
|
71
73
|
// Issue #4414
|
|
72
74
|
if (path === "_search") {
|
|
@@ -94,10 +96,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
94
96
|
type: runtime_definitions_1.CreateSummarizerNodeSource.FromSummary,
|
|
95
97
|
}));
|
|
96
98
|
}
|
|
97
|
-
const deferred = new common_utils_1.Deferred();
|
|
98
|
-
deferred.resolve(channelContext);
|
|
99
99
|
this.contexts.set(path, channelContext);
|
|
100
|
-
this.contextsDeferred.set(path, deferred);
|
|
101
100
|
});
|
|
102
101
|
}
|
|
103
102
|
if (initializeEntryPoint) {
|
|
@@ -131,7 +130,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
131
130
|
}
|
|
132
131
|
// By default, a data store can log maximum 10 local changes telemetry in summarizer.
|
|
133
132
|
this.localChangesTelemetryCount =
|
|
134
|
-
|
|
133
|
+
this.mc.config.getNumber("Fluid.Telemetry.LocalChangesTelemetryCount") ?? 10;
|
|
135
134
|
}
|
|
136
135
|
/**
|
|
137
136
|
* @deprecated - Instantiate the class using its constructor instead.
|
|
@@ -144,6 +143,9 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
144
143
|
static load(context, sharedObjectRegistry, existing) {
|
|
145
144
|
return new FluidDataStoreRuntime(context, sharedObjectRegistry, existing, async (dataStoreRuntime) => (0, runtime_utils_1.requestFluidObject)(dataStoreRuntime, "/"));
|
|
146
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
|
+
*/
|
|
147
149
|
get IFluidRouter() {
|
|
148
150
|
return this;
|
|
149
151
|
}
|
|
@@ -214,6 +216,9 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
214
216
|
async resolveHandle(request) {
|
|
215
217
|
return this.request(request);
|
|
216
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
|
+
*/
|
|
217
222
|
async request(request) {
|
|
218
223
|
try {
|
|
219
224
|
const parser = runtime_utils_1.RequestParser.create(request);
|
|
@@ -222,11 +227,10 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
222
227
|
return this.request(parser.createSubRequest(1));
|
|
223
228
|
}
|
|
224
229
|
// Check for a data type reference first
|
|
225
|
-
|
|
230
|
+
const context = this.contexts.get(id);
|
|
231
|
+
if (context !== undefined && parser.isLeaf(1)) {
|
|
226
232
|
try {
|
|
227
|
-
|
|
228
|
-
const value = await this.contextsDeferred.get(id).promise;
|
|
229
|
-
const channel = await value.getChannel();
|
|
233
|
+
const channel = await context.getChannel();
|
|
230
234
|
return { mimeType: "fluid/object", status: 200, value: channel };
|
|
231
235
|
}
|
|
232
236
|
catch (error) {
|
|
@@ -243,16 +247,11 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
243
247
|
}
|
|
244
248
|
async getChannel(id) {
|
|
245
249
|
this.verifyNotClosed();
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
if (!this.contextsDeferred.has(id)) {
|
|
250
|
-
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");
|
|
251
253
|
}
|
|
252
|
-
|
|
253
|
-
const context = await this.contextsDeferred.get(id).promise;
|
|
254
|
-
const channel = await context.getChannel();
|
|
255
|
-
return channel;
|
|
254
|
+
return context.getChannel();
|
|
256
255
|
}
|
|
257
256
|
createChannel(id = (0, uuid_1.v4)(), type) {
|
|
258
257
|
if (id.includes("/")) {
|
|
@@ -263,15 +262,6 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
263
262
|
this.notBoundedChannelContextSet.add(id);
|
|
264
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));
|
|
265
264
|
this.contexts.set(id, context);
|
|
266
|
-
if (this.contextsDeferred.has(id)) {
|
|
267
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
268
|
-
this.contextsDeferred.get(id).resolve(context);
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
const deferred = new common_utils_1.Deferred();
|
|
272
|
-
deferred.resolve(context);
|
|
273
|
-
this.contextsDeferred.set(id, deferred);
|
|
274
|
-
}
|
|
275
265
|
// Channels (DDS) should not be created in summarizer client.
|
|
276
266
|
this.identifyLocalChangeInSummarizer("DDSCreatedInSummarizer", id, type);
|
|
277
267
|
return context.channel;
|
|
@@ -361,9 +351,9 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
361
351
|
getAudience() {
|
|
362
352
|
return this.audience;
|
|
363
353
|
}
|
|
364
|
-
async uploadBlob(blob) {
|
|
354
|
+
async uploadBlob(blob, signal) {
|
|
365
355
|
this.verifyNotClosed();
|
|
366
|
-
return this.dataStoreContext.uploadBlob(blob);
|
|
356
|
+
return this.dataStoreContext.uploadBlob(blob, signal);
|
|
367
357
|
}
|
|
368
358
|
process(message, local, localOpMetadata) {
|
|
369
359
|
this.verifyNotClosed();
|
|
@@ -389,15 +379,6 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
389
379
|
snapshot: attachMessage.snapshot,
|
|
390
380
|
}), attachMessage.type);
|
|
391
381
|
this.contexts.set(id, remoteChannelContext);
|
|
392
|
-
if (this.contextsDeferred.has(id)) {
|
|
393
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
394
|
-
this.contextsDeferred.get(id).resolve(remoteChannelContext);
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
const deferred = new common_utils_1.Deferred();
|
|
398
|
-
deferred.resolve(remoteChannelContext);
|
|
399
|
-
this.contextsDeferred.set(id, deferred);
|
|
400
|
-
}
|
|
401
382
|
}
|
|
402
383
|
break;
|
|
403
384
|
}
|
|
@@ -491,7 +472,6 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
491
472
|
* @param usedRoutes - The routes that are used in all contexts in this channel.
|
|
492
473
|
*/
|
|
493
474
|
updateUsedRoutes(usedRoutes) {
|
|
494
|
-
var _a;
|
|
495
475
|
// Get a map of channel ids to routes used in it.
|
|
496
476
|
const usedContextRoutes = (0, runtime_utils_1.unpackChildNodesUsedRoutes)(usedRoutes);
|
|
497
477
|
// Verify that the used routes are correct.
|
|
@@ -500,7 +480,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
500
480
|
}
|
|
501
481
|
// Update the used routes in each context. Used routes is empty for unused context.
|
|
502
482
|
for (const [contextId, context] of this.contexts) {
|
|
503
|
-
context.updateUsedRoutes(
|
|
483
|
+
context.updateUsedRoutes(usedContextRoutes.get(contextId) ?? []);
|
|
504
484
|
}
|
|
505
485
|
}
|
|
506
486
|
/**
|
|
@@ -510,8 +490,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
510
490
|
* @param outboundHandle - The handle of the outbound node that is referenced.
|
|
511
491
|
*/
|
|
512
492
|
addedGCOutboundReference(srcHandle, outboundHandle) {
|
|
513
|
-
|
|
514
|
-
(_b = (_a = this.dataStoreContext).addedGCOutboundReference) === null || _b === void 0 ? void 0 : _b.call(_a, srcHandle, outboundHandle);
|
|
493
|
+
this.dataStoreContext.addedGCOutboundReference?.(srcHandle, outboundHandle);
|
|
515
494
|
}
|
|
516
495
|
/**
|
|
517
496
|
* Returns a summary at the current sequence number.
|
|
@@ -686,7 +665,10 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
686
665
|
processChannelOp(message, local, localOpMetadata) {
|
|
687
666
|
this.verifyNotClosed();
|
|
688
667
|
const envelope = message.contents;
|
|
689
|
-
const transformed =
|
|
668
|
+
const transformed = {
|
|
669
|
+
...message,
|
|
670
|
+
contents: envelope.contents,
|
|
671
|
+
};
|
|
690
672
|
const channelContext = this.contexts.get(envelope.address);
|
|
691
673
|
(0, common_utils_1.assert)(!!channelContext, 0x185 /* "Channel not found" */);
|
|
692
674
|
channelContext.processOp(transformed, local, localOpMetadata);
|
|
@@ -742,16 +724,12 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
742
724
|
// in the summarizer and the data will help us plan this.
|
|
743
725
|
this.mc.logger.sendTelemetryEvent({
|
|
744
726
|
eventName,
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
value: this.id,
|
|
752
|
-
tag: telemetry_utils_1.TelemetryDataTag.CodeArtifact,
|
|
753
|
-
},
|
|
754
|
-
fluidDataStorePackagePath: (0, runtime_utils_1.packagePathToTelemetryProperty)(this.dataStoreContext.packagePath),
|
|
727
|
+
...(0, telemetry_utils_1.tagCodeArtifacts)({
|
|
728
|
+
channelType,
|
|
729
|
+
channelId,
|
|
730
|
+
fluidDataStoreId: this.id,
|
|
731
|
+
fluidDataStorePackagePath: this.dataStoreContext.packagePath.join("/"),
|
|
732
|
+
}),
|
|
755
733
|
stack: (0, telemetry_utils_1.generateStack)(),
|
|
756
734
|
});
|
|
757
735
|
this.localChangesTelemetryCount--;
|