@fluidframework/container-runtime 2.0.0-internal.5.4.2 → 2.0.0-internal.6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/dist/batchTracker.d.ts +2 -1
  3. package/dist/batchTracker.d.ts.map +1 -1
  4. package/dist/batchTracker.js.map +1 -1
  5. package/dist/blobManager.d.ts +4 -1
  6. package/dist/blobManager.d.ts.map +1 -1
  7. package/dist/blobManager.js +61 -26
  8. package/dist/blobManager.js.map +1 -1
  9. package/dist/connectionTelemetry.js +10 -2
  10. package/dist/connectionTelemetry.js.map +1 -1
  11. package/dist/containerRuntime.d.ts +26 -11
  12. package/dist/containerRuntime.d.ts.map +1 -1
  13. package/dist/containerRuntime.js +177 -123
  14. package/dist/containerRuntime.js.map +1 -1
  15. package/dist/dataStore.js +8 -2
  16. package/dist/dataStore.js.map +1 -1
  17. package/dist/dataStoreContext.js +23 -24
  18. package/dist/dataStoreContext.js.map +1 -1
  19. package/dist/dataStores.d.ts +20 -4
  20. package/dist/dataStores.d.ts.map +1 -1
  21. package/dist/dataStores.js +107 -53
  22. package/dist/dataStores.js.map +1 -1
  23. package/dist/gc/garbageCollection.js +17 -20
  24. package/dist/gc/garbageCollection.js.map +1 -1
  25. package/dist/gc/gcConfigs.js +13 -11
  26. package/dist/gc/gcConfigs.js.map +1 -1
  27. package/dist/gc/gcHelpers.js +4 -6
  28. package/dist/gc/gcHelpers.js.map +1 -1
  29. package/dist/gc/gcSummaryStateTracker.js +4 -6
  30. package/dist/gc/gcSummaryStateTracker.js.map +1 -1
  31. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  32. package/dist/gc/gcTelemetry.js +55 -37
  33. package/dist/gc/gcTelemetry.js.map +1 -1
  34. package/dist/id-compressor/idCompressor.js +49 -51
  35. package/dist/id-compressor/idCompressor.js.map +1 -1
  36. package/dist/id-compressor/idRange.js +2 -2
  37. package/dist/id-compressor/idRange.js.map +1 -1
  38. package/dist/id-compressor/sessionIdNormalizer.js +11 -16
  39. package/dist/id-compressor/sessionIdNormalizer.js.map +1 -1
  40. package/dist/index.d.ts +1 -1
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js.map +1 -1
  43. package/dist/opLifecycle/batchManager.js +10 -6
  44. package/dist/opLifecycle/batchManager.js.map +1 -1
  45. package/dist/opLifecycle/opCompressor.js +6 -1
  46. package/dist/opLifecycle/opCompressor.js.map +1 -1
  47. package/dist/opLifecycle/opDecompressor.js +11 -9
  48. package/dist/opLifecycle/opDecompressor.js.map +1 -1
  49. package/dist/opLifecycle/opGroupingManager.js +13 -5
  50. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  51. package/dist/opLifecycle/opSplitter.js +10 -6
  52. package/dist/opLifecycle/opSplitter.js.map +1 -1
  53. package/dist/opLifecycle/outbox.js +1 -2
  54. package/dist/opLifecycle/outbox.js.map +1 -1
  55. package/dist/opLifecycle/remoteMessageProcessor.js +1 -1
  56. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  57. package/dist/opProperties.js +1 -2
  58. package/dist/opProperties.js.map +1 -1
  59. package/dist/packageVersion.d.ts +1 -1
  60. package/dist/packageVersion.js +1 -1
  61. package/dist/packageVersion.js.map +1 -1
  62. package/dist/pendingStateManager.d.ts +2 -2
  63. package/dist/pendingStateManager.d.ts.map +1 -1
  64. package/dist/pendingStateManager.js +22 -22
  65. package/dist/pendingStateManager.js.map +1 -1
  66. package/dist/scheduleManager.js +14 -10
  67. package/dist/scheduleManager.js.map +1 -1
  68. package/dist/summary/orderedClientElection.d.ts +2 -1
  69. package/dist/summary/orderedClientElection.d.ts.map +1 -1
  70. package/dist/summary/orderedClientElection.js +17 -18
  71. package/dist/summary/orderedClientElection.js.map +1 -1
  72. package/dist/summary/runningSummarizer.js +32 -38
  73. package/dist/summary/runningSummarizer.js.map +1 -1
  74. package/dist/summary/summarizer.js +4 -7
  75. package/dist/summary/summarizer.js.map +1 -1
  76. package/dist/summary/summarizerClientElection.js +5 -9
  77. package/dist/summary/summarizerClientElection.js.map +1 -1
  78. package/dist/summary/summarizerHeuristics.js +8 -12
  79. package/dist/summary/summarizerHeuristics.js.map +1 -1
  80. package/dist/summary/summarizerNode/summarizerNode.js +22 -15
  81. package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
  82. package/dist/summary/summarizerNode/summarizerNodeUtils.js +2 -4
  83. package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  84. package/dist/summary/summarizerNode/summarizerNodeWithGc.js +17 -16
  85. package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  86. package/dist/summary/summaryCollection.js +3 -5
  87. package/dist/summary/summaryCollection.js.map +1 -1
  88. package/dist/summary/summaryFormat.js +1 -2
  89. package/dist/summary/summaryFormat.js.map +1 -1
  90. package/dist/summary/summaryGenerator.js +62 -20
  91. package/dist/summary/summaryGenerator.js.map +1 -1
  92. package/dist/summary/summaryManager.js +3 -5
  93. package/dist/summary/summaryManager.js.map +1 -1
  94. package/lib/batchTracker.d.ts +2 -1
  95. package/lib/batchTracker.d.ts.map +1 -1
  96. package/lib/batchTracker.js.map +1 -1
  97. package/lib/blobManager.d.ts +4 -1
  98. package/lib/blobManager.d.ts.map +1 -1
  99. package/lib/blobManager.js +61 -26
  100. package/lib/blobManager.js.map +1 -1
  101. package/lib/connectionTelemetry.js +10 -2
  102. package/lib/connectionTelemetry.js.map +1 -1
  103. package/lib/containerRuntime.d.ts +26 -11
  104. package/lib/containerRuntime.d.ts.map +1 -1
  105. package/lib/containerRuntime.js +177 -123
  106. package/lib/containerRuntime.js.map +1 -1
  107. package/lib/dataStore.js +8 -2
  108. package/lib/dataStore.js.map +1 -1
  109. package/lib/dataStoreContext.js +23 -24
  110. package/lib/dataStoreContext.js.map +1 -1
  111. package/lib/dataStores.d.ts +20 -4
  112. package/lib/dataStores.d.ts.map +1 -1
  113. package/lib/dataStores.js +107 -53
  114. package/lib/dataStores.js.map +1 -1
  115. package/lib/gc/garbageCollection.js +17 -20
  116. package/lib/gc/garbageCollection.js.map +1 -1
  117. package/lib/gc/gcConfigs.js +13 -11
  118. package/lib/gc/gcConfigs.js.map +1 -1
  119. package/lib/gc/gcHelpers.js +4 -6
  120. package/lib/gc/gcHelpers.js.map +1 -1
  121. package/lib/gc/gcSummaryStateTracker.js +4 -6
  122. package/lib/gc/gcSummaryStateTracker.js.map +1 -1
  123. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  124. package/lib/gc/gcTelemetry.js +55 -37
  125. package/lib/gc/gcTelemetry.js.map +1 -1
  126. package/lib/id-compressor/idCompressor.js +49 -51
  127. package/lib/id-compressor/idCompressor.js.map +1 -1
  128. package/lib/id-compressor/idRange.js +2 -2
  129. package/lib/id-compressor/idRange.js.map +1 -1
  130. package/lib/id-compressor/sessionIdNormalizer.js +11 -16
  131. package/lib/id-compressor/sessionIdNormalizer.js.map +1 -1
  132. package/lib/index.d.ts +1 -1
  133. package/lib/index.d.ts.map +1 -1
  134. package/lib/index.js.map +1 -1
  135. package/lib/opLifecycle/batchManager.js +10 -6
  136. package/lib/opLifecycle/batchManager.js.map +1 -1
  137. package/lib/opLifecycle/opCompressor.js +6 -1
  138. package/lib/opLifecycle/opCompressor.js.map +1 -1
  139. package/lib/opLifecycle/opDecompressor.js +11 -9
  140. package/lib/opLifecycle/opDecompressor.js.map +1 -1
  141. package/lib/opLifecycle/opGroupingManager.js +13 -5
  142. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  143. package/lib/opLifecycle/opSplitter.js +10 -6
  144. package/lib/opLifecycle/opSplitter.js.map +1 -1
  145. package/lib/opLifecycle/outbox.js +1 -2
  146. package/lib/opLifecycle/outbox.js.map +1 -1
  147. package/lib/opLifecycle/remoteMessageProcessor.js +1 -1
  148. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  149. package/lib/opProperties.js +1 -2
  150. package/lib/opProperties.js.map +1 -1
  151. package/lib/packageVersion.d.ts +1 -1
  152. package/lib/packageVersion.js +1 -1
  153. package/lib/packageVersion.js.map +1 -1
  154. package/lib/pendingStateManager.d.ts +2 -2
  155. package/lib/pendingStateManager.d.ts.map +1 -1
  156. package/lib/pendingStateManager.js +22 -22
  157. package/lib/pendingStateManager.js.map +1 -1
  158. package/lib/scheduleManager.js +14 -10
  159. package/lib/scheduleManager.js.map +1 -1
  160. package/lib/summary/orderedClientElection.d.ts +2 -1
  161. package/lib/summary/orderedClientElection.d.ts.map +1 -1
  162. package/lib/summary/orderedClientElection.js +17 -18
  163. package/lib/summary/orderedClientElection.js.map +1 -1
  164. package/lib/summary/runningSummarizer.js +32 -38
  165. package/lib/summary/runningSummarizer.js.map +1 -1
  166. package/lib/summary/summarizer.js +4 -7
  167. package/lib/summary/summarizer.js.map +1 -1
  168. package/lib/summary/summarizerClientElection.js +5 -9
  169. package/lib/summary/summarizerClientElection.js.map +1 -1
  170. package/lib/summary/summarizerHeuristics.js +8 -12
  171. package/lib/summary/summarizerHeuristics.js.map +1 -1
  172. package/lib/summary/summarizerNode/summarizerNode.js +22 -15
  173. package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
  174. package/lib/summary/summarizerNode/summarizerNodeUtils.js +2 -4
  175. package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  176. package/lib/summary/summarizerNode/summarizerNodeWithGc.js +17 -16
  177. package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  178. package/lib/summary/summaryCollection.js +3 -5
  179. package/lib/summary/summaryCollection.js.map +1 -1
  180. package/lib/summary/summaryFormat.js +1 -2
  181. package/lib/summary/summaryFormat.js.map +1 -1
  182. package/lib/summary/summaryGenerator.js +62 -20
  183. package/lib/summary/summaryGenerator.js.map +1 -1
  184. package/lib/summary/summaryManager.js +3 -5
  185. package/lib/summary/summaryManager.js.map +1 -1
  186. package/package.json +17 -17
  187. package/src/batchTracker.ts +2 -1
  188. package/src/blobManager.ts +43 -2
  189. package/src/containerRuntime.ts +74 -51
  190. package/src/dataStore.ts +7 -1
  191. package/src/dataStores.ts +95 -55
  192. package/src/gc/gcTelemetry.ts +1 -2
  193. package/src/index.ts +0 -1
  194. package/src/packageVersion.ts +1 -1
  195. package/src/pendingStateManager.ts +12 -15
  196. package/src/summary/orderedClientElection.ts +2 -1
package/lib/dataStore.js CHANGED
@@ -13,8 +13,8 @@ import { UsageError } from "@fluidframework/container-utils";
13
13
  * @returns True if the {@link IDataStoreAliasMessage} is fully implemented, false otherwise
14
14
  */
15
15
  export const isDataStoreAliasMessage = (maybeDataStoreAliasMessage) => {
16
- return (typeof (maybeDataStoreAliasMessage === null || maybeDataStoreAliasMessage === void 0 ? void 0 : maybeDataStoreAliasMessage.internalId) === "string" &&
17
- typeof (maybeDataStoreAliasMessage === null || maybeDataStoreAliasMessage === void 0 ? void 0 : maybeDataStoreAliasMessage.alias) === "string");
16
+ return (typeof maybeDataStoreAliasMessage?.internalId === "string" &&
17
+ typeof maybeDataStoreAliasMessage?.alias === "string");
18
18
  };
19
19
  export const channelToDataStore = (fluidDataStoreChannel, internalId, runtime, datastores, logger) => new DataStore(fluidDataStoreChannel, internalId, runtime, datastores, logger);
20
20
  var AliasState;
@@ -112,6 +112,9 @@ class DataStore {
112
112
  this.aliasState = AliasState.Aliased;
113
113
  return "Success";
114
114
  }
115
+ /**
116
+ * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
117
+ */
115
118
  async request(request) {
116
119
  return this.fluidDataStoreChannel.request(request);
117
120
  }
