@fluidframework/datastore 2.0.0-internal.6.1.1 → 2.0.0-internal.6.3.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 +35 -0
- package/README.md +4 -3
- package/dist/channelContext.d.ts.map +1 -1
- package/dist/channelContext.js +2 -3
- package/dist/channelContext.js.map +1 -1
- package/dist/channelDeltaConnection.js +5 -5
- package/dist/channelDeltaConnection.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts +1 -1
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +24 -25
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/localChannelContext.d.ts +1 -1
- package/dist/localChannelContext.d.ts.map +1 -1
- package/dist/localChannelContext.js +12 -13
- package/dist/localChannelContext.js.map +1 -1
- package/dist/localChannelStorageService.js +2 -2
- package/dist/localChannelStorageService.js.map +1 -1
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/remoteChannelContext.js +7 -8
- package/dist/remoteChannelContext.js.map +1 -1
- package/lib/channelContext.d.ts.map +1 -1
- package/lib/channelContext.js +1 -2
- package/lib/channelContext.js.map +1 -1
- package/lib/channelDeltaConnection.js +2 -2
- package/lib/channelDeltaConnection.js.map +1 -1
- package/lib/dataStoreRuntime.d.ts +1 -1
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +3 -4
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/localChannelContext.d.ts +1 -1
- package/lib/localChannelContext.d.ts.map +1 -1
- package/lib/localChannelContext.js +2 -3
- package/lib/localChannelContext.js.map +1 -1
- package/lib/localChannelStorageService.js +1 -1
- package/lib/localChannelStorageService.js.map +1 -1
- package/lib/remoteChannelContext.d.ts.map +1 -1
- package/lib/remoteChannelContext.js +1 -2
- package/lib/remoteChannelContext.js.map +1 -1
- package/package.json +29 -28
- package/src/channelContext.ts +5 -2
- package/src/channelDeltaConnection.ts +2 -2
- package/src/dataStoreRuntime.ts +4 -3
- package/src/localChannelContext.ts +2 -4
- package/src/localChannelStorageService.ts +1 -1
- package/src/remoteChannelContext.ts +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @fluidframework/datastore
|
|
2
2
|
|
|
3
|
+
## 2.0.0-internal.6.3.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
7
|
+
## 2.0.0-internal.6.2.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- Remove use of @fluidframework/common-definitions ([#16638](https://github.com/microsoft/FluidFramework/issues/16638)) [a8c81509c9](https://github.com/microsoft/FluidFramework/commits/a8c81509c9bf09cfb2092ebcf7265205f9eb6dbf)
|
|
12
|
+
|
|
13
|
+
The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
|
|
14
|
+
imported from the **@fluidframework/core-interfaces** package:
|
|
15
|
+
|
|
16
|
+
- interface IDisposable
|
|
17
|
+
- interface IErrorEvent
|
|
18
|
+
- interface IErrorEvent
|
|
19
|
+
- interface IEvent
|
|
20
|
+
- interface IEventProvider
|
|
21
|
+
- interface ILoggingError
|
|
22
|
+
- interface ITaggedTelemetryPropertyType
|
|
23
|
+
- interface ITelemetryBaseEvent
|
|
24
|
+
- interface ITelemetryBaseLogger
|
|
25
|
+
- interface ITelemetryErrorEvent
|
|
26
|
+
- interface ITelemetryGenericEvent
|
|
27
|
+
- interface ITelemetryLogger
|
|
28
|
+
- interface ITelemetryPerformanceEvent
|
|
29
|
+
- interface ITelemetryProperties
|
|
30
|
+
- type ExtendEventProvider
|
|
31
|
+
- type IEventThisPlaceHolder
|
|
32
|
+
- type IEventTransformer
|
|
33
|
+
- type ReplaceIEventThisPlaceHolder
|
|
34
|
+
- type ReplaceIEventThisPlaceHolder
|
|
35
|
+
- type TelemetryEventCategory
|
|
36
|
+
- type TelemetryEventPropertyType
|
|
37
|
+
|
|
3
38
|
## 2.0.0-internal.6.1.0
|
|
4
39
|
|
|
5
40
|
Dependency updates only.
|
package/README.md
CHANGED
|
@@ -11,9 +11,10 @@ When taking a dependency on a Fluid Framework library, we recommend using a `^`
|
|
|
11
11
|
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
12
12
|
library consumers should always prefer `^`.
|
|
13
13
|
|
|
14
|
-
Note that when depending on a library version of the form 2.0.0-internal.x.y.z
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
|
|
15
|
+
you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
|
|
16
|
+
Standard `^` and `~` ranges will not work as expected.
|
|
17
|
+
See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
|
|
17
18
|
package for more information including tools to convert between version schemes.
|
|
18
19
|
|
|
19
20
|
<!-- prettier-ignore-end -->
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelContext.d.ts","sourceRoot":"","sources":["../src/channelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"channelContext.d.ts","sourceRoot":"","sources":["../src/channelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,mBAAmB,EAEnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,EACN,sBAAsB,EACtB,sCA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.js
CHANGED
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.loadChannel = exports.loadChannelFactoryAndAttributes = exports.summarizeChannelAsync = exports.summarizeChannel = exports.createChannelServiceEndpoints = exports.attributesBlobKey = void 0;
|
|
8
8
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
9
9
|
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
10
|
-
const container_utils_1 = require("@fluidframework/container-utils");
|
|
11
10
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
12
11
|
const channelStorageService_1 = require("./channelStorageService");
|
|
13
12
|
const channelDeltaConnection_1 = require("./channelDeltaConnection");
|
|
@@ -46,7 +45,7 @@ async function loadChannelFactoryAndAttributes(dataStoreContext, services, chann
|
|
|
46
45
|
// messages.
|
|
47
46
|
const channelFactoryType = attributes ? attributes.type : attachMessageType;
|
|
48
47
|
if (channelFactoryType === undefined) {
|
|
49
|
-
throw new
|
|
48
|
+
throw new telemetry_utils_1.DataCorruptionError("channelTypeNotAvailable", (0, telemetry_utils_1.tagCodeArtifacts)({
|
|
50
49
|
channelId,
|
|
51
50
|
dataStoreId: dataStoreContext.id,
|
|
52
51
|
dataStorePackagePath: dataStoreContext.packagePath.join("/"),
|
|
@@ -55,7 +54,7 @@ async function loadChannelFactoryAndAttributes(dataStoreContext, services, chann
|
|
|
55
54
|
}
|
|
56
55
|
const factory = registry.get(channelFactoryType);
|
|
57
56
|
if (factory === undefined) {
|
|
58
|
-
throw new
|
|
57
|
+
throw new telemetry_utils_1.DataCorruptionError("channelFactoryNotRegisteredForGivenType", (0, telemetry_utils_1.tagCodeArtifacts)({
|
|
59
58
|
channelId,
|
|
60
59
|
dataStoreId: dataStoreContext.id,
|
|
61
60
|
dataStorePackagePath: dataStoreContext.packagePath.join("/"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelContext.js","sourceRoot":"","sources":["../src/channelContext.ts"],"names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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"]}
|
|
1
|
+
{"version":3,"file":"channelContext.js","sourceRoot":"","sources":["../src/channelContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAIyC;AAkBzC,iEAAiE;AACjE,+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,E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copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tDataCorruptionError,\n\tITelemetryLoggerExt,\n\ttagCodeArtifacts,\n} 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 { 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"]}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ChannelDeltaConnection = void 0;
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
9
|
+
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
10
10
|
class ChannelDeltaConnection {
|
|
11
11
|
constructor(_connected, submit, dirty, addedGCOutboundReference) {
|
|
12
12
|
this._connected = _connected;
|
|
@@ -15,14 +15,14 @@ class ChannelDeltaConnection {
|
|
|
15
15
|
this.addedGCOutboundReference = addedGCOutboundReference;
|
|
16
16
|
}
|
|
17
17
|
get handler() {
|
|
18
|
-
(0,
|
|
18
|
+
(0, core_utils_1.assert)(!!this._handler, 0x177 /* "Missing delta handler" */);
|
|
19
19
|
return this._handler;
|
|
20
20
|
}
|
|
21
21
|
get connected() {
|
|
22
22
|
return this._connected;
|
|
23
23
|
}
|
|
24
24
|
attach(handler) {
|
|
25
|
-
(0,
|
|
25
|
+
(0, core_utils_1.assert)(this._handler === undefined, 0x178 /* "Missing delta handler on attach" */);
|
|
26
26
|
this._handler = handler;
|
|
27
27
|
}
|
|
28
28
|
setConnectionState(connected) {
|
|
@@ -35,7 +35,7 @@ class ChannelDeltaConnection {
|
|
|
35
35
|
this.handler.process(message, local, localOpMetadata);
|
|
36
36
|
}
|
|
37
37
|
catch (error) {
|
|
38
|
-
throw
|
|
38
|
+
throw telemetry_utils_1.DataProcessingError.wrapIfUnrecognized(error, "channelDeltaConnectionFailedToProcessMessage", message);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
reSubmit(content, localOpMetadata) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelDeltaConnection.js","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH
|
|
1
|
+
{"version":3,"file":"channelDeltaConnection.js","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAGpD,qEAAsE;AAGtE,MAAa,sBAAsB;IAWlC,YACS,UAAmB,EACX,MAAwD,EACxD,KAAiB,EACjB,wBAGP;QAND,eAAU,GAAV,UAAU,CAAS;QACX,WAAM,GAAN,MAAM,CAAkD;QACxD,UAAK,GAAL,KAAK,CAAY;QACjB,6BAAwB,GAAxB,wBAAwB,CAG/B;IACP,CAAC;IAhBJ,IAAY,OAAO;QAClB,IAAA,mBAAM,EAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IACD,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAYM,MAAM,CAAC,OAAsB;QACnC,IAAA,mBAAM,EAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QACnF,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,kBAAkB,CAAC,SAAkB;QAC3C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;IAEM,OAAO,CAAC,OAAkC,EAAE,KAAc,EAAE,eAAwB;QAC1F,IAAI;YACH,sFAAsF;YACtF,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;SACtD;QAAC,OAAO,KAAK,EAAE;YACf,MAAM,qCAAmB,CAAC,kBAAkB,CAC3C,KAAK,EACL,8CAA8C,EAC9C,OAAO,CACP,CAAC;SACF;IACF,CAAC;IAEM,QAAQ,CAAC,OAAY,EAAE,eAAwB;QACrD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACjD,CAAC;IAEM,QAAQ,CAAC,OAAY,EAAE,eAAwB;QACrD,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE;YACxC,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;SACpD;QACD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACjD,CAAC;IAEM,cAAc,CAAC,OAAY;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;CACD;AA1DD,wDA0DC","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\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IDeltaConnection, IDeltaHandler } from \"@fluidframework/datastore-definitions\";\nimport { DataProcessingError } from \"@fluidframework/telemetry-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\n\nexport class ChannelDeltaConnection implements IDeltaConnection {\n\tprivate _handler: IDeltaHandler | undefined;\n\n\tprivate get handler(): IDeltaHandler {\n\t\tassert(!!this._handler, 0x177 /* \"Missing delta handler\" */);\n\t\treturn this._handler;\n\t}\n\tpublic get connected(): boolean {\n\t\treturn this._connected;\n\t}\n\n\tconstructor(\n\t\tprivate _connected: boolean,\n\t\tpublic readonly submit: (content: any, localOpMetadata: unknown) => void,\n\t\tpublic readonly dirty: () => void,\n\t\tpublic readonly addedGCOutboundReference: (\n\t\t\tsrcHandle: IFluidHandle,\n\t\t\toutboundHandle: IFluidHandle,\n\t\t) => void,\n\t) {}\n\n\tpublic attach(handler: IDeltaHandler) {\n\t\tassert(this._handler === undefined, 0x178 /* \"Missing delta handler on attach\" */);\n\t\tthis._handler = handler;\n\t}\n\n\tpublic setConnectionState(connected: boolean) {\n\t\tthis._connected = connected;\n\t\tthis.handler.setConnectionState(connected);\n\t}\n\n\tpublic process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n\t\ttry {\n\t\t\t// catches as data processing error whether or not they come from async pending queues\n\t\t\tthis.handler.process(message, local, localOpMetadata);\n\t\t} catch (error) {\n\t\t\tthrow DataProcessingError.wrapIfUnrecognized(\n\t\t\t\terror,\n\t\t\t\t\"channelDeltaConnectionFailedToProcessMessage\",\n\t\t\t\tmessage,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: any, localOpMetadata: unknown) {\n\t\tthis.handler.reSubmit(content, localOpMetadata);\n\t}\n\n\tpublic rollback(content: any, localOpMetadata: unknown) {\n\t\tif (this.handler.rollback === undefined) {\n\t\t\tthrow new Error(\"Handler doesn't support rollback\");\n\t\t}\n\t\tthis.handler.rollback(content, localOpMetadata);\n\t}\n\n\tpublic applyStashedOp(content: any): unknown {\n\t\treturn this.handler.applyStashedOp(content);\n\t}\n}\n"]}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
5
6
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
6
7
|
import { FluidObject, IFluidHandle, IFluidHandleContext, IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
7
8
|
import { IAudience, IDeltaManager, AttachState, ILoaderOptions } from "@fluidframework/container-definitions";
|
|
8
|
-
import { TypedEventEmitter } from "@fluidframework/common-utils";
|
|
9
9
|
import { IClientDetails, IDocumentMessage, ISequencedDocumentMessage, IQuorumClients } from "@fluidframework/protocol-definitions";
|
|
10
10
|
import { IFluidDataStoreContext, IFluidDataStoreChannel, IGarbageCollectionData, IInboundSignalMessage, ISummaryTreeWithStats, VisibilityState, ITelemetryContext, IIdCompressor } from "@fluidframework/runtime-definitions";
|
|
11
11
|
import { IChannel, IFluidDataStoreRuntime, IFluidDataStoreRuntimeEvents, IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAEN,mBAAmB,EAQnB,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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AkCD,CAAC"}
|
package/dist/dataStoreRuntime.js
CHANGED
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.mixinSummaryHandler = exports.mixinRequestHandler = exports.FluidDataStoreRuntime = exports.DataStoreMessageType = void 0;
|
|
8
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
8
9
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
9
10
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
10
11
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
11
|
-
const container_utils_1 = require("@fluidframework/container-utils");
|
|
12
|
-
const common_utils_1 = require("@fluidframework/common-utils");
|
|
13
12
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
14
13
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
15
14
|
const runtime_definitions_1 = require("@fluidframework/runtime-definitions");
|
|
@@ -28,7 +27,7 @@ var DataStoreMessageType;
|
|
|
28
27
|
/**
|
|
29
28
|
* Base data store class
|
|
30
29
|
*/
|
|
31
|
-
class FluidDataStoreRuntime extends
|
|
30
|
+
class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
32
31
|
/**
|
|
33
32
|
* Create an instance of a DataStore runtime.
|
|
34
33
|
*
|
|
@@ -47,13 +46,13 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
47
46
|
this._disposed = false;
|
|
48
47
|
this.contexts = new Map();
|
|
49
48
|
this.pendingAttach = new Set();
|
|
50
|
-
this.deferredAttached = new
|
|
49
|
+
this.deferredAttached = new core_utils_1.Deferred();
|
|
51
50
|
this.localChannelContextQueue = new Map();
|
|
52
51
|
this.notBoundedChannelContextSet = new Set();
|
|
53
52
|
// A list of handles that are bound when the data store is not visible. We have to make them visible when the data
|
|
54
53
|
// store becomes visible.
|
|
55
54
|
this.pendingHandlesToMakeVisible = new Set();
|
|
56
|
-
(0,
|
|
55
|
+
(0, core_utils_1.assert)(!dataStoreContext.id.includes("/"), 0x30e /* Id cannot contain slashes. DataStoreContext should have validated this. */);
|
|
57
56
|
this.mc = (0, telemetry_utils_1.createChildMonitoringContext)({
|
|
58
57
|
logger: dataStoreContext.logger,
|
|
59
58
|
namespace: "FluidDataStoreRuntime",
|
|
@@ -255,10 +254,10 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
255
254
|
}
|
|
256
255
|
createChannel(id = (0, uuid_1.v4)(), type) {
|
|
257
256
|
if (id.includes("/")) {
|
|
258
|
-
throw new
|
|
257
|
+
throw new telemetry_utils_1.UsageError(`Id cannot contain slashes: ${id}`);
|
|
259
258
|
}
|
|
260
259
|
this.verifyNotClosed();
|
|
261
|
-
(0,
|
|
260
|
+
(0, core_utils_1.assert)(!this.contexts.has(id), 0x179 /* "createChannel() with existing ID" */);
|
|
262
261
|
this.notBoundedChannelContextSet.add(id);
|
|
263
262
|
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));
|
|
264
263
|
this.contexts.set(id, context);
|
|
@@ -272,7 +271,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
272
271
|
* @param channel - channel to be registered.
|
|
273
272
|
*/
|
|
274
273
|
bindChannel(channel) {
|
|
275
|
-
(0,
|
|
274
|
+
(0, core_utils_1.assert)(this.notBoundedChannelContextSet.has(channel.id), 0x17b /* "Channel to be bound should be in not bounded set" */);
|
|
276
275
|
this.notBoundedChannelContextSet.delete(channel.id);
|
|
277
276
|
// If our data store is attached, then attach the channel.
|
|
278
277
|
if (this.isAttached) {
|
|
@@ -371,10 +370,10 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
371
370
|
// If a non-local operation then go and create the object
|
|
372
371
|
// Otherwise mark it as officially attached.
|
|
373
372
|
if (local) {
|
|
374
|
-
(0,
|
|
373
|
+
(0, core_utils_1.assert)(this.pendingAttach.delete(id), 0x17c /* "Unexpected attach (local) channel OP" */);
|
|
375
374
|
}
|
|
376
375
|
else {
|
|
377
|
-
(0,
|
|
376
|
+
(0, core_utils_1.assert)(!this.contexts.has(id), 0x17d /* "Unexpected attach channel OP" */);
|
|
378
377
|
const summarizerNodeParams = {
|
|
379
378
|
type: runtime_definitions_1.CreateSummarizerNodeSource.FromAttach,
|
|
380
379
|
sequenceNumber: message.sequenceNumber,
|
|
@@ -393,7 +392,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
393
392
|
this.emit("op", message);
|
|
394
393
|
}
|
|
395
394
|
catch (error) {
|
|
396
|
-
throw
|
|
395
|
+
throw telemetry_utils_1.DataProcessingError.wrapIfUnrecognized(error, "fluidDataStoreRuntimeFailedToProcessMessage", message);
|
|
397
396
|
}
|
|
398
397
|
}
|
|
399
398
|
processSignal(message, local) {
|
|
@@ -479,7 +478,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
479
478
|
const usedContextRoutes = (0, runtime_utils_1.unpackChildNodesUsedRoutes)(usedRoutes);
|
|
480
479
|
// Verify that the used routes are correct.
|
|
481
480
|
for (const [id] of usedContextRoutes) {
|
|
482
|
-
(0,
|
|
481
|
+
(0, core_utils_1.assert)(this.contexts.has(id), 0x17e /* "Used route does not belong to any known context" */);
|
|
483
482
|
}
|
|
484
483
|
// Update the used routes in each context. Used routes is empty for unused context.
|
|
485
484
|
for (const [contextId, context] of this.contexts) {
|
|
@@ -508,7 +507,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
508
507
|
.filter(([contextId, _]) => {
|
|
509
508
|
const isAttached = this.isChannelAttached(contextId);
|
|
510
509
|
// We are not expecting local dds! Summary may not capture local state.
|
|
511
|
-
(0,
|
|
510
|
+
(0, core_utils_1.assert)(isAttached, 0x17f /* "Not expecting detached channels during summarize" */);
|
|
512
511
|
// If the object is registered - and we have received the sequenced op creating the object
|
|
513
512
|
// (i.e. it has a base mapping) - then we go ahead and summarize
|
|
514
513
|
return isAttached;
|
|
@@ -548,13 +547,13 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
548
547
|
let summaryTree;
|
|
549
548
|
if (context.isLoaded) {
|
|
550
549
|
const contextSummary = context.getAttachSummary(telemetryContext);
|
|
551
|
-
(0,
|
|
550
|
+
(0, core_utils_1.assert)(contextSummary.summary.type === protocol_definitions_1.SummaryType.Tree, 0x180 /* "getAttachSummary should always return a tree" */);
|
|
552
551
|
summaryTree = { stats: contextSummary.stats, summary: contextSummary.summary };
|
|
553
552
|
}
|
|
554
553
|
else {
|
|
555
554
|
// If this channel is not yet loaded, then there should be no changes in the snapshot from which
|
|
556
555
|
// it was created as it is detached container. So just use the previous snapshot.
|
|
557
|
-
(0,
|
|
556
|
+
(0, core_utils_1.assert)(!!this.dataStoreContext.baseSnapshot, 0x181 /* "BaseSnapshot should be there as detached container loaded from snapshot" */);
|
|
558
557
|
summaryTree = (0, runtime_utils_1.convertSnapshotTreeToSummaryTree)(this.dataStoreContext.baseSnapshot.trees[contextId]);
|
|
559
558
|
}
|
|
560
559
|
summaryBuilder.addWithStats(contextId, summaryTree);
|
|
@@ -585,8 +584,8 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
585
584
|
return;
|
|
586
585
|
}
|
|
587
586
|
channel.handle.attachGraph();
|
|
588
|
-
(0,
|
|
589
|
-
(0,
|
|
587
|
+
(0, core_utils_1.assert)(this.isAttached, 0x182 /* "Data store should be attached to attach the channel." */);
|
|
588
|
+
(0, core_utils_1.assert)(this.visibilityState === runtime_definitions_1.VisibilityState.GloballyVisible, 0x2d0 /* "Data store should be globally visible to attach channels." */);
|
|
590
589
|
const summarizeResult = (0, channelContext_1.summarizeChannel)(channel, true /* fullTree */, false /* trackState */);
|
|
591
590
|
// Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.
|
|
592
591
|
const snapshot = (0, runtime_utils_1.convertSummaryTreeToITree)(summarizeResult.summary);
|
|
@@ -622,7 +621,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
622
621
|
// For Operations, find the right channel and trigger resubmission on it.
|
|
623
622
|
const envelope = content;
|
|
624
623
|
const channelContext = this.contexts.get(envelope.address);
|
|
625
|
-
(0,
|
|
624
|
+
(0, core_utils_1.assert)(!!channelContext, 0x183 /* "There should be a channel context for the op" */);
|
|
626
625
|
channelContext.reSubmit(envelope.contents, localOpMetadata);
|
|
627
626
|
break;
|
|
628
627
|
}
|
|
@@ -631,7 +630,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
631
630
|
this.submit(type, content, localOpMetadata);
|
|
632
631
|
break;
|
|
633
632
|
default:
|
|
634
|
-
(0,
|
|
633
|
+
(0, core_utils_1.unreachableCase)(type);
|
|
635
634
|
}
|
|
636
635
|
}
|
|
637
636
|
/**
|
|
@@ -646,7 +645,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
646
645
|
// For Operations, find the right channel and trigger resubmission on it.
|
|
647
646
|
const envelope = content;
|
|
648
647
|
const channelContext = this.contexts.get(envelope.address);
|
|
649
|
-
(0,
|
|
648
|
+
(0, core_utils_1.assert)(!!channelContext, 0x2ed /* "There should be a channel context for the op" */);
|
|
650
649
|
channelContext.rollback(envelope.contents, localOpMetadata);
|
|
651
650
|
break;
|
|
652
651
|
}
|
|
@@ -671,12 +670,12 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
671
670
|
case DataStoreMessageType.ChannelOp: {
|
|
672
671
|
const envelope = content.content;
|
|
673
672
|
const channelContext = this.contexts.get(envelope.address);
|
|
674
|
-
(0,
|
|
673
|
+
(0, core_utils_1.assert)(!!channelContext, 0x184 /* "There should be a channel context for the op" */);
|
|
675
674
|
await channelContext.getChannel();
|
|
676
675
|
return channelContext.applyStashedOp(envelope.contents);
|
|
677
676
|
}
|
|
678
677
|
default:
|
|
679
|
-
(0,
|
|
678
|
+
(0, core_utils_1.unreachableCase)(type);
|
|
680
679
|
}
|
|
681
680
|
}
|
|
682
681
|
setChannelDirty(address) {
|
|
@@ -691,7 +690,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
691
690
|
contents: envelope.contents,
|
|
692
691
|
};
|
|
693
692
|
const channelContext = this.contexts.get(envelope.address);
|
|
694
|
-
(0,
|
|
693
|
+
(0, core_utils_1.assert)(!!channelContext, 0x185 /* "Channel not found" */);
|
|
695
694
|
channelContext.processOp(transformed, local, localOpMetadata);
|
|
696
695
|
return channelContext;
|
|
697
696
|
}
|
|
@@ -709,7 +708,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
709
708
|
*/
|
|
710
709
|
this.attachGraph();
|
|
711
710
|
this._attachState = container_definitions_1.AttachState.Attaching;
|
|
712
|
-
(0,
|
|
711
|
+
(0, core_utils_1.assert)(this.visibilityState === runtime_definitions_1.VisibilityState.LocallyVisible, 0x2d1 /* "Data store should be locally visible before it can become globally visible." */);
|
|
713
712
|
// Mark the data store globally visible and make its child channels visible as well.
|
|
714
713
|
this.visibilityState = runtime_definitions_1.VisibilityState.GloballyVisible;
|
|
715
714
|
this.localChannelContextQueue.forEach((channel) => {
|
|
@@ -721,7 +720,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
721
720
|
this.emit("attaching");
|
|
722
721
|
});
|
|
723
722
|
this.dataStoreContext.once("attached", () => {
|
|
724
|
-
(0,
|
|
723
|
+
(0, core_utils_1.assert)(this.visibilityState === runtime_definitions_1.VisibilityState.GloballyVisible, 0x2d2 /* "Data store should be globally visible when its attached." */);
|
|
725
724
|
this._attachState = container_definitions_1.AttachState.Attached;
|
|
726
725
|
this.emit("attached");
|
|
727
726
|
});
|