@fluidframework/container-runtime 2.0.0-internal.7.3.0 → 2.0.0-internal.7.4.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 +18 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +9 -1
- package/api-report/container-runtime.api.md +124 -107
- package/dist/blobManager.d.ts +4 -4
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js.map +1 -1
- package/dist/container-runtime-alpha.d.ts +1473 -0
- package/dist/container-runtime-beta.d.ts +300 -0
- package/dist/container-runtime-public.d.ts +300 -0
- package/dist/container-runtime-untrimmed.d.ts +1836 -0
- package/dist/containerRuntime.d.ts +30 -30
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +62 -40
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreRegistry.d.ts +1 -1
- package/dist/dataStoreRegistry.js +1 -1
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/dataStores.d.ts +10 -15
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +77 -40
- package/dist/dataStores.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +41 -13
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +215 -78
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +34 -37
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +121 -46
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +26 -18
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts +18 -25
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js +29 -45
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +0 -5
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +14 -42
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.d.ts +11 -5
- package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.js +43 -19
- package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/dist/gc/index.d.ts +1 -1
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +4 -5
- package/dist/gc/index.js.map +1 -1
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/dist/messageTypes.d.ts +15 -7
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js +6 -1
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +1 -0
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +1 -0
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +1 -1
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.d.ts +2 -2
- package/dist/summary/runWhileConnectedCoordinator.js +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/summarizer.d.ts +1 -1
- package/dist/summary/summarizer.js +1 -1
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +30 -30
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +10 -10
- package/dist/summary/summaryCollection.js +1 -1
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +3 -3
- package/dist/summary/summaryFormat.js.map +1 -1
- package/lib/blobManager.d.ts +4 -4
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js.map +1 -1
- package/lib/container-runtime-alpha.d.ts +1473 -0
- package/lib/container-runtime-beta.d.ts +300 -0
- package/lib/container-runtime-public.d.ts +300 -0
- package/lib/container-runtime-untrimmed.d.ts +1836 -0
- package/lib/containerRuntime.d.ts +30 -30
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +64 -42
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreRegistry.d.ts +1 -1
- package/lib/dataStoreRegistry.js +1 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/dataStores.d.ts +10 -15
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +80 -43
- package/lib/dataStores.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +41 -13
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +217 -80
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js +37 -40
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +121 -46
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js +25 -17
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcHelpers.d.ts +18 -25
- package/lib/gc/gcHelpers.d.ts.map +1 -1
- package/lib/gc/gcHelpers.js +27 -43
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +0 -5
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +15 -43
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.d.ts +11 -5
- package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.js +43 -19
- package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/lib/gc/index.d.ts +1 -1
- package/lib/gc/index.d.ts.map +1 -1
- package/lib/gc/index.js +1 -1
- package/lib/gc/index.js.map +1 -1
- package/lib/index.d.ts +14 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +15 -1
- package/lib/index.js.map +1 -1
- package/lib/messageTypes.d.ts +15 -7
- package/lib/messageTypes.d.ts.map +1 -1
- package/lib/messageTypes.js +6 -1
- package/lib/messageTypes.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts +1 -0
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +1 -0
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +1 -1
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.d.ts +2 -2
- package/lib/summary/runWhileConnectedCoordinator.js +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/summary/summarizer.d.ts +1 -1
- package/lib/summary/summarizer.js +1 -1
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +30 -30
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +10 -10
- package/lib/summary/summaryCollection.js +1 -1
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts +3 -3
- package/lib/summary/summaryFormat.js.map +1 -1
- package/package.json +42 -19
- package/src/blobManager.ts +5 -5
- package/src/containerRuntime.ts +86 -56
- package/src/dataStoreRegistry.ts +1 -1
- package/src/dataStores.ts +140 -69
- package/src/gc/garbageCollection.md +14 -15
- package/src/gc/garbageCollection.ts +256 -96
- package/src/gc/gcConfigs.ts +50 -52
- package/src/gc/gcDefinitions.ts +137 -52
- package/src/gc/gcHelpers.ts +31 -52
- package/src/gc/gcTelemetry.ts +16 -57
- package/src/gc/gcUnreferencedStateTracker.ts +61 -22
- package/src/gc/index.ts +6 -4
- package/src/index.ts +19 -1
- package/src/messageTypes.ts +19 -4
- package/src/opLifecycle/definitions.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +1 -0
- package/src/summary/orderedClientElection.ts +1 -1
- package/src/summary/runWhileConnectedCoordinator.ts +2 -2
- package/src/summary/summarizer.ts +1 -1
- package/src/summary/summarizerTypes.ts +30 -30
- package/src/summary/summaryCollection.ts +10 -10
- package/src/summary/summaryFormat.ts +3 -3
- package/dist/id-compressor/appendOnlySortedMap.d.ts +0 -124
- package/dist/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
- package/dist/id-compressor/appendOnlySortedMap.js +0 -318
- package/dist/id-compressor/appendOnlySortedMap.js.map +0 -1
- package/dist/id-compressor/finalSpace.d.ts +0 -29
- package/dist/id-compressor/finalSpace.d.ts.map +0 -1
- package/dist/id-compressor/finalSpace.js +0 -62
- package/dist/id-compressor/finalSpace.js.map +0 -1
- package/dist/id-compressor/idCompressor.d.ts +0 -54
- package/dist/id-compressor/idCompressor.d.ts.map +0 -1
- package/dist/id-compressor/idCompressor.js +0 -495
- package/dist/id-compressor/idCompressor.js.map +0 -1
- package/dist/id-compressor/identifiers.d.ts +0 -32
- package/dist/id-compressor/identifiers.d.ts.map +0 -1
- package/dist/id-compressor/identifiers.js +0 -15
- package/dist/id-compressor/identifiers.js.map +0 -1
- package/dist/id-compressor/index.d.ts +0 -13
- package/dist/id-compressor/index.d.ts.map +0 -1
- package/dist/id-compressor/index.js +0 -32
- package/dist/id-compressor/index.js.map +0 -1
- package/dist/id-compressor/persistanceUtilities.d.ts +0 -22
- package/dist/id-compressor/persistanceUtilities.d.ts.map +0 -1
- package/dist/id-compressor/persistanceUtilities.js +0 -43
- package/dist/id-compressor/persistanceUtilities.js.map +0 -1
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
- package/dist/id-compressor/sessionSpaceNormalizer.js +0 -80
- package/dist/id-compressor/sessionSpaceNormalizer.js.map +0 -1
- package/dist/id-compressor/sessions.d.ts +0 -115
- package/dist/id-compressor/sessions.d.ts.map +0 -1
- package/dist/id-compressor/sessions.js +0 -305
- package/dist/id-compressor/sessions.js.map +0 -1
- package/dist/id-compressor/utilities.d.ts +0 -52
- package/dist/id-compressor/utilities.d.ts.map +0 -1
- package/dist/id-compressor/utilities.js +0 -169
- package/dist/id-compressor/utilities.js.map +0 -1
- package/lib/id-compressor/appendOnlySortedMap.d.ts +0 -124
- package/lib/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
- package/lib/id-compressor/appendOnlySortedMap.js +0 -314
- package/lib/id-compressor/appendOnlySortedMap.js.map +0 -1
- package/lib/id-compressor/finalSpace.d.ts +0 -29
- package/lib/id-compressor/finalSpace.d.ts.map +0 -1
- package/lib/id-compressor/finalSpace.js +0 -58
- package/lib/id-compressor/finalSpace.js.map +0 -1
- package/lib/id-compressor/idCompressor.d.ts +0 -54
- package/lib/id-compressor/idCompressor.d.ts.map +0 -1
- package/lib/id-compressor/idCompressor.js +0 -491
- package/lib/id-compressor/idCompressor.js.map +0 -1
- package/lib/id-compressor/identifiers.d.ts +0 -32
- package/lib/id-compressor/identifiers.d.ts.map +0 -1
- package/lib/id-compressor/identifiers.js +0 -11
- package/lib/id-compressor/identifiers.js.map +0 -1
- package/lib/id-compressor/index.d.ts +0 -13
- package/lib/id-compressor/index.d.ts.map +0 -1
- package/lib/id-compressor/index.js +0 -13
- package/lib/id-compressor/index.js.map +0 -1
- package/lib/id-compressor/persistanceUtilities.d.ts +0 -22
- package/lib/id-compressor/persistanceUtilities.d.ts.map +0 -1
- package/lib/id-compressor/persistanceUtilities.js +0 -34
- package/lib/id-compressor/persistanceUtilities.js.map +0 -1
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
- package/lib/id-compressor/sessionSpaceNormalizer.js +0 -76
- package/lib/id-compressor/sessionSpaceNormalizer.js.map +0 -1
- package/lib/id-compressor/sessions.d.ts +0 -115
- package/lib/id-compressor/sessions.d.ts.map +0 -1
- package/lib/id-compressor/sessions.js +0 -290
- package/lib/id-compressor/sessions.js.map +0 -1
- package/lib/id-compressor/utilities.d.ts +0 -52
- package/lib/id-compressor/utilities.d.ts.map +0 -1
- package/lib/id-compressor/utilities.js +0 -151
- package/lib/id-compressor/utilities.js.map +0 -1
- package/src/id-compressor/README.md +0 -3
- package/src/id-compressor/appendOnlySortedMap.ts +0 -366
- package/src/id-compressor/finalSpace.ts +0 -67
- package/src/id-compressor/idCompressor.ts +0 -630
- package/src/id-compressor/identifiers.ts +0 -42
- package/src/id-compressor/index.ts +0 -26
- package/src/id-compressor/persistanceUtilities.ts +0 -58
- package/src/id-compressor/sessionSpaceNormalizer.ts +0 -83
- package/src/id-compressor/sessions.ts +0 -405
- package/src/id-compressor/utilities.ts +0 -190
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FluidDataStoreRegistryEntry, IFluidDataStoreRegistry, NamedFluidDataStoreRegistryEntries } from "@fluidframework/runtime-definitions";
|
|
2
2
|
/**
|
|
3
|
-
* @
|
|
3
|
+
* @internal
|
|
4
4
|
*/
|
|
5
5
|
export declare class FluidDataStoreRegistry implements IFluidDataStoreRegistry {
|
|
6
6
|
private readonly map;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRegistry.js","sourceRoot":"","sources":["../src/dataStoreRegistry.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,qEAA6D;AAO7D;;GAEG;AACH,MAAa,sBAAsB;IAMlC,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,YAAY,YAAgD;QAC3D,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;QACrB,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;YACjC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC3B,MAAM,IAAI,4BAAU,CAAC,6BAA6B,CAAC,CAAC;aACpD;YACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACjC;IACF,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,IAAY;QAC5B,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACvB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAC1B;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;CACD;AA3BD,wDA2BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { UsageError } from \"@fluidframework/telemetry-utils\";\nimport {\n\tFluidDataStoreRegistryEntry,\n\tIFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions\";\n\n/**\n * @
|
|
1
|
+
{"version":3,"file":"dataStoreRegistry.js","sourceRoot":"","sources":["../src/dataStoreRegistry.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,qEAA6D;AAO7D;;GAEG;AACH,MAAa,sBAAsB;IAMlC,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,YAAY,YAAgD;QAC3D,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;QACrB,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;YACjC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC3B,MAAM,IAAI,4BAAU,CAAC,6BAA6B,CAAC,CAAC;aACpD;YACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACjC;IACF,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,IAAY;QAC5B,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACvB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAC1B;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;CACD;AA3BD,wDA2BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { UsageError } from \"@fluidframework/telemetry-utils\";\nimport {\n\tFluidDataStoreRegistryEntry,\n\tIFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions\";\n\n/**\n * @internal\n */\nexport class FluidDataStoreRegistry implements IFluidDataStoreRegistry {\n\tprivate readonly map: Map<\n\t\tstring,\n\t\tFluidDataStoreRegistryEntry | Promise<FluidDataStoreRegistryEntry>\n\t>;\n\n\tpublic get IFluidDataStoreRegistry() {\n\t\treturn this;\n\t}\n\n\tconstructor(namedEntries: NamedFluidDataStoreRegistryEntries) {\n\t\tthis.map = new Map();\n\t\tfor (const entry of namedEntries) {\n\t\t\tif (this.map.has(entry[0])) {\n\t\t\t\tthrow new UsageError(\"Duplicate entry names exist\");\n\t\t\t}\n\t\t\tthis.map.set(entry[0], entry[1]);\n\t\t}\n\t}\n\n\tpublic async get(name: string): Promise<FluidDataStoreRegistryEntry | undefined> {\n\t\tif (this.map.has(name)) {\n\t\t\treturn this.map.get(name);\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n"]}
|
package/dist/dataStores.d.ts
CHANGED
|
@@ -66,19 +66,14 @@ export declare class DataStores implements IDisposable {
|
|
|
66
66
|
*/
|
|
67
67
|
getDataStoreIfAvailable(id: string, requestHeaderData: RuntimeHeaderData): Promise<FluidDataStoreContext | undefined>;
|
|
68
68
|
/**
|
|
69
|
-
* Checks if the data store has been deleted by GC.
|
|
70
|
-
* @param id - data store id
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
69
|
+
* Checks if the data store has been deleted by GC. If so, log an error.
|
|
70
|
+
* @param id - The data store's id.
|
|
71
|
+
* @param context - The data store context.
|
|
72
|
+
* @param callSite - The function name this is called from.
|
|
73
|
+
* @param requestHeaderData - The request header information to log if the data store is deleted.
|
|
73
74
|
* @returns true if the data store is deleted. Otherwise, returns false.
|
|
74
75
|
*/
|
|
75
|
-
private
|
|
76
|
-
/**
|
|
77
|
-
* Validate that the data store had not been deleted by GC.
|
|
78
|
-
* @param id - data store id
|
|
79
|
-
* @param requestHeaderData - the request header information to log if the validation detects the data store has been deleted
|
|
80
|
-
*/
|
|
81
|
-
private validateNotDeleted;
|
|
76
|
+
private checkAndLogIfDeleted;
|
|
82
77
|
processSignal(fluidDataStoreId: string, message: IInboundSignalMessage, local: boolean): void;
|
|
83
78
|
setConnectionState(connected: boolean, clientId?: string): void;
|
|
84
79
|
setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;
|
|
@@ -109,25 +104,25 @@ export declare class DataStores implements IDisposable {
|
|
|
109
104
|
* After GC has run, called to notify this Container's data stores of routes that are used in it.
|
|
110
105
|
* @param usedRoutes - The routes that are used in all data stores in this Container.
|
|
111
106
|
*/
|
|
112
|
-
updateUsedRoutes(usedRoutes: string[]): void;
|
|
107
|
+
updateUsedRoutes(usedRoutes: readonly string[]): void;
|
|
113
108
|
/**
|
|
114
109
|
* This is called to update objects whose routes are unused. The unused objects are deleted.
|
|
115
110
|
* @param unusedRoutes - The routes that are unused in all data stores in this Container.
|
|
116
111
|
*/
|
|
117
|
-
updateUnusedRoutes(unusedRoutes: string[]): void;
|
|
112
|
+
updateUnusedRoutes(unusedRoutes: readonly string[]): void;
|
|
118
113
|
/**
|
|
119
114
|
* Delete data stores and its objects that are sweep ready.
|
|
120
115
|
* @param sweepReadyDataStoreRoutes - The routes of data stores and its objects that are sweep ready and should
|
|
121
116
|
* be deleted.
|
|
122
117
|
* @returns The routes of data stores and its objects that were deleted.
|
|
123
118
|
*/
|
|
124
|
-
deleteSweepReadyNodes(sweepReadyDataStoreRoutes: string[]): string[];
|
|
119
|
+
deleteSweepReadyNodes(sweepReadyDataStoreRoutes: readonly string[]): readonly string[];
|
|
125
120
|
/**
|
|
126
121
|
* This is called to update objects whose routes are tombstones. Tombstoned datastore contexts enable testing
|
|
127
122
|
* scenarios with accessing deleted content without actually deleting content from summaries.
|
|
128
123
|
* @param tombstonedRoutes - The routes that are tombstones in all data stores in this Container.
|
|
129
124
|
*/
|
|
130
|
-
updateTombstonedRoutes(tombstonedRoutes: string[]): void;
|
|
125
|
+
updateTombstonedRoutes(tombstonedRoutes: readonly string[]): void;
|
|
131
126
|
/**
|
|
132
127
|
* Returns the outbound routes of this channel. Only root data stores are considered referenced and their paths are
|
|
133
128
|
* part of outbound routes.
|
package/dist/dataStores.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStores.d.ts","sourceRoot":"","sources":["../src/dataStores.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,oBAAoB,EACpB,WAAW,EAGX,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,EACN,WAAW,EAEX,2BAA2B,EAC3B,8BAA8B,EAE9B,cAAc,EACd,SAAS,EACT,8BAA8B,EAC9B,sBAAsB,EACtB,qBAAqB,EAGrB,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"dataStores.d.ts","sourceRoot":"","sources":["../src/dataStores.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA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WAAW,CAAC,QAAQ,GAAG,IAAI;IAUtF,IAAW,IAAI,IAAI,MAAM,CAExB;IAEY,SAAS,CACrB,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,OAAO,EACnB,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,qBAAqB,CAAC;IAiC1B,aAAa,CAAC,gBAAgB,CAAC,EAAE,iBAAiB,GAAG,qBAAqB;IA4CjF;;;;OAIG;IACU,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAajD;;;;;;;;;;;;OAYG;IACU,SAAS,CAAC,MAAM,GAAE,OAAe,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAiChF;;;OAGG;IACI,gBAAgB,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE;IAkBrD;;;OAGG;IACI,kBAAkB,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE;IAiBzD;;;;;OAKG;IACI,qBAAqB,CAAC,yBAAyB,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE;IAqC7F;;;;OAIG;IACI,sBAAsB,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE;IAmBjE;;;OAGG;YACW,iBAAiB;IAW/B;;OAEG;IACU,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAO9F;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;CAa9D;AAED,wBAAgB,uBAAuB,CACtC,QAAQ,EAAE,aAAa,GAAG,SAAS,EACnC,QAAQ,CAAC,EAAE,yBAAyB,GAClC,aAAa,GAAG,SAAS,CAsB3B"}
|
package/dist/dataStores.js
CHANGED
|
@@ -175,6 +175,11 @@ class DataStores {
|
|
|
175
175
|
return false;
|
|
176
176
|
}
|
|
177
177
|
const context = this.contexts.get(aliasMessage.internalId);
|
|
178
|
+
// If the data store has been deleted, log an error and ignore this message. This helps prevent document
|
|
179
|
+
// corruption in case a deleted data store accidentally submitted a signal.
|
|
180
|
+
if (this.checkAndLogIfDeleted(aliasMessage.internalId, context, "Changed", "processAliasMessageCore")) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
178
183
|
if (context === undefined) {
|
|
179
184
|
this.mc.logger.sendErrorEvent({
|
|
180
185
|
eventName: "AliasFluidDataStoreNotFound",
|
|
@@ -255,16 +260,37 @@ class DataStores {
|
|
|
255
260
|
}
|
|
256
261
|
resubmitDataStoreOp(envelope, localOpMetadata) {
|
|
257
262
|
const context = this.contexts.get(envelope.address);
|
|
263
|
+
// If the data store has been deleted, log an error and throw an error. If there are local changes for a
|
|
264
|
+
// deleted data store, it can otherwise lead to inconsistent state when compared to other clients.
|
|
265
|
+
if (this.checkAndLogIfDeleted(envelope.address, context, "Changed", "resubmitDataStoreOp")) {
|
|
266
|
+
throw new telemetry_utils_1.DataCorruptionError("Context is deleted!", {
|
|
267
|
+
callSite: "resubmitDataStoreOp",
|
|
268
|
+
...(0, telemetry_utils_1.tagCodeArtifacts)({ id: envelope.address }),
|
|
269
|
+
});
|
|
270
|
+
}
|
|
258
271
|
(0, core_utils_1.assert)(!!context, 0x160 /* "There should be a store context for the op" */);
|
|
259
272
|
context.reSubmit(envelope.contents, localOpMetadata);
|
|
260
273
|
}
|
|
261
274
|
rollbackDataStoreOp(envelope, localOpMetadata) {
|
|
262
275
|
const context = this.contexts.get(envelope.address);
|
|
276
|
+
// If the data store has been deleted, log an error and throw an error. If there are local changes for a
|
|
277
|
+
// deleted data store, it can otherwise lead to inconsistent state when compared to other clients.
|
|
278
|
+
if (this.checkAndLogIfDeleted(envelope.address, context, "Changed", "rollbackDataStoreOp")) {
|
|
279
|
+
throw new telemetry_utils_1.DataCorruptionError("Context is deleted!", {
|
|
280
|
+
callSite: "rollbackDataStoreOp",
|
|
281
|
+
...(0, telemetry_utils_1.tagCodeArtifacts)({ id: envelope.address }),
|
|
282
|
+
});
|
|
283
|
+
}
|
|
263
284
|
(0, core_utils_1.assert)(!!context, 0x2e8 /* "There should be a store context for the op" */);
|
|
264
285
|
context.rollback(envelope.contents, localOpMetadata);
|
|
265
286
|
}
|
|
266
287
|
async applyStashedOp(envelope) {
|
|
267
288
|
const context = this.contexts.get(envelope.address);
|
|
289
|
+
// If the data store has been deleted, log an error and ignore this message. This helps prevent document
|
|
290
|
+
// corruption in case the data store that stashed the op is deleted.
|
|
291
|
+
if (this.checkAndLogIfDeleted(envelope.address, context, "Changed", "applyStashedOp")) {
|
|
292
|
+
return undefined;
|
|
293
|
+
}
|
|
268
294
|
(0, core_utils_1.assert)(!!context, 0x161 /* "There should be a store context for the op" */);
|
|
269
295
|
return context.applyStashedOp(envelope.contents);
|
|
270
296
|
}
|
|
@@ -276,8 +302,12 @@ class DataStores {
|
|
|
276
302
|
processFluidDataStoreOp(message, local, localMessageMetadata) {
|
|
277
303
|
const envelope = message.contents;
|
|
278
304
|
const transformed = { ...message, contents: envelope.contents };
|
|
279
|
-
this.validateNotDeleted(envelope.address);
|
|
280
305
|
const context = this.contexts.get(envelope.address);
|
|
306
|
+
// If the data store has been deleted, log an error and ignore this message. This helps prevent document
|
|
307
|
+
// corruption in case a deleted data store accidentally submitted an op.
|
|
308
|
+
if (this.checkAndLogIfDeleted(envelope.address, context, "Changed", "processFluidDataStoreOp")) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
281
311
|
(0, core_utils_1.assert)(!!context, 0x162 /* "There should be a store context for the op" */);
|
|
282
312
|
context.process(transformed, local, localMessageMetadata);
|
|
283
313
|
// Notify that a GC node for the data store changed. This is used to detect if a deleted data store is
|
|
@@ -286,7 +316,11 @@ class DataStores {
|
|
|
286
316
|
}
|
|
287
317
|
async getDataStore(id, requestHeaderData) {
|
|
288
318
|
const headerData = { ...containerRuntime_1.defaultRuntimeHeaderData, ...requestHeaderData };
|
|
289
|
-
this.
|
|
319
|
+
if (this.checkAndLogIfDeleted(id, this.contexts.get(id), "Requested", "getDataStore", requestHeaderData)) {
|
|
320
|
+
// The requested data store has been deleted by gc. Create a 404 response exception.
|
|
321
|
+
const request = { url: id };
|
|
322
|
+
throw (0, runtime_utils_1.responseToException)((0, runtime_utils_1.createResponseError)(404, "DataStore was deleted", request), request);
|
|
323
|
+
}
|
|
290
324
|
const context = await this.contexts.getBoundOrRemoted(id, headerData.wait);
|
|
291
325
|
if (context === undefined) {
|
|
292
326
|
// The requested data store does not exits. Throw a 404 response exception.
|
|
@@ -299,8 +333,8 @@ class DataStores {
|
|
|
299
333
|
* Returns the data store requested with the given id if available. Otherwise, returns undefined.
|
|
300
334
|
*/
|
|
301
335
|
async getDataStoreIfAvailable(id, requestHeaderData) {
|
|
302
|
-
// If the data store has been deleted, return undefined.
|
|
303
|
-
if (this.
|
|
336
|
+
// If the data store has been deleted, log an error and return undefined.
|
|
337
|
+
if (this.checkAndLogIfDeleted(id, this.contexts.get(id), "Requested", "getDataStoreIfAvailable", requestHeaderData)) {
|
|
304
338
|
return undefined;
|
|
305
339
|
}
|
|
306
340
|
const headerData = { ...containerRuntime_1.defaultRuntimeHeaderData, ...requestHeaderData };
|
|
@@ -311,43 +345,34 @@ class DataStores {
|
|
|
311
345
|
return context;
|
|
312
346
|
}
|
|
313
347
|
/**
|
|
314
|
-
* Checks if the data store has been deleted by GC.
|
|
315
|
-
* @param id - data store id
|
|
316
|
-
* @param
|
|
317
|
-
* @param
|
|
348
|
+
* Checks if the data store has been deleted by GC. If so, log an error.
|
|
349
|
+
* @param id - The data store's id.
|
|
350
|
+
* @param context - The data store context.
|
|
351
|
+
* @param callSite - The function name this is called from.
|
|
352
|
+
* @param requestHeaderData - The request header information to log if the data store is deleted.
|
|
318
353
|
* @returns true if the data store is deleted. Otherwise, returns false.
|
|
319
354
|
*/
|
|
320
|
-
|
|
355
|
+
checkAndLogIfDeleted(id, context, deletedLogSuffix, callSite, requestHeaderData) {
|
|
321
356
|
const dataStoreNodePath = `/${id}`;
|
|
322
357
|
if (!this.isDataStoreDeleted(dataStoreNodePath)) {
|
|
323
358
|
return false;
|
|
324
359
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
isSummarizerClient: this.runtime.clientDetails.type === summary_1.summarizerClientType,
|
|
330
|
-
id,
|
|
360
|
+
this.mc.logger.sendErrorEvent({
|
|
361
|
+
eventName: `GC_Deleted_DataStore_${deletedLogSuffix}`,
|
|
362
|
+
...(0, telemetry_utils_1.tagCodeArtifacts)({ id }),
|
|
363
|
+
callSite,
|
|
331
364
|
headers: JSON.stringify(requestHeaderData),
|
|
332
|
-
|
|
333
|
-
}
|
|
365
|
+
exists: context !== undefined,
|
|
366
|
+
});
|
|
334
367
|
return true;
|
|
335
368
|
}
|
|
336
|
-
/**
|
|
337
|
-
* Validate that the data store had not been deleted by GC.
|
|
338
|
-
* @param id - data store id
|
|
339
|
-
* @param requestHeaderData - the request header information to log if the validation detects the data store has been deleted
|
|
340
|
-
*/
|
|
341
|
-
validateNotDeleted(id, requestHeaderData) {
|
|
342
|
-
if (this.checkIfDeleted(id, requestHeaderData)) {
|
|
343
|
-
// The requested data store is removed by gc. Create a 404 gc response exception.
|
|
344
|
-
const request = { url: id };
|
|
345
|
-
throw (0, runtime_utils_1.responseToException)((0, runtime_utils_1.createResponseError)(404, "DataStore was deleted", request), request);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
369
|
processSignal(fluidDataStoreId, message, local) {
|
|
349
|
-
this.validateNotDeleted(fluidDataStoreId);
|
|
350
370
|
const context = this.contexts.get(fluidDataStoreId);
|
|
371
|
+
// If the data store has been deleted, log an error and ignore this message. This helps prevent document
|
|
372
|
+
// corruption in case a deleted data store accidentally submitted a signal.
|
|
373
|
+
if (this.checkAndLogIfDeleted(fluidDataStoreId, context, "Changed", "processSignal")) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
351
376
|
if (!context) {
|
|
352
377
|
// Attach message may not have been processed yet
|
|
353
378
|
(0, core_utils_1.assert)(!local, 0x163 /* "Missing datastore for local signal" */);
|
|
@@ -399,8 +424,13 @@ class DataStores {
|
|
|
399
424
|
await Promise.all(Array.from(this.contexts)
|
|
400
425
|
.filter(([_, context]) => {
|
|
401
426
|
// Summarizer works only with clients with no local changes. A data store in attaching
|
|
402
|
-
// state indicates an op was sent to attach a local data store
|
|
403
|
-
|
|
427
|
+
// state indicates an op was sent to attach a local data store, and the the attach op
|
|
428
|
+
// had not yet round tripped back to the client.
|
|
429
|
+
if (context.attachState === container_definitions_1.AttachState.Attaching) {
|
|
430
|
+
// Formerly assert 0x588
|
|
431
|
+
const error = telemetry_utils_1.DataProcessingError.create("Local data store detected in attaching state during summarize", "summarize");
|
|
432
|
+
throw error;
|
|
433
|
+
}
|
|
404
434
|
return context.attachState === container_definitions_1.AttachState.Attached;
|
|
405
435
|
})
|
|
406
436
|
.map(async ([contextId, context]) => {
|
|
@@ -479,8 +509,13 @@ class DataStores {
|
|
|
479
509
|
await Promise.all(Array.from(this.contexts)
|
|
480
510
|
.filter(([_, context]) => {
|
|
481
511
|
// Summarizer client and hence GC works only with clients with no local changes. A data store in
|
|
482
|
-
// attaching state indicates an op was sent to attach a local data store
|
|
483
|
-
|
|
512
|
+
// attaching state indicates an op was sent to attach a local data store, and the the attach op
|
|
513
|
+
// had not yet round tripped back to the client.
|
|
514
|
+
// Formerly assert 0x589
|
|
515
|
+
if (context.attachState === container_definitions_1.AttachState.Attaching) {
|
|
516
|
+
const error = telemetry_utils_1.DataProcessingError.create("Local data store detected in attaching state while running GC", "getGCData");
|
|
517
|
+
throw error;
|
|
518
|
+
}
|
|
484
519
|
return context.attachState === container_definitions_1.AttachState.Attached;
|
|
485
520
|
})
|
|
486
521
|
.map(async ([contextId, context]) => {
|
|
@@ -543,21 +578,23 @@ class DataStores {
|
|
|
543
578
|
for (const route of sweepReadyDataStoreRoutes) {
|
|
544
579
|
const pathParts = route.split("/");
|
|
545
580
|
const dataStoreId = pathParts[1];
|
|
546
|
-
// TODO: GC:Validation - Skip any routes already deleted
|
|
547
581
|
// Ignore sub-data store routes because a data store and its sub-routes are deleted together, so, we only
|
|
548
582
|
// need to delete the data store.
|
|
549
583
|
if (pathParts.length > 2) {
|
|
550
584
|
continue;
|
|
551
585
|
}
|
|
552
|
-
|
|
586
|
+
const dataStoreContext = this.contexts.get(dataStoreId);
|
|
587
|
+
if (dataStoreContext === undefined) {
|
|
553
588
|
this.mc.logger.sendErrorEvent({
|
|
554
589
|
eventName: "DeletedDataStoreNotFound",
|
|
555
|
-
dataStoreId,
|
|
590
|
+
...(0, telemetry_utils_1.tagCodeArtifacts)({ id: dataStoreId }),
|
|
591
|
+
details: {
|
|
592
|
+
alreadyDeleted: this.isDataStoreDeleted(dataStoreId),
|
|
593
|
+
},
|
|
556
594
|
});
|
|
595
|
+
continue;
|
|
557
596
|
}
|
|
558
|
-
|
|
559
|
-
(0, core_utils_1.assert)(dataStore !== undefined, 0x571 /* Attempting to delete unknown dataStore */);
|
|
560
|
-
dataStore.delete();
|
|
597
|
+
dataStoreContext.delete();
|
|
561
598
|
// Delete the contexts of sweep ready data stores.
|
|
562
599
|
this.contexts.delete(dataStoreId);
|
|
563
600
|
// Delete the summarizer node of the sweep ready data stores.
|
package/dist/dataStores.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStores.js","sourceRoot":"","sources":["../src/dataStores.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,yDAA8D;AAE9D,6EAe6C;AAC7C,iEASuC;AACvC,qEAOyC;AACzC,iFAAoE;AACpE,+DAAiE;AACjE,2DAA0D;AAC1D,+BAAkC;AAClC,2DAAwD;AACxD,yDAAmG;AACnG,yDAM4B;AAC5B,mFAAgF;AAChF,2CAA8E;AAC9E,6BAAwF;AACxF,uCAKmB;AAInB;;;GAGG;AACH,MAAa,UAAU;IA4BtB,YACkB,YAAuC,EACvC,OAAyB,EACzB,cAAuD,EACvD,8BAGe,EACf,2BAAiD,EAClE,UAAgC,EACf,aAIR,EACQ,kBAAiD,E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AK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YAC1D,IAAI,CAAC,2BAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACrC,eAAe,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;aAC7B;SACD;QACD,OAAO;YACN,GAAG,QAAQ;YACX,KAAK,EAAE,eAAe;SACtB,CAAC;KACF;AACF,CAAC;AAzBD,0DAyBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tITelemetryBaseLogger,\n\tIDisposable,\n\tIFluidHandle,\n\tIRequest,\n} from \"@fluidframework/core-interfaces\";\nimport { FluidObjectHandle } from \"@fluidframework/datastore\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tAliasResult,\n\tchannelsTreeName,\n\tCreateChildSummarizerNodeFn,\n\tCreateChildSummarizerNodeParam,\n\tCreateSummarizerNodeSource,\n\tIAttachMessage,\n\tIEnvelope,\n\tIFluidDataStoreContextDetached,\n\tIGarbageCollectionData,\n\tIInboundSignalMessage,\n\tInboundAttachMessage,\n\tISummarizeResult,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertToSummaryTree,\n\tcreate404Response,\n\tcreateResponseError,\n\tGCDataBuilder,\n\tresponseToException,\n\tSummaryTreeBuilder,\n\tunpackChildNodesUsedRoutes,\n} from \"@fluidframework/runtime-utils\";\nimport {\n\tcreateChildMonitoringContext,\n\tDataCorruptionError,\n\textractSafePropertiesFromMessage,\n\tLoggingError,\n\tMonitoringContext,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport { assert, Lazy } from \"@fluidframework/core-utils\";\nimport { v4 as uuid } from \"uuid\";\nimport { DataStoreContexts } from \"./dataStoreContexts\";\nimport { ContainerRuntime, defaultRuntimeHeaderData, RuntimeHeaderData } from \"./containerRuntime\";\nimport {\n\tFluidDataStoreContext,\n\tRemoteFluidDataStoreContext,\n\tLocalFluidDataStoreContext,\n\tcreateAttributesBlob,\n\tLocalDetachedFluidDataStoreContext,\n} from \"./dataStoreContext\";\nimport { StorageServiceWithAttachBlobs } from \"./storageServiceWithAttachBlobs\";\nimport { IDataStoreAliasMessage, isDataStoreAliasMessage } from \"./dataStore\";\nimport { GCNodeType, disableDatastoreSweepKey, sendGCUnexpectedUsageEvent } from \"./gc\";\nimport {\n\tsummarizerClientType,\n\tIContainerRuntimeMetadata,\n\tnonDataStorePaths,\n\trootHasIsolatedChannels,\n} from \"./summary\";\n\ntype PendingAliasResolve = (success: boolean) => void;\n\n/**\n * This class encapsulates data store handling. Currently it is only used by the container runtime,\n * but eventually could be hosted on any channel once we formalize the channel api boundary.\n */\nexport class DataStores implements IDisposable {\n\t// Stores tracked by the Domain\n\tprivate readonly pendingAttach = new Map<string, IAttachMessage>();\n\t// 0.24 back-compat attachingBeforeSummary\n\tpublic readonly attachOpFiredForDataStore = new Set<string>();\n\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly disposeOnce = new Lazy<void>(() => this.contexts.dispose());\n\n\tpublic readonly containerLoadStats: {\n\t\t// number of dataStores during loadContainer\n\t\treadonly containerLoadDataStoreCount: number;\n\t\t// number of unreferenced dataStores during loadContainer\n\t\treadonly referencedDataStoreCount: number;\n\t};\n\n\t// Stores the ids of new data stores between two GC runs. This is used to notify the garbage collector of new\n\t// root data stores that are added.\n\tprivate dataStoresSinceLastGC: string[] = [];\n\t// The handle to the container runtime. This is used mainly for GC purposes to represent outbound reference from\n\t// the container runtime to other nodes.\n\tprivate readonly containerRuntimeHandle: IFluidHandle;\n\tprivate readonly pendingAliasMap: Map<string, Promise<AliasResult>> = new Map<\n\t\tstring,\n\t\tPromise<AliasResult>\n\t>();\n\n\tconstructor(\n\t\tprivate readonly baseSnapshot: ISnapshotTree | undefined,\n\t\tprivate readonly runtime: ContainerRuntime,\n\t\tprivate readonly submitAttachFn: (attachContent: IAttachMessage) => void,\n\t\tprivate readonly getCreateChildSummarizerNodeFn: (\n\t\t\tid: string,\n\t\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t\t) => CreateChildSummarizerNodeFn,\n\t\tprivate readonly deleteChildSummarizerNodeFn: (id: string) => void,\n\t\tbaseLogger: ITelemetryBaseLogger,\n\t\tprivate readonly gcNodeUpdated: (\n\t\t\tnodePath: string,\n\t\t\ttimestampMs: number,\n\t\t\tpackagePath?: readonly string[],\n\t\t) => void,\n\t\tprivate readonly isDataStoreDeleted: (nodePath: string) => boolean,\n\t\tprivate readonly aliasMap: Map<string, string>,\n\t\tprivate readonly contexts: DataStoreContexts = new DataStoreContexts(baseLogger),\n\t) {\n\t\tthis.mc = createChildMonitoringContext({ logger: baseLogger });\n\t\tthis.containerRuntimeHandle = new FluidObjectHandle(\n\t\t\tthis.runtime,\n\t\t\t\"/\",\n\t\t\tthis.runtime.IFluidHandleContext,\n\t\t);\n\n\t\t// Extract stores stored inside the snapshot\n\t\tconst fluidDataStores = new Map<string, ISnapshotTree>();\n\t\tif (baseSnapshot) {\n\t\t\tfor (const [key, value] of Object.entries(baseSnapshot.trees)) {\n\t\t\t\tfluidDataStores.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\tlet unreferencedDataStoreCount = 0;\n\t\t// Create a context for each of them\n\t\tfor (const [key, value] of fluidDataStores) {\n\t\t\tlet dataStoreContext: FluidDataStoreContext;\n\n\t\t\t// counting number of unreferenced data stores\n\t\t\tif (value.unreferenced) {\n\t\t\t\tunreferencedDataStoreCount++;\n\t\t\t}\n\t\t\t// If we have a detached container, then create local data store contexts.\n\t\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\t\tdataStoreContext = new RemoteFluidDataStoreContext({\n\t\t\t\t\tid: key,\n\t\t\t\t\tsnapshotTree: value,\n\t\t\t\t\truntime: this.runtime,\n\t\t\t\t\tstorage: this.runtime.storage,\n\t\t\t\t\tscope: this.runtime.scope,\n\t\t\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(key, {\n\t\t\t\t\t\ttype: CreateSummarizerNodeSource.FromSummary,\n\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif (typeof value !== \"object\") {\n\t\t\t\t\tthrow new LoggingError(\"Snapshot should be there to load from!!\");\n\t\t\t\t}\n\t\t\t\tconst snapshotTree = value;\n\t\t\t\tdataStoreContext = new LocalFluidDataStoreContext({\n\t\t\t\t\tid: key,\n\t\t\t\t\tpkg: undefined,\n\t\t\t\t\truntime: this.runtime,\n\t\t\t\t\tstorage: this.runtime.storage,\n\t\t\t\t\tscope: this.runtime.scope,\n\t\t\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(key, {\n\t\t\t\t\t\ttype: CreateSummarizerNodeSource.FromSummary,\n\t\t\t\t\t}),\n\t\t\t\t\tmakeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(key),\n\t\t\t\t\tsnapshotTree,\n\t\t\t\t\tisRootDataStore: undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.contexts.addBoundOrRemoted(dataStoreContext);\n\t\t}\n\t\tthis.containerLoadStats = {\n\t\t\tcontainerLoadDataStoreCount: fluidDataStores.size,\n\t\t\treferencedDataStoreCount: fluidDataStores.size - unreferencedDataStoreCount,\n\t\t};\n\t}\n\n\tpublic get aliases(): ReadonlyMap<string, string> {\n\t\treturn this.aliasMap;\n\t}\n\n\tpublic get pendingAliases(): Map<string, Promise<AliasResult>> {\n\t\treturn this.pendingAliasMap;\n\t}\n\n\tpublic async waitIfPendingAlias(maybeAlias: string): Promise<AliasResult> {\n\t\tconst pendingAliasPromise = this.pendingAliases.get(maybeAlias);\n\t\treturn pendingAliasPromise ?? \"Success\";\n\t}\n\n\tpublic processAttachMessage(message: ISequencedDocumentMessage, local: boolean) {\n\t\tconst attachMessage = message.contents as InboundAttachMessage;\n\n\t\tthis.dataStoresSinceLastGC.push(attachMessage.id);\n\n\t\t// The local object has already been attached\n\t\tif (local) {\n\t\t\tassert(\n\t\t\t\tthis.pendingAttach.has(attachMessage.id),\n\t\t\t\t0x15e /* \"Local object does not have matching attach message id\" */,\n\t\t\t);\n\t\t\tthis.contexts.get(attachMessage.id)?.emit(\"attached\");\n\t\t\tthis.pendingAttach.delete(attachMessage.id);\n\t\t\treturn;\n\t\t}\n\n\t\t// If a non-local operation then go and create the object, otherwise mark it as officially attached.\n\t\tif (this.alreadyProcessed(attachMessage.id)) {\n\t\t\t// TODO: dataStoreId may require a different tag from PackageData #7488\n\t\t\tconst error = new DataCorruptionError(\n\t\t\t\t// pre-0.58 error message: duplicateDataStoreCreatedWithExistingId\n\t\t\t\t\"Duplicate DataStore created with existing id\",\n\t\t\t\t{\n\t\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\t\t...tagCodeArtifacts({ dataStoreId: attachMessage.id }),\n\t\t\t\t},\n\t\t\t);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst flatAttachBlobs = new Map<string, ArrayBufferLike>();\n\t\tlet snapshotTree: ISnapshotTree | undefined;\n\t\tif (attachMessage.snapshot) {\n\t\t\tsnapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatAttachBlobs);\n\t\t}\n\n\t\t// Include the type of attach message which is the pkg of the store to be\n\t\t// used by RemoteFluidDataStoreContext in case it is not in the snapshot.\n\t\tconst pkg = [attachMessage.type];\n\t\tconst remoteFluidDataStoreContext = new RemoteFluidDataStoreContext({\n\t\t\tid: attachMessage.id,\n\t\t\tsnapshotTree,\n\t\t\truntime: this.runtime,\n\t\t\tstorage: new StorageServiceWithAttachBlobs(this.runtime.storage, flatAttachBlobs),\n\t\t\tscope: this.runtime.scope,\n\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(attachMessage.id, {\n\t\t\t\ttype: CreateSummarizerNodeSource.FromAttach,\n\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\tsnapshot: attachMessage.snapshot ?? {\n\t\t\t\t\tentries: [createAttributesBlob(pkg, true /* isRootDataStore */)],\n\t\t\t\t},\n\t\t\t}),\n\t\t\tpkg,\n\t\t});\n\n\t\tthis.contexts.addBoundOrRemoted(remoteFluidDataStoreContext);\n\t}\n\n\tpublic processAliasMessage(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocalOpMetadata: unknown,\n\t\tlocal: boolean,\n\t): void {\n\t\tconst aliasMessage = message.contents as IDataStoreAliasMessage;\n\t\tif (!isDataStoreAliasMessage(aliasMessage)) {\n\t\t\tthrow new DataCorruptionError(\"malformedDataStoreAliasMessage\", {\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t});\n\t\t}\n\n\t\tconst resolve = localOpMetadata as PendingAliasResolve;\n\t\tconst aliasResult = this.processAliasMessageCore(aliasMessage);\n\t\tif (local) {\n\t\t\tresolve(aliasResult);\n\t\t}\n\t}\n\n\tpublic processAliasMessageCore(aliasMessage: IDataStoreAliasMessage): boolean {\n\t\tif (this.alreadyProcessed(aliasMessage.alias)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst context = this.contexts.get(aliasMessage.internalId);\n\t\tif (context === undefined) {\n\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\teventName: \"AliasFluidDataStoreNotFound\",\n\t\t\t\tfluidDataStoreId: aliasMessage.internalId,\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\n\t\tconst handle = new FluidObjectHandle(\n\t\t\tcontext,\n\t\t\taliasMessage.internalId,\n\t\t\tthis.runtime.IFluidHandleContext,\n\t\t);\n\t\tthis.runtime.addedGCOutboundReference(this.containerRuntimeHandle, handle);\n\n\t\tthis.aliasMap.set(aliasMessage.alias, context.id);\n\t\tcontext.setInMemoryRoot();\n\t\treturn true;\n\t}\n\n\tprivate alreadyProcessed(id: string): boolean {\n\t\treturn this.aliasMap.get(id) !== undefined || this.contexts.get(id) !== undefined;\n\t}\n\n\t/**\n\t * Make the data stores locally visible in the container graph by moving the data store context from unbound to\n\t * bound list. This data store can now be reached from the root.\n\t * @param id - The id of the data store context to make visible.\n\t */\n\tprivate makeDataStoreLocallyVisible(id: string): void {\n\t\tconst localContext = this.contexts.getUnbound(id);\n\t\tassert(!!localContext, 0x15f /* \"Could not find unbound context to bind\" */);\n\n\t\t/**\n\t\t * If the container is not detached, it is globally visible to all clients. This data store should also be\n\t\t * globally visible. Move it to attaching state and send an \"attach\" op for it.\n\t\t * If the container is detached, this data store will be part of the summary that makes the container attached.\n\t\t */\n\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\tlocalContext.emit(\"attaching\");\n\t\t\tconst message = localContext.generateAttachMessage();\n\n\t\t\tthis.pendingAttach.set(id, message);\n\t\t\tthis.submitAttachFn(message);\n\t\t\tthis.attachOpFiredForDataStore.add(id);\n\t\t}\n\n\t\tthis.contexts.bind(id);\n\t}\n\n\tpublic createDetachedDataStoreCore(\n\t\tpkg: Readonly<string[]>,\n\t\tisRoot: boolean,\n\t\tid = uuid(),\n\t): IFluidDataStoreContextDetached {\n\t\tassert(!id.includes(\"/\"), 0x30c /* Id cannot contain slashes */);\n\n\t\tconst context = new LocalDetachedFluidDataStoreContext({\n\t\t\tid,\n\t\t\tpkg,\n\t\t\truntime: this.runtime,\n\t\t\tstorage: this.runtime.storage,\n\t\t\tscope: this.runtime.scope,\n\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(id, {\n\t\t\t\ttype: CreateSummarizerNodeSource.Local,\n\t\t\t}),\n\t\t\tmakeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(id),\n\t\t\tsnapshotTree: undefined,\n\t\t\tisRootDataStore: isRoot,\n\t\t});\n\t\tthis.contexts.addUnbound(context);\n\t\treturn context;\n\t}\n\n\tpublic _createFluidDataStoreContext(pkg: string[], id: string, props?: any) {\n\t\tassert(!id.includes(\"/\"), 0x30d /* Id cannot contain slashes */);\n\t\tconst context = new LocalFluidDataStoreContext({\n\t\t\tid,\n\t\t\tpkg,\n\t\t\truntime: this.runtime,\n\t\t\tstorage: this.runtime.storage,\n\t\t\tscope: this.runtime.scope,\n\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(id, {\n\t\t\t\ttype: CreateSummarizerNodeSource.Local,\n\t\t\t}),\n\t\t\tmakeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(id),\n\t\t\tsnapshotTree: undefined,\n\t\t\tisRootDataStore: false,\n\t\t\tcreateProps: props,\n\t\t});\n\t\tthis.contexts.addUnbound(context);\n\t\treturn context;\n\t}\n\n\tpublic get disposed() {\n\t\treturn this.disposeOnce.evaluated;\n\t}\n\tpublic readonly dispose = () => this.disposeOnce.value;\n\n\tpublic resubmitDataStoreOp(envelope: IEnvelope, localOpMetadata: unknown) {\n\t\tconst context = this.contexts.get(envelope.address);\n\t\tassert(!!context, 0x160 /* \"There should be a store context for the op\" */);\n\t\tcontext.reSubmit(envelope.contents, localOpMetadata);\n\t}\n\n\tpublic rollbackDataStoreOp(envelope: IEnvelope, localOpMetadata: unknown) {\n\t\tconst context = this.contexts.get(envelope.address);\n\t\tassert(!!context, 0x2e8 /* \"There should be a store context for the op\" */);\n\t\tcontext.rollback(envelope.contents, localOpMetadata);\n\t}\n\n\tpublic async applyStashedOp(envelope: IEnvelope): Promise<unknown> {\n\t\tconst context = this.contexts.get(envelope.address);\n\t\tassert(!!context, 0x161 /* \"There should be a store context for the op\" */);\n\t\treturn context.applyStashedOp(envelope.contents);\n\t}\n\n\tpublic async applyStashedAttachOp(message: IAttachMessage) {\n\t\tthis.pendingAttach.set(message.id, message);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tthis.processAttachMessage({ contents: message } as ISequencedDocumentMessage, false);\n\t}\n\n\tpublic processFluidDataStoreOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalMessageMetadata: unknown,\n\t) {\n\t\tconst envelope = message.contents as IEnvelope;\n\t\tconst transformed = { ...message, contents: envelope.contents };\n\t\tthis.validateNotDeleted(envelope.address);\n\t\tconst context = this.contexts.get(envelope.address);\n\t\tassert(!!context, 0x162 /* \"There should be a store context for the op\" */);\n\t\tcontext.process(transformed, local, localMessageMetadata);\n\n\t\t// Notify that a GC node for the data store changed. This is used to detect if a deleted data store is\n\t\t// being used.\n\t\tthis.gcNodeUpdated(\n\t\t\t`/${envelope.address}`,\n\t\t\tmessage.timestamp,\n\t\t\tcontext.isLoaded ? context.packagePath : undefined,\n\t\t);\n\t}\n\n\tpublic async getDataStore(\n\t\tid: string,\n\t\trequestHeaderData: RuntimeHeaderData,\n\t): Promise<FluidDataStoreContext> {\n\t\tconst headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };\n\t\tthis.validateNotDeleted(id, headerData);\n\n\t\tconst context = await this.contexts.getBoundOrRemoted(id, headerData.wait);\n\t\tif (context === undefined) {\n\t\t\t// The requested data store does not exits. Throw a 404 response exception.\n\t\t\tconst request: IRequest = { url: id };\n\t\t\tthrow responseToException(create404Response(request), request);\n\t\t}\n\t\treturn context;\n\t}\n\n\t/**\n\t * Returns the data store requested with the given id if available. Otherwise, returns undefined.\n\t */\n\tpublic async getDataStoreIfAvailable(\n\t\tid: string,\n\t\trequestHeaderData: RuntimeHeaderData,\n\t): Promise<FluidDataStoreContext | undefined> {\n\t\t// If the data store has been deleted, return undefined.\n\t\tif (this.checkIfDeleted(id, requestHeaderData)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };\n\t\tconst context = await this.contexts.getBoundOrRemoted(id, headerData.wait);\n\t\tif (context === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn context;\n\t}\n\n\t/**\n\t * Checks if the data store has been deleted by GC.\n\t * @param id - data store id\n\t * @param request - the request information to log if the validation detects the data store has been deleted\n\t * @param requestHeaderData - the request header information to log if the validation detects the data store has been deleted\n\t * @returns true if the data store is deleted. Otherwise, returns false.\n\t */\n\tprivate checkIfDeleted(id: string, requestHeaderData?: RuntimeHeaderData) {\n\t\tconst dataStoreNodePath = `/${id}`;\n\t\tif (!this.isDataStoreDeleted(dataStoreNodePath)) {\n\t\t\treturn false;\n\t\t}\n\t\tassert(\n\t\t\t!this.contexts.has(id),\n\t\t\t0x570 /* Inconsistent state! GC says the data store is deleted, but the data store is not deleted from the runtime. */,\n\t\t);\n\t\tsendGCUnexpectedUsageEvent(\n\t\t\tthis.mc,\n\t\t\t{\n\t\t\t\teventName: \"GC_Deleted_DataStore_Requested\",\n\t\t\t\tcategory: \"error\",\n\t\t\t\tisSummarizerClient: this.runtime.clientDetails.type === summarizerClientType,\n\t\t\t\tid,\n\t\t\t\theaders: JSON.stringify(requestHeaderData),\n\t\t\t\tgcTombstoneEnforcementAllowed: this.runtime.gcTombstoneEnforcementAllowed,\n\t\t\t},\n\t\t\tundefined /* packagePath */,\n\t\t);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Validate that the data store had not been deleted by GC.\n\t * @param id - data store id\n\t * @param requestHeaderData - the request header information to log if the validation detects the data store has been deleted\n\t */\n\tprivate validateNotDeleted(id: string, requestHeaderData?: RuntimeHeaderData) {\n\t\tif (this.checkIfDeleted(id, requestHeaderData)) {\n\t\t\t// The requested data store is removed by gc. Create a 404 gc response exception.\n\t\t\tconst request: IRequest = { url: id };\n\t\t\tthrow responseToException(\n\t\t\t\tcreateResponseError(404, \"DataStore was deleted\", request),\n\t\t\t\trequest,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic processSignal(fluidDataStoreId: string, message: IInboundSignalMessage, local: boolean) {\n\t\tthis.validateNotDeleted(fluidDataStoreId);\n\t\tconst context = this.contexts.get(fluidDataStoreId);\n\t\tif (!context) {\n\t\t\t// Attach message may not have been processed yet\n\t\t\tassert(!local, 0x163 /* \"Missing datastore for local signal\" */);\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"SignalFluidDataStoreNotFound\",\n\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\tfluidDataStoreId,\n\t\t\t\t}),\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tcontext.processSignal(message, local);\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\tfor (const [fluidDataStoreId, context] of this.contexts) {\n\t\t\ttry {\n\t\t\t\tcontext.setConnectionState(connected, clientId);\n\t\t\t} catch (error) {\n\t\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"SetConnectionStateError\",\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\t\tfluidDataStoreId,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\t\truntimeConnected: this.runtime.connected,\n\t\t\t\t\t\t\tconnected,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void {\n\t\tconst eventName = attachState === AttachState.Attaching ? \"attaching\" : \"attached\";\n\t\tfor (const [, context] of this.contexts) {\n\t\t\t// Fire only for bounded stores.\n\t\t\tif (!this.contexts.isNotBound(context.id)) {\n\t\t\t\tcontext.emit(eventName);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.contexts.size;\n\t}\n\n\tpublic async summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\tconst summaryBuilder = new SummaryTreeBuilder();\n\n\t\t// Iterate over each store and ask it to snapshot\n\t\tawait Promise.all(\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(([_, context]) => {\n\t\t\t\t\t// Summarizer works only with clients with no local changes. A data store in attaching\n\t\t\t\t\t// state indicates an op was sent to attach a local data store.\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcontext.attachState !== AttachState.Attaching,\n\t\t\t\t\t\t0x588 /* Local data store detected in attaching state during summarize */,\n\t\t\t\t\t);\n\t\t\t\t\treturn context.attachState === AttachState.Attached;\n\t\t\t\t})\n\t\t\t\t.map(async ([contextId, context]) => {\n\t\t\t\t\tconst contextSummary = await context.summarize(\n\t\t\t\t\t\tfullTree,\n\t\t\t\t\t\ttrackState,\n\t\t\t\t\t\ttelemetryContext,\n\t\t\t\t\t);\n\t\t\t\t\tsummaryBuilder.addWithStats(contextId, contextSummary);\n\t\t\t\t}),\n\t\t);\n\n\t\treturn summaryBuilder.getSummaryTree();\n\t}\n\n\tpublic createSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\t\t// Attaching graph of some stores can cause other stores to get bound too.\n\t\t// So keep taking summary until no new stores get bound.\n\t\tlet notBoundContextsLength: number;\n\t\tdo {\n\t\t\tconst builderTree = builder.summary.tree;\n\t\t\tnotBoundContextsLength = this.contexts.notBoundLength();\n\t\t\t// Iterate over each data store and ask it to snapshot\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(\n\t\t\t\t\t([key, _]) =>\n\t\t\t\t\t\t// Take summary of bounded data stores only, make sure we haven't summarized them already\n\t\t\t\t\t\t// and no attach op has been fired for that data store because for loader versions <= 0.24\n\t\t\t\t\t\t// we set attach state as \"attaching\" before taking createNew summary.\n\t\t\t\t\t\t!(\n\t\t\t\t\t\t\tthis.contexts.isNotBound(key) ||\n\t\t\t\t\t\t\tbuilderTree[key] ||\n\t\t\t\t\t\t\tthis.attachOpFiredForDataStore.has(key)\n\t\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\tlet dataStoreSummary: ISummarizeResult;\n\t\t\t\t\tif (value.isLoaded) {\n\t\t\t\t\t\tconst snapshot = value.generateAttachMessage().snapshot;\n\t\t\t\t\t\tdataStoreSummary = convertToSummaryTree(snapshot, true);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If this data store is not yet loaded, then there should be no changes in the snapshot from\n\t\t\t\t\t\t// which it was created as it is detached container. So just use the previous snapshot.\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t!!this.baseSnapshot,\n\t\t\t\t\t\t\t0x166 /* \"BaseSnapshot should be there as detached container loaded from snapshot\" */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdataStoreSummary = convertSnapshotTreeToSummaryTree(\n\t\t\t\t\t\t\tthis.baseSnapshot.trees[key],\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbuilder.addWithStats(key, dataStoreSummary);\n\t\t\t\t});\n\t\t} while (notBoundContextsLength !== this.contexts.notBoundLength());\n\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Before GC runs, called by the garbage collector to update any pending GC state.\n\t * The garbage collector needs to know all outbound references that are added. Since root data stores are not\n\t * explicitly marked as referenced, notify GC of new root data stores that were added since the last GC run.\n\t */\n\tpublic async updateStateBeforeGC(): Promise<void> {\n\t\tfor (const id of this.dataStoresSinceLastGC) {\n\t\t\tconst context = this.contexts.get(id);\n\t\t\tassert(context !== undefined, 0x2b6 /* Missing data store context */);\n\t\t\tif (await context.isRoot()) {\n\t\t\t\t// A root data store is basically a reference from the container runtime to the data store.\n\t\t\t\tconst handle = new FluidObjectHandle(context, id, this.runtime.IFluidHandleContext);\n\t\t\t\tthis.runtime.addedGCOutboundReference(this.containerRuntimeHandle, handle);\n\t\t\t}\n\t\t}\n\t\tthis.dataStoresSinceLastGC = [];\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. It does the following:\n\t *\n\t * 1. Calls into each child data store context to get its GC data.\n\t *\n\t * 2. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be\n\t * identified as belonging to the child.\n\t *\n\t * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent\n\t * the GC data of this channel.\n\t *\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst builder = new GCDataBuilder();\n\t\t// Iterate over each store and get their GC data.\n\t\tawait Promise.all(\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(([_, context]) => {\n\t\t\t\t\t// Summarizer client and hence GC works only with clients with no local changes. A data store in\n\t\t\t\t\t// attaching state indicates an op was sent to attach a local data store.\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcontext.attachState !== AttachState.Attaching,\n\t\t\t\t\t\t0x589 /* Local data store detected in attaching state while running GC */,\n\t\t\t\t\t);\n\t\t\t\t\treturn context.attachState === AttachState.Attached;\n\t\t\t\t})\n\t\t\t\t.map(async ([contextId, context]) => {\n\t\t\t\t\tconst contextGCData = await context.getGCData(fullGC);\n\t\t\t\t\t// Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.\n\t\t\t\t\t// This also gradually builds the id of each node to be a path from the root.\n\t\t\t\t\tbuilder.prefixAndAddNodes(contextId, contextGCData.gcNodes);\n\t\t\t\t}),\n\t\t);\n\n\t\t// Get the outbound routes and add a GC node for this channel.\n\t\tbuilder.addNode(\"/\", await this.getOutboundRoutes());\n\t\treturn builder.getGCData();\n\t}\n\n\t/**\n\t * After GC has run, called to notify this Container's data stores of routes that are used in it.\n\t * @param usedRoutes - The routes that are used in all data stores in this Container.\n\t */\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t// Get a map of data store ids to routes used in it.\n\t\tconst usedDataStoreRoutes = unpackChildNodesUsedRoutes(usedRoutes);\n\n\t\t// Verify that the used routes are correct.\n\t\tfor (const [id] of usedDataStoreRoutes) {\n\t\t\tassert(\n\t\t\t\tthis.contexts.has(id),\n\t\t\t\t0x167 /* \"Used route does not belong to any known data store\" */,\n\t\t\t);\n\t\t}\n\n\t\t// Update the used routes in each data store. Used routes is empty for unused data stores.\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tcontext.updateUsedRoutes(usedDataStoreRoutes.get(contextId) ?? []);\n\t\t}\n\t}\n\n\t/**\n\t * This is called to update objects whose routes are unused. The unused objects are deleted.\n\t * @param unusedRoutes - The routes that are unused in all data stores in this Container.\n\t */\n\tpublic updateUnusedRoutes(unusedRoutes: string[]) {\n\t\tfor (const route of unusedRoutes) {\n\t\t\tconst pathParts = route.split(\"/\");\n\t\t\t// Delete data store only if its route (/datastoreId) is in unusedRoutes. We don't want to delete a data\n\t\t\t// store based on its DDS being unused.\n\t\t\tif (pathParts.length > 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst dataStoreId = pathParts[1];\n\t\t\tassert(this.contexts.has(dataStoreId), 0x2d7 /* No data store with specified id */);\n\t\t\t// Delete the contexts of unused data stores.\n\t\t\tthis.contexts.delete(dataStoreId);\n\t\t\t// Delete the summarizer node of the unused data stores.\n\t\t\tthis.deleteChildSummarizerNodeFn(dataStoreId);\n\t\t}\n\t}\n\n\t/**\n\t * Delete data stores and its objects that are sweep ready.\n\t * @param sweepReadyDataStoreRoutes - The routes of data stores and its objects that are sweep ready and should\n\t * be deleted.\n\t * @returns The routes of data stores and its objects that were deleted.\n\t */\n\tpublic deleteSweepReadyNodes(sweepReadyDataStoreRoutes: string[]): string[] {\n\t\t// If sweep for data stores is not enabled, return empty list indicating nothing is deleted.\n\t\tif (this.mc.config.getBoolean(disableDatastoreSweepKey) === true) {\n\t\t\treturn [];\n\t\t}\n\t\tfor (const route of sweepReadyDataStoreRoutes) {\n\t\t\tconst pathParts = route.split(\"/\");\n\t\t\tconst dataStoreId = pathParts[1];\n\n\t\t\t// TODO: GC:Validation - Skip any routes already deleted\n\t\t\t// Ignore sub-data store routes because a data store and its sub-routes are deleted together, so, we only\n\t\t\t// need to delete the data store.\n\t\t\tif (pathParts.length > 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!this.contexts.has(dataStoreId)) {\n\t\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"DeletedDataStoreNotFound\",\n\t\t\t\t\tdataStoreId,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst dataStore = this.contexts.get(dataStoreId);\n\t\t\tassert(dataStore !== undefined, 0x571 /* Attempting to delete unknown dataStore */);\n\t\t\tdataStore.delete();\n\n\t\t\t// Delete the contexts of sweep ready data stores.\n\t\t\tthis.contexts.delete(dataStoreId);\n\t\t\t// Delete the summarizer node of the sweep ready data stores.\n\t\t\tthis.deleteChildSummarizerNodeFn(dataStoreId);\n\t\t}\n\t\treturn Array.from(sweepReadyDataStoreRoutes);\n\t}\n\n\t/**\n\t * This is called to update objects whose routes are tombstones. Tombstoned datastore contexts enable testing\n\t * scenarios with accessing deleted content without actually deleting content from summaries.\n\t * @param tombstonedRoutes - The routes that are tombstones in all data stores in this Container.\n\t */\n\tpublic updateTombstonedRoutes(tombstonedRoutes: string[]) {\n\t\tconst tombstonedDataStoresSet: Set<string> = new Set();\n\t\tfor (const route of tombstonedRoutes) {\n\t\t\tconst pathParts = route.split(\"/\");\n\t\t\t// Tombstone data store only if its route (/datastoreId) is directly in tombstoneRoutes.\n\t\t\tif (pathParts.length > 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst dataStoreId = pathParts[1];\n\t\t\tassert(this.contexts.has(dataStoreId), 0x510 /* No data store with specified id */);\n\t\t\ttombstonedDataStoresSet.add(dataStoreId);\n\t\t}\n\n\t\t// Update the used routes in each data store. Used routes is empty for unused data stores.\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tcontext.setTombstone(tombstonedDataStoresSet.has(contextId));\n\t\t}\n\t}\n\n\t/**\n\t * Returns the outbound routes of this channel. Only root data stores are considered referenced and their paths are\n\t * part of outbound routes.\n\t */\n\tprivate async getOutboundRoutes(): Promise<string[]> {\n\t\tconst outboundRoutes: string[] = [];\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tconst isRootDataStore = await context.isRoot();\n\t\t\tif (isRootDataStore) {\n\t\t\t\toutboundRoutes.push(`/${contextId}`);\n\t\t\t}\n\t\t}\n\t\treturn outboundRoutes;\n\t}\n\n\t/**\n\t * Called by GC to retrieve the package path of a data store node with the given path.\n\t */\n\tpublic async getDataStorePackagePath(nodePath: string): Promise<readonly string[] | undefined> {\n\t\t// If the node belongs to a data store, return its package path. For DDSes, we return the package path of the\n\t\t// data store that contains it.\n\t\tconst context = this.contexts.get(nodePath.split(\"/\")[1]);\n\t\treturn (await context?.getInitialSnapshotDetails())?.pkg;\n\t}\n\n\t/**\n\t * Called by GC to determine if a node is for a data store or for an object within a data store (for e.g. DDS).\n\t * @returns the GC node type if the node belongs to a data store or object within data store, undefined otherwise.\n\t */\n\tpublic getGCNodeType(nodePath: string): GCNodeType | undefined {\n\t\tconst pathParts = nodePath.split(\"/\");\n\t\tif (!this.contexts.has(pathParts[1])) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Data stores paths are of the format \"/dataStoreId\".\n\t\t// Sub data store paths are of the format \"/dataStoreId/subPath/...\".\n\t\tif (pathParts.length === 2) {\n\t\t\treturn GCNodeType.DataStore;\n\t\t}\n\t\treturn GCNodeType.SubDataStore;\n\t}\n}\n\nexport function getSummaryForDatastores(\n\tsnapshot: ISnapshotTree | undefined,\n\tmetadata?: IContainerRuntimeMetadata,\n): ISnapshotTree | undefined {\n\tif (!snapshot) {\n\t\treturn undefined;\n\t}\n\n\tif (rootHasIsolatedChannels(metadata)) {\n\t\tconst datastoresSnapshot = snapshot.trees[channelsTreeName];\n\t\tassert(!!datastoresSnapshot, 0x168 /* Expected tree in snapshot not found */);\n\t\treturn datastoresSnapshot;\n\t} else {\n\t\t// back-compat: strip out all non-datastore paths before giving to DataStores object.\n\t\tconst datastoresTrees: ISnapshotTree[\"trees\"] = {};\n\t\tfor (const [key, value] of Object.entries(snapshot.trees)) {\n\t\t\tif (!nonDataStorePaths.includes(key)) {\n\t\t\t\tdatastoresTrees[key] = value;\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\t...snapshot,\n\t\t\ttrees: datastoresTrees,\n\t\t};\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dataStores.js","sourceRoot":"","sources":["../src/dataStores.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,yDAA8D;AAE9D,6EAe6C;AAC7C,iEASuC;AACvC,qEAQyC;AACzC,iFAAoE;AACpE,+DAAiE;AACjE,2DAA0D;AAC1D,+BAAkC;AAClC,2DAAwD;AACxD,yDAAmG;AACnG,yDAM4B;AAC5B,mFAAgF;AAChF,2CAA8E;AAC9E,6BAA4D;AAC5D,uCAAkG;AAIlG;;;GAGG;AACH,MAAa,UAAU;IA4BtB,YACkB,YAAuC,EACvC,OAAyB,EACzB,cAAuD,EACvD,8BAGe,EACf,2BAAiD,EAClE,UAAgC,EACf,aAIR,EACQ,kBAAiD,EACjD,QAA6B,EAC7B,WAA8B,IAAI,qCAAiB,CAAC,UAAU,CAAC;QAhB/D,iBAAY,GAAZ,YAAY,CAA2B;QACvC,YAAO,GAAP,OAAO,CAAkB;QACzB,mBAAc,GAAd,cAAc,CAAyC;QACvD,mCAA8B,GAA9B,8BAA8B,CAGf;QACf,gCAA2B,GAA3B,2BAA2B,CAAsB;QAEjD,kBAAa,GAAb,aAAa,CAIrB;QACQ,uBAAkB,GAAlB,kBAAkB,CAA+B;QACjD,aAAQ,GAAR,QAAQ,CAAqB;QAC7B,aAAQ,GAAR,QAAQ,CAAuD;QA5CjF,+BAA+B;QACd,kBAAa,GAAG,IAAI,GAAG,EAA0B,CAAC;QACnE,0CAA0C;QAC1B,8BAAyB,GAAG,IAAI,GAAG,EAAU,CAAC;QAI7C,gBAAW,GAAG,IAAI,iBAAI,CAAO,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;QA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DAAsD;QACtD,qEAAqE;QACrE,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAC3B,OAAO,eAAU,CAAC,SAAS,CAAC;SAC5B;QACD,OAAO,eAAU,CAAC,YAAY,CAAC;IAChC,CAAC;CACD;AA90BD,gCA80BC;AAED,SAAgB,uBAAuB,CACtC,QAAmC,EACnC,QAAoC;IAEpC,IAAI,CAAC,QAAQ,EAAE;QACd,OAAO,SAAS,CAAC;KACjB;IAED,IAAI,IAAA,iCAAuB,EAAC,QAAQ,CAAC,EAAE;QACtC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,KAAK,CAAC,sCAAgB,CAAC,CAAC;QAC5D,IAAA,mBAAM,EAAC,CAAC,CAAC,kBAAkB,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC9E,OAAO,kBAAkB,CAAC;KAC1B;SAAM;QACN,qFAAqF;QACrF,MAAM,eAAe,GAA2B,EAAE,CAAC;QACnD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YAC1D,IAAI,CAAC,2BAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACrC,eAAe,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;aAC7B;SACD;QACD,OAAO;YACN,GAAG,QAAQ;YACX,KAAK,EAAE,eAAe;SACtB,CAAC;KACF;AACF,CAAC;AAzBD,0DAyBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tITelemetryBaseLogger,\n\tIDisposable,\n\tIFluidHandle,\n\tIRequest,\n} from \"@fluidframework/core-interfaces\";\nimport { FluidObjectHandle } from \"@fluidframework/datastore\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tAliasResult,\n\tchannelsTreeName,\n\tCreateChildSummarizerNodeFn,\n\tCreateChildSummarizerNodeParam,\n\tCreateSummarizerNodeSource,\n\tIAttachMessage,\n\tIEnvelope,\n\tIFluidDataStoreContextDetached,\n\tIGarbageCollectionData,\n\tIInboundSignalMessage,\n\tInboundAttachMessage,\n\tISummarizeResult,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertToSummaryTree,\n\tcreate404Response,\n\tcreateResponseError,\n\tGCDataBuilder,\n\tresponseToException,\n\tSummaryTreeBuilder,\n\tunpackChildNodesUsedRoutes,\n} from \"@fluidframework/runtime-utils\";\nimport {\n\tcreateChildMonitoringContext,\n\tDataCorruptionError,\n\tDataProcessingError,\n\textractSafePropertiesFromMessage,\n\tLoggingError,\n\tMonitoringContext,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport { assert, Lazy } from \"@fluidframework/core-utils\";\nimport { v4 as uuid } from \"uuid\";\nimport { DataStoreContexts } from \"./dataStoreContexts\";\nimport { ContainerRuntime, defaultRuntimeHeaderData, RuntimeHeaderData } from \"./containerRuntime\";\nimport {\n\tFluidDataStoreContext,\n\tRemoteFluidDataStoreContext,\n\tLocalFluidDataStoreContext,\n\tcreateAttributesBlob,\n\tLocalDetachedFluidDataStoreContext,\n} from \"./dataStoreContext\";\nimport { StorageServiceWithAttachBlobs } from \"./storageServiceWithAttachBlobs\";\nimport { IDataStoreAliasMessage, isDataStoreAliasMessage } from \"./dataStore\";\nimport { GCNodeType, disableDatastoreSweepKey } from \"./gc\";\nimport { IContainerRuntimeMetadata, nonDataStorePaths, rootHasIsolatedChannels } from \"./summary\";\n\ntype PendingAliasResolve = (success: boolean) => void;\n\n/**\n * This class encapsulates data store handling. Currently it is only used by the container runtime,\n * but eventually could be hosted on any channel once we formalize the channel api boundary.\n */\nexport class DataStores implements IDisposable {\n\t// Stores tracked by the Domain\n\tprivate readonly pendingAttach = new Map<string, IAttachMessage>();\n\t// 0.24 back-compat attachingBeforeSummary\n\tpublic readonly attachOpFiredForDataStore = new Set<string>();\n\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly disposeOnce = new Lazy<void>(() => this.contexts.dispose());\n\n\tpublic readonly containerLoadStats: {\n\t\t// number of dataStores during loadContainer\n\t\treadonly containerLoadDataStoreCount: number;\n\t\t// number of unreferenced dataStores during loadContainer\n\t\treadonly referencedDataStoreCount: number;\n\t};\n\n\t// Stores the ids of new data stores between two GC runs. This is used to notify the garbage collector of new\n\t// root data stores that are added.\n\tprivate dataStoresSinceLastGC: string[] = [];\n\t// The handle to the container runtime. This is used mainly for GC purposes to represent outbound reference from\n\t// the container runtime to other nodes.\n\tprivate readonly containerRuntimeHandle: IFluidHandle;\n\tprivate readonly pendingAliasMap: Map<string, Promise<AliasResult>> = new Map<\n\t\tstring,\n\t\tPromise<AliasResult>\n\t>();\n\n\tconstructor(\n\t\tprivate readonly baseSnapshot: ISnapshotTree | undefined,\n\t\tprivate readonly runtime: ContainerRuntime,\n\t\tprivate readonly submitAttachFn: (attachContent: IAttachMessage) => void,\n\t\tprivate readonly getCreateChildSummarizerNodeFn: (\n\t\t\tid: string,\n\t\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t\t) => CreateChildSummarizerNodeFn,\n\t\tprivate readonly deleteChildSummarizerNodeFn: (id: string) => void,\n\t\tbaseLogger: ITelemetryBaseLogger,\n\t\tprivate readonly gcNodeUpdated: (\n\t\t\tnodePath: string,\n\t\t\ttimestampMs: number,\n\t\t\tpackagePath?: readonly string[],\n\t\t) => void,\n\t\tprivate readonly isDataStoreDeleted: (nodePath: string) => boolean,\n\t\tprivate readonly aliasMap: Map<string, string>,\n\t\tprivate readonly contexts: DataStoreContexts = new DataStoreContexts(baseLogger),\n\t) {\n\t\tthis.mc = createChildMonitoringContext({ logger: baseLogger });\n\t\tthis.containerRuntimeHandle = new FluidObjectHandle(\n\t\t\tthis.runtime,\n\t\t\t\"/\",\n\t\t\tthis.runtime.IFluidHandleContext,\n\t\t);\n\n\t\t// Extract stores stored inside the snapshot\n\t\tconst fluidDataStores = new Map<string, ISnapshotTree>();\n\t\tif (baseSnapshot) {\n\t\t\tfor (const [key, value] of Object.entries(baseSnapshot.trees)) {\n\t\t\t\tfluidDataStores.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\tlet unreferencedDataStoreCount = 0;\n\t\t// Create a context for each of them\n\t\tfor (const [key, value] of fluidDataStores) {\n\t\t\tlet dataStoreContext: FluidDataStoreContext;\n\n\t\t\t// counting number of unreferenced data stores\n\t\t\tif (value.unreferenced) {\n\t\t\t\tunreferencedDataStoreCount++;\n\t\t\t}\n\t\t\t// If we have a detached container, then create local data store contexts.\n\t\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\t\tdataStoreContext = new RemoteFluidDataStoreContext({\n\t\t\t\t\tid: key,\n\t\t\t\t\tsnapshotTree: value,\n\t\t\t\t\truntime: this.runtime,\n\t\t\t\t\tstorage: this.runtime.storage,\n\t\t\t\t\tscope: this.runtime.scope,\n\t\t\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(key, {\n\t\t\t\t\t\ttype: CreateSummarizerNodeSource.FromSummary,\n\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif (typeof value !== \"object\") {\n\t\t\t\t\tthrow new LoggingError(\"Snapshot should be there to load from!!\");\n\t\t\t\t}\n\t\t\t\tconst snapshotTree = value;\n\t\t\t\tdataStoreContext = new LocalFluidDataStoreContext({\n\t\t\t\t\tid: key,\n\t\t\t\t\tpkg: undefined,\n\t\t\t\t\truntime: this.runtime,\n\t\t\t\t\tstorage: this.runtime.storage,\n\t\t\t\t\tscope: this.runtime.scope,\n\t\t\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(key, {\n\t\t\t\t\t\ttype: CreateSummarizerNodeSource.FromSummary,\n\t\t\t\t\t}),\n\t\t\t\t\tmakeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(key),\n\t\t\t\t\tsnapshotTree,\n\t\t\t\t\tisRootDataStore: undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.contexts.addBoundOrRemoted(dataStoreContext);\n\t\t}\n\t\tthis.containerLoadStats = {\n\t\t\tcontainerLoadDataStoreCount: fluidDataStores.size,\n\t\t\treferencedDataStoreCount: fluidDataStores.size - unreferencedDataStoreCount,\n\t\t};\n\t}\n\n\tpublic get aliases(): ReadonlyMap<string, string> {\n\t\treturn this.aliasMap;\n\t}\n\n\tpublic get pendingAliases(): Map<string, Promise<AliasResult>> {\n\t\treturn this.pendingAliasMap;\n\t}\n\n\tpublic async waitIfPendingAlias(maybeAlias: string): Promise<AliasResult> {\n\t\tconst pendingAliasPromise = this.pendingAliases.get(maybeAlias);\n\t\treturn pendingAliasPromise ?? \"Success\";\n\t}\n\n\tpublic processAttachMessage(message: ISequencedDocumentMessage, local: boolean) {\n\t\tconst attachMessage = message.contents as InboundAttachMessage;\n\n\t\tthis.dataStoresSinceLastGC.push(attachMessage.id);\n\n\t\t// The local object has already been attached\n\t\tif (local) {\n\t\t\tassert(\n\t\t\t\tthis.pendingAttach.has(attachMessage.id),\n\t\t\t\t0x15e /* \"Local object does not have matching attach message id\" */,\n\t\t\t);\n\t\t\tthis.contexts.get(attachMessage.id)?.emit(\"attached\");\n\t\t\tthis.pendingAttach.delete(attachMessage.id);\n\t\t\treturn;\n\t\t}\n\n\t\t// If a non-local operation then go and create the object, otherwise mark it as officially attached.\n\t\tif (this.alreadyProcessed(attachMessage.id)) {\n\t\t\t// TODO: dataStoreId may require a different tag from PackageData #7488\n\t\t\tconst error = new DataCorruptionError(\n\t\t\t\t// pre-0.58 error message: duplicateDataStoreCreatedWithExistingId\n\t\t\t\t\"Duplicate DataStore created with existing id\",\n\t\t\t\t{\n\t\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\t\t...tagCodeArtifacts({ dataStoreId: attachMessage.id }),\n\t\t\t\t},\n\t\t\t);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst flatAttachBlobs = new Map<string, ArrayBufferLike>();\n\t\tlet snapshotTree: ISnapshotTree | undefined;\n\t\tif (attachMessage.snapshot) {\n\t\t\tsnapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatAttachBlobs);\n\t\t}\n\n\t\t// Include the type of attach message which is the pkg of the store to be\n\t\t// used by RemoteFluidDataStoreContext in case it is not in the snapshot.\n\t\tconst pkg = [attachMessage.type];\n\t\tconst remoteFluidDataStoreContext = new RemoteFluidDataStoreContext({\n\t\t\tid: attachMessage.id,\n\t\t\tsnapshotTree,\n\t\t\truntime: this.runtime,\n\t\t\tstorage: new StorageServiceWithAttachBlobs(this.runtime.storage, flatAttachBlobs),\n\t\t\tscope: this.runtime.scope,\n\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(attachMessage.id, {\n\t\t\t\ttype: CreateSummarizerNodeSource.FromAttach,\n\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\tsnapshot: attachMessage.snapshot ?? {\n\t\t\t\t\tentries: [createAttributesBlob(pkg, true /* isRootDataStore */)],\n\t\t\t\t},\n\t\t\t}),\n\t\t\tpkg,\n\t\t});\n\n\t\tthis.contexts.addBoundOrRemoted(remoteFluidDataStoreContext);\n\t}\n\n\tpublic processAliasMessage(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocalOpMetadata: unknown,\n\t\tlocal: boolean,\n\t): void {\n\t\tconst aliasMessage = message.contents as IDataStoreAliasMessage;\n\t\tif (!isDataStoreAliasMessage(aliasMessage)) {\n\t\t\tthrow new DataCorruptionError(\"malformedDataStoreAliasMessage\", {\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t});\n\t\t}\n\n\t\tconst resolve = localOpMetadata as PendingAliasResolve;\n\t\tconst aliasResult = this.processAliasMessageCore(aliasMessage);\n\t\tif (local) {\n\t\t\tresolve(aliasResult);\n\t\t}\n\t}\n\n\tpublic processAliasMessageCore(aliasMessage: IDataStoreAliasMessage): boolean {\n\t\tif (this.alreadyProcessed(aliasMessage.alias)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst context = this.contexts.get(aliasMessage.internalId);\n\t\t// If the data store has been deleted, log an error and ignore this message. This helps prevent document\n\t\t// corruption in case a deleted data store accidentally submitted a signal.\n\t\tif (\n\t\t\tthis.checkAndLogIfDeleted(\n\t\t\t\taliasMessage.internalId,\n\t\t\t\tcontext,\n\t\t\t\t\"Changed\",\n\t\t\t\t\"processAliasMessageCore\",\n\t\t\t)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (context === undefined) {\n\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\teventName: \"AliasFluidDataStoreNotFound\",\n\t\t\t\tfluidDataStoreId: aliasMessage.internalId,\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\n\t\tconst handle = new FluidObjectHandle(\n\t\t\tcontext,\n\t\t\taliasMessage.internalId,\n\t\t\tthis.runtime.IFluidHandleContext,\n\t\t);\n\t\tthis.runtime.addedGCOutboundReference(this.containerRuntimeHandle, handle);\n\n\t\tthis.aliasMap.set(aliasMessage.alias, context.id);\n\t\tcontext.setInMemoryRoot();\n\t\treturn true;\n\t}\n\n\tprivate alreadyProcessed(id: string): boolean {\n\t\treturn this.aliasMap.get(id) !== undefined || this.contexts.get(id) !== undefined;\n\t}\n\n\t/**\n\t * Make the data stores locally visible in the container graph by moving the data store context from unbound to\n\t * bound list. This data store can now be reached from the root.\n\t * @param id - The id of the data store context to make visible.\n\t */\n\tprivate makeDataStoreLocallyVisible(id: string): void {\n\t\tconst localContext = this.contexts.getUnbound(id);\n\t\tassert(!!localContext, 0x15f /* \"Could not find unbound context to bind\" */);\n\n\t\t/**\n\t\t * If the container is not detached, it is globally visible to all clients. This data store should also be\n\t\t * globally visible. Move it to attaching state and send an \"attach\" op for it.\n\t\t * If the container is detached, this data store will be part of the summary that makes the container attached.\n\t\t */\n\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\tlocalContext.emit(\"attaching\");\n\t\t\tconst message = localContext.generateAttachMessage();\n\n\t\t\tthis.pendingAttach.set(id, message);\n\t\t\tthis.submitAttachFn(message);\n\t\t\tthis.attachOpFiredForDataStore.add(id);\n\t\t}\n\n\t\tthis.contexts.bind(id);\n\t}\n\n\tpublic createDetachedDataStoreCore(\n\t\tpkg: Readonly<string[]>,\n\t\tisRoot: boolean,\n\t\tid = uuid(),\n\t): IFluidDataStoreContextDetached {\n\t\tassert(!id.includes(\"/\"), 0x30c /* Id cannot contain slashes */);\n\n\t\tconst context = new LocalDetachedFluidDataStoreContext({\n\t\t\tid,\n\t\t\tpkg,\n\t\t\truntime: this.runtime,\n\t\t\tstorage: this.runtime.storage,\n\t\t\tscope: this.runtime.scope,\n\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(id, {\n\t\t\t\ttype: CreateSummarizerNodeSource.Local,\n\t\t\t}),\n\t\t\tmakeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(id),\n\t\t\tsnapshotTree: undefined,\n\t\t\tisRootDataStore: isRoot,\n\t\t});\n\t\tthis.contexts.addUnbound(context);\n\t\treturn context;\n\t}\n\n\tpublic _createFluidDataStoreContext(pkg: string[], id: string, props?: any) {\n\t\tassert(!id.includes(\"/\"), 0x30d /* Id cannot contain slashes */);\n\t\tconst context = new LocalFluidDataStoreContext({\n\t\t\tid,\n\t\t\tpkg,\n\t\t\truntime: this.runtime,\n\t\t\tstorage: this.runtime.storage,\n\t\t\tscope: this.runtime.scope,\n\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(id, {\n\t\t\t\ttype: CreateSummarizerNodeSource.Local,\n\t\t\t}),\n\t\t\tmakeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(id),\n\t\t\tsnapshotTree: undefined,\n\t\t\tisRootDataStore: false,\n\t\t\tcreateProps: props,\n\t\t});\n\t\tthis.contexts.addUnbound(context);\n\t\treturn context;\n\t}\n\n\tpublic get disposed() {\n\t\treturn this.disposeOnce.evaluated;\n\t}\n\tpublic readonly dispose = () => this.disposeOnce.value;\n\n\tpublic resubmitDataStoreOp(envelope: IEnvelope, localOpMetadata: unknown) {\n\t\tconst context = this.contexts.get(envelope.address);\n\t\t// If the data store has been deleted, log an error and throw an error. If there are local changes for a\n\t\t// deleted data store, it can otherwise lead to inconsistent state when compared to other clients.\n\t\tif (\n\t\t\tthis.checkAndLogIfDeleted(envelope.address, context, \"Changed\", \"resubmitDataStoreOp\")\n\t\t) {\n\t\t\tthrow new DataCorruptionError(\"Context is deleted!\", {\n\t\t\t\tcallSite: \"resubmitDataStoreOp\",\n\t\t\t\t...tagCodeArtifacts({ id: envelope.address }),\n\t\t\t});\n\t\t}\n\t\tassert(!!context, 0x160 /* \"There should be a store context for the op\" */);\n\t\tcontext.reSubmit(envelope.contents, localOpMetadata);\n\t}\n\n\tpublic rollbackDataStoreOp(envelope: IEnvelope, localOpMetadata: unknown) {\n\t\tconst context = this.contexts.get(envelope.address);\n\t\t// If the data store has been deleted, log an error and throw an error. If there are local changes for a\n\t\t// deleted data store, it can otherwise lead to inconsistent state when compared to other clients.\n\t\tif (\n\t\t\tthis.checkAndLogIfDeleted(envelope.address, context, \"Changed\", \"rollbackDataStoreOp\")\n\t\t) {\n\t\t\tthrow new DataCorruptionError(\"Context is deleted!\", {\n\t\t\t\tcallSite: \"rollbackDataStoreOp\",\n\t\t\t\t...tagCodeArtifacts({ id: envelope.address }),\n\t\t\t});\n\t\t}\n\t\tassert(!!context, 0x2e8 /* \"There should be a store context for the op\" */);\n\t\tcontext.rollback(envelope.contents, localOpMetadata);\n\t}\n\n\tpublic async applyStashedOp(envelope: IEnvelope): Promise<unknown> {\n\t\tconst context = this.contexts.get(envelope.address);\n\t\t// If the data store has been deleted, log an error and ignore this message. This helps prevent document\n\t\t// corruption in case the data store that stashed the op is deleted.\n\t\tif (this.checkAndLogIfDeleted(envelope.address, context, \"Changed\", \"applyStashedOp\")) {\n\t\t\treturn undefined;\n\t\t}\n\t\tassert(!!context, 0x161 /* \"There should be a store context for the op\" */);\n\t\treturn context.applyStashedOp(envelope.contents);\n\t}\n\n\tpublic async applyStashedAttachOp(message: IAttachMessage) {\n\t\tthis.pendingAttach.set(message.id, message);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tthis.processAttachMessage({ contents: message } as ISequencedDocumentMessage, false);\n\t}\n\n\tpublic processFluidDataStoreOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalMessageMetadata: unknown,\n\t) {\n\t\tconst envelope = message.contents as IEnvelope;\n\t\tconst transformed = { ...message, contents: envelope.contents };\n\t\tconst context = this.contexts.get(envelope.address);\n\n\t\t// If the data store has been deleted, log an error and ignore this message. This helps prevent document\n\t\t// corruption in case a deleted data store accidentally submitted an op.\n\t\tif (\n\t\t\tthis.checkAndLogIfDeleted(\n\t\t\t\tenvelope.address,\n\t\t\t\tcontext,\n\t\t\t\t\"Changed\",\n\t\t\t\t\"processFluidDataStoreOp\",\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(!!context, 0x162 /* \"There should be a store context for the op\" */);\n\t\tcontext.process(transformed, local, localMessageMetadata);\n\n\t\t// Notify that a GC node for the data store changed. This is used to detect if a deleted data store is\n\t\t// being used.\n\t\tthis.gcNodeUpdated(\n\t\t\t`/${envelope.address}`,\n\t\t\tmessage.timestamp,\n\t\t\tcontext.isLoaded ? context.packagePath : undefined,\n\t\t);\n\t}\n\n\tpublic async getDataStore(\n\t\tid: string,\n\t\trequestHeaderData: RuntimeHeaderData,\n\t): Promise<FluidDataStoreContext> {\n\t\tconst headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };\n\t\tif (\n\t\t\tthis.checkAndLogIfDeleted(\n\t\t\t\tid,\n\t\t\t\tthis.contexts.get(id),\n\t\t\t\t\"Requested\",\n\t\t\t\t\"getDataStore\",\n\t\t\t\trequestHeaderData,\n\t\t\t)\n\t\t) {\n\t\t\t// The requested data store has been deleted by gc. Create a 404 response exception.\n\t\t\tconst request: IRequest = { url: id };\n\t\t\tthrow responseToException(\n\t\t\t\tcreateResponseError(404, \"DataStore was deleted\", request),\n\t\t\t\trequest,\n\t\t\t);\n\t\t}\n\n\t\tconst context = await this.contexts.getBoundOrRemoted(id, headerData.wait);\n\t\tif (context === undefined) {\n\t\t\t// The requested data store does not exits. Throw a 404 response exception.\n\t\t\tconst request: IRequest = { url: id };\n\t\t\tthrow responseToException(create404Response(request), request);\n\t\t}\n\t\treturn context;\n\t}\n\n\t/**\n\t * Returns the data store requested with the given id if available. Otherwise, returns undefined.\n\t */\n\tpublic async getDataStoreIfAvailable(\n\t\tid: string,\n\t\trequestHeaderData: RuntimeHeaderData,\n\t): Promise<FluidDataStoreContext | undefined> {\n\t\t// If the data store has been deleted, log an error and return undefined.\n\t\tif (\n\t\t\tthis.checkAndLogIfDeleted(\n\t\t\t\tid,\n\t\t\t\tthis.contexts.get(id),\n\t\t\t\t\"Requested\",\n\t\t\t\t\"getDataStoreIfAvailable\",\n\t\t\t\trequestHeaderData,\n\t\t\t)\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };\n\t\tconst context = await this.contexts.getBoundOrRemoted(id, headerData.wait);\n\t\tif (context === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn context;\n\t}\n\n\t/**\n\t * Checks if the data store has been deleted by GC. If so, log an error.\n\t * @param id - The data store's id.\n\t * @param context - The data store context.\n\t * @param callSite - The function name this is called from.\n\t * @param requestHeaderData - The request header information to log if the data store is deleted.\n\t * @returns true if the data store is deleted. Otherwise, returns false.\n\t */\n\tprivate checkAndLogIfDeleted(\n\t\tid: string,\n\t\tcontext: FluidDataStoreContext | undefined,\n\t\tdeletedLogSuffix: string,\n\t\tcallSite: string,\n\t\trequestHeaderData?: RuntimeHeaderData,\n\t) {\n\t\tconst dataStoreNodePath = `/${id}`;\n\t\tif (!this.isDataStoreDeleted(dataStoreNodePath)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.mc.logger.sendErrorEvent({\n\t\t\teventName: `GC_Deleted_DataStore_${deletedLogSuffix}`,\n\t\t\t...tagCodeArtifacts({ id }),\n\t\t\tcallSite,\n\t\t\theaders: JSON.stringify(requestHeaderData),\n\t\t\texists: context !== undefined,\n\t\t});\n\t\treturn true;\n\t}\n\n\tpublic processSignal(fluidDataStoreId: string, message: IInboundSignalMessage, local: boolean) {\n\t\tconst context = this.contexts.get(fluidDataStoreId);\n\t\t// If the data store has been deleted, log an error and ignore this message. This helps prevent document\n\t\t// corruption in case a deleted data store accidentally submitted a signal.\n\t\tif (this.checkAndLogIfDeleted(fluidDataStoreId, context, \"Changed\", \"processSignal\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!context) {\n\t\t\t// Attach message may not have been processed yet\n\t\t\tassert(!local, 0x163 /* \"Missing datastore for local signal\" */);\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"SignalFluidDataStoreNotFound\",\n\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\tfluidDataStoreId,\n\t\t\t\t}),\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tcontext.processSignal(message, local);\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\tfor (const [fluidDataStoreId, context] of this.contexts) {\n\t\t\ttry {\n\t\t\t\tcontext.setConnectionState(connected, clientId);\n\t\t\t} catch (error) {\n\t\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"SetConnectionStateError\",\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\t\tfluidDataStoreId,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\t\truntimeConnected: this.runtime.connected,\n\t\t\t\t\t\t\tconnected,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void {\n\t\tconst eventName = attachState === AttachState.Attaching ? \"attaching\" : \"attached\";\n\t\tfor (const [, context] of this.contexts) {\n\t\t\t// Fire only for bounded stores.\n\t\t\tif (!this.contexts.isNotBound(context.id)) {\n\t\t\t\tcontext.emit(eventName);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.contexts.size;\n\t}\n\n\tpublic async summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\tconst summaryBuilder = new SummaryTreeBuilder();\n\n\t\t// Iterate over each store and ask it to snapshot\n\t\tawait Promise.all(\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(([_, context]) => {\n\t\t\t\t\t// Summarizer works only with clients with no local changes. A data store in attaching\n\t\t\t\t\t// state indicates an op was sent to attach a local data store, and the the attach op\n\t\t\t\t\t// had not yet round tripped back to the client.\n\t\t\t\t\tif (context.attachState === AttachState.Attaching) {\n\t\t\t\t\t\t// Formerly assert 0x588\n\t\t\t\t\t\tconst error = DataProcessingError.create(\n\t\t\t\t\t\t\t\"Local data store detected in attaching state during summarize\",\n\t\t\t\t\t\t\t\"summarize\",\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t\treturn context.attachState === AttachState.Attached;\n\t\t\t\t})\n\t\t\t\t.map(async ([contextId, context]) => {\n\t\t\t\t\tconst contextSummary = await context.summarize(\n\t\t\t\t\t\tfullTree,\n\t\t\t\t\t\ttrackState,\n\t\t\t\t\t\ttelemetryContext,\n\t\t\t\t\t);\n\t\t\t\t\tsummaryBuilder.addWithStats(contextId, contextSummary);\n\t\t\t\t}),\n\t\t);\n\n\t\treturn summaryBuilder.getSummaryTree();\n\t}\n\n\tpublic createSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\t\t// Attaching graph of some stores can cause other stores to get bound too.\n\t\t// So keep taking summary until no new stores get bound.\n\t\tlet notBoundContextsLength: number;\n\t\tdo {\n\t\t\tconst builderTree = builder.summary.tree;\n\t\t\tnotBoundContextsLength = this.contexts.notBoundLength();\n\t\t\t// Iterate over each data store and ask it to snapshot\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(\n\t\t\t\t\t([key, _]) =>\n\t\t\t\t\t\t// Take summary of bounded data stores only, make sure we haven't summarized them already\n\t\t\t\t\t\t// and no attach op has been fired for that data store because for loader versions <= 0.24\n\t\t\t\t\t\t// we set attach state as \"attaching\" before taking createNew summary.\n\t\t\t\t\t\t!(\n\t\t\t\t\t\t\tthis.contexts.isNotBound(key) ||\n\t\t\t\t\t\t\tbuilderTree[key] ||\n\t\t\t\t\t\t\tthis.attachOpFiredForDataStore.has(key)\n\t\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\tlet dataStoreSummary: ISummarizeResult;\n\t\t\t\t\tif (value.isLoaded) {\n\t\t\t\t\t\tconst snapshot = value.generateAttachMessage().snapshot;\n\t\t\t\t\t\tdataStoreSummary = convertToSummaryTree(snapshot, true);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If this data store is not yet loaded, then there should be no changes in the snapshot from\n\t\t\t\t\t\t// which it was created as it is detached container. So just use the previous snapshot.\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t!!this.baseSnapshot,\n\t\t\t\t\t\t\t0x166 /* \"BaseSnapshot should be there as detached container loaded from snapshot\" */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdataStoreSummary = convertSnapshotTreeToSummaryTree(\n\t\t\t\t\t\t\tthis.baseSnapshot.trees[key],\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbuilder.addWithStats(key, dataStoreSummary);\n\t\t\t\t});\n\t\t} while (notBoundContextsLength !== this.contexts.notBoundLength());\n\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Before GC runs, called by the garbage collector to update any pending GC state.\n\t * The garbage collector needs to know all outbound references that are added. Since root data stores are not\n\t * explicitly marked as referenced, notify GC of new root data stores that were added since the last GC run.\n\t */\n\tpublic async updateStateBeforeGC(): Promise<void> {\n\t\tfor (const id of this.dataStoresSinceLastGC) {\n\t\t\tconst context = this.contexts.get(id);\n\t\t\tassert(context !== undefined, 0x2b6 /* Missing data store context */);\n\t\t\tif (await context.isRoot()) {\n\t\t\t\t// A root data store is basically a reference from the container runtime to the data store.\n\t\t\t\tconst handle = new FluidObjectHandle(context, id, this.runtime.IFluidHandleContext);\n\t\t\t\tthis.runtime.addedGCOutboundReference(this.containerRuntimeHandle, handle);\n\t\t\t}\n\t\t}\n\t\tthis.dataStoresSinceLastGC = [];\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. It does the following:\n\t *\n\t * 1. Calls into each child data store context to get its GC data.\n\t *\n\t * 2. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be\n\t * identified as belonging to the child.\n\t *\n\t * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent\n\t * the GC data of this channel.\n\t *\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst builder = new GCDataBuilder();\n\t\t// Iterate over each store and get their GC data.\n\t\tawait Promise.all(\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(([_, context]) => {\n\t\t\t\t\t// Summarizer client and hence GC works only with clients with no local changes. A data store in\n\t\t\t\t\t// attaching state indicates an op was sent to attach a local data store, and the the attach op\n\t\t\t\t\t// had not yet round tripped back to the client.\n\t\t\t\t\t// Formerly assert 0x589\n\t\t\t\t\tif (context.attachState === AttachState.Attaching) {\n\t\t\t\t\t\tconst error = DataProcessingError.create(\n\t\t\t\t\t\t\t\"Local data store detected in attaching state while running GC\",\n\t\t\t\t\t\t\t\"getGCData\",\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn context.attachState === AttachState.Attached;\n\t\t\t\t})\n\t\t\t\t.map(async ([contextId, context]) => {\n\t\t\t\t\tconst contextGCData = await context.getGCData(fullGC);\n\t\t\t\t\t// Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.\n\t\t\t\t\t// This also gradually builds the id of each node to be a path from the root.\n\t\t\t\t\tbuilder.prefixAndAddNodes(contextId, contextGCData.gcNodes);\n\t\t\t\t}),\n\t\t);\n\n\t\t// Get the outbound routes and add a GC node for this channel.\n\t\tbuilder.addNode(\"/\", await this.getOutboundRoutes());\n\t\treturn builder.getGCData();\n\t}\n\n\t/**\n\t * After GC has run, called to notify this Container's data stores of routes that are used in it.\n\t * @param usedRoutes - The routes that are used in all data stores in this Container.\n\t */\n\tpublic updateUsedRoutes(usedRoutes: readonly string[]) {\n\t\t// Get a map of data store ids to routes used in it.\n\t\tconst usedDataStoreRoutes = unpackChildNodesUsedRoutes(usedRoutes);\n\n\t\t// Verify that the used routes are correct.\n\t\tfor (const [id] of usedDataStoreRoutes) {\n\t\t\tassert(\n\t\t\t\tthis.contexts.has(id),\n\t\t\t\t0x167 /* \"Used route does not belong to any known data store\" */,\n\t\t\t);\n\t\t}\n\n\t\t// Update the used routes in each data store. Used routes is empty for unused data stores.\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tcontext.updateUsedRoutes(usedDataStoreRoutes.get(contextId) ?? []);\n\t\t}\n\t}\n\n\t/**\n\t * This is called to update objects whose routes are unused. The unused objects are deleted.\n\t * @param unusedRoutes - The routes that are unused in all data stores in this Container.\n\t */\n\tpublic updateUnusedRoutes(unusedRoutes: readonly string[]) {\n\t\tfor (const route of unusedRoutes) {\n\t\t\tconst pathParts = route.split(\"/\");\n\t\t\t// Delete data store only if its route (/datastoreId) is in unusedRoutes. We don't want to delete a data\n\t\t\t// store based on its DDS being unused.\n\t\t\tif (pathParts.length > 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst dataStoreId = pathParts[1];\n\t\t\tassert(this.contexts.has(dataStoreId), 0x2d7 /* No data store with specified id */);\n\t\t\t// Delete the contexts of unused data stores.\n\t\t\tthis.contexts.delete(dataStoreId);\n\t\t\t// Delete the summarizer node of the unused data stores.\n\t\t\tthis.deleteChildSummarizerNodeFn(dataStoreId);\n\t\t}\n\t}\n\n\t/**\n\t * Delete data stores and its objects that are sweep ready.\n\t * @param sweepReadyDataStoreRoutes - The routes of data stores and its objects that are sweep ready and should\n\t * be deleted.\n\t * @returns The routes of data stores and its objects that were deleted.\n\t */\n\tpublic deleteSweepReadyNodes(sweepReadyDataStoreRoutes: readonly string[]): readonly string[] {\n\t\t// If sweep for data stores is not enabled, return empty list indicating nothing is deleted.\n\t\tif (this.mc.config.getBoolean(disableDatastoreSweepKey) === true) {\n\t\t\treturn [];\n\t\t}\n\t\tfor (const route of sweepReadyDataStoreRoutes) {\n\t\t\tconst pathParts = route.split(\"/\");\n\t\t\tconst dataStoreId = pathParts[1];\n\n\t\t\t// Ignore sub-data store routes because a data store and its sub-routes are deleted together, so, we only\n\t\t\t// need to delete the data store.\n\t\t\tif (pathParts.length > 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst dataStoreContext = this.contexts.get(dataStoreId);\n\t\t\tif (dataStoreContext === undefined) {\n\t\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"DeletedDataStoreNotFound\",\n\t\t\t\t\t...tagCodeArtifacts({ id: dataStoreId }),\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\talreadyDeleted: this.isDataStoreDeleted(dataStoreId),\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tdataStoreContext.delete();\n\n\t\t\t// Delete the contexts of sweep ready data stores.\n\t\t\tthis.contexts.delete(dataStoreId);\n\t\t\t// Delete the summarizer node of the sweep ready data stores.\n\t\t\tthis.deleteChildSummarizerNodeFn(dataStoreId);\n\t\t}\n\t\treturn Array.from(sweepReadyDataStoreRoutes);\n\t}\n\n\t/**\n\t * This is called to update objects whose routes are tombstones. Tombstoned datastore contexts enable testing\n\t * scenarios with accessing deleted content without actually deleting content from summaries.\n\t * @param tombstonedRoutes - The routes that are tombstones in all data stores in this Container.\n\t */\n\tpublic updateTombstonedRoutes(tombstonedRoutes: readonly string[]) {\n\t\tconst tombstonedDataStoresSet: Set<string> = new Set();\n\t\tfor (const route of tombstonedRoutes) {\n\t\t\tconst pathParts = route.split(\"/\");\n\t\t\t// Tombstone data store only if its route (/datastoreId) is directly in tombstoneRoutes.\n\t\t\tif (pathParts.length > 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst dataStoreId = pathParts[1];\n\t\t\tassert(this.contexts.has(dataStoreId), 0x510 /* No data store with specified id */);\n\t\t\ttombstonedDataStoresSet.add(dataStoreId);\n\t\t}\n\n\t\t// Update the used routes in each data store. Used routes is empty for unused data stores.\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tcontext.setTombstone(tombstonedDataStoresSet.has(contextId));\n\t\t}\n\t}\n\n\t/**\n\t * Returns the outbound routes of this channel. Only root data stores are considered referenced and their paths are\n\t * part of outbound routes.\n\t */\n\tprivate async getOutboundRoutes(): Promise<string[]> {\n\t\tconst outboundRoutes: string[] = [];\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tconst isRootDataStore = await context.isRoot();\n\t\t\tif (isRootDataStore) {\n\t\t\t\toutboundRoutes.push(`/${contextId}`);\n\t\t\t}\n\t\t}\n\t\treturn outboundRoutes;\n\t}\n\n\t/**\n\t * Called by GC to retrieve the package path of a data store node with the given path.\n\t */\n\tpublic async getDataStorePackagePath(nodePath: string): Promise<readonly string[] | undefined> {\n\t\t// If the node belongs to a data store, return its package path. For DDSes, we return the package path of the\n\t\t// data store that contains it.\n\t\tconst context = this.contexts.get(nodePath.split(\"/\")[1]);\n\t\treturn (await context?.getInitialSnapshotDetails())?.pkg;\n\t}\n\n\t/**\n\t * Called by GC to determine if a node is for a data store or for an object within a data store (for e.g. DDS).\n\t * @returns the GC node type if the node belongs to a data store or object within data store, undefined otherwise.\n\t */\n\tpublic getGCNodeType(nodePath: string): GCNodeType | undefined {\n\t\tconst pathParts = nodePath.split(\"/\");\n\t\tif (!this.contexts.has(pathParts[1])) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Data stores paths are of the format \"/dataStoreId\".\n\t\t// Sub data store paths are of the format \"/dataStoreId/subPath/...\".\n\t\tif (pathParts.length === 2) {\n\t\t\treturn GCNodeType.DataStore;\n\t\t}\n\t\treturn GCNodeType.SubDataStore;\n\t}\n}\n\nexport function getSummaryForDatastores(\n\tsnapshot: ISnapshotTree | undefined,\n\tmetadata?: IContainerRuntimeMetadata,\n): ISnapshotTree | undefined {\n\tif (!snapshot) {\n\t\treturn undefined;\n\t}\n\n\tif (rootHasIsolatedChannels(metadata)) {\n\t\tconst datastoresSnapshot = snapshot.trees[channelsTreeName];\n\t\tassert(!!datastoresSnapshot, 0x168 /* Expected tree in snapshot not found */);\n\t\treturn datastoresSnapshot;\n\t} else {\n\t\t// back-compat: strip out all non-datastore paths before giving to DataStores object.\n\t\tconst datastoresTrees: ISnapshotTree[\"trees\"] = {};\n\t\tfor (const [key, value] of Object.entries(snapshot.trees)) {\n\t\t\tif (!nonDataStorePaths.includes(key)) {\n\t\t\t\tdatastoresTrees[key] = value;\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\t...snapshot,\n\t\t\ttrees: datastoresTrees,\n\t\t};\n\t}\n}\n"]}
|