@@ -121,6 +124,9 @@ class DataStore {
121
124
  get entryPoint() {
122
125
  return this.fluidDataStoreChannel.entryPoint;
123
126
  }
127
+ /**
128
+ * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
129
+ */
124
130
  get IFluidRouter() {
125
131
  return this.fluidDataStoreChannel;
126
132
  }
@@ -1 +1 @@
1
- {"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rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt, TelemetryDataTag } from \"@fluidframework/telemetry-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/common-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport { FluidObject, IFluidHandle, IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport {\n\tAliasResult,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\nimport { ContainerRuntime } from \"./containerRuntime\";\nimport { DataStores } from \"./dataStores\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n */\nexport interface IDataStoreAliasMessage {\n\t/** The internal id of the datastore */\n\treadonly internalId: string;\n\t/** The alias name to be assigned to the datastore */\n\treadonly alias: string;\n}\n\n/**\n * Type guard that returns true if the given alias message is actually an instance of\n * a class which implements {@link IDataStoreAliasMessage}\n * @param maybeDataStoreAliasMessage - message object to be validated\n * @returns True if the {@link IDataStoreAliasMessage} is fully implemented, false otherwise\n */\nexport const isDataStoreAliasMessage = (\n\tmaybeDataStoreAliasMessage: any,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n\treturn (\n\t\ttypeof maybeDataStoreAliasMessage?.internalId === \"string\" &&\n\t\ttypeof maybeDataStoreAliasMessage?.alias === \"string\"\n\t);\n};\n\nexport const channelToDataStore = (\n\tfluidDataStoreChannel: IFluidDataStoreChannel,\n\tinternalId: string,\n\truntime: ContainerRuntime,\n\tdatastores: DataStores,\n\tlogger: ITelemetryLoggerExt,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, runtime, datastores, logger);\n\nenum AliasState {\n\tAliased = \"Aliased\",\n\tAliasing = \"Aliasing\",\n\tNone = \"None\",\n}\n\nclass DataStore implements IDataStore {\n\tprivate aliasState: AliasState = AliasState.None;\n\tprivate alias: string | undefined;\n\tprivate readonly pendingAliases: Map<string, Promise<AliasResult>>;\n\tprivate aliasResult: Promise<AliasResult> | undefined;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.trySetAlias}\n\t */\n\tasync trySetAlias(alias: string): Promise<AliasResult> {\n\t\tif (alias.includes(\"/\")) {\n\t\t\tthrow new UsageError(`The alias cannot contain slashes: '${alias}'`);\n\t\t}\n\n\t\tswitch (this.aliasState) {\n\t\t\t// If we're already aliasing, check if it's for the same value and return\n\t\t\t// the stored promise, otherwise return 'AlreadyAliased'\n\t\t\tcase AliasState.Aliasing:\n\t\t\t\tassert(\n\t\t\t\t\tthis.aliasResult !== undefined,\n\t\t\t\t\t0x316 /* There should be a cached promise of in-progress aliasing */,\n\t\t\t\t);\n\t\t\t\tawait this.aliasResult;\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\n\t\t\t// If this datastore is already aliased, return true only if this\n\t\t\t// is a repeated call for the same alias\n\t\t\tcase AliasState.Aliased:\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\n\t\t\tcase AliasState.None: {\n\t\t\t\tconst existingAlias = this.pendingAliases.get(alias);\n\t\t\t\tif (existingAlias !== undefined) {\n\t\t\t\t\t// There is already another datastore which will be aliased\n\t\t\t\t\t// to the same name\n\t\t\t\t\treturn \"Conflict\";\n\t\t\t\t}\n\n\t\t\t\t// There is no current or past alias operation for this datastore,\n\t\t\t\t// or for this alias, so it is safe to continue execution\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tunreachableCase(this.aliasState);\n\t\t}\n\n\t\tthis.aliasState = AliasState.Aliasing;\n\t\tthis.aliasResult = this.trySetAliasInternal(alias);\n\t\tthis.pendingAliases.set(alias, this.aliasResult);\n\t\treturn this.aliasResult;\n\t}\n\n\tasync trySetAliasInternal(alias: string): Promise<AliasResult> {\n\t\tconst message: IDataStoreAliasMessage = {\n\t\t\tinternalId: this.internalId,\n\t\t\talias,\n\t\t};\n\n\t\tthis.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\tconst localResult = this.datastores.processAliasMessageCore(message);\n\t\t\t// Explicitly lock-out future attempts of aliasing,\n\t\t\t// regardless of result\n\t\t\tthis.aliasState = AliasState.Aliased;\n\t\t\treturn localResult ? \"Success\" : \"Conflict\";\n\t\t}\n\n\t\tconst aliased = await this.ackBasedPromise<boolean>((resolve) => {\n\t\t\tthis.runtime.submitDataStoreAliasOp(message, resolve);\n\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"AliasingException\",\n\t\t\t\t\t\talias: {\n\t\t\t\t\t\t\tvalue: alias,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.UserData,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinternalId: {\n\t\t\t\t\t\t\tvalue: this.internalId,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\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\n\t\t\t\treturn false;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tthis.pendingAliases.delete(alias);\n\t\t\t});\n\n\t\tif (!aliased) {\n\t\t\tthis.aliasState = AliasState.None;\n\t\t\tthis.aliasResult = undefined;\n\t\t\treturn \"Conflict\";\n\t\t}\n\n\t\tthis.alias = alias;\n\t\tthis.aliasState = AliasState.Aliased;\n\t\treturn \"Success\";\n\t}\n\n\tasync request(request: IRequest): Promise<IResponse> {\n\t\treturn this.fluidDataStoreChannel.request(request);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}\n\t */\n\tget entryPoint(): IFluidHandle<FluidObject> | undefined {\n\t\treturn this.fluidDataStoreChannel.entryPoint;\n\t}\n\n\tconstructor(\n\t\tprivate readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n\t\tprivate readonly internalId: string,\n\t\tprivate readonly runtime: ContainerRuntime,\n\t\tprivate readonly datastores: DataStores,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.pendingAliases = datastores.pendingAliases;\n\t}\n\n\tpublic get IFluidRouter() {\n\t\treturn this.fluidDataStoreChannel;\n\t}\n\n\tprivate async ackBasedPromise<T>(\n\t\texecutor: (\n\t\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\t\treject: (reason?: any) => void,\n\t\t) => void,\n\t): Promise<T> {\n\t\tlet rejectBecauseDispose: () => void;\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\trejectBecauseDispose = () =>\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"),\n\t\t\t\t);\n\n\t\t\tif (this.runtime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.runtime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\tthis.runtime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAuB,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAqB7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACtC,0BAA+B,EACwB,EAAE;IACzD,OAAO,CACN,OAAO,0BAA0B,EAAE,UAAU,KAAK,QAAQ;QAC1D,OAAO,0BAA0B,EAAE,KAAK,KAAK,QAAQ,CACrD,CAAC;AACH,CAAC,CAAC;AAEF,MA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EO,KAAK,CAAC,eAAe,CAC5B,QAGS;QAET,IAAI,oBAAgC,CAAC;QACrC,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACzC,oBAAoB,GAAG,GAAG,EAAE,CAC3B,MAAM,CACL,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAC/E,CAAC;YAEH,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;gBAC1B,oBAAoB,EAAE,CAAC;gBACvB,OAAO;aACP;YAED,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YACjD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YACf,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt, TelemetryDataTag } from \"@fluidframework/telemetry-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/common-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport { FluidObject, IFluidHandle, IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport {\n\tAliasResult,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\nimport { ContainerRuntime } from \"./containerRuntime\";\nimport { DataStores } from \"./dataStores\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n */\nexport interface IDataStoreAliasMessage {\n\t/** The internal id of the datastore */\n\treadonly internalId: string;\n\t/** The alias name to be assigned to the datastore */\n\treadonly alias: string;\n}\n\n/**\n * Type guard that returns true if the given alias message is actually an instance of\n * a class which implements {@link IDataStoreAliasMessage}\n * @param maybeDataStoreAliasMessage - message object to be validated\n * @returns True if the {@link IDataStoreAliasMessage} is fully implemented, false otherwise\n */\nexport const isDataStoreAliasMessage = (\n\tmaybeDataStoreAliasMessage: any,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n\treturn (\n\t\ttypeof maybeDataStoreAliasMessage?.internalId === \"string\" &&\n\t\ttypeof maybeDataStoreAliasMessage?.alias === \"string\"\n\t);\n};\n\nexport const channelToDataStore = (\n\tfluidDataStoreChannel: IFluidDataStoreChannel,\n\tinternalId: string,\n\truntime: ContainerRuntime,\n\tdatastores: DataStores,\n\tlogger: ITelemetryLoggerExt,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, runtime, datastores, logger);\n\nenum AliasState {\n\tAliased = \"Aliased\",\n\tAliasing = \"Aliasing\",\n\tNone = \"None\",\n}\n\nclass DataStore implements IDataStore {\n\tprivate aliasState: AliasState = AliasState.None;\n\tprivate alias: string | undefined;\n\tprivate readonly pendingAliases: Map<string, Promise<AliasResult>>;\n\tprivate aliasResult: Promise<AliasResult> | undefined;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.trySetAlias}\n\t */\n\tasync trySetAlias(alias: string): Promise<AliasResult> {\n\t\tif (alias.includes(\"/\")) {\n\t\t\tthrow new UsageError(`The alias cannot contain slashes: '${alias}'`);\n\t\t}\n\n\t\tswitch (this.aliasState) {\n\t\t\t// If we're already aliasing, check if it's for the same value and return\n\t\t\t// the stored promise, otherwise return 'AlreadyAliased'\n\t\t\tcase AliasState.Aliasing:\n\t\t\t\tassert(\n\t\t\t\t\tthis.aliasResult !== undefined,\n\t\t\t\t\t0x316 /* There should be a cached promise of in-progress aliasing */,\n\t\t\t\t);\n\t\t\t\tawait this.aliasResult;\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\n\t\t\t// If this datastore is already aliased, return true only if this\n\t\t\t// is a repeated call for the same alias\n\t\t\tcase AliasState.Aliased:\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\n\t\t\tcase AliasState.None: {\n\t\t\t\tconst existingAlias = this.pendingAliases.get(alias);\n\t\t\t\tif (existingAlias !== undefined) {\n\t\t\t\t\t// There is already another datastore which will be aliased\n\t\t\t\t\t// to the same name\n\t\t\t\t\treturn \"Conflict\";\n\t\t\t\t}\n\n\t\t\t\t// There is no current or past alias operation for this datastore,\n\t\t\t\t// or for this alias, so it is safe to continue execution\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tunreachableCase(this.aliasState);\n\t\t}\n\n\t\tthis.aliasState = AliasState.Aliasing;\n\t\tthis.aliasResult = this.trySetAliasInternal(alias);\n\t\tthis.pendingAliases.set(alias, this.aliasResult);\n\t\treturn this.aliasResult;\n\t}\n\n\tasync trySetAliasInternal(alias: string): Promise<AliasResult> {\n\t\tconst message: IDataStoreAliasMessage = {\n\t\t\tinternalId: this.internalId,\n\t\t\talias,\n\t\t};\n\n\t\tthis.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\tconst localResult = this.datastores.processAliasMessageCore(message);\n\t\t\t// Explicitly lock-out future attempts of aliasing,\n\t\t\t// regardless of result\n\t\t\tthis.aliasState = AliasState.Aliased;\n\t\t\treturn localResult ? \"Success\" : \"Conflict\";\n\t\t}\n\n\t\tconst aliased = await this.ackBasedPromise<boolean>((resolve) => {\n\t\t\tthis.runtime.submitDataStoreAliasOp(message, resolve);\n\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"AliasingException\",\n\t\t\t\t\t\talias: {\n\t\t\t\t\t\t\tvalue: alias,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.UserData,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinternalId: {\n\t\t\t\t\t\t\tvalue: this.internalId,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\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\n\t\t\t\treturn false;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tthis.pendingAliases.delete(alias);\n\t\t\t});\n\n\t\tif (!aliased) {\n\t\t\tthis.aliasState = AliasState.None;\n\t\t\tthis.aliasResult = undefined;\n\t\t\treturn \"Conflict\";\n\t\t}\n\n\t\tthis.alias = alias;\n\t\tthis.aliasState = AliasState.Aliased;\n\t\treturn \"Success\";\n\t}\n\n\t/**\n\t * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\treturn this.fluidDataStoreChannel.request(request);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}\n\t */\n\tget entryPoint(): IFluidHandle<FluidObject> | undefined {\n\t\treturn this.fluidDataStoreChannel.entryPoint;\n\t}\n\n\tconstructor(\n\t\tprivate readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n\t\tprivate readonly internalId: string,\n\t\tprivate readonly runtime: ContainerRuntime,\n\t\tprivate readonly datastores: DataStores,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.pendingAliases = datastores.pendingAliases;\n\t}\n\n\t/**\n\t * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic get IFluidRouter() {\n\t\treturn this.fluidDataStoreChannel;\n\t}\n\n\tprivate async ackBasedPromise<T>(\n\t\texecutor: (\n\t\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\t\treject: (reason?: any) => void,\n\t\t) => void,\n\t): Promise<T> {\n\t\tlet rejectBecauseDispose: () => void;\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\trejectBecauseDispose = () =>\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"),\n\t\t\t\t);\n\n\t\t\tif (this.runtime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.runtime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\tthis.runtime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n}\n"]}
@@ -29,7 +29,6 @@ export function createAttributesBlob(pkg, isRootDataStore) {
29
29
  */
30
30
  export class FluidDataStoreContext extends TypedEventEmitter {
31
31
  constructor(props, existing, isLocalDataStore, makeLocallyVisibleFn) {
32
- var _a, _b;
33
32
  super();
34
33
  this.existing = existing;
35
34
  this.isLocalDataStore = isLocalDataStore;
@@ -66,7 +65,7 @@ export class FluidDataStoreContext extends TypedEventEmitter {
66
65
  properties: {
67
66
  all: tagCodeArtifacts({
68
67
  fluidDataStoreId: this.id,
69
- fullPackageName: (_a = this.pkg) === null || _a === void 0 ? void 0 : _a.join("/"),
68
+ fullPackageName: this.pkg?.join("/"),
70
69
  }),
71
70
  },
72
71
  });
@@ -78,7 +77,7 @@ export class FluidDataStoreContext extends TypedEventEmitter {
78
77
  this.clientDetails.type !== summarizerClientType;
79
78
  // By default, a data store can log maximum 10 local changes telemetry in summarizer.
80
79
  this.localChangesTelemetryCount =
81
- (_b = this.mc.config.getNumber("Fluid.Telemetry.LocalChangesTelemetryCount")) !== null && _b !== void 0 ? _b : 10;
80
+ this.mc.config.getNumber("Fluid.Telemetry.LocalChangesTelemetryCount") ?? 10;
82
81
  }
83
82
  get packagePath() {
84
83
  assert(this.pkg !== undefined, 0x139 /* "Undefined package path" */);
@@ -183,7 +182,7 @@ export class FluidDataStoreContext extends TypedEventEmitter {
183
182
  rejectDeferredRealize(reason, failedPkgPath, fullPackageName) {
184
183
  throw new LoggingError(reason, tagCodeArtifacts({
185
184
  failedPkgPath,
186
- packagePath: fullPackageName === null || fullPackageName === void 0 ? void 0 : fullPackageName.join("/"),
185
+ packagePath: fullPackageName?.join("/"),
187
186
  }));
188
187
  }
189
188
  async realize() {
@@ -191,13 +190,12 @@ export class FluidDataStoreContext extends TypedEventEmitter {
191
190
  if (!this.channelDeferred) {
192
191
  this.channelDeferred = new Deferred();
193
192
  this.realizeCore(this.existing).catch((error) => {
194
- var _a, _b;
195
193
  const errorWrapped = DataProcessingError.wrapIfUnrecognized(error, "realizeFluidDataStoreContext");
196
194
  errorWrapped.addTelemetryProperties(tagCodeArtifacts({
197
- fullPackageName: (_a = this.pkg) === null || _a === void 0 ? void 0 : _a.join("/"),
195
+ fullPackageName: this.pkg?.join("/"),
198
196
  fluidDataStoreId: this.id,
199
197
  }));
200
- (_b = this.channelDeferred) === null || _b === void 0 ? void 0 : _b.reject(errorWrapped);
198
+ this.channelDeferred?.reject(errorWrapped);
201
199
  this.mc.logger.sendErrorEvent({ eventName: "RealizeError" }, errorWrapped);
202
200
  });
203
201
  }
@@ -222,7 +220,7 @@ export class FluidDataStoreContext extends TypedEventEmitter {
222
220
  }
223
221
  registry = entry.IFluidDataStoreRegistry;
224
222
  }
225
- const factory = entry === null || entry === void 0 ? void 0 : entry.IFluidDataStoreFactory;
223
+ const factory = entry?.IFluidDataStoreFactory;
226
224
  if (factory === undefined) {
227
225
  this.rejectDeferredRealize("Can't find factory for package", lastPkg, packages);
228
226
  }
@@ -260,13 +258,16 @@ export class FluidDataStoreContext extends TypedEventEmitter {
260
258
  this.channel.setConnectionState(connected, clientId);
261
259
  }
262
260
  process(messageArg, local, localOpMetadata) {
263
- var _a;
264
261
  this.verifyNotClosed("process", true, extractSafePropertiesFromMessage(messageArg));
265
262
  const innerContents = messageArg.contents;
266
- const message = Object.assign(Object.assign({}, messageArg), { type: innerContents.type, contents: innerContents.content });
263
+ const message = {
264
+ ...messageArg,
265
+ type: innerContents.type,
266
+ contents: innerContents.content,
267
+ };
267
268
  this.summarizerNode.recordChange(message);
268
269
  if (this.loaded) {
269
- return (_a = this.channel) === null || _a === void 0 ? void 0 : _a.process(message, local, localOpMetadata);
270
+ return this.channel?.process(message, local, localOpMetadata);
270
271
  }
271
272
  else {
272
273
  assert(!local, 0x142 /* "local store channel is not loaded" */);
@@ -276,13 +277,12 @@ export class FluidDataStoreContext extends TypedEventEmitter {
276
277
  }
277
278
  }
278
279
  processSignal(message, local) {
279
- var _a;
280
280
  this.verifyNotClosed("processSignal");
281
281
  // Signals are ignored if the store is not yet loaded
282
282
  if (!this.loaded) {
283
283
  return;
284
284
  }
285
- (_a = this.channel) === null || _a === void 0 ? void 0 : _a.processSignal(message, local);
285
+ this.channel?.processSignal(message, local);
286
286
  }
287
287
  getQuorum() {
288
288
  return this._containerRuntime.getQuorum();
@@ -317,7 +317,11 @@ export class FluidDataStoreContext extends TypedEventEmitter {
317
317
  summarizeResult.summary.unreferenced = true;
318
318
  summarizeResult.stats.unreferencedBlobSize = summarizeResult.stats.totalBlobSize;
319
319
  }
320
- return Object.assign(Object.assign({}, summarizeResult), { id: this.id, pathPartsForChildren });
320
+ return {
321
+ ...summarizeResult,
322
+ id: this.id,
323
+ pathPartsForChildren,
324
+ };
321
325
  }
322
326
  /**
323
327
  * Returns the data used for garbage collection. This includes a list of GC nodes that represent this data store
@@ -455,7 +459,6 @@ export class FluidDataStoreContext extends TypedEventEmitter {
455
459
  this.makeLocallyVisibleFn();
456
460
  }
457
461
  bindRuntime(channel) {
458
- var _a;
459
462
  if (this.channel) {
460
463
  throw new Error("Runtime already bound");
461
464
  }
@@ -489,7 +492,7 @@ export class FluidDataStoreContext extends TypedEventEmitter {
489
492
  this.channelDeferred.resolve(this.channel);
490
493
  }
491
494
  catch (error) {
492
- (_a = this.channelDeferred) === null || _a === void 0 ? void 0 : _a.reject(error);
495
+ this.channelDeferred?.reject(error);
493
496
  this.mc.logger.sendErrorEvent({
494
497
  eventName: "BindRuntimeError",
495
498
  }, error);
@@ -571,7 +574,6 @@ export class FluidDataStoreContext extends TypedEventEmitter {
571
574
  * other clients that are up-to-date till seq# 100 may not have them yet.
572
575
  */
573
576
  identifyLocalChangeInSummarizer(eventName, type) {
574
- var _a, _b;
575
577
  if (this.clientDetails.type !== summarizerClientType ||
576
578
  this.localChangesTelemetryCount <= 0) {
577
579
  return;
@@ -582,7 +584,7 @@ export class FluidDataStoreContext extends TypedEventEmitter {
582
584
  this.mc.logger.sendTelemetryEvent({
583
585
  eventName,
584
586
  type,
585
- isSummaryInProgress: (_b = (_a = this.summarizerNode).isSummaryInProgress) === null || _b === void 0 ? void 0 : _b.call(_a),
587
+ isSummaryInProgress: this.summarizerNode.isSummaryInProgress?.(),
586
588
  stack: generateStack(),
587
589
  });
588
590
  this.localChangesTelemetryCount--;
@@ -603,7 +605,6 @@ export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
603
605
  throw new Error("Already attached");
604
606
  });
605
607
  this.initialSnapshotDetailsP = new LazyPromise(async () => {
606
- var _a;
607
608
  let tree = this.initSnapshotValue;
608
609
  let isRootDataStore = true;
609
610
  if (!!tree && tree.blobs[dataStoreAttributesBlobName] !== undefined) {
@@ -628,7 +629,7 @@ export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
628
629
  * data stores in older documents are not garbage collected incorrectly. This may lead to additional
629
630
  * roots in the document but they won't break.
630
631
  */
631
- isRootDataStore = (_a = attributes.isRootDataStore) !== null && _a !== void 0 ? _a : true;
632
+ isRootDataStore = attributes.isRootDataStore ?? true;
632
633
  if (hasIsolatedChannels(attributes)) {
633
634
  tree = tree.trees[channelsTreeName];
634
635
  assert(tree !== undefined, 0x1fe /* "isolated channels subtree should exist in remote datastore snapshot" */);
@@ -697,7 +698,6 @@ export class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
697
698
  return message;
698
699
  }
699
700
  async getInitialSnapshotDetails() {
700
- var _a;
701
701
  let snapshot = this.snapshotTree;
702
702
  let attributes;
703
703
  let isRootDataStore = false;
@@ -714,7 +714,7 @@ export class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
714
714
  // If there is no isRootDataStore in the attributes blob, set it to true. This ensures that data
715
715
  // stores in older documents are not garbage collected incorrectly. This may lead to additional
716
716
  // roots in the document but they won't break.
717
- if ((_a = attributes.isRootDataStore) !== null && _a !== void 0 ? _a : true) {
717
+ if (attributes.isRootDataStore ?? true) {
718
718
  isRootDataStore = true;
719
719
  this.setInMemoryRoot();
720
720
  }
@@ -768,7 +768,6 @@ export class LocalDetachedFluidDataStoreContext extends LocalFluidDataStoreConte
768
768
  this.detachedRuntimeCreation = true;
769
769
  }
770
770
  async attachRuntime(registry, dataStoreChannel) {
771
- var _a;
772
771
  assert(this.detachedRuntimeCreation, 0x154 /* "runtime creation is already attached" */);
773
772
  this.detachedRuntimeCreation = false;
774
773
  assert(this.channelDeferred === undefined, 0x155 /* "channel deferral is already set" */);
@@ -786,7 +785,7 @@ export class LocalDetachedFluidDataStoreContext extends LocalFluidDataStoreConte
786
785
  // of data store factories tends to construct the data object (at least kick off an async method that returns
787
786
  // it); that code moved to the entryPoint initialization function, so we want to ensure it still executes
788
787
  // before the data store is attached.
789
- await ((_a = dataStoreChannel.entryPoint) === null || _a === void 0 ? void 0 : _a.get());
788
+ await dataStoreChannel.entryPoint?.get();
790
789
  if (await this.isRoot()) {
791
790
  dataStoreChannel.makeVisibleAndAttachGraph();
792
791
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreContext.js","sourceRoot":"","sources":["../src/dataStoreContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EAGN,WAAW,GAEX,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAU3E,OAAO,EACN,gBAAgB,EAqBhB,eAAe,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K,OAAO,EAAE,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAErF,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,2CAA2C,CAAC,CAAC;QACvF,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAE/B,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;QAEpC,6GAA6G;QAC7G,yGAAyG;QACzG,+FAA+F;QAC/F,2GAA2G;QAC3G,6GAA6G;QAC7G,yGAAyG;QACzG,qCAAqC;QACrC,MAAM,CAAA,MAAA,gBAAgB,CAAC,UAAU,0CAAE,GAAG,EAAE,CAAA,CAAC;QAEzC,IAAI,MAAM,IAAI,CAAC,MAAM,EAAE,EAAE;YACxB,gBAAgB,CAAC,yBAAyB,EAAE,CAAC;SAC7C;IACF,CAAC;IAEM,KAAK,CAAC,yBAAyB;QACrC,IAAI,IAAI,CAAC,uBAAuB,EAAE;YACjC,MAAM,IAAI,KAAK,CACd,mFAAmF,CACnF,CAAC;SACF;QACD,OAAO,KAAK,CAAC,yBAAyB,EAAE,CAAC;IAC1C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDisposable,\n\tFluidObject,\n\tIRequest,\n\tIResponse,\n\tIFluidHandle,\n\tITelemetryProperties,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tIAudience,\n\tIDeltaManager,\n\tAttachState,\n\tILoaderOptions,\n} from \"@fluidframework/container-definitions\";\nimport { assert, Deferred, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { LazyPromise } from \"@fluidframework/core-utils\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { BlobTreeEntry, readAndParse } from \"@fluidframework/driver-utils\";\nimport {\n\tIClientDetails,\n\tIDocumentMessage,\n\tIQuorumClients,\n\tISequencedDocumentMessage,\n\tISnapshotTree,\n\tITreeEntry,\n} from \"@fluidframework/protocol-definitions\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport {\n\tchannelsTreeName,\n\tCreateChildSummarizerNodeFn,\n\tCreateChildSummarizerNodeParam,\n\tFluidDataStoreRegistryEntry,\n\tIAttachMessage,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreContextDetached,\n\tIFluidDataStoreContextEvents,\n\tIFluidDataStoreRegistry,\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tIInboundSignalMessage,\n\tIProvideFluidDataStoreFactory,\n\tISummarizeInternalResult,\n\tISummarizeResult,\n\tISummarizerNodeWithGC,\n\tSummarizeInternalFn,\n\tITelemetryContext,\n\tIIdCompressor,\n\tIIdCompressorCore,\n\tVisibilityState,\n} from \"@fluidframework/runtime-definitions\";\nimport { addBlobToSummary, convertSummaryTreeToITree } from \"@fluidframework/runtime-utils\";\nimport {\n\tcreateChildMonitoringContext,\n\tgenerateStack,\n\tITelemetryLoggerExt,\n\tLoggingError,\n\tMonitoringContext,\n\ttagCodeArtifacts,\n\tThresholdCounter,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n\tDataCorruptionError,\n\tDataProcessingError,\n\textractSafePropertiesFromMessage,\n} from \"@fluidframework/container-utils\";\n\nimport {\n\tdataStoreAttributesBlobName,\n\thasIsolatedChannels,\n\twrapSummaryInChannelsTree,\n\tReadFluidDataStoreAttributes,\n\tWriteFluidDataStoreAttributes,\n\tgetAttributesFormatVersion,\n\tgetFluidDataStoreAttributes,\n\tsummarizerClientType,\n} from \"./summary\";\nimport { ContainerRuntime } from \"./containerRuntime\";\nimport { sendGCUnexpectedUsageEvent, throwOnTombstoneUsageKey } from \"./gc\";\n\nfunction createAttributes(\n\tpkg: readonly string[],\n\tisRootDataStore: boolean,\n): WriteFluidDataStoreAttributes {\n\tconst stringifiedPkg = JSON.stringify(pkg);\n\treturn {\n\t\tpkg: stringifiedPkg,\n\t\tsummaryFormatVersion: 2,\n\t\tisRootDataStore,\n\t};\n}\nexport function createAttributesBlob(pkg: readonly string[], isRootDataStore: boolean): ITreeEntry {\n\tconst attributes = createAttributes(pkg, isRootDataStore);\n\treturn new BlobTreeEntry(dataStoreAttributesBlobName, JSON.stringify(attributes));\n}\n\ninterface ISnapshotDetails {\n\tpkg: readonly string[];\n\tisRootDataStore: boolean;\n\tsnapshot?: ISnapshotTree;\n}\n\ninterface FluidDataStoreMessage {\n\tcontent: any;\n\ttype: string;\n}\n\n/** Properties necessary for creating a FluidDataStoreContext */\nexport interface IFluidDataStoreContextProps {\n\treadonly id: string;\n\treadonly runtime: ContainerRuntime;\n\treadonly storage: IDocumentStorageService;\n\treadonly scope: FluidObject;\n\treadonly createSummarizerNodeFn: CreateChildSummarizerNodeFn;\n\treadonly pkg?: Readonly<string[]>;\n}\n\n/** Properties necessary for creating a local FluidDataStoreContext */\nexport interface ILocalFluidDataStoreContextProps extends IFluidDataStoreContextProps {\n\treadonly pkg: Readonly<string[]> | undefined;\n\treadonly snapshotTree: ISnapshotTree | undefined;\n\treadonly isRootDataStore: boolean | undefined;\n\treadonly makeLocallyVisibleFn: () => void;\n\t/**\n\t * @deprecated 0.16 Issue #1635, #3631\n\t */\n\treadonly createProps?: any;\n}\n\n/** Properties necessary for creating a remote FluidDataStoreContext */\nexport interface IRemoteFluidDataStoreContextProps extends IFluidDataStoreContextProps {\n\treadonly snapshotTree: ISnapshotTree | undefined;\n}\n\n/**\n * Represents the context for the store. This context is passed to the store runtime.\n */\nexport abstract class FluidDataStoreContext\n\textends TypedEventEmitter<IFluidDataStoreContextEvents>\n\timplements IFluidDataStoreContext, IDisposable\n{\n\tpublic get packagePath(): readonly string[] {\n\t\tassert(this.pkg !== undefined, 0x139 /* \"Undefined package path\" */);\n\t\treturn this.pkg;\n\t}\n\n\tpublic get options(): ILoaderOptions {\n\t\treturn this._containerRuntime.options;\n\t}\n\n\tpublic get clientId(): string | undefined {\n\t\treturn this._containerRuntime.clientId;\n\t}\n\n\tpublic get clientDetails(): IClientDetails {\n\t\treturn this._containerRuntime.clientDetails;\n\t}\n\n\tpublic get logger(): ITelemetryLoggerExt {\n\t\treturn this._containerRuntime.logger;\n\t}\n\n\tpublic get deltaManager(): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {\n\t\treturn this._containerRuntime.deltaManager;\n\t}\n\n\tpublic get connected(): boolean {\n\t\treturn this._containerRuntime.connected;\n\t}\n\n\tpublic get IFluidHandleContext() {\n\t\treturn this._containerRuntime.IFluidHandleContext;\n\t}\n\n\tpublic get containerRuntime(): IContainerRuntime {\n\t\treturn this._containerRuntime;\n\t}\n\n\tpublic ensureNoDataModelChanges<T>(callback: () => T): T {\n\t\treturn this._containerRuntime.ensureNoDataModelChanges(callback);\n\t}\n\n\tpublic get isLoaded(): boolean {\n\t\treturn this.loaded;\n\t}\n\n\tpublic get baseSnapshot(): ISnapshotTree | undefined {\n\t\treturn this._baseSnapshot;\n\t}\n\n\tpublic get idCompressor(): (IIdCompressorCore & IIdCompressor) | undefined {\n\t\treturn this._containerRuntime.idCompressor;\n\t}\n\n\tprivate _disposed = false;\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\n\t/**\n\t * Tombstone is a temporary feature that prevents a data store from sending / receiving ops, signals and from\n\t * loading.\n\t */\n\tprivate _tombstoned = false;\n\tpublic get tombstoned() {\n\t\treturn this._tombstoned;\n\t}\n\t/** If true, throw an error when a tombstone data store is used. */\n\tprivate readonly throwOnTombstoneUsage: boolean;\n\n\t/** If true, this means that this data store context and its children have been removed from the runtime */\n\tprivate deleted: boolean = false;\n\n\tpublic get attachState(): AttachState {\n\t\treturn this._attachState;\n\t}\n\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined {\n\t\treturn this.registry;\n\t}\n\n\t/**\n\t * A datastore is considered as root if it\n\t * 1. is root in memory - see isInMemoryRoot\n\t * 2. is root as part of the base snapshot that the datastore loaded from\n\t * @returns whether a datastore is root\n\t */\n\tpublic async isRoot(): Promise<boolean> {\n\t\treturn this.isInMemoryRoot() || (await this.getInitialSnapshotDetails()).isRootDataStore;\n\t}\n\n\t/**\n\t * There are 3 states where isInMemoryRoot needs to be true\n\t * 1. when a datastore becomes aliased. This can happen for both remote and local datastores\n\t * 2. when a datastore is created locally as root\n\t * 3. when a datastore is created locally as root and is rehydrated\n\t * @returns whether a datastore is root in memory\n\t */\n\tprotected isInMemoryRoot(): boolean {\n\t\treturn this._isInMemoryRoot;\n\t}\n\n\tprotected registry: IFluidDataStoreRegistry | undefined;\n\n\tprotected detachedRuntimeCreation = false;\n\tprotected channel: IFluidDataStoreChannel | undefined;\n\tprivate loaded = false;\n\tprotected pending: ISequencedDocumentMessage[] | undefined = [];\n\tprotected channelDeferred: Deferred<IFluidDataStoreChannel> | undefined;\n\tprivate _baseSnapshot: ISnapshotTree | undefined;\n\tprotected _attachState: AttachState;\n\tprivate _isInMemoryRoot: boolean = false;\n\tprotected readonly summarizerNode: ISummarizerNodeWithGC;\n\tprotected readonly mc: MonitoringContext;\n\tprivate readonly thresholdOpsCounter: ThresholdCounter;\n\tprivate static readonly pendingOpsCountThreshold = 1000;\n\n\t/**\n\t * If the summarizer makes local changes, a telemetry event is logged. This has the potential to be very noisy.\n\t * So, adding a count of how many telemetry events are logged per data store context. This can be\n\t * controlled via feature flags.\n\t */\n\tprivate localChangesTelemetryCount: number;\n\n\t// The used routes of this node as per the last GC run. This is used to update the used routes of the channel\n\t// if it realizes after GC is run.\n\tprivate lastUsedRoutes: string[] | undefined;\n\n\tpublic readonly id: string;\n\tprivate readonly _containerRuntime: ContainerRuntime;\n\tpublic readonly storage: IDocumentStorageService;\n\tpublic readonly scope: FluidObject;\n\tprotected pkg?: readonly string[];\n\n\tconstructor(\n\t\tprops: IFluidDataStoreContextProps,\n\t\tprivate readonly existing: boolean,\n\t\tpublic readonly isLocalDataStore: boolean,\n\t\tprivate readonly makeLocallyVisibleFn: () => void,\n\t) {\n\t\tsuper();\n\n\t\tthis._containerRuntime = props.runtime;\n\t\tthis.id = props.id;\n\t\tthis.storage = props.storage;\n\t\tthis.scope = props.scope;\n\t\tthis.pkg = props.pkg;\n\n\t\t// URIs use slashes as delimiters. Handles use URIs.\n\t\t// Thus having slashes in types almost guarantees trouble down the road!\n\t\tassert(!this.id.includes(\"/\"), 0x13a /* Data store ID contains slash */);\n\n\t\tthis._attachState =\n\t\t\tthis.containerRuntime.attachState !== AttachState.Detached && this.existing\n\t\t\t\t? this.containerRuntime.attachState\n\t\t\t\t: AttachState.Detached;\n\n\t\tconst thisSummarizeInternal = async (\n\t\t\tfullTree: boolean,\n\t\t\ttrackState: boolean,\n\t\t\ttelemetryContext?: ITelemetryContext,\n\t\t) => this.summarizeInternal(fullTree, trackState, telemetryContext);\n\n\t\tthis.summarizerNode = props.createSummarizerNodeFn(\n\t\t\tthisSummarizeInternal,\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t);\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.logger,\n\t\t\tnamespace: \"FluidDataStoreContext\",\n\t\t\tproperties: {\n\t\t\t\tall: tagCodeArtifacts({\n\t\t\t\t\tfluidDataStoreId: this.id,\n\t\t\t\t\tfullPackageName: this.pkg?.join(\"/\"),\n\t\t\t\t}),\n\t\t\t},\n\t\t});\n\t\tthis.thresholdOpsCounter = new ThresholdCounter(\n\t\t\tFluidDataStoreContext.pendingOpsCountThreshold,\n\t\t\tthis.mc.logger,\n\t\t);\n\n\t\t// Tombstone should only throw when the feature flag is enabled and the client isn't a summarizer\n\t\tthis.throwOnTombstoneUsage =\n\t\t\tthis.mc.config.getBoolean(throwOnTombstoneUsageKey) === true &&\n\t\t\tthis._containerRuntime.gcTombstoneEnforcementAllowed &&\n\t\t\tthis.clientDetails.type !== summarizerClientType;\n\n\t\t// By default, a data store can log maximum 10 local changes telemetry in summarizer.\n\t\tthis.localChangesTelemetryCount =\n\t\t\tthis.mc.config.getNumber(\"Fluid.Telemetry.LocalChangesTelemetryCount\") ?? 10;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._disposed = true;\n\n\t\t// Dispose any pending runtime after it gets fulfilled\n\t\t// Errors are logged where this.channelDeferred is consumed/generated (realizeCore(), bindRuntime())\n\t\tif (this.channelDeferred) {\n\t\t\tthis.channelDeferred.promise\n\t\t\t\t.then((runtime) => {\n\t\t\t\t\truntime.dispose();\n\t\t\t\t})\n\t\t\t\t.catch((error) => {});\n\t\t}\n\t}\n\n\t/**\n\t * When delete is called, that means that the data store is permanently removed from the runtime, and will not show up in future summaries\n\t * This function is called to prevent ops from being generated from this data store once it has been deleted. Furthermore, this data store\n\t * should not receive any ops/signals.\n\t */\n\tpublic delete() {\n\t\tthis.deleted = true;\n\t}\n\n\tpublic setTombstone(tombstone: boolean) {\n\t\tif (this.tombstoned === tombstone) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._tombstoned = tombstone;\n\t}\n\n\tprivate rejectDeferredRealize(\n\t\treason: string,\n\t\tfailedPkgPath?: string,\n\t\tfullPackageName?: readonly string[],\n\t): never {\n\t\tthrow new LoggingError(\n\t\t\treason,\n\t\t\ttagCodeArtifacts({\n\t\t\t\tfailedPkgPath,\n\t\t\t\tpackagePath: fullPackageName?.join(\"/\"),\n\t\t\t}),\n\t\t);\n\t}\n\n\tpublic async realize(): Promise<IFluidDataStoreChannel> {\n\t\tassert(!this.detachedRuntimeCreation, 0x13d /* \"Detached runtime creation on realize()\" */);\n\t\tif (!this.channelDeferred) {\n\t\t\tthis.channelDeferred = new Deferred<IFluidDataStoreChannel>();\n\t\t\tthis.realizeCore(this.existing).catch((error) => {\n\t\t\t\tconst errorWrapped = DataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\terror,\n\t\t\t\t\t\"realizeFluidDataStoreContext\",\n\t\t\t\t);\n\t\t\t\terrorWrapped.addTelemetryProperties(\n\t\t\t\t\ttagCodeArtifacts({\n\t\t\t\t\t\tfullPackageName: this.pkg?.join(\"/\"),\n\t\t\t\t\t\tfluidDataStoreId: this.id,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\tthis.channelDeferred?.reject(errorWrapped);\n\t\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"RealizeError\" }, errorWrapped);\n\t\t\t});\n\t\t}\n\t\treturn this.channelDeferred.promise;\n\t}\n\n\tprotected async factoryFromPackagePath(packages?: readonly string[]) {\n\t\tassert(this.pkg === packages, 0x13e /* \"Unexpected package path\" */);\n\t\tif (packages === undefined) {\n\t\t\tthis.rejectDeferredRealize(\"packages is undefined\");\n\t\t}\n\n\t\tlet entry: FluidDataStoreRegistryEntry | undefined;\n\t\tlet registry: IFluidDataStoreRegistry | undefined =\n\t\t\tthis._containerRuntime.IFluidDataStoreRegistry;\n\t\tlet lastPkg: string | undefined;\n\t\tfor (const pkg of packages) {\n\t\t\tif (!registry) {\n\t\t\t\tthis.rejectDeferredRealize(\"No registry for package\", lastPkg, packages);\n\t\t\t}\n\t\t\tlastPkg = pkg;\n\t\t\tentry = await registry.get(pkg);\n\t\t\tif (!entry) {\n\t\t\t\tthis.rejectDeferredRealize(\n\t\t\t\t\t\"Registry does not contain entry for the package\",\n\t\t\t\t\tpkg,\n\t\t\t\t\tpackages,\n\t\t\t\t);\n\t\t\t}\n\t\t\tregistry = entry.IFluidDataStoreRegistry;\n\t\t}\n\t\tconst factory = entry?.IFluidDataStoreFactory;\n\t\tif (factory === undefined) {\n\t\t\tthis.rejectDeferredRealize(\"Can't find factory for package\", lastPkg, packages);\n\t\t}\n\n\t\treturn { factory, registry };\n\t}\n\n\tprivate async realizeCore(existing: boolean): Promise<void> {\n\t\tconst details = await this.getInitialSnapshotDetails();\n\t\t// Base snapshot is the baseline where pending ops are applied to.\n\t\t// It is important that this be in sync with the pending ops, and also\n\t\t// that it is set here, before bindRuntime is called.\n\t\tthis._baseSnapshot = details.snapshot;\n\t\tconst packages = details.pkg;\n\n\t\tconst { factory, registry } = await this.factoryFromPackagePath(packages);\n\n\t\tassert(\n\t\t\tthis.registry === undefined,\n\t\t\t0x13f /* \"datastore context registry is already set\" */,\n\t\t);\n\t\tthis.registry = registry;\n\n\t\tconst channel = await factory.instantiateDataStore(this, existing);\n\t\tassert(channel !== undefined, 0x140 /* \"undefined channel on datastore context\" */);\n\t\tthis.bindRuntime(channel);\n\t}\n\n\t/**\n\t * Notifies this object about changes in the connection state.\n\t * @param value - New connection state.\n\t * @param clientId - ID of the client. Its old ID when in disconnected state and\n\t * its new client ID when we are connecting or connected.\n\t */\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\t// ConnectionState should not fail in tombstone mode as this is internally run\n\t\tthis.verifyNotClosed(\"setConnectionState\", false /* checkTombstone */);\n\n\t\t// Connection events are ignored if the store is not yet loaded\n\t\tif (!this.loaded) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(this.connected === connected, 0x141 /* \"Unexpected connected state\" */);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tthis.channel!.setConnectionState(connected, clientId);\n\t}\n\n\tpublic process(\n\t\tmessageArg: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.verifyNotClosed(\"process\", true, extractSafePropertiesFromMessage(messageArg));\n\n\t\tconst innerContents = messageArg.contents as FluidDataStoreMessage;\n\t\tconst message = {\n\t\t\t...messageArg,\n\t\t\ttype: innerContents.type,\n\t\t\tcontents: innerContents.content,\n\t\t};\n\n\t\tthis.summarizerNode.recordChange(message);\n\n\t\tif (this.loaded) {\n\t\t\treturn this.channel?.process(message, local, localOpMetadata);\n\t\t} else {\n\t\t\tassert(!local, 0x142 /* \"local store channel is not loaded\" */);\n\t\t\tassert(this.pending !== undefined, 0x23d /* \"pending is undefined\" */);\n\t\t\tthis.pending.push(message);\n\t\t\tthis.thresholdOpsCounter.sendIfMultiple(\"StorePendingOps\", this.pending.length);\n\t\t}\n\t}\n\n\tpublic processSignal(message: IInboundSignalMessage, local: boolean): void {\n\t\tthis.verifyNotClosed(\"processSignal\");\n\n\t\t// Signals are ignored if the store is not yet loaded\n\t\tif (!this.loaded) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.channel?.processSignal(message, local);\n\t}\n\n\tpublic getQuorum(): IQuorumClients {\n\t\treturn this._containerRuntime.getQuorum();\n\t}\n\n\tpublic getAudience(): IAudience {\n\t\treturn this._containerRuntime.getAudience();\n\t}\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\treturn this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n\t}\n\n\tprivate async summarizeInternal(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeInternalResult> {\n\t\tawait this.realize();\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tconst summarizeResult = await this.channel!.summarize(\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t);\n\n\t\t// Wrap dds summaries in .channels subtree.\n\t\twrapSummaryInChannelsTree(summarizeResult);\n\t\tconst pathPartsForChildren = [channelsTreeName];\n\n\t\t// Add data store's attributes to the summary.\n\t\tconst { pkg } = await this.getInitialSnapshotDetails();\n\t\tconst isRoot = await this.isRoot();\n\t\tconst attributes = createAttributes(pkg, isRoot);\n\t\taddBlobToSummary(summarizeResult, dataStoreAttributesBlobName, JSON.stringify(attributes));\n\n\t\t// If we are not referenced, mark the summary tree as unreferenced. Also, update unreferenced blob\n\t\t// size in the summary stats with the blobs size of this data store.\n\t\tif (!this.summarizerNode.isReferenced()) {\n\t\t\tsummarizeResult.summary.unreferenced = true;\n\t\t\tsummarizeResult.stats.unreferencedBlobSize = summarizeResult.stats.totalBlobSize;\n\t\t}\n\n\t\treturn {\n\t\t\t...summarizeResult,\n\t\t\tid: this.id,\n\t\t\tpathPartsForChildren,\n\t\t};\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this data store\n\t * including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the\n\t * document.\n\t * If there is no new data in this data store since the last summary, previous GC data is used.\n\t * If there is new data, the GC data is generated again (by calling getGCDataInternal).\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\treturn this.summarizerNode.getGCData(fullGC);\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. This is called when there is new data since last summary. It\n\t * realizes the data store and calls into each channel context to get its GC data.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tprivate async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tawait this.realize();\n\t\tassert(\n\t\t\tthis.channel !== undefined,\n\t\t\t0x143 /* \"Channel should not be undefined when running GC\" */,\n\t\t);\n\n\t\treturn this.channel.getGCData(fullGC);\n\t}\n\n\t/**\n\t * After GC has run, called to notify the data store of routes used in it. These are used for the following:\n\t *\n\t * 1. To identify if this data store is being referenced in the document or not.\n\t *\n\t * 2. To determine if it needs to re-summarize in case used routes changed since last summary.\n\t *\n\t * 3. These are added to the summary generated by the data store.\n\t *\n\t * 4. To notify child contexts of their used routes. This is done immediately if the data store is loaded.\n\t * Else, it is done when realizing the data store.\n\t *\n\t * 5. To update the timestamp when this data store or any children are marked as unreferenced.\n\t *\n\t * @param usedRoutes - The routes that are used in this data store.\n\t */\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t// Update the used routes in this data store's summarizer node.\n\t\tthis.summarizerNode.updateUsedRoutes(usedRoutes);\n\n\t\t/**\n\t\t * Store the used routes to update the channel if the data store is not loaded yet. If the used routes changed\n\t\t * since the previous run, the data store will be loaded during summarize since the used state changed. So, it's\n\t\t * safe to only store the last used routes.\n\t\t */\n\t\tthis.lastUsedRoutes = usedRoutes;\n\n\t\t// If we are loaded, call the channel so it can update the used routes of the child contexts.\n\t\t// If we are not loaded, we will update this when we are realized.\n\t\tif (this.loaded) {\n\t\t\tthis.updateChannelUsedRoutes();\n\t\t}\n\t}\n\n\t/**\n\t * Called when a new outbound reference is added to another node. This is used by garbage collection to identify\n\t * all references added in the system.\n\t * @param srcHandle - The handle of the node that added the reference.\n\t * @param outboundHandle - The handle of the outbound node that is referenced.\n\t */\n\tpublic addedGCOutboundReference(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) {\n\t\tthis._containerRuntime.addedGCOutboundReference(srcHandle, outboundHandle);\n\t}\n\n\t/**\n\t * Updates the used routes of the channel and its child contexts. The channel must be loaded before calling this.\n\t * It is called in these two scenarios:\n\t * 1. When the used routes of the data store is updated and the data store is loaded.\n\t * 2. When the data store is realized. This updates the channel's used routes as per last GC run.\n\t */\n\tprivate updateChannelUsedRoutes() {\n\t\tassert(this.loaded, 0x144 /* \"Channel should be loaded when updating used routes\" */);\n\t\tassert(\n\t\t\tthis.channel !== undefined,\n\t\t\t0x145 /* \"Channel should be present when data store is loaded\" */,\n\t\t);\n\n\t\t// If there is no lastUsedRoutes, GC has not run up until this point.\n\t\tif (this.lastUsedRoutes === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Remove the route to this data store, if it exists.\n\t\tconst usedChannelRoutes = this.lastUsedRoutes.filter((id: string) => {\n\t\t\treturn id !== \"/\" && id !== \"\";\n\t\t});\n\t\tthis.channel.updateUsedRoutes(usedChannelRoutes);\n\t}\n\n\t/**\n\t * @deprecated 0.18.Should call request on the runtime directly\n\t */\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\tconst runtime = await this.realize();\n\t\treturn runtime.request(request);\n\t}\n\n\tpublic submitMessage(type: string, content: any, localOpMetadata: unknown): void {\n\t\tthis.verifyNotClosed(\"submitMessage\");\n\t\tassert(!!this.channel, 0x146 /* \"Channel must exist when submitting message\" */);\n\t\tconst fluidDataStoreContent: FluidDataStoreMessage = {\n\t\t\tcontent,\n\t\t\ttype,\n\t\t};\n\n\t\t// Summarizer clients should not submit messages.\n\t\tthis.identifyLocalChangeInSummarizer(\"DataStoreMessageSubmittedInSummarizer\", type);\n\n\t\tthis._containerRuntime.submitDataStoreOp(this.id, fluidDataStoreContent, localOpMetadata);\n\t}\n\n\t/**\n\t * This is called from a SharedSummaryBlock that does not generate ops but only wants to be part of the summary.\n\t * It indicates that there is data in the object that needs to be summarized.\n\t * We will update the latestSequenceNumber of the summary tracker of this\n\t * store and of the object's channel.\n\t *\n\t * @param address - The address of the channel that is dirty.\n\t *\n\t */\n\tpublic setChannelDirty(address: string): void {\n\t\tthis.verifyNotClosed(\"setChannelDirty\");\n\n\t\t// Get the latest sequence number.\n\t\tconst latestSequenceNumber = this.deltaManager.lastSequenceNumber;\n\n\t\tthis.summarizerNode.invalidate(latestSequenceNumber);\n\n\t\tconst channelSummarizerNode = this.summarizerNode.getChild(address);\n\n\t\tif (channelSummarizerNode) {\n\t\t\tchannelSummarizerNode.invalidate(latestSequenceNumber); // TODO: lazy load problem?\n\t\t}\n\t}\n\n\tpublic submitSignal(type: string, content: any) {\n\t\tthis.verifyNotClosed(\"submitSignal\");\n\n\t\tassert(!!this.channel, 0x147 /* \"Channel must exist on submitting signal\" */);\n\t\treturn this._containerRuntime.submitDataStoreSignal(this.id, type, content);\n\t}\n\n\t/**\n\t * This is called by the data store channel when it becomes locally visible indicating that it is ready to become\n\t * globally visible now.\n\t */\n\tpublic makeLocallyVisible() {\n\t\tassert(this.channel !== undefined, 0x2cf /* \"undefined channel on datastore context\" */);\n\t\tassert(\n\t\t\tthis.channel.visibilityState === VisibilityState.LocallyVisible,\n\t\t\t0x590 /* Channel must be locally visible */,\n\t\t);\n\t\tthis.makeLocallyVisibleFn();\n\t}\n\n\t/** @deprecated - To be replaced by calling makeLocallyVisible directly */\n\tpublic bindToContext() {\n\t\tthis.makeLocallyVisibleFn();\n\t}\n\n\tprotected bindRuntime(channel: IFluidDataStoreChannel) {\n\t\tif (this.channel) {\n\t\t\tthrow new Error(\"Runtime already bound\");\n\t\t}\n\n\t\ttry {\n\t\t\tassert(\n\t\t\t\t!this.detachedRuntimeCreation,\n\t\t\t\t0x148 /* \"Detached runtime creation on runtime bind\" */,\n\t\t\t);\n\t\t\tassert(this.channelDeferred !== undefined, 0x149 /* \"Undefined channel deferral\" */);\n\t\t\tassert(this.pkg !== undefined, 0x14a /* \"Undefined package path\" */);\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst pending = this.pending!;\n\n\t\t\t// Apply all pending ops\n\t\t\tfor (const op of pending) {\n\t\t\t\tchannel.process(op, false, undefined /* localOpMetadata */);\n\t\t\t}\n\n\t\t\tthis.thresholdOpsCounter.send(\"ProcessPendingOps\", pending.length);\n\t\t\tthis.pending = undefined;\n\n\t\t\t// And now mark the runtime active\n\t\t\tthis.loaded = true;\n\t\t\tthis.channel = channel;\n\n\t\t\t// Freeze the package path to ensure that someone doesn't modify it when it is\n\t\t\t// returned in packagePath().\n\t\t\tObject.freeze(this.pkg);\n\n\t\t\t/**\n\t\t\t * Update the used routes of the channel. If GC has run before this data store was realized, we will have\n\t\t\t * the used routes saved. So, this will ensure that all the child contexts have up-to-date used routes as\n\t\t\t * per the last time GC was run.\n\t\t\t * Also, this data store may have been realized during summarize. In that case, the child contexts need to\n\t\t\t * have their used routes updated to determine if its needs to summarize again and to add it to the summary.\n\t\t\t */\n\t\t\tthis.updateChannelUsedRoutes();\n\n\t\t\t// And notify the pending promise it is now available\n\t\t\tthis.channelDeferred.resolve(this.channel);\n\t\t} catch (error) {\n\t\t\tthis.channelDeferred?.reject(error);\n\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"BindRuntimeError\",\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic async getAbsoluteUrl(relativeUrl: string): Promise<string | undefined> {\n\t\tif (this.attachState !== AttachState.Attached) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this._containerRuntime.getAbsoluteUrl(relativeUrl);\n\t}\n\n\tpublic abstract generateAttachMessage(): IAttachMessage;\n\n\tpublic abstract getInitialSnapshotDetails(): Promise<ISnapshotDetails>;\n\n\t/**\n\t * @deprecated Sets the datastore as root, for aliasing purposes: #7948\n\t * This method should not be used outside of the aliasing context.\n\t * It will be removed, as the source of truth for this flag will be the aliasing blob.\n\t */\n\tpublic setInMemoryRoot(): void {\n\t\tthis._isInMemoryRoot = true;\n\t}\n\n\t/**\n\t * @deprecated - The functionality to get base GC details has been moved to summarizer node.\n\t */\n\tpublic async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n\t\treturn {};\n\t}\n\n\tpublic reSubmit(contents: any, localOpMetadata: unknown) {\n\t\tassert(!!this.channel, 0x14b /* \"Channel must exist when resubmitting ops\" */);\n\t\tconst innerContents = contents as FluidDataStoreMessage;\n\t\tthis.channel.reSubmit(innerContents.type, innerContents.content, localOpMetadata);\n\t}\n\n\tpublic rollback(contents: any, localOpMetadata: unknown) {\n\t\tif (!this.channel) {\n\t\t\tthrow new Error(\"Channel must exist when rolling back ops\");\n\t\t}\n\t\tif (!this.channel.rollback) {\n\t\t\tthrow new Error(\"Channel doesn't support rollback\");\n\t\t}\n\t\tconst innerContents = contents as FluidDataStoreMessage;\n\t\tthis.channel.rollback(innerContents.type, innerContents.content, localOpMetadata);\n\t}\n\n\tpublic async applyStashedOp(contents: any): Promise<unknown> {\n\t\tif (!this.channel) {\n\t\t\tawait this.realize();\n\t\t}\n\t\tassert(!!this.channel, 0x14c /* \"Channel must exist when rebasing ops\" */);\n\t\tconst innerContents = contents as FluidDataStoreMessage;\n\t\treturn this.channel.applyStashedOp(innerContents.content);\n\t}\n\n\tprivate verifyNotClosed(\n\t\tcallSite: string,\n\t\tcheckTombstone = true,\n\t\tsafeTelemetryProps: ITelemetryProperties = {},\n\t) {\n\t\tif (this.deleted) {\n\t\t\tconst messageString = `Context is deleted! Call site [${callSite}]`;\n\t\t\tconst error = new DataCorruptionError(messageString, safeTelemetryProps);\n\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"GC_Deleted_DataStore_Changed\",\n\t\t\t\t\tcallSite,\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (this._disposed) {\n\t\t\tthrow new Error(`Context is closed! Call site [${callSite}]`);\n\t\t}\n\n\t\tif (checkTombstone && this.tombstoned) {\n\t\t\tconst messageString = `Context is tombstoned! Call site [${callSite}]`;\n\t\t\tconst error = new DataCorruptionError(messageString, safeTelemetryProps);\n\n\t\t\tsendGCUnexpectedUsageEvent(\n\t\t\t\tthis.mc,\n\t\t\t\t{\n\t\t\t\t\teventName: \"GC_Tombstone_DataStore_Changed\",\n\t\t\t\t\tcategory: this.throwOnTombstoneUsage ? \"error\" : \"generic\",\n\t\t\t\t\tgcTombstoneEnforcementAllowed:\n\t\t\t\t\t\tthis._containerRuntime.gcTombstoneEnforcementAllowed,\n\t\t\t\t\tcallSite,\n\t\t\t\t},\n\t\t\t\tthis.pkg,\n\t\t\t\terror,\n\t\t\t);\n\t\t\tif (this.throwOnTombstoneUsage) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Summarizer client should not have local changes. These changes can become part of the summary and can break\n\t * eventual consistency. For example, the next summary (say at ref seq# 100) may contain these changes whereas\n\t * other clients that are up-to-date till seq# 100 may not have them yet.\n\t */\n\tprotected identifyLocalChangeInSummarizer(eventName: string, type?: string) {\n\t\tif (\n\t\t\tthis.clientDetails.type !== summarizerClientType ||\n\t\t\tthis.localChangesTelemetryCount <= 0\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Log a telemetry if there are local changes in the summarizer. This will give us data on how often\n\t\t// this is happening and which data stores do this. The eventual goal is to disallow local changes\n\t\t// in the summarizer and the data will help us plan this.\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName,\n\t\t\ttype,\n\t\t\tisSummaryInProgress: this.summarizerNode.isSummaryInProgress?.(),\n\t\t\tstack: generateStack(),\n\t\t});\n\t\tthis.localChangesTelemetryCount--;\n\t}\n\n\tpublic getCreateChildSummarizerNodeFn(id: string, createParam: CreateChildSummarizerNodeParam) {\n\t\treturn (\n\t\t\tsummarizeInternal: SummarizeInternalFn,\n\t\t\tgetGCDataFn: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\t\t) =>\n\t\t\tthis.summarizerNode.createChild(\n\t\t\t\tsummarizeInternal,\n\t\t\t\tid,\n\t\t\t\tcreateParam,\n\t\t\t\t// DDS will not create failure summaries\n\t\t\t\t{ throwOnFailure: true },\n\t\t\t\tgetGCDataFn,\n\t\t\t);\n\t}\n\n\tpublic async uploadBlob(\n\t\tblob: ArrayBufferLike,\n\t\tsignal?: AbortSignal,\n\t): Promise<IFluidHandle<ArrayBufferLike>> {\n\t\treturn this.containerRuntime.uploadBlob(blob, signal);\n\t}\n}\n\nexport class RemoteFluidDataStoreContext extends FluidDataStoreContext {\n\tprivate readonly initSnapshotValue: ISnapshotTree | undefined;\n\n\tconstructor(props: IRemoteFluidDataStoreContextProps) {\n\t\tsuper(props, true /* existing */, false /* isLocalDataStore */, () => {\n\t\t\tthrow new Error(\"Already attached\");\n\t\t});\n\n\t\tthis.initSnapshotValue = props.snapshotTree;\n\n\t\tif (props.snapshotTree !== undefined) {\n\t\t\tthis.summarizerNode.updateBaseSummaryState(props.snapshotTree);\n\t\t}\n\t}\n\n\tprivate readonly initialSnapshotDetailsP = new LazyPromise<ISnapshotDetails>(async () => {\n\t\tlet tree = this.initSnapshotValue;\n\t\tlet isRootDataStore = true;\n\n\t\tif (!!tree && tree.blobs[dataStoreAttributesBlobName] !== undefined) {\n\t\t\t// Need to get through snapshot and use that to populate extraBlobs\n\t\t\tconst attributes = await readAndParse<ReadFluidDataStoreAttributes>(\n\t\t\t\tthis.storage,\n\t\t\t\ttree.blobs[dataStoreAttributesBlobName],\n\t\t\t);\n\n\t\t\tlet pkgFromSnapshot: string[];\n\t\t\t// Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.\n\t\t\t// For snapshotFormatVersion = \"0.1\" (1) or above, pkg is jsonified, otherwise it is just a string.\n\t\t\tconst formatVersion = getAttributesFormatVersion(attributes);\n\t\t\tif (formatVersion < 1) {\n\t\t\t\tpkgFromSnapshot =\n\t\t\t\t\tattributes.pkg.startsWith('[\"') && attributes.pkg.endsWith('\"]')\n\t\t\t\t\t\t? (JSON.parse(attributes.pkg) as string[])\n\t\t\t\t\t\t: [attributes.pkg];\n\t\t\t} else {\n\t\t\t\tpkgFromSnapshot = JSON.parse(attributes.pkg) as string[];\n\t\t\t}\n\t\t\tthis.pkg = pkgFromSnapshot;\n\n\t\t\t/**\n\t\t\t * If there is no isRootDataStore in the attributes blob, set it to true. This will ensure that\n\t\t\t * data stores in older documents are not garbage collected incorrectly. This may lead to additional\n\t\t\t * roots in the document but they won't break.\n\t\t\t */\n\t\t\tisRootDataStore = attributes.isRootDataStore ?? true;\n\n\t\t\tif (hasIsolatedChannels(attributes)) {\n\t\t\t\ttree = tree.trees[channelsTreeName];\n\t\t\t\tassert(\n\t\t\t\t\ttree !== undefined,\n\t\t\t\t\t0x1fe /* \"isolated channels subtree should exist in remote datastore snapshot\" */,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tpkg: this.pkg!,\n\t\t\tisRootDataStore,\n\t\t\tsnapshot: tree,\n\t\t};\n\t});\n\n\tpublic async getInitialSnapshotDetails(): Promise<ISnapshotDetails> {\n\t\treturn this.initialSnapshotDetailsP;\n\t}\n\n\tpublic generateAttachMessage(): IAttachMessage {\n\t\tthrow new Error(\"Cannot attach remote store\");\n\t}\n}\n\n/**\n * Base class for detached & attached context classes\n */\nexport class LocalFluidDataStoreContextBase extends FluidDataStoreContext {\n\tprivate readonly snapshotTree: ISnapshotTree | undefined;\n\t/**\n\t * @deprecated 0.16 Issue #1635, #3631\n\t */\n\tpublic readonly createProps?: any;\n\n\tconstructor(props: ILocalFluidDataStoreContextProps) {\n\t\tsuper(\n\t\t\tprops,\n\t\t\tprops.snapshotTree !== undefined ? true : false /* existing */,\n\t\t\ttrue /* isLocalDataStore */,\n\t\t\tprops.makeLocallyVisibleFn,\n\t\t);\n\n\t\t// Summarizer client should not create local data stores.\n\t\tthis.identifyLocalChangeInSummarizer(\"DataStoreCreatedInSummarizer\");\n\n\t\tthis.snapshotTree = props.snapshotTree;\n\t\tif (props.isRootDataStore === true) {\n\t\t\tthis.setInMemoryRoot();\n\t\t}\n\t\tthis.createProps = props.createProps;\n\t\tthis.attachListeners();\n\t}\n\n\tprivate attachListeners(): void {\n\t\tthis.once(\"attaching\", () => {\n\t\t\tassert(\n\t\t\t\tthis.attachState === AttachState.Detached,\n\t\t\t\t0x14d /* \"Should move from detached to attaching\" */,\n\t\t\t);\n\t\t\tthis._attachState = AttachState.Attaching;\n\t\t});\n\t\tthis.once(\"attached\", () => {\n\t\t\tassert(\n\t\t\t\tthis.attachState === AttachState.Attaching,\n\t\t\t\t0x14e /* \"Should move from attaching to attached\" */,\n\t\t\t);\n\t\t\tthis._attachState = AttachState.Attached;\n\t\t});\n\t}\n\n\tpublic generateAttachMessage(): IAttachMessage {\n\t\tassert(\n\t\t\tthis.channel !== undefined,\n\t\t\t0x14f /* \"There should be a channel when generating attach message\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.pkg !== undefined,\n\t\t\t0x150 /* \"pkg should be available in local data store context\" */,\n\t\t);\n\n\t\tconst summarizeResult = this.channel.getAttachSummary();\n\n\t\t// Wrap dds summaries in .channels subtree.\n\t\twrapSummaryInChannelsTree(summarizeResult);\n\n\t\t// Add data store's attributes to the summary.\n\t\tconst attributes = createAttributes(this.pkg, this.isInMemoryRoot());\n\t\taddBlobToSummary(summarizeResult, dataStoreAttributesBlobName, JSON.stringify(attributes));\n\n\t\t// Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.\n\t\tconst snapshot = convertSummaryTreeToITree(summarizeResult.summary);\n\n\t\tconst message: IAttachMessage = {\n\t\t\tid: this.id,\n\t\t\tsnapshot,\n\t\t\ttype: this.pkg[this.pkg.length - 1],\n\t\t};\n\n\t\treturn message;\n\t}\n\n\tpublic async getInitialSnapshotDetails(): Promise<ISnapshotDetails> {\n\t\tlet snapshot = this.snapshotTree;\n\t\tlet attributes: ReadFluidDataStoreAttributes;\n\t\tlet isRootDataStore = false;\n\t\tif (snapshot !== undefined) {\n\t\t\t// Get the dataStore attributes.\n\t\t\t// Note: storage can be undefined in special case while detached.\n\t\t\tattributes = await getFluidDataStoreAttributes(this.storage, snapshot);\n\t\t\tif (hasIsolatedChannels(attributes)) {\n\t\t\t\tsnapshot = snapshot.trees[channelsTreeName];\n\t\t\t\tassert(\n\t\t\t\t\tsnapshot !== undefined,\n\t\t\t\t\t0x1ff /* \"isolated channels subtree should exist in local datastore snapshot\" */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (this.pkg === undefined) {\n\t\t\t\tthis.pkg = JSON.parse(attributes.pkg) as string[];\n\t\t\t\t// If there is no isRootDataStore in the attributes blob, set it to true. This ensures that data\n\t\t\t\t// stores in older documents are not garbage collected incorrectly. This may lead to additional\n\t\t\t\t// roots in the document but they won't break.\n\t\t\t\tif (attributes.isRootDataStore ?? true) {\n\t\t\t\t\tisRootDataStore = true;\n\t\t\t\t\tthis.setInMemoryRoot();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tassert(this.pkg !== undefined, 0x152 /* \"pkg should be available in local data store\" */);\n\n\t\treturn {\n\t\t\tpkg: this.pkg,\n\t\t\tisRootDataStore,\n\t\t\tsnapshot,\n\t\t};\n\t}\n\n\t/**\n\t * A context should only be marked as deleted when its a remote context.\n\t * Session Expiry at the runtime level should have closed the container creating the local data store context\n\t * before delete is even possible. Session Expiry is at 30 days, and sweep is done 36+ days later from the time\n\t * it was unreferenced. Thus the sweeping container should have loaded from a snapshot and thus creating a remote\n\t * context.\n\t */\n\tpublic delete() {\n\t\t// TODO: GC:Validation - potentially prevent this from happening or asserting. Maybe throw here.\n\t\tsendGCUnexpectedUsageEvent(\n\t\t\tthis.mc,\n\t\t\t{\n\t\t\t\teventName: \"GC_Deleted_DataStore_Unexpected_Delete\",\n\t\t\t\tmessage: \"Unexpected deletion of a local data store context\",\n\t\t\t\tcategory: \"error\",\n\t\t\t\tgcTombstoneEnforcementAllowed: undefined,\n\t\t\t},\n\t\t\tthis.pkg,\n\t\t);\n\t\tsuper.delete();\n\t}\n}\n\n/**\n * context implementation for \"attached\" data store runtime.\n * Various workflows (snapshot creation, requests) result in .realize() being called\n * on context, resulting in instantiation and attachment of runtime.\n * Runtime is created using data store factory that is associated with this context.\n */\nexport class LocalFluidDataStoreContext extends LocalFluidDataStoreContextBase {\n\tconstructor(props: ILocalFluidDataStoreContextProps) {\n\t\tsuper(props);\n\t}\n}\n\n/**\n * Detached context. Data Store runtime will be attached to it by attachRuntime() call\n * Before attachment happens, this context is not associated with particular type of runtime\n * or factory, i.e. it's package path is undefined.\n * Attachment process provides all missing parts - package path, data store runtime, and data store factory\n */\nexport class LocalDetachedFluidDataStoreContext\n\textends LocalFluidDataStoreContextBase\n\timplements IFluidDataStoreContextDetached\n{\n\tconstructor(props: ILocalFluidDataStoreContextProps) {\n\t\tsuper(props);\n\t\tthis.detachedRuntimeCreation = true;\n\t}\n\n\tpublic async attachRuntime(\n\t\tregistry: IProvideFluidDataStoreFactory,\n\t\tdataStoreChannel: IFluidDataStoreChannel,\n\t) {\n\t\tassert(this.detachedRuntimeCreation, 0x154 /* \"runtime creation is already attached\" */);\n\t\tthis.detachedRuntimeCreation = false;\n\n\t\tassert(this.channelDeferred === undefined, 0x155 /* \"channel deferral is already set\" */);\n\t\tthis.channelDeferred = new Deferred<IFluidDataStoreChannel>();\n\n\t\tconst factory = registry.IFluidDataStoreFactory;\n\n\t\tconst entry = await this.factoryFromPackagePath(this.pkg);\n\t\tassert(entry.factory === factory, 0x156 /* \"Unexpected factory for package path\" */);\n\n\t\tassert(this.registry === undefined, 0x157 /* \"datastore registry already attached\" */);\n\t\tthis.registry = entry.registry;\n\n\t\tsuper.bindRuntime(dataStoreChannel);\n\n\t\t// Load the handle to the data store's entryPoint to make sure that for a detached data store, the entryPoint\n\t\t// initialization function is called before the data store gets attached and potentially connected to the\n\t\t// delta stream, so it gets a chance to do things while the data store is still \"purely local\".\n\t\t// This preserves the behavior from before we introduced entryPoints, where the instantiateDataStore method\n\t\t// of data store factories tends to construct the data object (at least kick off an async method that returns\n\t\t// it); that code moved to the entryPoint initialization function, so we want to ensure it still executes\n\t\t// before the data store is attached.\n\t\tawait dataStoreChannel.entryPoint?.get();\n\n\t\tif (await this.isRoot()) {\n\t\t\tdataStoreChannel.makeVisibleAndAttachGraph();\n\t\t}\n\t}\n\n\tpublic async getInitialSnapshotDetails(): Promise<ISnapshotDetails> {\n\t\tif (this.detachedRuntimeCreation) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Detached Fluid Data Store context can't be realized! Please attach runtime first!\",\n\t\t\t);\n\t\t}\n\t\treturn super.getInitialSnapshotDetails();\n\t}\n}\n"]}
1
+ {"version":3,"file":"dataStoreContext.js","sourceRoot":"","sources":["../src/dataStoreContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EAGN,WAAW,GAEX,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC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K,OAAO,EAAE,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAErF,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,2CAA2C,CAAC,CAAC;QACvF,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAE/B,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;QAEpC,6GAA6G;QAC7G,yGAAyG;QACzG,+FAA+F;QAC/F,2GAA2G;QAC3G,6GAA6G;QAC7G,yGAAyG;QACzG,qCAAqC;QACrC,MAAM,gBAAgB,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC;QAEzC,IAAI,MAAM,IAAI,CAAC,MAAM,EAAE,EAAE;YACxB,gBAAgB,CAAC,yBAAyB,EAAE,CAAC;SAC7C;IACF,CAAC;IAEM,KAAK,CAAC,yBAAyB;QACrC,IAAI,IAAI,CAAC,uBAAuB,EAAE;YACjC,MAAM,IAAI,KAAK,CACd,mFAAmF,CACnF,CAAC;SACF;QACD,OAAO,KAAK,CAAC,yBAAyB,EAAE,CAAC;IAC1C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDisposable,\n\tFluidObject,\n\tIRequest,\n\tIResponse,\n\tIFluidHandle,\n\tITelemetryProperties,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tIAudience,\n\tIDeltaManager,\n\tAttachState,\n\tILoaderOptions,\n} from \"@fluidframework/container-definitions\";\nimport { assert, Deferred, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { LazyPromise } from \"@fluidframework/core-utils\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { BlobTreeEntry, readAndParse } from \"@fluidframework/driver-utils\";\nimport {\n\tIClientDetails,\n\tIDocumentMessage,\n\tIQuorumClients,\n\tISequencedDocumentMessage,\n\tISnapshotTree,\n\tITreeEntry,\n} from \"@fluidframework/protocol-definitions\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport {\n\tchannelsTreeName,\n\tCreateChildSummarizerNodeFn,\n\tCreateChildSummarizerNodeParam,\n\tFluidDataStoreRegistryEntry,\n\tIAttachMessage,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreContextDetached,\n\tIFluidDataStoreContextEvents,\n\tIFluidDataStoreRegistry,\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tIInboundSignalMessage,\n\tIProvideFluidDataStoreFactory,\n\tISummarizeInternalResult,\n\tISummarizeResult,\n\tISummarizerNodeWithGC,\n\tSummarizeInternalFn,\n\tITelemetryContext,\n\tIIdCompressor,\n\tIIdCompressorCore,\n\tVisibilityState,\n} from \"@fluidframework/runtime-definitions\";\nimport { addBlobToSummary, convertSummaryTreeToITree } from \"@fluidframework/runtime-utils\";\nimport {\n\tcreateChildMonitoringContext,\n\tgenerateStack,\n\tITelemetryLoggerExt,\n\tLoggingError,\n\tMonitoringContext,\n\ttagCodeArtifacts,\n\tThresholdCounter,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n\tDataCorruptionError,\n\tDataProcessingError,\n\textractSafePropertiesFromMessage,\n} from \"@fluidframework/container-utils\";\n\nimport {\n\tdataStoreAttributesBlobName,\n\thasIsolatedChannels,\n\twrapSummaryInChannelsTree,\n\tReadFluidDataStoreAttributes,\n\tWriteFluidDataStoreAttributes,\n\tgetAttributesFormatVersion,\n\tgetFluidDataStoreAttributes,\n\tsummarizerClientType,\n} from \"./summary\";\nimport { ContainerRuntime } from \"./containerRuntime\";\nimport { sendGCUnexpectedUsageEvent, throwOnTombstoneUsageKey } from \"./gc\";\n\nfunction createAttributes(\n\tpkg: readonly string[],\n\tisRootDataStore: boolean,\n): WriteFluidDataStoreAttributes {\n\tconst stringifiedPkg = JSON.stringify(pkg);\n\treturn {\n\t\tpkg: stringifiedPkg,\n\t\tsummaryFormatVersion: 2,\n\t\tisRootDataStore,\n\t};\n}\nexport function createAttributesBlob(pkg: readonly string[], isRootDataStore: boolean): ITreeEntry {\n\tconst attributes = createAttributes(pkg, isRootDataStore);\n\treturn new BlobTreeEntry(dataStoreAttributesBlobName, JSON.stringify(attributes));\n}\n\ninterface ISnapshotDetails {\n\tpkg: readonly string[];\n\tisRootDataStore: boolean;\n\tsnapshot?: ISnapshotTree;\n}\n\ninterface FluidDataStoreMessage {\n\tcontent: any;\n\ttype: string;\n}\n\n/** Properties necessary for creating a FluidDataStoreContext */\nexport interface IFluidDataStoreContextProps {\n\treadonly id: string;\n\treadonly runtime: ContainerRuntime;\n\treadonly storage: IDocumentStorageService;\n\treadonly scope: FluidObject;\n\treadonly createSummarizerNodeFn: CreateChildSummarizerNodeFn;\n\treadonly pkg?: Readonly<string[]>;\n}\n\n/** Properties necessary for creating a local FluidDataStoreContext */\nexport interface ILocalFluidDataStoreContextProps extends IFluidDataStoreContextProps {\n\treadonly pkg: Readonly<string[]> | undefined;\n\treadonly snapshotTree: ISnapshotTree | undefined;\n\treadonly isRootDataStore: boolean | undefined;\n\treadonly makeLocallyVisibleFn: () => void;\n\t/**\n\t * @deprecated 0.16 Issue #1635, #3631\n\t */\n\treadonly createProps?: any;\n}\n\n/** Properties necessary for creating a remote FluidDataStoreContext */\nexport interface IRemoteFluidDataStoreContextProps extends IFluidDataStoreContextProps {\n\treadonly snapshotTree: ISnapshotTree | undefined;\n}\n\n/**\n * Represents the context for the store. This context is passed to the store runtime.\n */\nexport abstract class FluidDataStoreContext\n\textends TypedEventEmitter<IFluidDataStoreContextEvents>\n\timplements IFluidDataStoreContext, IDisposable\n{\n\tpublic get packagePath(): readonly string[] {\n\t\tassert(this.pkg !== undefined, 0x139 /* \"Undefined package path\" */);\n\t\treturn this.pkg;\n\t}\n\n\tpublic get options(): ILoaderOptions {\n\t\treturn this._containerRuntime.options;\n\t}\n\n\tpublic get clientId(): string | undefined {\n\t\treturn this._containerRuntime.clientId;\n\t}\n\n\tpublic get clientDetails(): IClientDetails {\n\t\treturn this._containerRuntime.clientDetails;\n\t}\n\n\tpublic get logger(): ITelemetryLoggerExt {\n\t\treturn this._containerRuntime.logger;\n\t}\n\n\tpublic get deltaManager(): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {\n\t\treturn this._containerRuntime.deltaManager;\n\t}\n\n\tpublic get connected(): boolean {\n\t\treturn this._containerRuntime.connected;\n\t}\n\n\tpublic get IFluidHandleContext() {\n\t\treturn this._containerRuntime.IFluidHandleContext;\n\t}\n\n\tpublic get containerRuntime(): IContainerRuntime {\n\t\treturn this._containerRuntime;\n\t}\n\n\tpublic ensureNoDataModelChanges<T>(callback: () => T): T {\n\t\treturn this._containerRuntime.ensureNoDataModelChanges(callback);\n\t}\n\n\tpublic get isLoaded(): boolean {\n\t\treturn this.loaded;\n\t}\n\n\tpublic get baseSnapshot(): ISnapshotTree | undefined {\n\t\treturn this._baseSnapshot;\n\t}\n\n\tpublic get idCompressor(): (IIdCompressorCore & IIdCompressor) | undefined {\n\t\treturn this._containerRuntime.idCompressor;\n\t}\n\n\tprivate _disposed = false;\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\n\t/**\n\t * Tombstone is a temporary feature that prevents a data store from sending / receiving ops, signals and from\n\t * loading.\n\t */\n\tprivate _tombstoned = false;\n\tpublic get tombstoned() {\n\t\treturn this._tombstoned;\n\t}\n\t/** If true, throw an error when a tombstone data store is used. */\n\tprivate readonly throwOnTombstoneUsage: boolean;\n\n\t/** If true, this means that this data store context and its children have been removed from the runtime */\n\tprivate deleted: boolean = false;\n\n\tpublic get attachState(): AttachState {\n\t\treturn this._attachState;\n\t}\n\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined {\n\t\treturn this.registry;\n\t}\n\n\t/**\n\t * A datastore is considered as root if it\n\t * 1. is root in memory - see isInMemoryRoot\n\t * 2. is root as part of the base snapshot that the datastore loaded from\n\t * @returns whether a datastore is root\n\t */\n\tpublic async isRoot(): Promise<boolean> {\n\t\treturn this.isInMemoryRoot() || (await this.getInitialSnapshotDetails()).isRootDataStore;\n\t}\n\n\t/**\n\t * There are 3 states where isInMemoryRoot needs to be true\n\t * 1. when a datastore becomes aliased. This can happen for both remote and local datastores\n\t * 2. when a datastore is created locally as root\n\t * 3. when a datastore is created locally as root and is rehydrated\n\t * @returns whether a datastore is root in memory\n\t */\n\tprotected isInMemoryRoot(): boolean {\n\t\treturn this._isInMemoryRoot;\n\t}\n\n\tprotected registry: IFluidDataStoreRegistry | undefined;\n\n\tprotected detachedRuntimeCreation = false;\n\tprotected channel: IFluidDataStoreChannel | undefined;\n\tprivate loaded = false;\n\tprotected pending: ISequencedDocumentMessage[] | undefined = [];\n\tprotected channelDeferred: Deferred<IFluidDataStoreChannel> | undefined;\n\tprivate _baseSnapshot: ISnapshotTree | undefined;\n\tprotected _attachState: AttachState;\n\tprivate _isInMemoryRoot: boolean = false;\n\tprotected readonly summarizerNode: ISummarizerNodeWithGC;\n\tprotected readonly mc: MonitoringContext;\n\tprivate readonly thresholdOpsCounter: ThresholdCounter;\n\tprivate static readonly pendingOpsCountThreshold = 1000;\n\n\t/**\n\t * If the summarizer makes local changes, a telemetry event is logged. This has the potential to be very noisy.\n\t * So, adding a count of how many telemetry events are logged per data store context. This can be\n\t * controlled via feature flags.\n\t */\n\tprivate localChangesTelemetryCount: number;\n\n\t// The used routes of this node as per the last GC run. This is used to update the used routes of the channel\n\t// if it realizes after GC is run.\n\tprivate lastUsedRoutes: string[] | undefined;\n\n\tpublic readonly id: string;\n\tprivate readonly _containerRuntime: ContainerRuntime;\n\tpublic readonly storage: IDocumentStorageService;\n\tpublic readonly scope: FluidObject;\n\tprotected pkg?: readonly string[];\n\n\tconstructor(\n\t\tprops: IFluidDataStoreContextProps,\n\t\tprivate readonly existing: boolean,\n\t\tpublic readonly isLocalDataStore: boolean,\n\t\tprivate readonly makeLocallyVisibleFn: () => void,\n\t) {\n\t\tsuper();\n\n\t\tthis._containerRuntime = props.runtime;\n\t\tthis.id = props.id;\n\t\tthis.storage = props.storage;\n\t\tthis.scope = props.scope;\n\t\tthis.pkg = props.pkg;\n\n\t\t// URIs use slashes as delimiters. Handles use URIs.\n\t\t// Thus having slashes in types almost guarantees trouble down the road!\n\t\tassert(!this.id.includes(\"/\"), 0x13a /* Data store ID contains slash */);\n\n\t\tthis._attachState =\n\t\t\tthis.containerRuntime.attachState !== AttachState.Detached && this.existing\n\t\t\t\t? this.containerRuntime.attachState\n\t\t\t\t: AttachState.Detached;\n\n\t\tconst thisSummarizeInternal = async (\n\t\t\tfullTree: boolean,\n\t\t\ttrackState: boolean,\n\t\t\ttelemetryContext?: ITelemetryContext,\n\t\t) => this.summarizeInternal(fullTree, trackState, telemetryContext);\n\n\t\tthis.summarizerNode = props.createSummarizerNodeFn(\n\t\t\tthisSummarizeInternal,\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t);\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.logger,\n\t\t\tnamespace: \"FluidDataStoreContext\",\n\t\t\tproperties: {\n\t\t\t\tall: tagCodeArtifacts({\n\t\t\t\t\tfluidDataStoreId: this.id,\n\t\t\t\t\tfullPackageName: this.pkg?.join(\"/\"),\n\t\t\t\t}),\n\t\t\t},\n\t\t});\n\t\tthis.thresholdOpsCounter = new ThresholdCounter(\n\t\t\tFluidDataStoreContext.pendingOpsCountThreshold,\n\t\t\tthis.mc.logger,\n\t\t);\n\n\t\t// Tombstone should only throw when the feature flag is enabled and the client isn't a summarizer\n\t\tthis.throwOnTombstoneUsage =\n\t\t\tthis.mc.config.getBoolean(throwOnTombstoneUsageKey) === true &&\n\t\t\tthis._containerRuntime.gcTombstoneEnforcementAllowed &&\n\t\t\tthis.clientDetails.type !== summarizerClientType;\n\n\t\t// By default, a data store can log maximum 10 local changes telemetry in summarizer.\n\t\tthis.localChangesTelemetryCount =\n\t\t\tthis.mc.config.getNumber(\"Fluid.Telemetry.LocalChangesTelemetryCount\") ?? 10;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._disposed = true;\n\n\t\t// Dispose any pending runtime after it gets fulfilled\n\t\t// Errors are logged where this.channelDeferred is consumed/generated (realizeCore(), bindRuntime())\n\t\tif (this.channelDeferred) {\n\t\t\tthis.channelDeferred.promise\n\t\t\t\t.then((runtime) => {\n\t\t\t\t\truntime.dispose();\n\t\t\t\t})\n\t\t\t\t.catch((error) => {});\n\t\t}\n\t}\n\n\t/**\n\t * When delete is called, that means that the data store is permanently removed from the runtime, and will not show up in future summaries\n\t * This function is called to prevent ops from being generated from this data store once it has been deleted. Furthermore, this data store\n\t * should not receive any ops/signals.\n\t */\n\tpublic delete() {\n\t\tthis.deleted = true;\n\t}\n\n\tpublic setTombstone(tombstone: boolean) {\n\t\tif (this.tombstoned === tombstone) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._tombstoned = tombstone;\n\t}\n\n\tprivate rejectDeferredRealize(\n\t\treason: string,\n\t\tfailedPkgPath?: string,\n\t\tfullPackageName?: readonly string[],\n\t): never {\n\t\tthrow new LoggingError(\n\t\t\treason,\n\t\t\ttagCodeArtifacts({\n\t\t\t\tfailedPkgPath,\n\t\t\t\tpackagePath: fullPackageName?.join(\"/\"),\n\t\t\t}),\n\t\t);\n\t}\n\n\tpublic async realize(): Promise<IFluidDataStoreChannel> {\n\t\tassert(!this.detachedRuntimeCreation, 0x13d /* \"Detached runtime creation on realize()\" */);\n\t\tif (!this.channelDeferred) {\n\t\t\tthis.channelDeferred = new Deferred<IFluidDataStoreChannel>();\n\t\t\tthis.realizeCore(this.existing).catch((error) => {\n\t\t\t\tconst errorWrapped = DataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\terror,\n\t\t\t\t\t\"realizeFluidDataStoreContext\",\n\t\t\t\t);\n\t\t\t\terrorWrapped.addTelemetryProperties(\n\t\t\t\t\ttagCodeArtifacts({\n\t\t\t\t\t\tfullPackageName: this.pkg?.join(\"/\"),\n\t\t\t\t\t\tfluidDataStoreId: this.id,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\tthis.channelDeferred?.reject(errorWrapped);\n\t\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"RealizeError\" }, errorWrapped);\n\t\t\t});\n\t\t}\n\t\treturn this.channelDeferred.promise;\n\t}\n\n\tprotected async factoryFromPackagePath(packages?: readonly string[]) {\n\t\tassert(this.pkg === packages, 0x13e /* \"Unexpected package path\" */);\n\t\tif (packages === undefined) {\n\t\t\tthis.rejectDeferredRealize(\"packages is undefined\");\n\t\t}\n\n\t\tlet entry: FluidDataStoreRegistryEntry | undefined;\n\t\tlet registry: IFluidDataStoreRegistry | undefined =\n\t\t\tthis._containerRuntime.IFluidDataStoreRegistry;\n\t\tlet lastPkg: string | undefined;\n\t\tfor (const pkg of packages) {\n\t\t\tif (!registry) {\n\t\t\t\tthis.rejectDeferredRealize(\"No registry for package\", lastPkg, packages);\n\t\t\t}\n\t\t\tlastPkg = pkg;\n\t\t\tentry = await registry.get(pkg);\n\t\t\tif (!entry) {\n\t\t\t\tthis.rejectDeferredRealize(\n\t\t\t\t\t\"Registry does not contain entry for the package\",\n\t\t\t\t\tpkg,\n\t\t\t\t\tpackages,\n\t\t\t\t);\n\t\t\t}\n\t\t\tregistry = entry.IFluidDataStoreRegistry;\n\t\t}\n\t\tconst factory = entry?.IFluidDataStoreFactory;\n\t\tif (factory === undefined) {\n\t\t\tthis.rejectDeferredRealize(\"Can't find factory for package\", lastPkg, packages);\n\t\t}\n\n\t\treturn { factory, registry };\n\t}\n\n\tprivate async realizeCore(existing: boolean): Promise<void> {\n\t\tconst details = await this.getInitialSnapshotDetails();\n\t\t// Base snapshot is the baseline where pending ops are applied to.\n\t\t// It is important that this be in sync with the pending ops, and also\n\t\t// that it is set here, before bindRuntime is called.\n\t\tthis._baseSnapshot = details.snapshot;\n\t\tconst packages = details.pkg;\n\n\t\tconst { factory, registry } = await this.factoryFromPackagePath(packages);\n\n\t\tassert(\n\t\t\tthis.registry === undefined,\n\t\t\t0x13f /* \"datastore context registry is already set\" */,\n\t\t);\n\t\tthis.registry = registry;\n\n\t\tconst channel = await factory.instantiateDataStore(this, existing);\n\t\tassert(channel !== undefined, 0x140 /* \"undefined channel on datastore context\" */);\n\t\tthis.bindRuntime(channel);\n\t}\n\n\t/**\n\t * Notifies this object about changes in the connection state.\n\t * @param value - New connection state.\n\t * @param clientId - ID of the client. Its old ID when in disconnected state and\n\t * its new client ID when we are connecting or connected.\n\t */\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\t// ConnectionState should not fail in tombstone mode as this is internally run\n\t\tthis.verifyNotClosed(\"setConnectionState\", false /* checkTombstone */);\n\n\t\t// Connection events are ignored if the store is not yet loaded\n\t\tif (!this.loaded) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(this.connected === connected, 0x141 /* \"Unexpected connected state\" */);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tthis.channel!.setConnectionState(connected, clientId);\n\t}\n\n\tpublic process(\n\t\tmessageArg: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.verifyNotClosed(\"process\", true, extractSafePropertiesFromMessage(messageArg));\n\n\t\tconst innerContents = messageArg.contents as FluidDataStoreMessage;\n\t\tconst message = {\n\t\t\t...messageArg,\n\t\t\ttype: innerContents.type,\n\t\t\tcontents: innerContents.content,\n\t\t};\n\n\t\tthis.summarizerNode.recordChange(message);\n\n\t\tif (this.loaded) {\n\t\t\treturn this.channel?.process(message, local, localOpMetadata);\n\t\t} else {\n\t\t\tassert(!local, 0x142 /* \"local store channel is not loaded\" */);\n\t\t\tassert(this.pending !== undefined, 0x23d /* \"pending is undefined\" */);\n\t\t\tthis.pending.push(message);\n\t\t\tthis.thresholdOpsCounter.sendIfMultiple(\"StorePendingOps\", this.pending.length);\n\t\t}\n\t}\n\n\tpublic processSignal(message: IInboundSignalMessage, local: boolean): void {\n\t\tthis.verifyNotClosed(\"processSignal\");\n\n\t\t// Signals are ignored if the store is not yet loaded\n\t\tif (!this.loaded) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.channel?.processSignal(message, local);\n\t}\n\n\tpublic getQuorum(): IQuorumClients {\n\t\treturn this._containerRuntime.getQuorum();\n\t}\n\n\tpublic getAudience(): IAudience {\n\t\treturn this._containerRuntime.getAudience();\n\t}\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\treturn this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n\t}\n\n\tprivate async summarizeInternal(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeInternalResult> {\n\t\tawait this.realize();\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tconst summarizeResult = await this.channel!.summarize(\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t);\n\n\t\t// Wrap dds summaries in .channels subtree.\n\t\twrapSummaryInChannelsTree(summarizeResult);\n\t\tconst pathPartsForChildren = [channelsTreeName];\n\n\t\t// Add data store's attributes to the summary.\n\t\tconst { pkg } = await this.getInitialSnapshotDetails();\n\t\tconst isRoot = await this.isRoot();\n\t\tconst attributes = createAttributes(pkg, isRoot);\n\t\taddBlobToSummary(summarizeResult, dataStoreAttributesBlobName, JSON.stringify(attributes));\n\n\t\t// If we are not referenced, mark the summary tree as unreferenced. Also, update unreferenced blob\n\t\t// size in the summary stats with the blobs size of this data store.\n\t\tif (!this.summarizerNode.isReferenced()) {\n\t\t\tsummarizeResult.summary.unreferenced = true;\n\t\t\tsummarizeResult.stats.unreferencedBlobSize = summarizeResult.stats.totalBlobSize;\n\t\t}\n\n\t\treturn {\n\t\t\t...summarizeResult,\n\t\t\tid: this.id,\n\t\t\tpathPartsForChildren,\n\t\t};\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this data store\n\t * including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the\n\t * document.\n\t * If there is no new data in this data store since the last summary, previous GC data is used.\n\t * If there is new data, the GC data is generated again (by calling getGCDataInternal).\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\treturn this.summarizerNode.getGCData(fullGC);\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. This is called when there is new data since last summary. It\n\t * realizes the data store and calls into each channel context to get its GC data.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tprivate async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tawait this.realize();\n\t\tassert(\n\t\t\tthis.channel !== undefined,\n\t\t\t0x143 /* \"Channel should not be undefined when running GC\" */,\n\t\t);\n\n\t\treturn this.channel.getGCData(fullGC);\n\t}\n\n\t/**\n\t * After GC has run, called to notify the data store of routes used in it. These are used for the following:\n\t *\n\t * 1. To identify if this data store is being referenced in the document or not.\n\t *\n\t * 2. To determine if it needs to re-summarize in case used routes changed since last summary.\n\t *\n\t * 3. These are added to the summary generated by the data store.\n\t *\n\t * 4. To notify child contexts of their used routes. This is done immediately if the data store is loaded.\n\t * Else, it is done when realizing the data store.\n\t *\n\t * 5. To update the timestamp when this data store or any children are marked as unreferenced.\n\t *\n\t * @param usedRoutes - The routes that are used in this data store.\n\t */\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t// Update the used routes in this data store's summarizer node.\n\t\tthis.summarizerNode.updateUsedRoutes(usedRoutes);\n\n\t\t/**\n\t\t * Store the used routes to update the channel if the data store is not loaded yet. If the used routes changed\n\t\t * since the previous run, the data store will be loaded during summarize since the used state changed. So, it's\n\t\t * safe to only store the last used routes.\n\t\t */\n\t\tthis.lastUsedRoutes = usedRoutes;\n\n\t\t// If we are loaded, call the channel so it can update the used routes of the child contexts.\n\t\t// If we are not loaded, we will update this when we are realized.\n\t\tif (this.loaded) {\n\t\t\tthis.updateChannelUsedRoutes();\n\t\t}\n\t}\n\n\t/**\n\t * Called when a new outbound reference is added to another node. This is used by garbage collection to identify\n\t * all references added in the system.\n\t * @param srcHandle - The handle of the node that added the reference.\n\t * @param outboundHandle - The handle of the outbound node that is referenced.\n\t */\n\tpublic addedGCOutboundReference(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) {\n\t\tthis._containerRuntime.addedGCOutboundReference(srcHandle, outboundHandle);\n\t}\n\n\t/**\n\t * Updates the used routes of the channel and its child contexts. The channel must be loaded before calling this.\n\t * It is called in these two scenarios:\n\t * 1. When the used routes of the data store is updated and the data store is loaded.\n\t * 2. When the data store is realized. This updates the channel's used routes as per last GC run.\n\t */\n\tprivate updateChannelUsedRoutes() {\n\t\tassert(this.loaded, 0x144 /* \"Channel should be loaded when updating used routes\" */);\n\t\tassert(\n\t\t\tthis.channel !== undefined,\n\t\t\t0x145 /* \"Channel should be present when data store is loaded\" */,\n\t\t);\n\n\t\t// If there is no lastUsedRoutes, GC has not run up until this point.\n\t\tif (this.lastUsedRoutes === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Remove the route to this data store, if it exists.\n\t\tconst usedChannelRoutes = this.lastUsedRoutes.filter((id: string) => {\n\t\t\treturn id !== \"/\" && id !== \"\";\n\t\t});\n\t\tthis.channel.updateUsedRoutes(usedChannelRoutes);\n\t}\n\n\t/**\n\t * @deprecated 0.18.Should call request on the runtime directly\n\t */\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\tconst runtime = await this.realize();\n\t\treturn runtime.request(request);\n\t}\n\n\tpublic submitMessage(type: string, content: any, localOpMetadata: unknown): void {\n\t\tthis.verifyNotClosed(\"submitMessage\");\n\t\tassert(!!this.channel, 0x146 /* \"Channel must exist when submitting message\" */);\n\t\tconst fluidDataStoreContent: FluidDataStoreMessage = {\n\t\t\tcontent,\n\t\t\ttype,\n\t\t};\n\n\t\t// Summarizer clients should not submit messages.\n\t\tthis.identifyLocalChangeInSummarizer(\"DataStoreMessageSubmittedInSummarizer\", type);\n\n\t\tthis._containerRuntime.submitDataStoreOp(this.id, fluidDataStoreContent, localOpMetadata);\n\t}\n\n\t/**\n\t * This is called from a SharedSummaryBlock that does not generate ops but only wants to be part of the summary.\n\t * It indicates that there is data in the object that needs to be summarized.\n\t * We will update the latestSequenceNumber of the summary tracker of this\n\t * store and of the object's channel.\n\t *\n\t * @param address - The address of the channel that is dirty.\n\t *\n\t */\n\tpublic setChannelDirty(address: string): void {\n\t\tthis.verifyNotClosed(\"setChannelDirty\");\n\n\t\t// Get the latest sequence number.\n\t\tconst latestSequenceNumber = this.deltaManager.lastSequenceNumber;\n\n\t\tthis.summarizerNode.invalidate(latestSequenceNumber);\n\n\t\tconst channelSummarizerNode = this.summarizerNode.getChild(address);\n\n\t\tif (channelSummarizerNode) {\n\t\t\tchannelSummarizerNode.invalidate(latestSequenceNumber); // TODO: lazy load problem?\n\t\t}\n\t}\n\n\tpublic submitSignal(type: string, content: any) {\n\t\tthis.verifyNotClosed(\"submitSignal\");\n\n\t\tassert(!!this.channel, 0x147 /* \"Channel must exist on submitting signal\" */);\n\t\treturn this._containerRuntime.submitDataStoreSignal(this.id, type, content);\n\t}\n\n\t/**\n\t * This is called by the data store channel when it becomes locally visible indicating that it is ready to become\n\t * globally visible now.\n\t */\n\tpublic makeLocallyVisible() {\n\t\tassert(this.channel !== undefined, 0x2cf /* \"undefined channel on datastore context\" */);\n\t\tassert(\n\t\t\tthis.channel.visibilityState === VisibilityState.LocallyVisible,\n\t\t\t0x590 /* Channel must be locally visible */,\n\t\t);\n\t\tthis.makeLocallyVisibleFn();\n\t}\n\n\t/** @deprecated - To be replaced by calling makeLocallyVisible directly */\n\tpublic bindToContext() {\n\t\tthis.makeLocallyVisibleFn();\n\t}\n\n\tprotected bindRuntime(channel: IFluidDataStoreChannel) {\n\t\tif (this.channel) {\n\t\t\tthrow new Error(\"Runtime already bound\");\n\t\t}\n\n\t\ttry {\n\t\t\tassert(\n\t\t\t\t!this.detachedRuntimeCreation,\n\t\t\t\t0x148 /* \"Detached runtime creation on runtime bind\" */,\n\t\t\t);\n\t\t\tassert(this.channelDeferred !== undefined, 0x149 /* \"Undefined channel deferral\" */);\n\t\t\tassert(this.pkg !== undefined, 0x14a /* \"Undefined package path\" */);\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst pending = this.pending!;\n\n\t\t\t// Apply all pending ops\n\t\t\tfor (const op of pending) {\n\t\t\t\tchannel.process(op, false, undefined /* localOpMetadata */);\n\t\t\t}\n\n\t\t\tthis.thresholdOpsCounter.send(\"ProcessPendingOps\", pending.length);\n\t\t\tthis.pending = undefined;\n\n\t\t\t// And now mark the runtime active\n\t\t\tthis.loaded = true;\n\t\t\tthis.channel = channel;\n\n\t\t\t// Freeze the package path to ensure that someone doesn't modify it when it is\n\t\t\t// returned in packagePath().\n\t\t\tObject.freeze(this.pkg);\n\n\t\t\t/**\n\t\t\t * Update the used routes of the channel. If GC has run before this data store was realized, we will have\n\t\t\t * the used routes saved. So, this will ensure that all the child contexts have up-to-date used routes as\n\t\t\t * per the last time GC was run.\n\t\t\t * Also, this data store may have been realized during summarize. In that case, the child contexts need to\n\t\t\t * have their used routes updated to determine if its needs to summarize again and to add it to the summary.\n\t\t\t */\n\t\t\tthis.updateChannelUsedRoutes();\n\n\t\t\t// And notify the pending promise it is now available\n\t\t\tthis.channelDeferred.resolve(this.channel);\n\t\t} catch (error) {\n\t\t\tthis.channelDeferred?.reject(error);\n\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"BindRuntimeError\",\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic async getAbsoluteUrl(relativeUrl: string): Promise<string | undefined> {\n\t\tif (this.attachState !== AttachState.Attached) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this._containerRuntime.getAbsoluteUrl(relativeUrl);\n\t}\n\n\tpublic abstract generateAttachMessage(): IAttachMessage;\n\n\tpublic abstract getInitialSnapshotDetails(): Promise<ISnapshotDetails>;\n\n\t/**\n\t * @deprecated Sets the datastore as root, for aliasing purposes: #7948\n\t * This method should not be used outside of the aliasing context.\n\t * It will be removed, as the source of truth for this flag will be the aliasing blob.\n\t */\n\tpublic setInMemoryRoot(): void {\n\t\tthis._isInMemoryRoot = true;\n\t}\n\n\t/**\n\t * @deprecated - The functionality to get base GC details has been moved to summarizer node.\n\t */\n\tpublic async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n\t\treturn {};\n\t}\n\n\tpublic reSubmit(contents: any, localOpMetadata: unknown) {\n\t\tassert(!!this.channel, 0x14b /* \"Channel must exist when resubmitting ops\" */);\n\t\tconst innerContents = contents as FluidDataStoreMessage;\n\t\tthis.channel.reSubmit(innerContents.type, innerContents.content, localOpMetadata);\n\t}\n\n\tpublic rollback(contents: any, localOpMetadata: unknown) {\n\t\tif (!this.channel) {\n\t\t\tthrow new Error(\"Channel must exist when rolling back ops\");\n\t\t}\n\t\tif (!this.channel.rollback) {\n\t\t\tthrow new Error(\"Channel doesn't support rollback\");\n\t\t}\n\t\tconst innerContents = contents as FluidDataStoreMessage;\n\t\tthis.channel.rollback(innerContents.type, innerContents.content, localOpMetadata);\n\t}\n\n\tpublic async applyStashedOp(contents: any): Promise<unknown> {\n\t\tif (!this.channel) {\n\t\t\tawait this.realize();\n\t\t}\n\t\tassert(!!this.channel, 0x14c /* \"Channel must exist when rebasing ops\" */);\n\t\tconst innerContents = contents as FluidDataStoreMessage;\n\t\treturn this.channel.applyStashedOp(innerContents.content);\n\t}\n\n\tprivate verifyNotClosed(\n\t\tcallSite: string,\n\t\tcheckTombstone = true,\n\t\tsafeTelemetryProps: ITelemetryProperties = {},\n\t) {\n\t\tif (this.deleted) {\n\t\t\tconst messageString = `Context is deleted! Call site [${callSite}]`;\n\t\t\tconst error = new DataCorruptionError(messageString, safeTelemetryProps);\n\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"GC_Deleted_DataStore_Changed\",\n\t\t\t\t\tcallSite,\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (this._disposed) {\n\t\t\tthrow new Error(`Context is closed! Call site [${callSite}]`);\n\t\t}\n\n\t\tif (checkTombstone && this.tombstoned) {\n\t\t\tconst messageString = `Context is tombstoned! Call site [${callSite}]`;\n\t\t\tconst error = new DataCorruptionError(messageString, safeTelemetryProps);\n\n\t\t\tsendGCUnexpectedUsageEvent(\n\t\t\t\tthis.mc,\n\t\t\t\t{\n\t\t\t\t\teventName: \"GC_Tombstone_DataStore_Changed\",\n\t\t\t\t\tcategory: this.throwOnTombstoneUsage ? \"error\" : \"generic\",\n\t\t\t\t\tgcTombstoneEnforcementAllowed:\n\t\t\t\t\t\tthis._containerRuntime.gcTombstoneEnforcementAllowed,\n\t\t\t\t\tcallSite,\n\t\t\t\t},\n\t\t\t\tthis.pkg,\n\t\t\t\terror,\n\t\t\t);\n\t\t\tif (this.throwOnTombstoneUsage) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Summarizer client should not have local changes. These changes can become part of the summary and can break\n\t * eventual consistency. For example, the next summary (say at ref seq# 100) may contain these changes whereas\n\t * other clients that are up-to-date till seq# 100 may not have them yet.\n\t */\n\tprotected identifyLocalChangeInSummarizer(eventName: string, type?: string) {\n\t\tif (\n\t\t\tthis.clientDetails.type !== summarizerClientType ||\n\t\t\tthis.localChangesTelemetryCount <= 0\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Log a telemetry if there are local changes in the summarizer. This will give us data on how often\n\t\t// this is happening and which data stores do this. The eventual goal is to disallow local changes\n\t\t// in the summarizer and the data will help us plan this.\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName,\n\t\t\ttype,\n\t\t\tisSummaryInProgress: this.summarizerNode.isSummaryInProgress?.(),\n\t\t\tstack: generateStack(),\n\t\t});\n\t\tthis.localChangesTelemetryCount--;\n\t}\n\n\tpublic getCreateChildSummarizerNodeFn(id: string, createParam: CreateChildSummarizerNodeParam) {\n\t\treturn (\n\t\t\tsummarizeInternal: SummarizeInternalFn,\n\t\t\tgetGCDataFn: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\t\t) =>\n\t\t\tthis.summarizerNode.createChild(\n\t\t\t\tsummarizeInternal,\n\t\t\t\tid,\n\t\t\t\tcreateParam,\n\t\t\t\t// DDS will not create failure summaries\n\t\t\t\t{ throwOnFailure: true },\n\t\t\t\tgetGCDataFn,\n\t\t\t);\n\t}\n\n\tpublic async uploadBlob(\n\t\tblob: ArrayBufferLike,\n\t\tsignal?: AbortSignal,\n\t): Promise<IFluidHandle<ArrayBufferLike>> {\n\t\treturn this.containerRuntime.uploadBlob(blob, signal);\n\t}\n}\n\nexport class RemoteFluidDataStoreContext extends FluidDataStoreContext {\n\tprivate readonly initSnapshotValue: ISnapshotTree | undefined;\n\n\tconstructor(props: IRemoteFluidDataStoreContextProps) {\n\t\tsuper(props, true /* existing */, false /* isLocalDataStore */, () => {\n\t\t\tthrow new Error(\"Already attached\");\n\t\t});\n\n\t\tthis.initSnapshotValue = props.snapshotTree;\n\n\t\tif (props.snapshotTree !== undefined) {\n\t\t\tthis.summarizerNode.updateBaseSummaryState(props.snapshotTree);\n\t\t}\n\t}\n\n\tprivate readonly initialSnapshotDetailsP = new LazyPromise<ISnapshotDetails>(async () => {\n\t\tlet tree = this.initSnapshotValue;\n\t\tlet isRootDataStore = true;\n\n\t\tif (!!tree && tree.blobs[dataStoreAttributesBlobName] !== undefined) {\n\t\t\t// Need to get through snapshot and use that to populate extraBlobs\n\t\t\tconst attributes = await readAndParse<ReadFluidDataStoreAttributes>(\n\t\t\t\tthis.storage,\n\t\t\t\ttree.blobs[dataStoreAttributesBlobName],\n\t\t\t);\n\n\t\t\tlet pkgFromSnapshot: string[];\n\t\t\t// Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.\n\t\t\t// For snapshotFormatVersion = \"0.1\" (1) or above, pkg is jsonified, otherwise it is just a string.\n\t\t\tconst formatVersion = getAttributesFormatVersion(attributes);\n\t\t\tif (formatVersion < 1) {\n\t\t\t\tpkgFromSnapshot =\n\t\t\t\t\tattributes.pkg.startsWith('[\"') && attributes.pkg.endsWith('\"]')\n\t\t\t\t\t\t? (JSON.parse(attributes.pkg) as string[])\n\t\t\t\t\t\t: [attributes.pkg];\n\t\t\t} else {\n\t\t\t\tpkgFromSnapshot = JSON.parse(attributes.pkg) as string[];\n\t\t\t}\n\t\t\tthis.pkg = pkgFromSnapshot;\n\n\t\t\t/**\n\t\t\t * If there is no isRootDataStore in the attributes blob, set it to true. This will ensure that\n\t\t\t * data stores in older documents are not garbage collected incorrectly. This may lead to additional\n\t\t\t * roots in the document but they won't break.\n\t\t\t */\n\t\t\tisRootDataStore = attributes.isRootDataStore ?? true;\n\n\t\t\tif (hasIsolatedChannels(attributes)) {\n\t\t\t\ttree = tree.trees[channelsTreeName];\n\t\t\t\tassert(\n\t\t\t\t\ttree !== undefined,\n\t\t\t\t\t0x1fe /* \"isolated channels subtree should exist in remote datastore snapshot\" */,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tpkg: this.pkg!,\n\t\t\tisRootDataStore,\n\t\t\tsnapshot: tree,\n\t\t};\n\t});\n\n\tpublic async getInitialSnapshotDetails(): Promise<ISnapshotDetails> {\n\t\treturn this.initialSnapshotDetailsP;\n\t}\n\n\tpublic generateAttachMessage(): IAttachMessage {\n\t\tthrow new Error(\"Cannot attach remote store\");\n\t}\n}\n\n/**\n * Base class for detached & attached context classes\n */\nexport class LocalFluidDataStoreContextBase extends FluidDataStoreContext {\n\tprivate readonly snapshotTree: ISnapshotTree | undefined;\n\t/**\n\t * @deprecated 0.16 Issue #1635, #3631\n\t */\n\tpublic readonly createProps?: any;\n\n\tconstructor(props: ILocalFluidDataStoreContextProps) {\n\t\tsuper(\n\t\t\tprops,\n\t\t\tprops.snapshotTree !== undefined ? true : false /* existing */,\n\t\t\ttrue /* isLocalDataStore */,\n\t\t\tprops.makeLocallyVisibleFn,\n\t\t);\n\n\t\t// Summarizer client should not create local data stores.\n\t\tthis.identifyLocalChangeInSummarizer(\"DataStoreCreatedInSummarizer\");\n\n\t\tthis.snapshotTree = props.snapshotTree;\n\t\tif (props.isRootDataStore === true) {\n\t\t\tthis.setInMemoryRoot();\n\t\t}\n\t\tthis.createProps = props.createProps;\n\t\tthis.attachListeners();\n\t}\n\n\tprivate attachListeners(): void {\n\t\tthis.once(\"attaching\", () => {\n\t\t\tassert(\n\t\t\t\tthis.attachState === AttachState.Detached,\n\t\t\t\t0x14d /* \"Should move from detached to attaching\" */,\n\t\t\t);\n\t\t\tthis._attachState = AttachState.Attaching;\n\t\t});\n\t\tthis.once(\"attached\", () => {\n\t\t\tassert(\n\t\t\t\tthis.attachState === AttachState.Attaching,\n\t\t\t\t0x14e /* \"Should move from attaching to attached\" */,\n\t\t\t);\n\t\t\tthis._attachState = AttachState.Attached;\n\t\t});\n\t}\n\n\tpublic generateAttachMessage(): IAttachMessage {\n\t\tassert(\n\t\t\tthis.channel !== undefined,\n\t\t\t0x14f /* \"There should be a channel when generating attach message\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.pkg !== undefined,\n\t\t\t0x150 /* \"pkg should be available in local data store context\" */,\n\t\t);\n\n\t\tconst summarizeResult = this.channel.getAttachSummary();\n\n\t\t// Wrap dds summaries in .channels subtree.\n\t\twrapSummaryInChannelsTree(summarizeResult);\n\n\t\t// Add data store's attributes to the summary.\n\t\tconst attributes = createAttributes(this.pkg, this.isInMemoryRoot());\n\t\taddBlobToSummary(summarizeResult, dataStoreAttributesBlobName, JSON.stringify(attributes));\n\n\t\t// Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.\n\t\tconst snapshot = convertSummaryTreeToITree(summarizeResult.summary);\n\n\t\tconst message: IAttachMessage = {\n\t\t\tid: this.id,\n\t\t\tsnapshot,\n\t\t\ttype: this.pkg[this.pkg.length - 1],\n\t\t};\n\n\t\treturn message;\n\t}\n\n\tpublic async getInitialSnapshotDetails(): Promise<ISnapshotDetails> {\n\t\tlet snapshot = this.snapshotTree;\n\t\tlet attributes: ReadFluidDataStoreAttributes;\n\t\tlet isRootDataStore = false;\n\t\tif (snapshot !== undefined) {\n\t\t\t// Get the dataStore attributes.\n\t\t\t// Note: storage can be undefined in special case while detached.\n\t\t\tattributes = await getFluidDataStoreAttributes(this.storage, snapshot);\n\t\t\tif (hasIsolatedChannels(attributes)) {\n\t\t\t\tsnapshot = snapshot.trees[channelsTreeName];\n\t\t\t\tassert(\n\t\t\t\t\tsnapshot !== undefined,\n\t\t\t\t\t0x1ff /* \"isolated channels subtree should exist in local datastore snapshot\" */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (this.pkg === undefined) {\n\t\t\t\tthis.pkg = JSON.parse(attributes.pkg) as string[];\n\t\t\t\t// If there is no isRootDataStore in the attributes blob, set it to true. This ensures that data\n\t\t\t\t// stores in older documents are not garbage collected incorrectly. This may lead to additional\n\t\t\t\t// roots in the document but they won't break.\n\t\t\t\tif (attributes.isRootDataStore ?? true) {\n\t\t\t\t\tisRootDataStore = true;\n\t\t\t\t\tthis.setInMemoryRoot();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tassert(this.pkg !== undefined, 0x152 /* \"pkg should be available in local data store\" */);\n\n\t\treturn {\n\t\t\tpkg: this.pkg,\n\t\t\tisRootDataStore,\n\t\t\tsnapshot,\n\t\t};\n\t}\n\n\t/**\n\t * A context should only be marked as deleted when its a remote context.\n\t * Session Expiry at the runtime level should have closed the container creating the local data store context\n\t * before delete is even possible. Session Expiry is at 30 days, and sweep is done 36+ days later from the time\n\t * it was unreferenced. Thus the sweeping container should have loaded from a snapshot and thus creating a remote\n\t * context.\n\t */\n\tpublic delete() {\n\t\t// TODO: GC:Validation - potentially prevent this from happening or asserting. Maybe throw here.\n\t\tsendGCUnexpectedUsageEvent(\n\t\t\tthis.mc,\n\t\t\t{\n\t\t\t\teventName: \"GC_Deleted_DataStore_Unexpected_Delete\",\n\t\t\t\tmessage: \"Unexpected deletion of a local data store context\",\n\t\t\t\tcategory: \"error\",\n\t\t\t\tgcTombstoneEnforcementAllowed: undefined,\n\t\t\t},\n\t\t\tthis.pkg,\n\t\t);\n\t\tsuper.delete();\n\t}\n}\n\n/**\n * context implementation for \"attached\" data store runtime.\n * Various workflows (snapshot creation, requests) result in .realize() being called\n * on context, resulting in instantiation and attachment of runtime.\n * Runtime is created using data store factory that is associated with this context.\n */\nexport class LocalFluidDataStoreContext extends LocalFluidDataStoreContextBase {\n\tconstructor(props: ILocalFluidDataStoreContextProps) {\n\t\tsuper(props);\n\t}\n}\n\n/**\n * Detached context. Data Store runtime will be attached to it by attachRuntime() call\n * Before attachment happens, this context is not associated with particular type of runtime\n * or factory, i.e. it's package path is undefined.\n * Attachment process provides all missing parts - package path, data store runtime, and data store factory\n */\nexport class LocalDetachedFluidDataStoreContext\n\textends LocalFluidDataStoreContextBase\n\timplements IFluidDataStoreContextDetached\n{\n\tconstructor(props: ILocalFluidDataStoreContextProps) {\n\t\tsuper(props);\n\t\tthis.detachedRuntimeCreation = true;\n\t}\n\n\tpublic async attachRuntime(\n\t\tregistry: IProvideFluidDataStoreFactory,\n\t\tdataStoreChannel: IFluidDataStoreChannel,\n\t) {\n\t\tassert(this.detachedRuntimeCreation, 0x154 /* \"runtime creation is already attached\" */);\n\t\tthis.detachedRuntimeCreation = false;\n\n\t\tassert(this.channelDeferred === undefined, 0x155 /* \"channel deferral is already set\" */);\n\t\tthis.channelDeferred = new Deferred<IFluidDataStoreChannel>();\n\n\t\tconst factory = registry.IFluidDataStoreFactory;\n\n\t\tconst entry = await this.factoryFromPackagePath(this.pkg);\n\t\tassert(entry.factory === factory, 0x156 /* \"Unexpected factory for package path\" */);\n\n\t\tassert(this.registry === undefined, 0x157 /* \"datastore registry already attached\" */);\n\t\tthis.registry = entry.registry;\n\n\t\tsuper.bindRuntime(dataStoreChannel);\n\n\t\t// Load the handle to the data store's entryPoint to make sure that for a detached data store, the entryPoint\n\t\t// initialization function is called before the data store gets attached and potentially connected to the\n\t\t// delta stream, so it gets a chance to do things while the data store is still \"purely local\".\n\t\t// This preserves the behavior from before we introduced entryPoints, where the instantiateDataStore method\n\t\t// of data store factories tends to construct the data object (at least kick off an async method that returns\n\t\t// it); that code moved to the entryPoint initialization function, so we want to ensure it still executes\n\t\t// before the data store is attached.\n\t\tawait dataStoreChannel.entryPoint?.get();\n\n\t\tif (await this.isRoot()) {\n\t\t\tdataStoreChannel.makeVisibleAndAttachGraph();\n\t\t}\n\t}\n\n\tpublic async getInitialSnapshotDetails(): Promise<ISnapshotDetails> {\n\t\tif (this.detachedRuntimeCreation) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Detached Fluid Data Store context can't be realized! Please attach runtime first!\",\n\t\t\t);\n\t\t}\n\t\treturn super.getInitialSnapshotDetails();\n\t}\n}\n"]}