@fluidframework/container-runtime 2.0.0-internal.6.4.0 → 2.0.0-internal.7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/api-extractor.json +13 -1
  3. package/api-report/container-runtime.api.md +799 -0
  4. package/dist/blobManager.d.ts +1 -1
  5. package/dist/blobManager.d.ts.map +1 -1
  6. package/dist/blobManager.js +7 -7
  7. package/dist/blobManager.js.map +1 -1
  8. package/dist/connectionTelemetry.d.ts.map +1 -1
  9. package/dist/connectionTelemetry.js +75 -42
  10. package/dist/connectionTelemetry.js.map +1 -1
  11. package/dist/container-runtime-alpha.d.ts +1554 -0
  12. package/dist/container-runtime-beta.d.ts +1554 -0
  13. package/dist/container-runtime-public.d.ts +1554 -0
  14. package/dist/container-runtime.d.ts +1611 -0
  15. package/dist/containerHandleContext.js +3 -3
  16. package/dist/containerHandleContext.js.map +1 -1
  17. package/dist/containerRuntime.d.ts +28 -24
  18. package/dist/containerRuntime.d.ts.map +1 -1
  19. package/dist/containerRuntime.js +277 -256
  20. package/dist/containerRuntime.js.map +1 -1
  21. package/dist/dataStore.js +9 -9
  22. package/dist/dataStore.js.map +1 -1
  23. package/dist/dataStoreContext.d.ts +1 -3
  24. package/dist/dataStoreContext.d.ts.map +1 -1
  25. package/dist/dataStoreContext.js +54 -58
  26. package/dist/dataStoreContext.js.map +1 -1
  27. package/dist/dataStoreRegistry.js +3 -3
  28. package/dist/dataStoreRegistry.js.map +1 -1
  29. package/dist/deltaManagerProxyBase.js +4 -4
  30. package/dist/deltaManagerProxyBase.js.map +1 -1
  31. package/dist/deltaManagerSummarizerProxy.js +6 -6
  32. package/dist/deltaManagerSummarizerProxy.js.map +1 -1
  33. package/dist/deltaScheduler.js.map +1 -1
  34. package/dist/error.d.ts.map +1 -1
  35. package/dist/error.js.map +1 -1
  36. package/dist/gc/garbageCollection.js +13 -13
  37. package/dist/gc/garbageCollection.js.map +1 -1
  38. package/dist/gc/gcDefinitions.d.ts +4 -15
  39. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  40. package/dist/gc/gcDefinitions.js.map +1 -1
  41. package/dist/gc/gcTelemetry.d.ts +1 -1
  42. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  43. package/dist/gc/gcUnreferencedStateTracker.js +3 -3
  44. package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
  45. package/dist/id-compressor/appendOnlySortedMap.js.map +1 -1
  46. package/dist/id-compressor/idCompressor.js.map +1 -1
  47. package/dist/id-compressor/identifiers.d.ts +3 -3
  48. package/dist/id-compressor/identifiers.d.ts.map +1 -1
  49. package/dist/index.d.ts +1 -1
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +2 -1
  52. package/dist/index.js.map +1 -1
  53. package/dist/messageTypes.d.ts +17 -17
  54. package/dist/messageTypes.d.ts.map +1 -1
  55. package/dist/messageTypes.js +1 -1
  56. package/dist/messageTypes.js.map +1 -1
  57. package/dist/opLifecycle/batchManager.js +6 -6
  58. package/dist/opLifecycle/batchManager.js.map +1 -1
  59. package/dist/opLifecycle/definitions.d.ts +2 -2
  60. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  61. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  62. package/dist/opLifecycle/outbox.js +7 -2
  63. package/dist/opLifecycle/outbox.js.map +1 -1
  64. package/dist/packageVersion.d.ts +1 -1
  65. package/dist/packageVersion.js +1 -1
  66. package/dist/packageVersion.js.map +1 -1
  67. package/dist/pendingStateManager.d.ts +3 -19
  68. package/dist/pendingStateManager.d.ts.map +1 -1
  69. package/dist/pendingStateManager.js +23 -40
  70. package/dist/pendingStateManager.js.map +1 -1
  71. package/dist/scheduleManager.js +6 -2
  72. package/dist/scheduleManager.js.map +1 -1
  73. package/dist/summary/orderedClientElection.d.ts +3 -3
  74. package/dist/summary/orderedClientElection.d.ts.map +1 -1
  75. package/dist/summary/orderedClientElection.js +54 -54
  76. package/dist/summary/orderedClientElection.js.map +1 -1
  77. package/dist/summary/runWhileConnectedCoordinator.js +6 -6
  78. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  79. package/dist/summary/runningSummarizer.js +37 -37
  80. package/dist/summary/runningSummarizer.js.map +1 -1
  81. package/dist/summary/summarizer.d.ts +1 -0
  82. package/dist/summary/summarizer.d.ts.map +1 -1
  83. package/dist/summary/summarizer.js +17 -8
  84. package/dist/summary/summarizer.js.map +1 -1
  85. package/dist/summary/summarizerClientElection.js +6 -6
  86. package/dist/summary/summarizerClientElection.js.map +1 -1
  87. package/dist/summary/summarizerHeuristics.js +9 -9
  88. package/dist/summary/summarizerHeuristics.js.map +1 -1
  89. package/dist/summary/summarizerNode/summarizerNode.js +7 -7
  90. package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
  91. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +1 -1
  92. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  93. package/dist/summary/summarizerNode/summarizerNodeUtils.js +3 -3
  94. package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  95. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +2 -2
  96. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  97. package/dist/summary/summarizerTypes.d.ts +12 -12
  98. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  99. package/dist/summary/summaryCollection.d.ts +2 -2
  100. package/dist/summary/summaryCollection.d.ts.map +1 -1
  101. package/dist/summary/summaryCollection.js +22 -21
  102. package/dist/summary/summaryCollection.js.map +1 -1
  103. package/dist/summary/summaryFormat.d.ts +5 -5
  104. package/dist/summary/summaryFormat.d.ts.map +1 -1
  105. package/dist/summary/summaryGenerator.d.ts +3 -3
  106. package/dist/summary/summaryGenerator.d.ts.map +1 -1
  107. package/dist/summary/summaryGenerator.js.map +1 -1
  108. package/dist/summary/summaryManager.d.ts +2 -2
  109. package/dist/summary/summaryManager.d.ts.map +1 -1
  110. package/dist/summary/summaryManager.js +10 -10
  111. package/dist/summary/summaryManager.js.map +1 -1
  112. package/dist/throttler.js +16 -16
  113. package/dist/throttler.js.map +1 -1
  114. package/dist/tsdoc-metadata.json +1 -1
  115. package/lib/blobManager.d.ts +1 -1
  116. package/lib/blobManager.d.ts.map +1 -1
  117. package/lib/blobManager.js +7 -7
  118. package/lib/blobManager.js.map +1 -1
  119. package/lib/connectionTelemetry.d.ts.map +1 -1
  120. package/lib/connectionTelemetry.js +76 -43
  121. package/lib/connectionTelemetry.js.map +1 -1
  122. package/lib/containerHandleContext.js +3 -3
  123. package/lib/containerHandleContext.js.map +1 -1
  124. package/lib/containerRuntime.d.ts +28 -24
  125. package/lib/containerRuntime.d.ts.map +1 -1
  126. package/lib/containerRuntime.js +268 -252
  127. package/lib/containerRuntime.js.map +1 -1
  128. package/lib/dataStore.js +9 -9
  129. package/lib/dataStore.js.map +1 -1
  130. package/lib/dataStoreContext.d.ts +1 -3
  131. package/lib/dataStoreContext.d.ts.map +1 -1
  132. package/lib/dataStoreContext.js +54 -58
  133. package/lib/dataStoreContext.js.map +1 -1
  134. package/lib/dataStoreRegistry.js +3 -3
  135. package/lib/dataStoreRegistry.js.map +1 -1
  136. package/lib/deltaManagerProxyBase.js +4 -4
  137. package/lib/deltaManagerProxyBase.js.map +1 -1
  138. package/lib/deltaManagerSummarizerProxy.js +6 -6
  139. package/lib/deltaManagerSummarizerProxy.js.map +1 -1
  140. package/lib/deltaScheduler.js.map +1 -1
  141. package/lib/error.d.ts.map +1 -1
  142. package/lib/error.js.map +1 -1
  143. package/lib/gc/garbageCollection.js +13 -13
  144. package/lib/gc/garbageCollection.js.map +1 -1
  145. package/lib/gc/gcDefinitions.d.ts +4 -15
  146. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  147. package/lib/gc/gcDefinitions.js.map +1 -1
  148. package/lib/gc/gcTelemetry.d.ts +1 -1
  149. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  150. package/lib/gc/gcUnreferencedStateTracker.js +3 -3
  151. package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
  152. package/lib/id-compressor/appendOnlySortedMap.js.map +1 -1
  153. package/lib/id-compressor/idCompressor.js.map +1 -1
  154. package/lib/id-compressor/identifiers.d.ts +3 -3
  155. package/lib/id-compressor/identifiers.d.ts.map +1 -1
  156. package/lib/index.d.ts +1 -1
  157. package/lib/index.d.ts.map +1 -1
  158. package/lib/index.js +1 -1
  159. package/lib/index.js.map +1 -1
  160. package/lib/messageTypes.d.ts +17 -17
  161. package/lib/messageTypes.d.ts.map +1 -1
  162. package/lib/opLifecycle/batchManager.js +6 -6
  163. package/lib/opLifecycle/batchManager.js.map +1 -1
  164. package/lib/opLifecycle/definitions.d.ts +2 -2
  165. package/lib/opLifecycle/definitions.d.ts.map +1 -1
  166. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  167. package/lib/opLifecycle/outbox.js +7 -2
  168. package/lib/opLifecycle/outbox.js.map +1 -1
  169. package/lib/packageVersion.d.ts +1 -1
  170. package/lib/packageVersion.js +1 -1
  171. package/lib/packageVersion.js.map +1 -1
  172. package/lib/pendingStateManager.d.ts +3 -19
  173. package/lib/pendingStateManager.d.ts.map +1 -1
  174. package/lib/pendingStateManager.js +23 -40
  175. package/lib/pendingStateManager.js.map +1 -1
  176. package/lib/scheduleManager.js +6 -2
  177. package/lib/scheduleManager.js.map +1 -1
  178. package/lib/summary/orderedClientElection.d.ts +3 -3
  179. package/lib/summary/orderedClientElection.d.ts.map +1 -1
  180. package/lib/summary/orderedClientElection.js +54 -54
  181. package/lib/summary/orderedClientElection.js.map +1 -1
  182. package/lib/summary/runWhileConnectedCoordinator.js +6 -6
  183. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
  184. package/lib/summary/runningSummarizer.js +37 -37
  185. package/lib/summary/runningSummarizer.js.map +1 -1
  186. package/lib/summary/summarizer.d.ts +1 -0
  187. package/lib/summary/summarizer.d.ts.map +1 -1
  188. package/lib/summary/summarizer.js +18 -9
  189. package/lib/summary/summarizer.js.map +1 -1
  190. package/lib/summary/summarizerClientElection.js +6 -6
  191. package/lib/summary/summarizerClientElection.js.map +1 -1
  192. package/lib/summary/summarizerHeuristics.js +9 -9
  193. package/lib/summary/summarizerHeuristics.js.map +1 -1
  194. package/lib/summary/summarizerNode/summarizerNode.js +7 -7
  195. package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
  196. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +1 -1
  197. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  198. package/lib/summary/summarizerNode/summarizerNodeUtils.js +3 -3
  199. package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  200. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +2 -2
  201. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  202. package/lib/summary/summarizerTypes.d.ts +12 -12
  203. package/lib/summary/summarizerTypes.d.ts.map +1 -1
  204. package/lib/summary/summaryCollection.d.ts +2 -2
  205. package/lib/summary/summaryCollection.d.ts.map +1 -1
  206. package/lib/summary/summaryCollection.js +22 -21
  207. package/lib/summary/summaryCollection.js.map +1 -1
  208. package/lib/summary/summaryFormat.d.ts +5 -5
  209. package/lib/summary/summaryFormat.d.ts.map +1 -1
  210. package/lib/summary/summaryGenerator.d.ts +3 -3
  211. package/lib/summary/summaryGenerator.d.ts.map +1 -1
  212. package/lib/summary/summaryGenerator.js.map +1 -1
  213. package/lib/summary/summaryManager.d.ts +2 -2
  214. package/lib/summary/summaryManager.d.ts.map +1 -1
  215. package/lib/summary/summaryManager.js +9 -9
  216. package/lib/summary/summaryManager.js.map +1 -1
  217. package/lib/throttler.js +16 -16
  218. package/lib/throttler.js.map +1 -1
  219. package/package.json +27 -27
  220. package/src/blobManager.ts +1 -1
  221. package/src/connectionTelemetry.ts +97 -52
  222. package/src/containerRuntime.ts +96 -73
  223. package/src/dataStore.ts +1 -1
  224. package/src/dataStoreContext.ts +1 -6
  225. package/src/error.ts +4 -1
  226. package/src/gc/gcDefinitions.ts +3 -15
  227. package/src/gc/gcEarlyAdoption.md +1 -1
  228. package/src/index.ts +1 -0
  229. package/src/opLifecycle/README.md +53 -28
  230. package/src/opLifecycle/outbox.ts +3 -0
  231. package/src/packageVersion.ts +1 -1
  232. package/src/pendingStateManager.ts +8 -46
  233. package/src/scheduleManager.ts +2 -0
  234. package/src/summary/summarizer.ts +20 -7
  235. package/src/summary/summaryCollection.ts +1 -0
  236. package/src/summary/summaryGenerator.ts +3 -3
  237. package/src/summary/summaryManager.ts +2 -2
@@ -7,6 +7,9 @@ exports.FluidDataStoreRegistry = void 0;
7
7
  */
8
8
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
9
9
  class FluidDataStoreRegistry {
10
+ get IFluidDataStoreRegistry() {
11
+ return this;
12
+ }
10
13
  constructor(namedEntries) {
11
14
  this.map = new Map();
12
15
  for (const entry of namedEntries) {
@@ -16,9 +19,6 @@ class FluidDataStoreRegistry {
16
19
  this.map.set(entry[0], entry[1]);
17
20
  }
18
21
  }
19
- get IFluidDataStoreRegistry() {
20
- return this;
21
- }
22
22
  async get(name) {
23
23
  if (this.map.has(name)) {
24
24
  return this.map.get(name);
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreRegistry.js","sourceRoot":"","sources":["../src/dataStoreRegistry.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,qEAA6D;AAO7D,MAAa,sBAAsB;IAUlC,YAAY,YAAgD;QAC3D,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;QACrB,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;YACjC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC3B,MAAM,IAAI,4BAAU,CAAC,6BAA6B,CAAC,CAAC;aACpD;YACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACjC;IACF,CAAC;IAZD,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC;IACb,CAAC;IAYM,KAAK,CAAC,GAAG,CAAC,IAAY;QAC5B,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACvB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAC1B;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;CACD;AA3BD,wDA2BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { UsageError } from \"@fluidframework/telemetry-utils\";\nimport {\n\tFluidDataStoreRegistryEntry,\n\tIFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions\";\n\nexport class FluidDataStoreRegistry implements IFluidDataStoreRegistry {\n\tprivate readonly map: Map<\n\t\tstring,\n\t\tFluidDataStoreRegistryEntry | Promise<FluidDataStoreRegistryEntry>\n\t>;\n\n\tpublic get IFluidDataStoreRegistry() {\n\t\treturn this;\n\t}\n\n\tconstructor(namedEntries: NamedFluidDataStoreRegistryEntries) {\n\t\tthis.map = new Map();\n\t\tfor (const entry of namedEntries) {\n\t\t\tif (this.map.has(entry[0])) {\n\t\t\t\tthrow new UsageError(\"Duplicate entry names exist\");\n\t\t\t}\n\t\t\tthis.map.set(entry[0], entry[1]);\n\t\t}\n\t}\n\n\tpublic async get(name: string): Promise<FluidDataStoreRegistryEntry | undefined> {\n\t\tif (this.map.has(name)) {\n\t\t\treturn this.map.get(name);\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n"]}
1
+ {"version":3,"file":"dataStoreRegistry.js","sourceRoot":"","sources":["../src/dataStoreRegistry.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,qEAA6D;AAO7D,MAAa,sBAAsB;IAMlC,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,YAAY,YAAgD;QAC3D,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;QACrB,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;YACjC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC3B,MAAM,IAAI,4BAAU,CAAC,6BAA6B,CAAC,CAAC;aACpD;YACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACjC;IACF,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,IAAY;QAC5B,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACvB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAC1B;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;CACD;AA3BD,wDA2BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { UsageError } from \"@fluidframework/telemetry-utils\";\nimport {\n\tFluidDataStoreRegistryEntry,\n\tIFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions\";\n\nexport class FluidDataStoreRegistry implements IFluidDataStoreRegistry {\n\tprivate readonly map: Map<\n\t\tstring,\n\t\tFluidDataStoreRegistryEntry | Promise<FluidDataStoreRegistryEntry>\n\t>;\n\n\tpublic get IFluidDataStoreRegistry() {\n\t\treturn this;\n\t}\n\n\tconstructor(namedEntries: NamedFluidDataStoreRegistryEntries) {\n\t\tthis.map = new Map();\n\t\tfor (const entry of namedEntries) {\n\t\t\tif (this.map.has(entry[0])) {\n\t\t\t\tthrow new UsageError(\"Duplicate entry names exist\");\n\t\t\t}\n\t\t\tthis.map.set(entry[0], entry[1]);\n\t\t}\n\t}\n\n\tpublic async get(name: string): Promise<FluidDataStoreRegistryEntry | undefined> {\n\t\tif (this.map.has(name)) {\n\t\t\treturn this.map.get(name);\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n"]}
@@ -11,10 +11,6 @@ const client_utils_1 = require("@fluid-internal/client-utils");
11
11
  * proxy implementations can override specific methods.
12
12
  */
13
13
  class DeltaManagerProxyBase extends client_utils_1.EventForwarder {
14
- constructor(deltaManager) {
15
- super(deltaManager);
16
- this.deltaManager = deltaManager;
17
- }
18
14
  get IDeltaSender() {
19
15
  return this;
20
16
  }
@@ -63,6 +59,10 @@ class DeltaManagerProxyBase extends client_utils_1.EventForwarder {
63
59
  get readOnlyInfo() {
64
60
  return this.deltaManager.readOnlyInfo;
65
61
  }
62
+ constructor(deltaManager) {
63
+ super(deltaManager);
64
+ this.deltaManager = deltaManager;
65
+ }
66
66
  dispose() {
67
67
  super.dispose();
68
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"deltaManagerProxyBase.js","sourceRoot":"","sources":["../src/deltaManagerProxyBase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAgB9D;;;GAGG;AACH,MAAa,qBACZ,SAAQ,6BAAmC;IAmE3C,YACoB,YAAwE;QAE3F,KAAK,CAAC,YAAY,CAAC,CAAC;QAFD,iBAAY,GAAZ,YAAY,CAA4D;IAG5F,CAAC;IApED,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;IAClC,CAAC;IAED,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC;IACnC,CAAC;IAED,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC;IACxC,CAAC;IAED,IAAW,qBAAqB;QAC/B,OAAO,I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ights reserved.\n * Licensed under the MIT License.\n */\n\nimport { EventForwarder } from \"@fluid-internal/client-utils\";\nimport {\n\tIDeltaManager,\n\tIDeltaManagerEvents,\n\tIDeltaQueue,\n\tIDeltaSender,\n\tReadOnlyInfo,\n} from \"@fluidframework/container-definitions\";\nimport {\n\tIClientConfiguration,\n\tIClientDetails,\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Base class for creating proxy to the real delta manager. It implements all required methods on IDeltaManager and\n * proxy implementations can override specific methods.\n */\nexport class DeltaManagerProxyBase\n\textends EventForwarder<IDeltaManagerEvents>\n\timplements IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>\n{\n\tpublic get IDeltaSender(): IDeltaSender {\n\t\treturn this;\n\t}\n\n\tpublic get inbound(): IDeltaQueue<ISequencedDocumentMessage> {\n\t\treturn this.deltaManager.inbound;\n\t}\n\n\tpublic get outbound(): IDeltaQueue<IDocumentMessage[]> {\n\t\treturn this.deltaManager.outbound;\n\t}\n\n\tpublic get inboundSignal(): IDeltaQueue<ISignalMessage> {\n\t\treturn this.deltaManager.inboundSignal;\n\t}\n\n\tpublic get minimumSequenceNumber(): number {\n\t\treturn this.deltaManager.minimumSequenceNumber;\n\t}\n\n\tpublic get lastSequenceNumber(): number {\n\t\treturn this.deltaManager.lastSequenceNumber;\n\t}\n\n\tpublic get lastMessage() {\n\t\treturn this.deltaManager.lastMessage;\n\t}\n\n\tpublic get lastKnownSeqNumber() {\n\t\treturn this.deltaManager.lastKnownSeqNumber;\n\t}\n\n\tpublic get initialSequenceNumber(): number {\n\t\treturn this.deltaManager.initialSequenceNumber;\n\t}\n\n\tpublic get hasCheckpointSequenceNumber() {\n\t\treturn this.deltaManager.hasCheckpointSequenceNumber;\n\t}\n\n\tpublic get clientDetails(): IClientDetails {\n\t\treturn this.deltaManager.clientDetails;\n\t}\n\n\tpublic get version(): string {\n\t\treturn this.deltaManager.version;\n\t}\n\n\tpublic get maxMessageSize(): number {\n\t\treturn this.deltaManager.maxMessageSize;\n\t}\n\n\tpublic get serviceConfiguration(): IClientConfiguration | undefined {\n\t\treturn this.deltaManager.serviceConfiguration;\n\t}\n\n\tpublic get active(): boolean {\n\t\treturn this.deltaManager.active;\n\t}\n\n\tpublic get readOnlyInfo(): ReadOnlyInfo {\n\t\treturn this.deltaManager.readOnlyInfo;\n\t}\n\n\tconstructor(\n\t\tprotected readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t) {\n\t\tsuper(deltaManager);\n\t}\n\n\tpublic dispose(): void {\n\t\tsuper.dispose();\n\t}\n\n\tpublic submitSignal(content: any): void {\n\t\treturn this.deltaManager.submitSignal(content);\n\t}\n\n\tpublic flush(): void {\n\t\treturn this.deltaManager.flush();\n\t}\n}\n"]}
1
+ {"version":3,"file":"deltaManagerProxyBase.js","sourceRoot":"","sources":["../src/deltaManagerProxyBase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAgB9D;;;GAGG;AACH,MAAa,qBACZ,SAAQ,6BAAmC;IAG3C,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;IAClC,CAAC;IAED,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC;IACnC,CAAC;IAED,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC;IACxC,CAAC;IAED,IAAW,qBAAqB;QAC/B,OAAO,IAAI,CAAC,YAAY,CAAC,qBAAqB,CAAC;IAChD,CAAC;IAED,IAAW,kBAAkB;QAC5B,OAAO,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC;IAC7C,CAAC;IAED,IAAW,WAAW;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC;IACtC,CAAC;IAED,IAAW,kBAAkB;QAC5B,OAAO,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC;IAC7C,CAAC;IAED,IAAW,qBAAqB;QAC/B,OAAO,IAAI,CAAC,YAAY,CAAC,qBAAqB,CAAC;IAChD,CAAC;IAED,IAAW,2BAA2B;QACrC,OAAO,IAAI,CAAC,YAAY,CAAC,2BAA2B,CAAC;IACtD,CAAC;IAED,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC;IACxC,CAAC;IAED,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;IAClC,CAAC;IAED,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC;IACzC,CAAC;IAED,IAAW,oBAAoB;QAC9B,OAAO,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC;IAC/C,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;IACjC,CAAC;IAED,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC;IACvC,CAAC;IAED,YACoB,YAAwE;QAE3F,KAAK,CAAC,YAAY,CAAC,CAAC;QAFD,iBAAY,GAAZ,YAAY,CAA4D;IAG5F,CAAC;IAEM,OAAO;QACb,KAAK,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IAEM,YAAY,CAAC,OAAY;QAC/B,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IAEM,KAAK;QACX,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAClC,CAAC;CACD;AArFD,sDAqFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { EventForwarder } from \"@fluid-internal/client-utils\";\nimport {\n\tIDeltaManager,\n\tIDeltaManagerEvents,\n\tIDeltaQueue,\n\tIDeltaSender,\n\tReadOnlyInfo,\n} from \"@fluidframework/container-definitions\";\nimport {\n\tIClientConfiguration,\n\tIClientDetails,\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Base class for creating proxy to the real delta manager. It implements all required methods on IDeltaManager and\n * proxy implementations can override specific methods.\n */\nexport class DeltaManagerProxyBase\n\textends EventForwarder<IDeltaManagerEvents>\n\timplements IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>\n{\n\tpublic get IDeltaSender(): IDeltaSender {\n\t\treturn this;\n\t}\n\n\tpublic get inbound(): IDeltaQueue<ISequencedDocumentMessage> {\n\t\treturn this.deltaManager.inbound;\n\t}\n\n\tpublic get outbound(): IDeltaQueue<IDocumentMessage[]> {\n\t\treturn this.deltaManager.outbound;\n\t}\n\n\tpublic get inboundSignal(): IDeltaQueue<ISignalMessage> {\n\t\treturn this.deltaManager.inboundSignal;\n\t}\n\n\tpublic get minimumSequenceNumber(): number {\n\t\treturn this.deltaManager.minimumSequenceNumber;\n\t}\n\n\tpublic get lastSequenceNumber(): number {\n\t\treturn this.deltaManager.lastSequenceNumber;\n\t}\n\n\tpublic get lastMessage() {\n\t\treturn this.deltaManager.lastMessage;\n\t}\n\n\tpublic get lastKnownSeqNumber() {\n\t\treturn this.deltaManager.lastKnownSeqNumber;\n\t}\n\n\tpublic get initialSequenceNumber(): number {\n\t\treturn this.deltaManager.initialSequenceNumber;\n\t}\n\n\tpublic get hasCheckpointSequenceNumber() {\n\t\treturn this.deltaManager.hasCheckpointSequenceNumber;\n\t}\n\n\tpublic get clientDetails(): IClientDetails {\n\t\treturn this.deltaManager.clientDetails;\n\t}\n\n\tpublic get version(): string {\n\t\treturn this.deltaManager.version;\n\t}\n\n\tpublic get maxMessageSize(): number {\n\t\treturn this.deltaManager.maxMessageSize;\n\t}\n\n\tpublic get serviceConfiguration(): IClientConfiguration | undefined {\n\t\treturn this.deltaManager.serviceConfiguration;\n\t}\n\n\tpublic get active(): boolean {\n\t\treturn this.deltaManager.active;\n\t}\n\n\tpublic get readOnlyInfo(): ReadOnlyInfo {\n\t\treturn this.deltaManager.readOnlyInfo;\n\t}\n\n\tconstructor(\n\t\tprotected readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t) {\n\t\tsuper(deltaManager);\n\t}\n\n\tpublic dispose(): void {\n\t\tsuper.dispose();\n\t}\n\n\tpublic submitSignal(content: any): void {\n\t\treturn this.deltaManager.submitSignal(content);\n\t}\n\n\tpublic flush(): void {\n\t\treturn this.deltaManager.flush();\n\t}\n}\n"]}
@@ -13,12 +13,6 @@ const summary_1 = require("./summary");
13
13
  * - Summarizer client should not be active to layers below the container runtime to restrict local changes.
14
14
  */
15
15
  class DeltaManagerSummarizerProxy extends deltaManagerProxyBase_1.DeltaManagerProxyBase {
16
- constructor(deltaManager) {
17
- super(deltaManager);
18
- // We are expecting this class to have many listeners, so we suppress noisy "MaxListenersExceededWarning" logging.
19
- super.setMaxListeners(0);
20
- this.isSummarizerClient = this.deltaManager.clientDetails.type === summary_1.summarizerClientType;
21
- }
22
16
  get active() {
23
17
  // Summarize clients should not be active. There shouldn't be any local changes (writes) in the summarizer
24
18
  // except for the SummarizeOp which is generated by the runtime.
@@ -37,6 +31,12 @@ class DeltaManagerSummarizerProxy extends deltaManagerProxyBase_1.DeltaManagerPr
37
31
  }
38
32
  return this.deltaManager.readOnlyInfo;
39
33
  }
34
+ constructor(deltaManager) {
35
+ super(deltaManager);
36
+ // We are expecting this class to have many listeners, so we suppress noisy "MaxListenersExceededWarning" logging.
37
+ super.setMaxListeners(0);
38
+ this.isSummarizerClient = this.deltaManager.clientDetails.type === summary_1.summarizerClientType;
39
+ }
40
40
  }
41
41
  exports.DeltaManagerSummarizerProxy = DeltaManagerSummarizerProxy;
42
42
  //# sourceMappingURL=deltaManagerSummarizerProxy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deltaManagerSummarizerProxy.js","sourceRoot":"","sources":["../src/deltaManagerSummarizerProxy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,mEAAgE;AAChE,uCAAiD;AAEjD;;;;GAIG;AACH,MAAa,2BACZ,SAAQ,6CAAqB;IAyB7B,YAAY,YAAwE;QACnF,KAAK,CAAC,YAAY,CAAC,CAAC;QACpB,kHAAkH;QAClH,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,KAAK,8BAAoB,CAAC;IACzF,CAAC;IA3BD,IAAW,MAAM;QAChB,0GAA0G;QAC1G,gEAAgE;QAChE,OAAO,CAAC,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;IAC7D,CAAC;IAED,IAAW,YAAY;QACtB,+GAA+G;QAC/G,iHAAiH;QACjH,IAAI,IAAI,CAAC,kBAAkB,EAAE;YAC5B,OAAO;gBACN,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,KAAK;gBACb,WAAW,EAAE,SAAS;gBACtB,WAAW,EAAE,KAAK;aAClB,CAAC;SACF;QACD,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC;IACvC,CAAC;CAUD;AAhCD,kEAgCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDeltaManager, ReadOnlyInfo } from \"@fluidframework/container-definitions\";\nimport { IDocumentMessage, ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\nimport { DeltaManagerProxyBase } from \"./deltaManagerProxyBase\";\nimport { summarizerClientType } from \"./summary\";\n\n/**\n * Proxy to the real IDeltaManager for restricting certain access to layers below container runtime in summarizer clients:\n * - Summarizer client should be read-only to layers below the container runtime to restrict local changes.\n * - Summarizer client should not be active to layers below the container runtime to restrict local changes.\n */\nexport class DeltaManagerSummarizerProxy\n\textends DeltaManagerProxyBase\n\timplements IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>\n{\n\tpublic get active(): boolean {\n\t\t// Summarize clients should not be active. There shouldn't be any local changes (writes) in the summarizer\n\t\t// except for the SummarizeOp which is generated by the runtime.\n\t\treturn !this.isSummarizerClient && this.deltaManager.active;\n\t}\n\n\tpublic get readOnlyInfo(): ReadOnlyInfo {\n\t\t// Summarizer clients should be read-only as far as the runtime and layers below are concerned. There shouldn't\n\t\t// be any local changes (writes) in the summarizer except for the summarize op which is generated by the runtime.\n\t\tif (this.isSummarizerClient) {\n\t\t\treturn {\n\t\t\t\treadonly: true,\n\t\t\t\tforced: false,\n\t\t\t\tpermissions: undefined,\n\t\t\t\tstorageOnly: false,\n\t\t\t};\n\t\t}\n\t\treturn this.deltaManager.readOnlyInfo;\n\t}\n\n\tprivate readonly isSummarizerClient: boolean;\n\n\tconstructor(deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>) {\n\t\tsuper(deltaManager);\n\t\t// We are expecting this class to have many listeners, so we suppress noisy \"MaxListenersExceededWarning\" logging.\n\t\tsuper.setMaxListeners(0);\n\t\tthis.isSummarizerClient = this.deltaManager.clientDetails.type === summarizerClientType;\n\t}\n}\n"]}
1
+ {"version":3,"file":"deltaManagerSummarizerProxy.js","sourceRoot":"","sources":["../src/deltaManagerSummarizerProxy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,mEAAgE;AAChE,uCAAiD;AAEjD;;;;GAIG;AACH,MAAa,2BACZ,SAAQ,6CAAqB;IAG7B,IAAW,MAAM;QAChB,0GAA0G;QAC1G,gEAAgE;QAChE,OAAO,CAAC,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;IAC7D,CAAC;IAED,IAAW,YAAY;QACtB,+GAA+G;QAC/G,iHAAiH;QACjH,IAAI,IAAI,CAAC,kBAAkB,EAAE;YAC5B,OAAO;gBACN,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,KAAK;gBACb,WAAW,EAAE,SAAS;gBACtB,WAAW,EAAE,KAAK;aAClB,CAAC;SACF;QACD,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC;IACvC,CAAC;IAID,YAAY,YAAwE;QACnF,KAAK,CAAC,YAAY,CAAC,CAAC;QACpB,kHAAkH;QAClH,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,KAAK,8BAAoB,CAAC;IACzF,CAAC;CACD;AAhCD,kEAgCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDeltaManager, ReadOnlyInfo } from \"@fluidframework/container-definitions\";\nimport { IDocumentMessage, ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\nimport { DeltaManagerProxyBase } from \"./deltaManagerProxyBase\";\nimport { summarizerClientType } from \"./summary\";\n\n/**\n * Proxy to the real IDeltaManager for restricting certain access to layers below container runtime in summarizer clients:\n * - Summarizer client should be read-only to layers below the container runtime to restrict local changes.\n * - Summarizer client should not be active to layers below the container runtime to restrict local changes.\n */\nexport class DeltaManagerSummarizerProxy\n\textends DeltaManagerProxyBase\n\timplements IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>\n{\n\tpublic get active(): boolean {\n\t\t// Summarize clients should not be active. There shouldn't be any local changes (writes) in the summarizer\n\t\t// except for the SummarizeOp which is generated by the runtime.\n\t\treturn !this.isSummarizerClient && this.deltaManager.active;\n\t}\n\n\tpublic get readOnlyInfo(): ReadOnlyInfo {\n\t\t// Summarizer clients should be read-only as far as the runtime and layers below are concerned. There shouldn't\n\t\t// be any local changes (writes) in the summarizer except for the summarize op which is generated by the runtime.\n\t\tif (this.isSummarizerClient) {\n\t\t\treturn {\n\t\t\t\treadonly: true,\n\t\t\t\tforced: false,\n\t\t\t\tpermissions: undefined,\n\t\t\t\tstorageOnly: false,\n\t\t\t};\n\t\t}\n\t\treturn this.deltaManager.readOnlyInfo;\n\t}\n\n\tprivate readonly isSummarizerClient: boolean;\n\n\tconstructor(deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>) {\n\t\tsuper(deltaManager);\n\t\t// We are expecting this class to have many listeners, so we suppress noisy \"MaxListenersExceededWarning\" logging.\n\t\tsuper.setMaxListeners(0);\n\t\tthis.isSummarizerClient = this.deltaManager.clientDetails.type === summarizerClientType;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"deltaScheduler.js","sourceRoot":"","sources":["../src/deltaScheduler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAAkF;AAClF,+DAA2D;AAI3D;;;;;;;;;;;;GAYG;AACH,MAAa,cAAc;IA4B1B,YACC,YAAwE,EACvD,MAA2B;QAA3B,WAAM,GAAN,MAAM,CAAqB;QAzB7C,2DAA2D;QAC1C,4BAAuB,GAAG,EAAE,CAAC;QAGtC,wCAAmC,GAAW,cAAc,CAAC,cAAc,CAAC;QAEpF,+FAA+F;QAC/F,gGAAgG;QAChG,sBAAsB;QACd,oBAAe,GAAW,CAAC,CAAC;QAkBnC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;YACzC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACzB,CAAC,CAAC,CAAC;IACJ,CAAC;IAEM,UAAU,CAAC,OAAkC;QACnD,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC9B,IAAI,CAAC,mBAAmB,GAAG,0BAAW,CAAC,GAAG,EAAE,CAAC;SAC7C;QACD,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,eAAe,GAAG,GAAG,KAAK,CAAC,EAAE;YACzE,iFAAiF;YACjF,oFAAoF;YACpF,IAAI,CAAC,aA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CAAC;gBAClE,YAAY,EACX,IAAI,CAAC,aAAa,CAAC,kBAAkB;oBACrC,IAAI,CAAC,aAAa,CAAC,mBAAmB;oBACtC,CAAC;gBACF,gBAAgB,EAAE,IAAI,CAAC,aAAa,CAAC,wBAAwB;gBAC7D,QAAQ,EAAE,IAAA,4BAAU,EAAC,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC;gBAChE,eAAe,EAAE,IAAI,CAAC,eAAe;aACrC,CAAC,CAAC;YAEH,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;SAC/B;QAED,yFAAyF;QACzF,qCAAqC;QACrC,IAAI,CAAC,eAAe,EAAE,CAAC;QAEvB,8BAA8B;QAC9B,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;QACrC,IAAI,CAAC,mCAAmC,GAAG,cAAc,CAAC,cAAc,CAAC;IAC1E,CAAC;IAED;;OAEG;IACK,kBAAkB;QACzB,qFAAqF;QACrF,qBAAqB;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7C,CAAC;;AAvJF,wCAwJC;AAtJA,gDAAgD;AACzB,6BAAc,GAAG,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt, formatTick } from \"@fluidframework/telemetry-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport { IDocumentMessage, ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\n/**\n * DeltaScheduler is responsible for the scheduling of inbound delta queue in cases where there\n * is more than one op a particular run of the queue. It does not schedule if there is just one\n * op or just one batch in the run. It does the following two things:\n *\n * 1. If the ops have been processed for more than a specific amount of time, it pauses the queue\n * and calls setTimeout to schedule a resume of the queue. This ensures that we don't block\n * the JS thread for a long time processing ops synchronously (for example, when catching up\n * ops right after boot or catching up ops / delayed realizing data stores by summarizer).\n *\n * 2. If we scheduled a particular run of the queue, it logs telemetry for the number of ops\n * processed, the time and number of turns it took to process the ops.\n */\nexport class DeltaScheduler {\n\tprivate readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\t// The time for processing ops in a single turn.\n\tpublic static readonly processingTime = 50;\n\n\t// The increase in time for processing ops after each turn.\n\tprivate readonly processingTimeIncrement = 10;\n\n\tprivate processingStartTime: number | undefined;\n\tprivate currentAllowedProcessingTimeForTurn: number = DeltaScheduler.processingTime;\n\n\t// This keeps track of the number of times inbound queue has been scheduled. After a particular\n\t// count, we log telemetry for the number of ops processed, the time and number of turns it took\n\t// to process the ops.\n\tprivate schedulingCount: number = 0;\n\n\tprivate schedulingLog:\n\t\t| {\n\t\t\t\topsRemainingToProcess: number;\n\t\t\t\ttotalProcessingTime: number;\n\t\t\t\tnumberOfTurns: number;\n\t\t\t\tnumberOfBatchesProcessed: number;\n\t\t\t\tlastSequenceNumber: number;\n\t\t\t\tfirstSequenceNumber: number;\n\t\t\t\tstartTime: number;\n\t\t }\n\t\t| undefined;\n\n\tconstructor(\n\t\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.deltaManager = deltaManager;\n\t\tthis.deltaManager.inbound.on(\"idle\", () => {\n\t\t\tthis.inboundQueueIdle();\n\t\t});\n\t}\n\n\tpublic batchBegin(message: ISequencedDocumentMessage) {\n\t\tif (!this.processingStartTime) {\n\t\t\tthis.processingStartTime = performance.now();\n\t\t}\n\t\tif (this.schedulingLog === undefined && this.schedulingCount % 500 === 0) {\n\t\t\t// Every 500th time we are scheduling the inbound queue, we log telemetry for the\n\t\t\t// number of ops processed, the time and number of turns it took to process the ops.\n\t\t\tthis.schedulingLog = {\n\t\t\t\topsRemainingToProcess: 0,\n\t\t\t\tnumberOfTurns: 1,\n\t\t\t\ttotalProcessingTime: 0,\n\t\t\t\tnumberOfBatchesProcessed: 0,\n\t\t\t\tfirstSequenceNumber: message.sequenceNumber,\n\t\t\t\tlastSequenceNumber: message.sequenceNumber,\n\t\t\t\tstartTime: performance.now(),\n\t\t\t};\n\t\t}\n\t}\n\n\tpublic batchEnd(message: ISequencedDocumentMessage) {\n\t\tif (this.schedulingLog) {\n\t\t\tthis.schedulingLog.numberOfBatchesProcessed++;\n\t\t\tthis.schedulingLog.lastSequenceNumber = message.sequenceNumber;\n\t\t\tthis.schedulingLog.opsRemainingToProcess = this.deltaManager.inbound.length;\n\t\t}\n\n\t\tif (this.shouldRunScheduler()) {\n\t\t\tconst currentTime = performance.now();\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst elapsedTime = currentTime - this.processingStartTime!;\n\t\t\tif (elapsedTime > this.currentAllowedProcessingTimeForTurn) {\n\t\t\t\t// We have processed ops for more than the total processing time. So, pause the\n\t\t\t\t// queue, yield the thread and schedule a resume.\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\t\tthis.deltaManager.inbound.pause();\n\n\t\t\t\t// Increase the total processing time. Keep doing this after each turn until all the ops have\n\t\t\t\t// been processed. This way we keep the responsiveness at the beginning while also making sure\n\t\t\t\t// that all the ops process fairly quickly.\n\t\t\t\tthis.currentAllowedProcessingTimeForTurn += this.processingTimeIncrement;\n\n\t\t\t\t// If we are logging the telemetry this time, update the telemetry log object.\n\t\t\t\tif (this.schedulingLog) {\n\t\t\t\t\tthis.schedulingLog.numberOfTurns++;\n\t\t\t\t\tthis.schedulingLog.totalProcessingTime += elapsedTime;\n\t\t\t\t}\n\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tif (this.schedulingLog) {\n\t\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\t\teventName: \"InboundOpsPartialProcessingTime\",\n\t\t\t\t\t\t\tduration: formatTick(elapsedTime),\n\t\t\t\t\t\t\topsProcessed:\n\t\t\t\t\t\t\t\tthis.schedulingLog.lastSequenceNumber -\n\t\t\t\t\t\t\t\tthis.schedulingLog.firstSequenceNumber +\n\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\topsRemainingToProcess: this.deltaManager.inbound.length,\n\t\t\t\t\t\t\tprocessingTime: formatTick(this.schedulingLog.totalProcessingTime),\n\t\t\t\t\t\t\tnumberOfTurns: this.schedulingLog.numberOfTurns,\n\t\t\t\t\t\t\tbatchesProcessed: this.schedulingLog.numberOfBatchesProcessed,\n\t\t\t\t\t\t\ttimeToResume: formatTick(performance.now() - currentTime),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tthis.deltaManager.inbound.resume();\n\t\t\t\t});\n\n\t\t\t\tthis.processingStartTime = undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate inboundQueueIdle() {\n\t\tif (this.schedulingLog) {\n\t\t\t// Add the time taken for processing the final ops to the total processing time in the\n\t\t\t// telemetry log object.\n\t\t\tconst currentTime = performance.now();\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.schedulingLog.totalProcessingTime += currentTime - this.processingStartTime!;\n\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"InboundOpsProcessingTime\",\n\t\t\t\topsRemainingToProcess: this.schedulingLog.opsRemainingToProcess,\n\t\t\t\tnumberOfTurns: this.schedulingLog.numberOfTurns,\n\t\t\t\tprocessingTime: formatTick(this.schedulingLog.totalProcessingTime),\n\t\t\t\topsProcessed:\n\t\t\t\t\tthis.schedulingLog.lastSequenceNumber -\n\t\t\t\t\tthis.schedulingLog.firstSequenceNumber +\n\t\t\t\t\t1,\n\t\t\t\tbatchesProcessed: this.schedulingLog.numberOfBatchesProcessed,\n\t\t\t\tduration: formatTick(currentTime - this.schedulingLog.startTime),\n\t\t\t\tschedulingCount: this.schedulingCount,\n\t\t\t});\n\n\t\t\tthis.schedulingLog = undefined;\n\t\t}\n\n\t\t// If we scheduled this batch of the inbound queue, increment the counter that tracks the\n\t\t// number of times we have done this.\n\t\tthis.schedulingCount++;\n\n\t\t// Reset the processing times.\n\t\tthis.processingStartTime = undefined;\n\t\tthis.currentAllowedProcessingTimeForTurn = DeltaScheduler.processingTime;\n\t}\n\n\t/**\n\t * This function tells whether we should run the scheduler.\n\t */\n\tprivate shouldRunScheduler(): boolean {\n\t\t// If there are still ops in the queue after the one we are processing now, we should\n\t\t// run the scheduler.\n\t\treturn this.deltaManager.inbound.length > 0;\n\t}\n}\n"]}
1
+ {"version":3,"file":"deltaScheduler.js","sourceRoot":"","sources":["../src/deltaScheduler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAAkF;AAClF,+DAA2D;AAI3D;;;;;;;;;;;;GAYG;AACH,MAAa,cAAc;IA4B1B,YACC,YAAwE,EACvD,MAA2B;QAA3B,WAAM,GAAN,MAAM,CAAqB;QAzB7C,2DAA2D;QAC1C,4BAAuB,GAAG,EAAE,CAAC;QAGtC,wCAAmC,GAAW,cAAc,CAAC,cAAc,CAAC;QAEpF,+FAA+F;QAC/F,gGAAgG;QAChG,sBAAsB;QACd,oBAAe,GAAW,CAAC,CAAC;QAkBnC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;YACzC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACzB,CAAC,CAAC,CAAC;IACJ,CAAC;IAEM,UAAU,CAAC,OAAkC;QACnD,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC9B,IAAI,CAAC,mBAAmB,GAAG,0BAAW,CAAC,GAAG,EAAE,CAAC;SAC7C;QACD,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,eAAe,GAAG,GAAG,KAAK,CAAC,EAAE;YACzE,iFAAiF;YACjF,oFAAoF;YACpF,IAAI,CAAC,aAAa,GAAG;gBACpB,q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,EACX,IAAI,CAAC,aAAa,CAAC,kBAAkB;oBACrC,IAAI,CAAC,aAAa,CAAC,mBAAmB;oBACtC,CAAC;gBACF,gBAAgB,EAAE,IAAI,CAAC,aAAa,CAAC,wBAAwB;gBAC7D,QAAQ,EAAE,IAAA,4BAAU,EAAC,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC;gBAChE,eAAe,EAAE,IAAI,CAAC,eAAe;aACrC,CAAC,CAAC;YAEH,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;SAC/B;QAED,yFAAyF;QACzF,qCAAqC;QACrC,IAAI,CAAC,eAAe,EAAE,CAAC;QAEvB,8BAA8B;QAC9B,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;QACrC,IAAI,CAAC,mCAAmC,GAAG,cAAc,CAAC,cAAc,CAAC;IAC1E,CAAC;IAED;;OAEG;IACK,kBAAkB;QACzB,qFAAqF;QACrF,qBAAqB;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7C,CAAC;;AAvJF,wCAwJC;AAtJA,gDAAgD;AACzB,6BAAc,GAAG,EAAE,AAAL,CAAM","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt, formatTick } from \"@fluidframework/telemetry-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport { IDocumentMessage, ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\n/**\n * DeltaScheduler is responsible for the scheduling of inbound delta queue in cases where there\n * is more than one op a particular run of the queue. It does not schedule if there is just one\n * op or just one batch in the run. It does the following two things:\n *\n * 1. If the ops have been processed for more than a specific amount of time, it pauses the queue\n * and calls setTimeout to schedule a resume of the queue. This ensures that we don't block\n * the JS thread for a long time processing ops synchronously (for example, when catching up\n * ops right after boot or catching up ops / delayed realizing data stores by summarizer).\n *\n * 2. If we scheduled a particular run of the queue, it logs telemetry for the number of ops\n * processed, the time and number of turns it took to process the ops.\n */\nexport class DeltaScheduler {\n\tprivate readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\t// The time for processing ops in a single turn.\n\tpublic static readonly processingTime = 50;\n\n\t// The increase in time for processing ops after each turn.\n\tprivate readonly processingTimeIncrement = 10;\n\n\tprivate processingStartTime: number | undefined;\n\tprivate currentAllowedProcessingTimeForTurn: number = DeltaScheduler.processingTime;\n\n\t// This keeps track of the number of times inbound queue has been scheduled. After a particular\n\t// count, we log telemetry for the number of ops processed, the time and number of turns it took\n\t// to process the ops.\n\tprivate schedulingCount: number = 0;\n\n\tprivate schedulingLog:\n\t\t| {\n\t\t\t\topsRemainingToProcess: number;\n\t\t\t\ttotalProcessingTime: number;\n\t\t\t\tnumberOfTurns: number;\n\t\t\t\tnumberOfBatchesProcessed: number;\n\t\t\t\tlastSequenceNumber: number;\n\t\t\t\tfirstSequenceNumber: number;\n\t\t\t\tstartTime: number;\n\t\t }\n\t\t| undefined;\n\n\tconstructor(\n\t\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.deltaManager = deltaManager;\n\t\tthis.deltaManager.inbound.on(\"idle\", () => {\n\t\t\tthis.inboundQueueIdle();\n\t\t});\n\t}\n\n\tpublic batchBegin(message: ISequencedDocumentMessage) {\n\t\tif (!this.processingStartTime) {\n\t\t\tthis.processingStartTime = performance.now();\n\t\t}\n\t\tif (this.schedulingLog === undefined && this.schedulingCount % 500 === 0) {\n\t\t\t// Every 500th time we are scheduling the inbound queue, we log telemetry for the\n\t\t\t// number of ops processed, the time and number of turns it took to process the ops.\n\t\t\tthis.schedulingLog = {\n\t\t\t\topsRemainingToProcess: 0,\n\t\t\t\tnumberOfTurns: 1,\n\t\t\t\ttotalProcessingTime: 0,\n\t\t\t\tnumberOfBatchesProcessed: 0,\n\t\t\t\tfirstSequenceNumber: message.sequenceNumber,\n\t\t\t\tlastSequenceNumber: message.sequenceNumber,\n\t\t\t\tstartTime: performance.now(),\n\t\t\t};\n\t\t}\n\t}\n\n\tpublic batchEnd(message: ISequencedDocumentMessage) {\n\t\tif (this.schedulingLog) {\n\t\t\tthis.schedulingLog.numberOfBatchesProcessed++;\n\t\t\tthis.schedulingLog.lastSequenceNumber = message.sequenceNumber;\n\t\t\tthis.schedulingLog.opsRemainingToProcess = this.deltaManager.inbound.length;\n\t\t}\n\n\t\tif (this.shouldRunScheduler()) {\n\t\t\tconst currentTime = performance.now();\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst elapsedTime = currentTime - this.processingStartTime!;\n\t\t\tif (elapsedTime > this.currentAllowedProcessingTimeForTurn) {\n\t\t\t\t// We have processed ops for more than the total processing time. So, pause the\n\t\t\t\t// queue, yield the thread and schedule a resume.\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\t\tthis.deltaManager.inbound.pause();\n\n\t\t\t\t// Increase the total processing time. Keep doing this after each turn until all the ops have\n\t\t\t\t// been processed. This way we keep the responsiveness at the beginning while also making sure\n\t\t\t\t// that all the ops process fairly quickly.\n\t\t\t\tthis.currentAllowedProcessingTimeForTurn += this.processingTimeIncrement;\n\n\t\t\t\t// If we are logging the telemetry this time, update the telemetry log object.\n\t\t\t\tif (this.schedulingLog) {\n\t\t\t\t\tthis.schedulingLog.numberOfTurns++;\n\t\t\t\t\tthis.schedulingLog.totalProcessingTime += elapsedTime;\n\t\t\t\t}\n\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tif (this.schedulingLog) {\n\t\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\t\teventName: \"InboundOpsPartialProcessingTime\",\n\t\t\t\t\t\t\tduration: formatTick(elapsedTime),\n\t\t\t\t\t\t\topsProcessed:\n\t\t\t\t\t\t\t\tthis.schedulingLog.lastSequenceNumber -\n\t\t\t\t\t\t\t\tthis.schedulingLog.firstSequenceNumber +\n\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\topsRemainingToProcess: this.deltaManager.inbound.length,\n\t\t\t\t\t\t\tprocessingTime: formatTick(this.schedulingLog.totalProcessingTime),\n\t\t\t\t\t\t\tnumberOfTurns: this.schedulingLog.numberOfTurns,\n\t\t\t\t\t\t\tbatchesProcessed: this.schedulingLog.numberOfBatchesProcessed,\n\t\t\t\t\t\t\ttimeToResume: formatTick(performance.now() - currentTime),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tthis.deltaManager.inbound.resume();\n\t\t\t\t});\n\n\t\t\t\tthis.processingStartTime = undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate inboundQueueIdle() {\n\t\tif (this.schedulingLog) {\n\t\t\t// Add the time taken for processing the final ops to the total processing time in the\n\t\t\t// telemetry log object.\n\t\t\tconst currentTime = performance.now();\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.schedulingLog.totalProcessingTime += currentTime - this.processingStartTime!;\n\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"InboundOpsProcessingTime\",\n\t\t\t\topsRemainingToProcess: this.schedulingLog.opsRemainingToProcess,\n\t\t\t\tnumberOfTurns: this.schedulingLog.numberOfTurns,\n\t\t\t\tprocessingTime: formatTick(this.schedulingLog.totalProcessingTime),\n\t\t\t\topsProcessed:\n\t\t\t\t\tthis.schedulingLog.lastSequenceNumber -\n\t\t\t\t\tthis.schedulingLog.firstSequenceNumber +\n\t\t\t\t\t1,\n\t\t\t\tbatchesProcessed: this.schedulingLog.numberOfBatchesProcessed,\n\t\t\t\tduration: formatTick(currentTime - this.schedulingLog.startTime),\n\t\t\t\tschedulingCount: this.schedulingCount,\n\t\t\t});\n\n\t\t\tthis.schedulingLog = undefined;\n\t\t}\n\n\t\t// If we scheduled this batch of the inbound queue, increment the counter that tracks the\n\t\t// number of times we have done this.\n\t\tthis.schedulingCount++;\n\n\t\t// Reset the processing times.\n\t\tthis.processingStartTime = undefined;\n\t\tthis.currentAllowedProcessingTimeForTurn = DeltaScheduler.processingTime;\n\t}\n\n\t/**\n\t * This function tells whether we should run the scheduler.\n\t */\n\tprivate shouldRunScheduler(): boolean {\n\t\t// If there are still ops in the queue after the one we are processing now, we should\n\t\t// run the scheduler.\n\t\treturn this.deltaManager.inbound.length > 0;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,YAAa,YAAW,eAAe;IAGxD,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAFtD,QAAQ,CAAC,SAAS,8BAAiD;gBAEvD,OAAO,EAAE,MAAM,EAAW,QAAQ,EAAE,MAAM;CAGtD"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,YAAa,YAAW,eAAe;IAKpF,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAJ1B,QAAQ,CAAC,SAAS,8BAAiD;gBAGlE,OAAO,EAAE,MAAM,EACN,QAAQ,EAAE,MAAM;CAI1B"}
package/dist/error.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAA4E;AAC5E,qEAAgF;AAEhF;;GAEG;AACH,MAAa,yBAA0B,SAAQ,8BAAY;IAG1D,YAAY,OAAe,EAAW,QAAgB;QACrD,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;QADH,aAAQ,GAAR,QAAQ,CAAQ;QAF7C,cAAS,GAAG,2CAAmB,CAAC,yBAAyB,CAAC;IAInE,CAAC;CACD;AAND,8DAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ContainerErrorTypes } from \"@fluidframework/container-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\n/**\n * Error indicating that a client's session has reached its time limit and is closed.\n */\nexport class ClientSessionExpiredError extends LoggingError implements IFluidErrorBase {\n\treadonly errorType = ContainerErrorTypes.clientSessionExpiredError;\n\n\tconstructor(message: string, readonly expiryMs: number) {\n\t\tsuper(message, { timeoutMs: expiryMs });\n\t}\n}\n"]}
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAA4E;AAC5E,qEAAgF;AAEhF;;GAEG;AACH,MAAa,yBAA0B,SAAQ,8BAAY;IAG1D,YACC,OAAe,EACN,QAAgB;QAEzB,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;QAF/B,aAAQ,GAAR,QAAQ,CAAQ;QAJjB,cAAS,GAAG,2CAAmB,CAAC,yBAAyB,CAAC;IAOnE,CAAC;CACD;AATD,8DASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ContainerErrorTypes } from \"@fluidframework/container-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\n/**\n * Error indicating that a client's session has reached its time limit and is closed.\n */\nexport class ClientSessionExpiredError extends LoggingError implements IFluidErrorBase {\n\treadonly errorType = ContainerErrorTypes.clientSessionExpiredError;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly expiryMs: number,\n\t) {\n\t\tsuper(message, { timeoutMs: expiryMs });\n\t}\n}\n"]}
@@ -41,6 +41,19 @@ const gcTelemetry_1 = require("./gcTelemetry");
41
41
  * ```
42
42
  */
43
43
  class GarbageCollector {
44
+ static create(createParams) {
45
+ return new GarbageCollector(createParams);
46
+ }
47
+ get shouldRunGC() {
48
+ return this.configs.shouldRunGC;
49
+ }
50
+ get summaryStateNeedsReset() {
51
+ return this.summaryStateTracker.doesSummaryStateNeedReset;
52
+ }
53
+ /** Returns the count of data stores whose GC state updated since the last summary. */
54
+ get updatedDSCountSinceLastSummary() {
55
+ return this.summaryStateTracker.updatedDSCountSinceLastSummary;
56
+ }
44
57
  constructor(createParams) {
45
58
  // Keeps a list of references (edges in the GC graph) between GC runs. Each entry has a node id and a list of
46
59
  // outbound routes from that node.
@@ -177,19 +190,6 @@ class GarbageCollector {
177
190
  gcOptions: JSON.stringify(createParams.gcOptions),
178
191
  });
179
192
  }
180
- static create(createParams) {
181
- return new GarbageCollector(createParams);
182
- }
183
- get shouldRunGC() {
184
- return this.configs.shouldRunGC;
185
- }
186
- get summaryStateNeedsReset() {
187
- return this.summaryStateTracker.doesSummaryStateNeedReset;
188
- }
189
- /** Returns the count of data stores whose GC state updated since the last summary. */
190
- get updatedDSCountSinceLastSummary() {
191
- return this.summaryStateTracker.updatedDSCountSinceLastSummary;
192
- }
193
193
  /**
194
194
  * Called during container initialization. Initialize from the tombstone state in the base snapshot. This is done
195
195
  * during initialization so that deleted or tombstoned objects are marked as such before they are loaded or used.
@@ -1 +1 @@
1
- {"version":3,"file":"garbageCollection.js","sourceRoot":"","sources":["../../src/gc/garbageCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAgE;AAEhE,6EAM6C;AAC7C,iEAAyF;AACzF,qEAOyC;AAEzC,0DAI6B;AAC7B,oCAAqD;AAErD,2CAAgD;AAChD,mDAUyB;AACzB,2CAA8F;AAC9F,2EAAmE;AAEnE,mEAAgE;A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,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;SAChD;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AA16BD,4CA06BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LazyPromise, Timer } from \"@fluidframework/core-utils\";\nimport { IRequest, IRequestHeader } from \"@fluidframework/core-interfaces\";\nimport {\n\tgcTreeKey,\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tISummarizeResult,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { createResponseError, responseToException } from \"@fluidframework/runtime-utils\";\nimport {\n\tcreateChildLogger,\n\tcreateChildMonitoringContext,\n\tDataProcessingError,\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils\";\n\nimport {\n\tAllowInactiveRequestHeaderKey,\n\tInactiveResponseHeaderKey,\n\tRuntimeHeaders,\n} from \"../containerRuntime\";\nimport { ClientSessionExpiredError } from \"../error\";\nimport { IRefreshSummaryResult } from \"../summary\";\nimport { generateGCConfigs } from \"./gcConfigs\";\nimport {\n\tGCNodeType,\n\tIGarbageCollector,\n\tIGarbageCollectorCreateParams,\n\tIGarbageCollectionRuntime,\n\tIGCResult,\n\tIGCStats,\n\tUnreferencedState,\n\tIGCMetadata,\n\tIGarbageCollectorConfigs,\n} from \"./gcDefinitions\";\nimport { cloneGCData, concatGarbageCollectionData, getGCDataFromSnapshot } from \"./gcHelpers\";\nimport { runGarbageCollection } from \"./gcReferenceGraphAlgorithm\";\nimport { IGarbageCollectionSnapshotData, IGarbageCollectionState } from \"./gcSummaryDefinitions\";\nimport { GCSummaryStateTracker } from \"./gcSummaryStateTracker\";\nimport { UnreferencedStateTracker } from \"./gcUnreferencedStateTracker\";\nimport { GCTelemetryTracker } from \"./gcTelemetry\";\n\n/**\n * The garbage collector for the container runtime. It consolidates the garbage collection functionality and maintains\n * its state across summaries.\n *\n * Node - represented as nodeId, it's a node on the GC graph\n *\n * Outbound Route - a path from one node to another node, think `nodeA` -\\> `nodeB`\n *\n * Graph - all nodes with their respective routes\n *\n * ```\n *\t\t\t GC Graph\n *\n *\t\t\t Node\n *\t\tNodeId = \"datastore1\"\n *\t\t /\t\t\t \\\\\n *\tOutboundRoute OutboundRoute\n *\t\t /\t\t\t\t \\\\\n *\t Node\t\t\t Node\n * NodeId = \"dds1\"\t NodeId = \"dds2\"\n * ```\n */\nexport class GarbageCollector implements IGarbageCollector {\n\tpublic static create(createParams: IGarbageCollectorCreateParams): IGarbageCollector {\n\t\treturn new GarbageCollector(createParams);\n\t}\n\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly configs: IGarbageCollectorConfigs;\n\n\tpublic get shouldRunGC(): boolean {\n\t\treturn this.configs.shouldRunGC;\n\t}\n\n\t// Keeps track of the GC state from the last run.\n\tprivate gcDataFromLastRun: IGarbageCollectionData | undefined;\n\t// Keeps a list of references (edges in the GC graph) between GC runs. Each entry has a node id and a list of\n\t// outbound routes from that node.\n\tprivate readonly newReferencesSinceLastRun: Map<string, string[]> = new Map();\n\t// A list of nodes that have been tombstoned.\n\tprivate tombstones: string[] = [];\n\t// A list of nodes that have been deleted during sweep phase.\n\tprivate deletedNodes: Set<string> = new Set();\n\n\t// Promise when resolved returns the GC data data in the base snapshot.\n\tprivate readonly baseSnapshotDataP: Promise<IGarbageCollectionSnapshotData | undefined>;\n\t// Promise when resolved initializes the GC state from the data in the base snapshot.\n\tprivate readonly initializeGCStateFromBaseSnapshotP: Promise<void>;\n\t// The GC details generated from the base snapshot.\n\tprivate readonly baseGCDetailsP: Promise<IGarbageCollectionDetailsBase>;\n\t// Map of node ids to their unreferenced state tracker.\n\tprivate readonly unreferencedNodesState: Map<string, UnreferencedStateTracker> = new Map();\n\t// The Timer responsible for closing the container when the session has expired\n\tprivate sessionExpiryTimer: Timer | undefined;\n\n\t// The number of times GC has successfully completed on this instance of GarbageCollector.\n\tprivate completedRuns = 0;\n\n\tprivate readonly runtime: IGarbageCollectionRuntime;\n\tprivate readonly isSummarizerClient: boolean;\n\n\tprivate readonly summaryStateTracker: GCSummaryStateTracker;\n\tprivate readonly telemetryTracker: GCTelemetryTracker;\n\n\t/** For a given node path, returns the node's package path. */\n\tprivate readonly getNodePackagePath: (\n\t\tnodePath: string,\n\t) => Promise<readonly string[] | undefined>;\n\t/** Returns the timestamp of the last summary generated for this container. */\n\tprivate readonly getLastSummaryTimestampMs: () => number | undefined;\n\t/** Returns true if connection is active, i.e. it's \"write\" connection and the runtime is connected. */\n\tprivate readonly activeConnection: () => boolean;\n\n\tpublic get summaryStateNeedsReset(): boolean {\n\t\treturn this.summaryStateTracker.doesSummaryStateNeedReset;\n\t}\n\n\t/** Returns the count of data stores whose GC state updated since the last summary. */\n\tpublic get updatedDSCountSinceLastSummary(): number {\n\t\treturn this.summaryStateTracker.updatedDSCountSinceLastSummary;\n\t}\n\n\tprotected constructor(createParams: IGarbageCollectorCreateParams) {\n\t\tthis.runtime = createParams.runtime;\n\t\tthis.isSummarizerClient = createParams.isSummarizerClient;\n\t\tthis.getNodePackagePath = createParams.getNodePackagePath;\n\t\tthis.getLastSummaryTimestampMs = createParams.getLastSummaryTimestampMs;\n\t\tthis.activeConnection = createParams.activeConnection;\n\n\t\tconst baseSnapshot = createParams.baseSnapshot;\n\t\tconst readAndParseBlob = createParams.readAndParseBlob;\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: createParams.baseLogger,\n\t\t\tnamespace: \"GarbageCollector\",\n\t\t\tproperties: {\n\t\t\t\tall: { completedGCRuns: () => this.completedRuns },\n\t\t\t},\n\t\t});\n\n\t\tthis.configs = generateGCConfigs(this.mc, createParams);\n\n\t\t// If session expiry is enabled, we need to close the container when the session expiry timeout expires.\n\t\tif (this.configs.sessionExpiryTimeoutMs !== undefined) {\n\t\t\t// If Test Override config is set, override Session Expiry timeout.\n\t\t\tconst overrideSessionExpiryTimeoutMs = this.mc.config.getNumber(\n\t\t\t\t\"Fluid.GarbageCollection.TestOverride.SessionExpiryMs\",\n\t\t\t);\n\t\t\tconst timeoutMs = overrideSessionExpiryTimeoutMs ?? this.configs.sessionExpiryTimeoutMs;\n\n\t\t\tthis.sessionExpiryTimer = new Timer(timeoutMs, () => {\n\t\t\t\tthis.runtime.closeFn(\n\t\t\t\t\tnew ClientSessionExpiredError(`Client session expired.`, timeoutMs),\n\t\t\t\t);\n\t\t\t});\n\t\t\tthis.sessionExpiryTimer.start();\n\t\t}\n\n\t\tthis.summaryStateTracker = new GCSummaryStateTracker(\n\t\t\tthis.configs,\n\t\t\tbaseSnapshot?.trees[gcTreeKey] !== undefined /* wasGCRunInBaseSnapshot */,\n\t\t);\n\n\t\tthis.telemetryTracker = new GCTelemetryTracker(\n\t\t\tthis.mc,\n\t\t\tthis.configs,\n\t\t\tthis.isSummarizerClient,\n\t\t\tthis.runtime.gcTombstoneEnforcementAllowed,\n\t\t\tcreateParams.createContainerMetadata,\n\t\t\t(nodeId: string) => this.runtime.getNodeType(nodeId),\n\t\t\t(nodeId: string) => this.unreferencedNodesState.get(nodeId),\n\t\t\tthis.getNodePackagePath,\n\t\t);\n\n\t\t// Get the GC data from the base snapshot. Use LazyPromise because we only want to do this once since it\n\t\t// it involves fetching blobs from storage which is expensive.\n\t\tthis.baseSnapshotDataP = new LazyPromise<IGarbageCollectionSnapshotData | undefined>(\n\t\t\tasync () => {\n\t\t\t\tif (baseSnapshot === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\t// For newer documents, GC data should be present in the GC tree in the root of the snapshot.\n\t\t\t\t\tconst gcSnapshotTree = baseSnapshot.trees[gcTreeKey];\n\t\t\t\t\tif (gcSnapshotTree === undefined) {\n\t\t\t\t\t\t// back-compat - Older documents get their gc data reset for simplicity as there are few of them\n\t\t\t\t\t\t// incremental gc summary will not work with older gc data as well\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst snapshotData = await getGCDataFromSnapshot(\n\t\t\t\t\t\tgcSnapshotTree,\n\t\t\t\t\t\treadAndParseBlob,\n\t\t\t\t\t);\n\n\t\t\t\t\t// If the GC version in base snapshot does not match the GC version currently in effect, the GC data\n\t\t\t\t\t// in the snapshot cannot be interpreted correctly. Set everything to undefined except for\n\t\t\t\t\t// deletedNodes because irrespective of GC versions, these nodes have been deleted and cannot be\n\t\t\t\t\t// brought back. The deletedNodes info is needed to identify when these nodes are used.\n\t\t\t\t\tif (this.configs.gcVersionInEffect !== this.configs.gcVersionInBaseSnapshot) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tgcState: undefined,\n\t\t\t\t\t\t\ttombstones: undefined,\n\t\t\t\t\t\t\tdeletedNodes: snapshotData.deletedNodes,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\treturn snapshotData;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst dpe = DataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\t\terror,\n\t\t\t\t\t\t\"FailedToInitializeGC\",\n\t\t\t\t\t);\n\t\t\t\t\tdpe.addTelemetryProperties({\n\t\t\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t\t\t});\n\t\t\t\t\tthrow dpe;\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\n\t\t/**\n\t\t * Set up the initializer which initializes the GC state from the data in base snapshot. This is done when\n\t\t * connected in write mode or when GC runs the first time. It sets up all unreferenced nodes from the base\n\t\t * GC state and updates their inactive or sweep ready state.\n\t\t */\n\t\tthis.initializeGCStateFromBaseSnapshotP = new LazyPromise<void>(async () => {\n\t\t\t/**\n\t\t\t * If there is no current reference timestamp, skip initialization. We need the current timestamp to track\n\t\t\t * how long objects have been unreferenced and if they can be deleted.\n\t\t\t *\n\t\t\t * Note that the only scenario where there is no reference timestamp is when no ops have ever been processed\n\t\t\t * for this container and it is in read mode. In this scenario, there is no point in running GC anyway\n\t\t\t * because references in the container do not change without any ops, i.e., there is nothing to collect.\n\t\t\t */\n\t\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\t\tif (currentReferenceTimestampMs === undefined) {\n\t\t\t\t// Log an event so we can evaluate how often we run into this scenario.\n\t\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"GarbageCollectorInitializedWithoutTimestamp\",\n\t\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t/**\n\t\t\t * The base snapshot data will not be present if the container is loaded from:\n\t\t\t * 1. The first summary created by the detached container.\n\t\t\t * 2. A summary that was generated with GC disabled.\n\t\t\t * 3. A summary that was generated before GC even existed.\n\t\t\t */\n\t\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t\tif (baseSnapshotData === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.updateStateFromSnapshotData(baseSnapshotData, currentReferenceTimestampMs);\n\t\t\tthis.summaryStateTracker.initializeBaseState(baseSnapshotData);\n\t\t});\n\n\t\t// Get the GC details from the GC state in the base summary. This is returned in getBaseGCDetails which is\n\t\t// used to initialize the GC state of all the nodes in the container.\n\t\tthis.baseGCDetailsP = new LazyPromise<IGarbageCollectionDetailsBase>(async () => {\n\t\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t\tif (baseSnapshotData?.gcState === undefined) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst gcNodes: { [id: string]: string[] } = {};\n\t\t\tfor (const [nodeId, nodeData] of Object.entries(baseSnapshotData.gcState.gcNodes)) {\n\t\t\t\tgcNodes[nodeId] = Array.from(nodeData.outboundRoutes);\n\t\t\t}\n\t\t\t// Run GC on the nodes in the base summary to get the routes used in each node in the container.\n\t\t\t// This is an optimization for space (vs performance) wherein we don't need to store the used routes of\n\t\t\t// each node in the summary.\n\t\t\tconst usedRoutes = runGarbageCollection(gcNodes, [\"/\"]).referencedNodeIds;\n\n\t\t\treturn { gcData: { gcNodes }, usedRoutes };\n\t\t});\n\n\t\t// Log all the GC options and the state determined by the garbage collector.\n\t\t// This is useful even for interactive clients since they track unreferenced nodes and log errors.\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"GarbageCollectorLoaded\",\n\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\tgcOptions: JSON.stringify(createParams.gcOptions),\n\t\t});\n\t}\n\n\t/**\n\t * Called during container initialization. Initialize from the tombstone state in the base snapshot. This is done\n\t * during initialization so that deleted or tombstoned objects are marked as such before they are loaded or used.\n\t */\n\tpublic async initializeBaseState(): Promise<void> {\n\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t/**\n\t\t * The base snapshot data will not be present if the container is loaded from:\n\t\t * 1. The first summary created by the detached container.\n\t\t * 2. A summary that was generated with GC disabled.\n\t\t * 3. A summary that was generated before GC even existed.\n\t\t */\n\t\tif (baseSnapshotData === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Initialize the deleted nodes from the snapshot. This is done irrespective of whether sweep is enabled or not\n\t\t// to identify deleted nodes' usage.\n\t\tif (baseSnapshotData.deletedNodes !== undefined) {\n\t\t\tthis.deletedNodes = new Set(baseSnapshotData.deletedNodes);\n\t\t}\n\n\t\t// If running in tombstone mode, initialize the tombstone state from the snapshot. Also, notify the runtime of\n\t\t// tombstone routes.\n\t\tif (this.configs.tombstoneMode && baseSnapshotData.tombstones !== undefined) {\n\t\t\t// Create a copy since we are writing from a source we don't control\n\t\t\tthis.tombstones = Array.from(baseSnapshotData.tombstones);\n\t\t\tthis.runtime.updateTombstonedRoutes(this.tombstones);\n\t\t}\n\t}\n\n\t/**\n\t * Update state from the given snapshot data. This is done during load and during refreshing state from a snapshot.\n\t * All current tracking is reset and updated from the data in the snapshot.\n\t * @param snapshotData - The snapshot data to update state from. If this is undefined, all GC state and tracking\n\t * is reset.\n\t * @param currentReferenceTimestampMs - The current reference timestamp for marking unreferenced nodes' unreferenced\n\t * timestamp.\n\t */\n\tprivate updateStateFromSnapshotData(\n\t\tsnapshotData: IGarbageCollectionSnapshotData | undefined,\n\t\tcurrentReferenceTimestampMs: number,\n\t) {\n\t\t/**\n\t\t * Note: \"newReferencesSinceLastRun\" is not reset here. This is done because there may be references since the\n\t\t * snapshot that we are updating state from. For example, this client may have processed ops till seq#1000 and\n\t\t * its refreshing state from a summary that happened at seq#900. In this case, there may be references between\n\t\t * seq#901 and seq#1000 that we don't want to reset.\n\t\t * Unfortunately, there is no way to track the seq# of ops that add references, so we choose to not reset any\n\t\t * references here. This should be fine because, in the worst case, we may end up updating the unreferenced\n\t\t * timestamp of a node which will delay its deletion. Although not ideal, this will only happen in rare\n\t\t * scenarios, so it should be okay.\n\t\t */\n\n\t\t// Clear all existing unreferenced state tracking.\n\t\tfor (const [, nodeStateTracker] of this.unreferencedNodesState) {\n\t\t\tnodeStateTracker.stopTracking();\n\t\t}\n\t\tthis.unreferencedNodesState.clear();\n\n\t\t// If running sweep, the tombstone state represents the list of nodes that have been deleted during sweep.\n\t\t// If running in tombstone mode, the tombstone state represents the list of nodes that have been marked as\n\t\t// tombstones.\n\t\t// If this call is because we are refreshing from a snapshot due to an ack, it is likely that the GC state\n\t\t// in the snapshot is newer than this client's. And so, the deleted / tombstone nodes need to be updated.\n\t\tif (this.configs.shouldRunSweep) {\n\t\t\tconst snapshotDeletedNodes = snapshotData?.deletedNodes\n\t\t\t\t? new Set(snapshotData.deletedNodes)\n\t\t\t\t: undefined;\n\t\t\t// If the snapshot contains deleted nodes that are not yet deleted by this client, ask the runtime to\n\t\t\t// delete them.\n\t\t\tif (snapshotDeletedNodes !== undefined) {\n\t\t\t\tconst newDeletedNodes: string[] = [];\n\t\t\t\tfor (const nodeId of snapshotDeletedNodes) {\n\t\t\t\t\tif (!this.deletedNodes.has(nodeId)) {\n\t\t\t\t\t\tnewDeletedNodes.push(nodeId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (newDeletedNodes.length > 0) {\n\t\t\t\t\t// Call container runtime to delete these nodes and add deleted nodes to this.deletedNodes.\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (this.configs.tombstoneMode) {\n\t\t\t// The snapshot may contain more or fewer tombstone nodes than this client. Update tombstone state and\n\t\t\t// notify the runtime to update its state as well.\n\t\t\tthis.tombstones = snapshotData?.tombstones ? Array.from(snapshotData.tombstones) : [];\n\t\t\tthis.runtime.updateTombstonedRoutes(this.tombstones);\n\t\t}\n\n\t\t// If there is no snapshot data, it means this snapshot was generated with GC disabled. Unset all GC state.\n\t\tif (snapshotData?.gcState === undefined) {\n\t\t\tthis.gcDataFromLastRun = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\t// Update unreferenced state tracking as per the GC state in the snapshot data and update gcDataFromLastRun\n\t\t// to the GC data from the snapshot data.\n\t\tconst gcNodes: { [id: string]: string[] } = {};\n\t\tfor (const [nodeId, nodeData] of Object.entries(snapshotData.gcState.gcNodes)) {\n\t\t\tif (nodeData.unreferencedTimestampMs !== undefined) {\n\t\t\t\tthis.unreferencedNodesState.set(\n\t\t\t\t\tnodeId,\n\t\t\t\t\tnew UnreferencedStateTracker(\n\t\t\t\t\t\tnodeData.unreferencedTimestampMs,\n\t\t\t\t\t\tthis.configs.inactiveTimeoutMs,\n\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\tthis.configs.sweepTimeoutMs,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t\tgcNodes[nodeId] = Array.from(nodeData.outboundRoutes);\n\t\t}\n\t\tthis.gcDataFromLastRun = { gcNodes };\n\t}\n\n\t/**\n\t * Called when the connection state of the runtime changes, i.e., it connects or disconnects. GC subscribes to this\n\t * to initialize the base state for non-summarizer clients so that they can track inactive / sweep ready nodes.\n\t * @param connected - Whether the runtime connected / disconnected.\n\t * @param clientId - The clientId of this runtime.\n\t */\n\tpublic setConnectionState(connected: boolean, clientId?: string | undefined): void {\n\t\t/**\n\t\t * For all clients, initialize the base state when the container becomes active, i.e., it transitions\n\t\t * to \"write\" mode. This will ensure that the container's own join op is processed and there is a recent\n\t\t * reference timestamp that will be used to update the state of unreferenced nodes. Also, all trailing ops which\n\t\t * could affect the GC state will have been processed.\n\t\t *\n\t\t * If GC is up-to-date for the client and the summarizing client, there will be an doubling of both\n\t\t * InactiveObject_Loaded and SweepReady_Loaded errors, as there will be one from the sending client and one from\n\t\t * the receiving summarizer client.\n\t\t *\n\t\t * Ideally, this initialization should only be done for summarizer client. However, we are currently rolling out\n\t\t * sweep in phases and we want to track when inactive and sweep ready objects are used in any client.\n\t\t */\n\t\tif (this.activeConnection() && this.configs.shouldRunGC) {\n\t\t\tthis.initializeGCStateFromBaseSnapshotP.catch((error) => {});\n\t\t}\n\t}\n\n\t/**\n\t * Returns a the GC details generated from the base summary. This is used to initialize the GC state of the nodes\n\t * in the container.\n\t */\n\tpublic async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n\t\treturn this.baseGCDetailsP;\n\t}\n\n\t/**\n\t * Runs garbage collection and updates the reference / used state of the nodes in the container.\n\t * @returns stats of the GC run or undefined if GC did not run.\n\t */\n\tpublic async collectGarbage(\n\t\toptions: {\n\t\t\t/** Logger to use for logging GC events */\n\t\t\tlogger?: ITelemetryLoggerExt;\n\t\t\t/** True to run GC sweep phase after the mark phase */\n\t\t\trunSweep?: boolean;\n\t\t\t/** True to generate full GC data */\n\t\t\tfullGC?: boolean;\n\t\t},\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<IGCStats | undefined> {\n\t\tconst fullGC =\n\t\t\toptions.fullGC ??\n\t\t\t(this.configs.runFullGC === true || this.summaryStateTracker.doesSummaryStateNeedReset);\n\n\t\t// Add the options that are used to run GC to the telemetry context.\n\t\ttelemetryContext?.setMultiple(\"fluid_GC\", \"Options\", {\n\t\t\tfullGC,\n\t\t\trunSweep: options.runSweep,\n\t\t});\n\n\t\tconst logger = options.logger\n\t\t\t? createChildLogger({\n\t\t\t\t\tlogger: options.logger,\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tall: { completedGCRuns: () => this.completedRuns },\n\t\t\t\t\t},\n\t\t\t })\n\t\t\t: this.mc.logger;\n\n\t\t/**\n\t\t * If there is no current reference timestamp, skip running GC. We need the current timestamp to track\n\t\t * how long objects have been unreferenced and if they should be deleted.\n\t\t *\n\t\t * Note that the only scenario where GC is called and there is no reference timestamp is when no ops have ever\n\t\t * been processed for this container and it is in read mode. In this scenario, there is no point in running GC\n\t\t * anyway because references in the container do not change without any ops, i.e., there is nothing to collect.\n\t\t */\n\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\tif (currentReferenceTimestampMs === undefined) {\n\t\t\t// Log an event so we can evaluate how often we run into this scenario.\n\t\t\tlogger.sendErrorEvent({\n\t\t\t\teventName: \"CollectGarbageCalledWithoutTimestamp\",\n\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t});\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"GarbageCollection\" },\n\t\t\tasync (event) => {\n\t\t\t\t/** Pre-GC steps */\n\t\t\t\t// Ensure that state has been initialized from the base snapshot data.\n\t\t\t\tawait this.initializeGCStateFromBaseSnapshotP;\n\t\t\t\t// Let the runtime update its pending state before GC runs.\n\t\t\t\tawait this.runtime.updateStateBeforeGC();\n\n\t\t\t\t/** GC step */\n\t\t\t\tconst gcStats = await this.runGC(fullGC, currentReferenceTimestampMs, logger);\n\t\t\t\tevent.end({ ...gcStats, timestamp: currentReferenceTimestampMs });\n\n\t\t\t\t/** Post-GC steps */\n\t\t\t\t// Log pending unreferenced events such as a node being used after inactive. This is done after GC runs and\n\t\t\t\t// updates its state so that we don't send false positives based on intermediate state. For example, we may get\n\t\t\t\t// reference to an unreferenced node from another unreferenced node which means the node wasn't revived.\n\t\t\t\tawait this.telemetryTracker.logPendingEvents(logger);\n\t\t\t\t// Update the state of summary state tracker from this run's stats.\n\t\t\t\tthis.summaryStateTracker.updateStateFromGCRunStats(gcStats);\n\t\t\t\tthis.newReferencesSinceLastRun.clear();\n\t\t\t\tthis.completedRuns++;\n\n\t\t\t\treturn gcStats;\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t}\n\n\t/**\n\t * Runs garbage collection. It does the following:\n\t * 1. It generates / analyzes the runtime's reference graph.\n\t * 2. Generates stats for the GC run based on previous / current GC state.\n\t * 3. Runs Mark phase.\n\t * 4. Runs Sweep phase.\n\t */\n\tprivate async runGC(\n\t\tfullGC: boolean,\n\t\tcurrentReferenceTimestampMs: number,\n\t\tlogger: ITelemetryLoggerExt,\n\t): Promise<IGCStats> {\n\t\t// 1. Generate / analyze the runtime's reference graph.\n\t\t// Get the reference graph (gcData) and run GC algorithm to get referenced / unreferenced nodes.\n\t\tconst gcData = await this.runtime.getGCData(fullGC);\n\t\tconst gcResult = runGarbageCollection(gcData.gcNodes, [\"/\"]);\n\t\t// Get all referenced nodes - References in this run + references between the previous and current runs.\n\t\tconst allReferencedNodeIds =\n\t\t\tthis.findAllNodesReferencedBetweenGCs(gcData, this.gcDataFromLastRun, logger) ??\n\t\t\tgcResult.referencedNodeIds;\n\n\t\t// 2. Generate stats based on the previous / current GC state.\n\t\t// Must happen before running Mark / Sweep phase because previous GC state will be updated in these stages.\n\t\tconst gcStats = this.generateStats(gcResult);\n\n\t\t// 3. Run the Mark phase.\n\t\t// It will mark nodes as referenced / unreferenced and return a list of node ids that are ready to be swept.\n\t\tconst sweepReadyNodeIds = this.runMarkPhase(\n\t\t\tgcResult,\n\t\t\tallReferencedNodeIds,\n\t\t\tcurrentReferenceTimestampMs,\n\t\t);\n\n\t\t// 4. Run the Sweep phase.\n\t\t// It will delete sweep ready nodes and return a list of deleted node ids.\n\t\tconst deletedNodeIds = this.runSweepPhase(\n\t\t\tgcResult,\n\t\t\tsweepReadyNodeIds,\n\t\t\tcurrentReferenceTimestampMs,\n\t\t\tlogger,\n\t\t);\n\n\t\tthis.gcDataFromLastRun = cloneGCData(\n\t\t\tgcData,\n\t\t\t(id: string) => deletedNodeIds.includes(id) /* filter out deleted nodes */,\n\t\t);\n\t\treturn gcStats;\n\t}\n\n\t/**\n\t * Runs the GC Mark phase. It does the following:\n\t *\n\t * 1. Marks all referenced nodes in this run by clearing tracking for them.\n\t *\n\t * 2. Marks unreferenced nodes in this run by starting tracking for them.\n\t *\n\t * 3. Calls the runtime to update nodes that were marked referenced.\n\t *\n\t * @param gcResult - The result of the GC run on the gcData.\n\t * @param allReferencedNodeIds - Nodes referenced in this GC run + referenced between previous and current GC run.\n\t * @param currentReferenceTimestampMs - The timestamp to be used for unreferenced nodes' timestamp.\n\t * @returns A list of sweep ready nodes, i.e., nodes that ready to be deleted.\n\t */\n\tprivate runMarkPhase(\n\t\tgcResult: IGCResult,\n\t\tallReferencedNodeIds: string[],\n\t\tcurrentReferenceTimestampMs: number,\n\t): string[] {\n\t\t// 1. Marks all referenced nodes by clearing their unreferenced tracker, if any.\n\t\tfor (const nodeId of allReferencedNodeIds) {\n\t\t\tconst nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n\t\t\tif (nodeStateTracker !== undefined) {\n\t\t\t\t// Stop tracking so as to clear out any running timers.\n\t\t\t\tnodeStateTracker.stopTracking();\n\t\t\t\t// Delete the node as we don't need to track it any more.\n\t\t\t\tthis.unreferencedNodesState.delete(nodeId);\n\t\t\t}\n\t\t}\n\n\t\t// 2. Mark unreferenced nodes in this run by starting unreferenced tracking for them.\n\t\tconst sweepReadyNodeIds: string[] = [];\n\t\tfor (const nodeId of gcResult.deletedNodeIds) {\n\t\t\tconst nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n\t\t\tif (nodeStateTracker === undefined) {\n\t\t\t\tthis.unreferencedNodesState.set(\n\t\t\t\t\tnodeId,\n\t\t\t\t\tnew UnreferencedStateTracker(\n\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\tthis.configs.inactiveTimeoutMs,\n\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\tthis.configs.sweepTimeoutMs,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// If a node was already unreferenced, update its tracking information. Since the current reference time\n\t\t\t\t// is from the ops seen, this will ensure that we keep updating unreferenced state as time moves forward.\n\t\t\t\tnodeStateTracker.updateTracking(currentReferenceTimestampMs);\n\n\t\t\t\t// If a node is sweep ready, store it so it can be returned.\n\t\t\t\tif (nodeStateTracker.state === UnreferencedState.SweepReady) {\n\t\t\t\t\tsweepReadyNodeIds.push(nodeId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 3. Call the runtime to update referenced nodes in this run.\n\t\tthis.runtime.updateUsedRoutes(gcResult.referencedNodeIds);\n\n\t\treturn sweepReadyNodeIds;\n\t}\n\n\t/**\n\t * Runs the GC Sweep phase. It does the following:\n\t * 1. Calls the runtime to delete nodes that are sweep ready.\n\t * 2. Clears tracking for deleted nodes.\n\t *\n\t * @param gcResult - The result of the GC run on the gcData.\n\t * @param sweepReadyNodes - List of nodes that are sweep ready.\n\t * @param currentReferenceTimestampMs - The timestamp to be used for unreferenced nodes' timestamp.\n\t * @param logger - The logger to be used to log any telemetry.\n\t * @returns A list of nodes that have been deleted.\n\t */\n\tprivate runSweepPhase(\n\t\tgcResult: IGCResult,\n\t\tsweepReadyNodes: string[],\n\t\tcurrentReferenceTimestampMs: number,\n\t\tlogger: ITelemetryLoggerExt,\n\t): string[] {\n\t\t// Log events for objects that are ready to be deleted by sweep. This will give us data on sweep when\n\t\t// its not enabled.\n\t\tthis.telemetryTracker.logSweepEvents(\n\t\t\tlogger,\n\t\t\tcurrentReferenceTimestampMs,\n\t\t\tthis.unreferencedNodesState,\n\t\t\tthis.completedRuns,\n\t\t\tthis.getLastSummaryTimestampMs(),\n\t\t);\n\n\t\t/**\n\t\t * Currently, there are 3 modes for sweep:\n\t\t * Test mode - Unreferenced nodes are immediately deleted without waiting for them to be sweep ready.\n\t\t * Tombstone mode - Sweep ready modes are marked as tombstones instead of being deleted.\n\t\t * Sweep mode - Sweep ready modes are deleted.\n\t\t *\n\t\t * These modes serve as staging for applications that want to enable sweep by providing an incremental\n\t\t * way to test and validate sweep works as expected.\n\t\t */\n\t\tif (this.configs.testMode) {\n\t\t\t// If we are running in GC test mode, unreferenced nodes (gcResult.deletedNodeIds) are deleted.\n\t\t\tthis.runtime.updateUnusedRoutes(gcResult.deletedNodeIds);\n\t\t\treturn [];\n\t\t}\n\n\t\tif (this.configs.tombstoneMode) {\n\t\t\tthis.tombstones = sweepReadyNodes;\n\t\t\t// If we are running in GC tombstone mode, update tombstoned routes. This enables testing scenarios\n\t\t\t// involving access to \"deleted\" data without actually deleting the data from summaries.\n\t\t\tthis.runtime.updateTombstonedRoutes(this.tombstones);\n\t\t\treturn [];\n\t\t}\n\n\t\tif (!this.configs.shouldRunSweep) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// 1. Call the runtime to delete sweep ready nodes. The runtime returns a list of nodes it deleted.\n\t\t// TODO: GC:Validation - validate that removed routes are not double delete and that the child routes of\n\t\t// removed routes are deleted as well.\n\t\tconst deletedNodeIds = this.runtime.deleteSweepReadyNodes(sweepReadyNodes);\n\n\t\t// 2. Clear unreferenced state tracking for deleted nodes.\n\t\tfor (const nodeId of deletedNodeIds) {\n\t\t\tconst nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n\t\t\t// TODO: GC:Validation - assert that the nodeStateTracker is defined\n\t\t\tif (nodeStateTracker !== undefined) {\n\t\t\t\t// Stop tracking so as to clear out any running timers.\n\t\t\t\tnodeStateTracker.stopTracking();\n\t\t\t\t// Delete the node as we don't need to track it any more.\n\t\t\t\tthis.unreferencedNodesState.delete(nodeId);\n\t\t\t}\n\t\t\t// TODO: GC:Validation - assert that the deleted node is not a duplicate\n\t\t\tthis.deletedNodes.add(nodeId);\n\t\t}\n\t\treturn deletedNodeIds;\n\t}\n\n\t/**\n\t * Since GC runs periodically, the GC data that is generated only tells us the state of the world at that point in\n\t * time. There can be nodes that were referenced in between two runs and their unreferenced state needs to be\n\t * updated. For example, in the following scenarios not updating the unreferenced timestamp can lead to deletion of\n\t * these objects while there can be in-memory referenced to it:\n\t * 1. A node transitions from `unreferenced -> referenced -> unreferenced` between two runs. When the reference is\n\t * added, the object may have been accessed and in-memory reference to it added.\n\t * 2. A reference is added from one unreferenced node to one or more unreferenced nodes. Even though the node[s] were\n\t * unreferenced, they could have been accessed and in-memory reference to them added.\n\t *\n\t * This function identifies nodes that were referenced since the last run.\n\t * If these nodes are currently unreferenced, they will be assigned new unreferenced state by the current run.\n\t *\n\t * @returns A list of all nodes referenced from the last local summary until now.\n\t */\n\tprivate findAllNodesReferencedBetweenGCs(\n\t\tcurrentGCData: IGarbageCollectionData,\n\t\tpreviousGCData: IGarbageCollectionData | undefined,\n\t\tlogger: ITelemetryLoggerExt,\n\t): string[] | undefined {\n\t\t// If we haven't run GC before there is nothing to do.\n\t\t// No previousGCData, means nothing is unreferenced, and there are no reference state trackers to clear\n\t\tif (previousGCData === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t/**\n\t\t * If there are references that were not explicitly notified to GC, log an error because this should never happen.\n\t\t * If it does, this may result in the unreferenced timestamps of these nodes not updated when they were referenced.\n\t\t */\n\t\tthis.telemetryTracker.logIfMissingExplicitReferences(\n\t\t\tcurrentGCData,\n\t\t\tpreviousGCData,\n\t\t\tthis.newReferencesSinceLastRun,\n\t\t\tlogger,\n\t\t);\n\n\t\t// No references were added since the last run so we don't have to update reference states of any unreferenced\n\t\t// nodes. There is no in between state at this point.\n\t\tif (this.newReferencesSinceLastRun.size === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t/**\n\t\t * Generate a super set of the GC data that contains the nodes and edges from last run, plus any new node and\n\t\t * edges that have been added since then. To do this, combine the GC data from the last run and the current\n\t\t * run, and then add the references since last run.\n\t\t *\n\t\t * Note on why we need to combine the data from previous run, current run and all references in between -\n\t\t * 1. We need data from last run because some of its references may have been deleted since then. If those\n\t\t * references added new outbound references before they were deleted, we need to detect them.\n\t\t *\n\t\t * 2. We need new outbound references since last run because some of them may have been deleted later. If those\n\t\t * references added new outbound references before they were deleted, we need to detect them.\n\t\t *\n\t\t * 3. We need data from the current run because currently we may not detect when DDSes are referenced:\n\t\t * - We don't require DDSes handles to be stored in a referenced DDS.\n\t\t * - A new data store may have \"root\" DDSes already created and we don't detect them today.\n\t\t */\n\t\tconst gcDataSuperSet = concatGarbageCollectionData(previousGCData, currentGCData);\n\t\tconst newOutboundRoutesSinceLastRun: string[] = [];\n\t\tthis.newReferencesSinceLastRun.forEach((outboundRoutes: string[], sourceNodeId: string) => {\n\t\t\tif (gcDataSuperSet.gcNodes[sourceNodeId] === undefined) {\n\t\t\t\tgcDataSuperSet.gcNodes[sourceNodeId] = outboundRoutes;\n\t\t\t} else {\n\t\t\t\tgcDataSuperSet.gcNodes[sourceNodeId].push(...outboundRoutes);\n\t\t\t}\n\t\t\tnewOutboundRoutesSinceLastRun.push(...outboundRoutes);\n\t\t});\n\n\t\t/**\n\t\t * Run GC on the above reference graph starting with root and all new outbound routes. This will generate a\n\t\t * list of all nodes that could have been referenced since the last run. If any of these nodes are unreferenced,\n\t\t * unreferenced, stop tracking them and remove from unreferenced list.\n\t\t * Note that some of these nodes may be unreferenced now and if so, the current run will mark them as\n\t\t * unreferenced and add unreferenced state.\n\t\t */\n\t\tconst gcResult = runGarbageCollection(gcDataSuperSet.gcNodes, [\n\t\t\t\"/\",\n\t\t\t...newOutboundRoutesSinceLastRun,\n\t\t]);\n\t\treturn gcResult.referencedNodeIds;\n\t}\n\n\t/**\n\t * Summarizes the GC data and returns it as a summary tree.\n\t * We current write the entire GC state in a single blob. This can be modified later to write multiple\n\t * blobs. All the blob keys should start with `gcBlobPrefix`.\n\t */\n\tpublic summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummarizeResult | undefined {\n\t\tif (!this.configs.shouldRunGC || this.gcDataFromLastRun === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst gcState: IGarbageCollectionState = { gcNodes: {} };\n\t\tfor (const [nodeId, outboundRoutes] of Object.entries(this.gcDataFromLastRun.gcNodes)) {\n\t\t\tgcState.gcNodes[nodeId] = {\n\t\t\t\toutboundRoutes,\n\t\t\t\tunreferencedTimestampMs:\n\t\t\t\t\tthis.unreferencedNodesState.get(nodeId)?.unreferencedTimestampMs,\n\t\t\t};\n\t\t}\n\n\t\treturn this.summaryStateTracker.summarize(\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\tgcState,\n\t\t\tthis.deletedNodes,\n\t\t\tthis.tombstones,\n\t\t);\n\t}\n\n\tpublic getMetadata(): IGCMetadata {\n\t\treturn {\n\t\t\t/**\n\t\t\t * If GC is enabled, the GC data is written using the GC version in effect and that is the gcFeature that goes\n\t\t\t * into the metadata blob. If GC is disabled, the gcFeature is 0.\n\t\t\t */\n\t\t\tgcFeature: this.configs.gcEnabled ? this.configs.gcVersionInEffect : 0,\n\t\t\tgcFeatureMatrix: this.configs.persistedGcFeatureMatrix,\n\t\t\tsessionExpiryTimeoutMs: this.configs.sessionExpiryTimeoutMs,\n\t\t\tsweepEnabled: false, // DEPRECATED - to be removed\n\t\t\tsweepTimeoutMs: this.configs.sweepTimeoutMs,\n\t\t};\n\t}\n\n\t/**\n\t * Called to refresh the latest summary state. This happens when either a pending summary is acked.\n\t */\n\tpublic async refreshLatestSummary(result: IRefreshSummaryResult): Promise<void> {\n\t\treturn this.summaryStateTracker.refreshLatestSummary(result);\n\t}\n\n\t/**\n\t * Called when a node with the given id is updated. If the node is inactive, log an error.\n\t * @param nodePath - The path of the node that changed.\n\t * @param reason - Whether the node was loaded or changed.\n\t * @param timestampMs - The timestamp when the node changed.\n\t * @param packagePath - The package path of the node. This may not be available if the node hasn't been loaded yet.\n\t * @param requestHeaders - If the node was loaded via request path, the headers in the request.\n\t */\n\tpublic nodeUpdated(\n\t\tnodePath: string,\n\t\treason: \"Loaded\" | \"Changed\",\n\t\ttimestampMs?: number,\n\t\tpackagePath?: readonly string[],\n\t\trequestHeaders?: IRequestHeader,\n\t) {\n\t\tif (!this.configs.shouldRunGC) {\n\t\t\treturn;\n\t\t}\n\n\t\t// This will log if appropriate\n\t\tthis.telemetryTracker.nodeUsed({\n\t\t\tid: nodePath,\n\t\t\tusageType: reason,\n\t\t\tcurrentReferenceTimestampMs:\n\t\t\t\ttimestampMs ?? this.runtime.getCurrentReferenceTimestampMs(),\n\t\t\tpackagePath,\n\t\t\tcompletedGCRuns: this.completedRuns,\n\t\t\tisTombstoned: this.tombstones.includes(nodePath),\n\t\t\tlastSummaryTime: this.getLastSummaryTimestampMs(),\n\t\t\tviaHandle: requestHeaders?.[RuntimeHeaders.viaHandle],\n\t\t});\n\n\t\t// Unless this is a Loaded event, we're done after telemetry tracking\n\t\tif (reason !== \"Loaded\") {\n\t\t\treturn;\n\t\t}\n\n\t\t// We may throw when loading an Inactive object, depending on these preconditions\n\t\tconst shouldThrowOnInactiveLoad =\n\t\t\t!this.isSummarizerClient &&\n\t\t\tthis.configs.throwOnInactiveLoad === true &&\n\t\t\trequestHeaders?.[AllowInactiveRequestHeaderKey] !== true;\n\t\tconst state = this.unreferencedNodesState.get(nodePath)?.state;\n\n\t\tif (shouldThrowOnInactiveLoad && state === \"Inactive\") {\n\t\t\tconst request: IRequest = { url: nodePath };\n\t\t\tconst error = responseToException(\n\t\t\t\tcreateResponseError(404, \"Object is inactive\", request, {\n\t\t\t\t\t[InactiveResponseHeaderKey]: true,\n\t\t\t\t}),\n\t\t\t\trequest,\n\t\t\t);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Called when an outbound reference is added to a node. This is used to identify all nodes that have been\n\t * referenced between summaries so that their unreferenced timestamp can be reset.\n\t *\n\t * @param fromNodePath - The node from which the reference is added.\n\t * @param toNodePath - The node to which the reference is added.\n\t */\n\tpublic addedOutboundReference(fromNodePath: string, toNodePath: string) {\n\t\tif (!this.configs.shouldRunGC) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst outboundRoutes = this.newReferencesSinceLastRun.get(fromNodePath) ?? [];\n\t\toutboundRoutes.push(toNodePath);\n\t\tthis.newReferencesSinceLastRun.set(fromNodePath, outboundRoutes);\n\n\t\tthis.telemetryTracker.nodeUsed({\n\t\t\tid: toNodePath,\n\t\t\tusageType: \"Revived\",\n\t\t\tcurrentReferenceTimestampMs: this.runtime.getCurrentReferenceTimestampMs(),\n\t\t\tpackagePath: undefined,\n\t\t\tcompletedGCRuns: this.completedRuns,\n\t\t\tisTombstoned: this.tombstones.includes(toNodePath),\n\t\t\tlastSummaryTime: this.getLastSummaryTimestampMs(),\n\t\t\tfromId: fromNodePath,\n\t\t});\n\t}\n\n\t/**\n\t * Returns whether a node with the given path has been deleted or not. This can be used by the runtime to identify\n\t * cases where objects are used after they are deleted and throw / log errors accordingly.\n\t */\n\tpublic isNodeDeleted(nodePath: string): boolean {\n\t\treturn this.deletedNodes.has(nodePath);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.sessionExpiryTimer?.clear();\n\t\tthis.sessionExpiryTimer = undefined;\n\t}\n\n\t/**\n\t * Generates the stats of a garbage collection run from the given results of the run.\n\t * @param gcResult - The result of a GC run.\n\t * @returns the GC stats of the GC run.\n\t */\n\tprivate generateStats(gcResult: IGCResult): IGCStats {\n\t\tconst gcStats: IGCStats = {\n\t\t\tnodeCount: 0,\n\t\t\tdataStoreCount: 0,\n\t\t\tattachmentBlobCount: 0,\n\t\t\tunrefNodeCount: 0,\n\t\t\tunrefDataStoreCount: 0,\n\t\t\tunrefAttachmentBlobCount: 0,\n\t\t\tupdatedNodeCount: 0,\n\t\t\tupdatedDataStoreCount: 0,\n\t\t\tupdatedAttachmentBlobCount: 0,\n\t\t};\n\n\t\tconst updateNodeStats = (nodeId: string, referenced: boolean) => {\n\t\t\tgcStats.nodeCount++;\n\t\t\t// If there is no previous GC data, every node's state is generated and is considered as updated.\n\t\t\t// Otherwise, find out if any node went from referenced to unreferenced or vice-versa.\n\t\t\tconst stateUpdated =\n\t\t\t\tthis.gcDataFromLastRun === undefined ||\n\t\t\t\tthis.unreferencedNodesState.has(nodeId) === referenced;\n\t\t\tif (stateUpdated) {\n\t\t\t\tgcStats.updatedNodeCount++;\n\t\t\t}\n\t\t\tif (!referenced) {\n\t\t\t\tgcStats.unrefNodeCount++;\n\t\t\t}\n\n\t\t\tif (this.runtime.getNodeType(nodeId) === GCNodeType.DataStore) {\n\t\t\t\tgcStats.dataStoreCount++;\n\t\t\t\tif (stateUpdated) {\n\t\t\t\t\tgcStats.updatedDataStoreCount++;\n\t\t\t\t}\n\t\t\t\tif (!referenced) {\n\t\t\t\t\tgcStats.unrefDataStoreCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.runtime.getNodeType(nodeId) === GCNodeType.Blob) {\n\t\t\t\tgcStats.attachmentBlobCount++;\n\t\t\t\tif (stateUpdated) {\n\t\t\t\t\tgcStats.updatedAttachmentBlobCount++;\n\t\t\t\t}\n\t\t\t\tif (!referenced) {\n\t\t\t\t\tgcStats.unrefAttachmentBlobCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tfor (const nodeId of gcResult.referencedNodeIds) {\n\t\t\tupdateNodeStats(nodeId, true /* referenced */);\n\t\t}\n\n\t\tfor (const nodeId of gcResult.deletedNodeIds) {\n\t\t\tupdateNodeStats(nodeId, false /* referenced */);\n\t\t}\n\n\t\treturn gcStats;\n\t}\n}\n"]}
1
+ {"version":3,"file":"garbageCollection.js","sourceRoot":"","sources":["../../src/gc/garbageCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAgE;AAEhE,6EAM6C;AAC7C,iEAAyF;AACzF,qEAOyC;AAEzC,0DAI6B;AAC7B,oCAAqD;AAErD,2CAAgD;AAChD,mDAUyB;AACzB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AAC,cAAc,EAAE;YAC7C,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;SAChD;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AA16BD,4CA06BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LazyPromise, Timer } from \"@fluidframework/core-utils\";\nimport { IRequest, IRequestHeader } from \"@fluidframework/core-interfaces\";\nimport {\n\tgcTreeKey,\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tISummarizeResult,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { createResponseError, responseToException } from \"@fluidframework/runtime-utils\";\nimport {\n\tcreateChildLogger,\n\tcreateChildMonitoringContext,\n\tDataProcessingError,\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils\";\n\nimport {\n\tAllowInactiveRequestHeaderKey,\n\tInactiveResponseHeaderKey,\n\tRuntimeHeaders,\n} from \"../containerRuntime\";\nimport { ClientSessionExpiredError } from \"../error\";\nimport { IRefreshSummaryResult } from \"../summary\";\nimport { generateGCConfigs } from \"./gcConfigs\";\nimport {\n\tGCNodeType,\n\tIGarbageCollector,\n\tIGarbageCollectorCreateParams,\n\tIGarbageCollectionRuntime,\n\tIGCResult,\n\tIGCStats,\n\tUnreferencedState,\n\tIGCMetadata,\n\tIGarbageCollectorConfigs,\n} from \"./gcDefinitions\";\nimport { cloneGCData, concatGarbageCollectionData, getGCDataFromSnapshot } from \"./gcHelpers\";\nimport { runGarbageCollection } from \"./gcReferenceGraphAlgorithm\";\nimport { IGarbageCollectionSnapshotData, IGarbageCollectionState } from \"./gcSummaryDefinitions\";\nimport { GCSummaryStateTracker } from \"./gcSummaryStateTracker\";\nimport { UnreferencedStateTracker } from \"./gcUnreferencedStateTracker\";\nimport { GCTelemetryTracker } from \"./gcTelemetry\";\n\n/**\n * The garbage collector for the container runtime. It consolidates the garbage collection functionality and maintains\n * its state across summaries.\n *\n * Node - represented as nodeId, it's a node on the GC graph\n *\n * Outbound Route - a path from one node to another node, think `nodeA` -\\> `nodeB`\n *\n * Graph - all nodes with their respective routes\n *\n * ```\n *\t\t\t GC Graph\n *\n *\t\t\t Node\n *\t\tNodeId = \"datastore1\"\n *\t\t /\t\t\t \\\\\n *\tOutboundRoute OutboundRoute\n *\t\t /\t\t\t\t \\\\\n *\t Node\t\t\t Node\n * NodeId = \"dds1\"\t NodeId = \"dds2\"\n * ```\n */\nexport class GarbageCollector implements IGarbageCollector {\n\tpublic static create(createParams: IGarbageCollectorCreateParams): IGarbageCollector {\n\t\treturn new GarbageCollector(createParams);\n\t}\n\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly configs: IGarbageCollectorConfigs;\n\n\tpublic get shouldRunGC(): boolean {\n\t\treturn this.configs.shouldRunGC;\n\t}\n\n\t// Keeps track of the GC state from the last run.\n\tprivate gcDataFromLastRun: IGarbageCollectionData | undefined;\n\t// Keeps a list of references (edges in the GC graph) between GC runs. Each entry has a node id and a list of\n\t// outbound routes from that node.\n\tprivate readonly newReferencesSinceLastRun: Map<string, string[]> = new Map();\n\t// A list of nodes that have been tombstoned.\n\tprivate tombstones: string[] = [];\n\t// A list of nodes that have been deleted during sweep phase.\n\tprivate deletedNodes: Set<string> = new Set();\n\n\t// Promise when resolved returns the GC data data in the base snapshot.\n\tprivate readonly baseSnapshotDataP: Promise<IGarbageCollectionSnapshotData | undefined>;\n\t// Promise when resolved initializes the GC state from the data in the base snapshot.\n\tprivate readonly initializeGCStateFromBaseSnapshotP: Promise<void>;\n\t// The GC details generated from the base snapshot.\n\tprivate readonly baseGCDetailsP: Promise<IGarbageCollectionDetailsBase>;\n\t// Map of node ids to their unreferenced state tracker.\n\tprivate readonly unreferencedNodesState: Map<string, UnreferencedStateTracker> = new Map();\n\t// The Timer responsible for closing the container when the session has expired\n\tprivate sessionExpiryTimer: Timer | undefined;\n\n\t// The number of times GC has successfully completed on this instance of GarbageCollector.\n\tprivate completedRuns = 0;\n\n\tprivate readonly runtime: IGarbageCollectionRuntime;\n\tprivate readonly isSummarizerClient: boolean;\n\n\tprivate readonly summaryStateTracker: GCSummaryStateTracker;\n\tprivate readonly telemetryTracker: GCTelemetryTracker;\n\n\t/** For a given node path, returns the node's package path. */\n\tprivate readonly getNodePackagePath: (\n\t\tnodePath: string,\n\t) => Promise<readonly string[] | undefined>;\n\t/** Returns the timestamp of the last summary generated for this container. */\n\tprivate readonly getLastSummaryTimestampMs: () => number | undefined;\n\t/** Returns true if connection is active, i.e. it's \"write\" connection and the runtime is connected. */\n\tprivate readonly activeConnection: () => boolean;\n\n\tpublic get summaryStateNeedsReset(): boolean {\n\t\treturn this.summaryStateTracker.doesSummaryStateNeedReset;\n\t}\n\n\t/** Returns the count of data stores whose GC state updated since the last summary. */\n\tpublic get updatedDSCountSinceLastSummary(): number {\n\t\treturn this.summaryStateTracker.updatedDSCountSinceLastSummary;\n\t}\n\n\tprotected constructor(createParams: IGarbageCollectorCreateParams) {\n\t\tthis.runtime = createParams.runtime;\n\t\tthis.isSummarizerClient = createParams.isSummarizerClient;\n\t\tthis.getNodePackagePath = createParams.getNodePackagePath;\n\t\tthis.getLastSummaryTimestampMs = createParams.getLastSummaryTimestampMs;\n\t\tthis.activeConnection = createParams.activeConnection;\n\n\t\tconst baseSnapshot = createParams.baseSnapshot;\n\t\tconst readAndParseBlob = createParams.readAndParseBlob;\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: createParams.baseLogger,\n\t\t\tnamespace: \"GarbageCollector\",\n\t\t\tproperties: {\n\t\t\t\tall: { completedGCRuns: () => this.completedRuns },\n\t\t\t},\n\t\t});\n\n\t\tthis.configs = generateGCConfigs(this.mc, createParams);\n\n\t\t// If session expiry is enabled, we need to close the container when the session expiry timeout expires.\n\t\tif (this.configs.sessionExpiryTimeoutMs !== undefined) {\n\t\t\t// If Test Override config is set, override Session Expiry timeout.\n\t\t\tconst overrideSessionExpiryTimeoutMs = this.mc.config.getNumber(\n\t\t\t\t\"Fluid.GarbageCollection.TestOverride.SessionExpiryMs\",\n\t\t\t);\n\t\t\tconst timeoutMs = overrideSessionExpiryTimeoutMs ?? this.configs.sessionExpiryTimeoutMs;\n\n\t\t\tthis.sessionExpiryTimer = new Timer(timeoutMs, () => {\n\t\t\t\tthis.runtime.closeFn(\n\t\t\t\t\tnew ClientSessionExpiredError(`Client session expired.`, timeoutMs),\n\t\t\t\t);\n\t\t\t});\n\t\t\tthis.sessionExpiryTimer.start();\n\t\t}\n\n\t\tthis.summaryStateTracker = new GCSummaryStateTracker(\n\t\t\tthis.configs,\n\t\t\tbaseSnapshot?.trees[gcTreeKey] !== undefined /* wasGCRunInBaseSnapshot */,\n\t\t);\n\n\t\tthis.telemetryTracker = new GCTelemetryTracker(\n\t\t\tthis.mc,\n\t\t\tthis.configs,\n\t\t\tthis.isSummarizerClient,\n\t\t\tthis.runtime.gcTombstoneEnforcementAllowed,\n\t\t\tcreateParams.createContainerMetadata,\n\t\t\t(nodeId: string) => this.runtime.getNodeType(nodeId),\n\t\t\t(nodeId: string) => this.unreferencedNodesState.get(nodeId),\n\t\t\tthis.getNodePackagePath,\n\t\t);\n\n\t\t// Get the GC data from the base snapshot. Use LazyPromise because we only want to do this once since it\n\t\t// it involves fetching blobs from storage which is expensive.\n\t\tthis.baseSnapshotDataP = new LazyPromise<IGarbageCollectionSnapshotData | undefined>(\n\t\t\tasync () => {\n\t\t\t\tif (baseSnapshot === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\t// For newer documents, GC data should be present in the GC tree in the root of the snapshot.\n\t\t\t\t\tconst gcSnapshotTree = baseSnapshot.trees[gcTreeKey];\n\t\t\t\t\tif (gcSnapshotTree === undefined) {\n\t\t\t\t\t\t// back-compat - Older documents get their gc data reset for simplicity as there are few of them\n\t\t\t\t\t\t// incremental gc summary will not work with older gc data as well\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst snapshotData = await getGCDataFromSnapshot(\n\t\t\t\t\t\tgcSnapshotTree,\n\t\t\t\t\t\treadAndParseBlob,\n\t\t\t\t\t);\n\n\t\t\t\t\t// If the GC version in base snapshot does not match the GC version currently in effect, the GC data\n\t\t\t\t\t// in the snapshot cannot be interpreted correctly. Set everything to undefined except for\n\t\t\t\t\t// deletedNodes because irrespective of GC versions, these nodes have been deleted and cannot be\n\t\t\t\t\t// brought back. The deletedNodes info is needed to identify when these nodes are used.\n\t\t\t\t\tif (this.configs.gcVersionInEffect !== this.configs.gcVersionInBaseSnapshot) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tgcState: undefined,\n\t\t\t\t\t\t\ttombstones: undefined,\n\t\t\t\t\t\t\tdeletedNodes: snapshotData.deletedNodes,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\treturn snapshotData;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst dpe = DataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\t\terror,\n\t\t\t\t\t\t\"FailedToInitializeGC\",\n\t\t\t\t\t);\n\t\t\t\t\tdpe.addTelemetryProperties({\n\t\t\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t\t\t});\n\t\t\t\t\tthrow dpe;\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\n\t\t/**\n\t\t * Set up the initializer which initializes the GC state from the data in base snapshot. This is done when\n\t\t * connected in write mode or when GC runs the first time. It sets up all unreferenced nodes from the base\n\t\t * GC state and updates their inactive or sweep ready state.\n\t\t */\n\t\tthis.initializeGCStateFromBaseSnapshotP = new LazyPromise<void>(async () => {\n\t\t\t/**\n\t\t\t * If there is no current reference timestamp, skip initialization. We need the current timestamp to track\n\t\t\t * how long objects have been unreferenced and if they can be deleted.\n\t\t\t *\n\t\t\t * Note that the only scenario where there is no reference timestamp is when no ops have ever been processed\n\t\t\t * for this container and it is in read mode. In this scenario, there is no point in running GC anyway\n\t\t\t * because references in the container do not change without any ops, i.e., there is nothing to collect.\n\t\t\t */\n\t\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\t\tif (currentReferenceTimestampMs === undefined) {\n\t\t\t\t// Log an event so we can evaluate how often we run into this scenario.\n\t\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"GarbageCollectorInitializedWithoutTimestamp\",\n\t\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t/**\n\t\t\t * The base snapshot data will not be present if the container is loaded from:\n\t\t\t * 1. The first summary created by the detached container.\n\t\t\t * 2. A summary that was generated with GC disabled.\n\t\t\t * 3. A summary that was generated before GC even existed.\n\t\t\t */\n\t\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t\tif (baseSnapshotData === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.updateStateFromSnapshotData(baseSnapshotData, currentReferenceTimestampMs);\n\t\t\tthis.summaryStateTracker.initializeBaseState(baseSnapshotData);\n\t\t});\n\n\t\t// Get the GC details from the GC state in the base summary. This is returned in getBaseGCDetails which is\n\t\t// used to initialize the GC state of all the nodes in the container.\n\t\tthis.baseGCDetailsP = new LazyPromise<IGarbageCollectionDetailsBase>(async () => {\n\t\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t\tif (baseSnapshotData?.gcState === undefined) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst gcNodes: { [id: string]: string[] } = {};\n\t\t\tfor (const [nodeId, nodeData] of Object.entries(baseSnapshotData.gcState.gcNodes)) {\n\t\t\t\tgcNodes[nodeId] = Array.from(nodeData.outboundRoutes);\n\t\t\t}\n\t\t\t// Run GC on the nodes in the base summary to get the routes used in each node in the container.\n\t\t\t// This is an optimization for space (vs performance) wherein we don't need to store the used routes of\n\t\t\t// each node in the summary.\n\t\t\tconst usedRoutes = runGarbageCollection(gcNodes, [\"/\"]).referencedNodeIds;\n\n\t\t\treturn { gcData: { gcNodes }, usedRoutes };\n\t\t});\n\n\t\t// Log all the GC options and the state determined by the garbage collector.\n\t\t// This is useful even for interactive clients since they track unreferenced nodes and log errors.\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"GarbageCollectorLoaded\",\n\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\tgcOptions: JSON.stringify(createParams.gcOptions),\n\t\t});\n\t}\n\n\t/**\n\t * Called during container initialization. Initialize from the tombstone state in the base snapshot. This is done\n\t * during initialization so that deleted or tombstoned objects are marked as such before they are loaded or used.\n\t */\n\tpublic async initializeBaseState(): Promise<void> {\n\t\tconst baseSnapshotData = await this.baseSnapshotDataP;\n\t\t/**\n\t\t * The base snapshot data will not be present if the container is loaded from:\n\t\t * 1. The first summary created by the detached container.\n\t\t * 2. A summary that was generated with GC disabled.\n\t\t * 3. A summary that was generated before GC even existed.\n\t\t */\n\t\tif (baseSnapshotData === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Initialize the deleted nodes from the snapshot. This is done irrespective of whether sweep is enabled or not\n\t\t// to identify deleted nodes' usage.\n\t\tif (baseSnapshotData.deletedNodes !== undefined) {\n\t\t\tthis.deletedNodes = new Set(baseSnapshotData.deletedNodes);\n\t\t}\n\n\t\t// If running in tombstone mode, initialize the tombstone state from the snapshot. Also, notify the runtime of\n\t\t// tombstone routes.\n\t\tif (this.configs.tombstoneMode && baseSnapshotData.tombstones !== undefined) {\n\t\t\t// Create a copy since we are writing from a source we don't control\n\t\t\tthis.tombstones = Array.from(baseSnapshotData.tombstones);\n\t\t\tthis.runtime.updateTombstonedRoutes(this.tombstones);\n\t\t}\n\t}\n\n\t/**\n\t * Update state from the given snapshot data. This is done during load and during refreshing state from a snapshot.\n\t * All current tracking is reset and updated from the data in the snapshot.\n\t * @param snapshotData - The snapshot data to update state from. If this is undefined, all GC state and tracking\n\t * is reset.\n\t * @param currentReferenceTimestampMs - The current reference timestamp for marking unreferenced nodes' unreferenced\n\t * timestamp.\n\t */\n\tprivate updateStateFromSnapshotData(\n\t\tsnapshotData: IGarbageCollectionSnapshotData | undefined,\n\t\tcurrentReferenceTimestampMs: number,\n\t) {\n\t\t/**\n\t\t * Note: \"newReferencesSinceLastRun\" is not reset here. This is done because there may be references since the\n\t\t * snapshot that we are updating state from. For example, this client may have processed ops till seq#1000 and\n\t\t * its refreshing state from a summary that happened at seq#900. In this case, there may be references between\n\t\t * seq#901 and seq#1000 that we don't want to reset.\n\t\t * Unfortunately, there is no way to track the seq# of ops that add references, so we choose to not reset any\n\t\t * references here. This should be fine because, in the worst case, we may end up updating the unreferenced\n\t\t * timestamp of a node which will delay its deletion. Although not ideal, this will only happen in rare\n\t\t * scenarios, so it should be okay.\n\t\t */\n\n\t\t// Clear all existing unreferenced state tracking.\n\t\tfor (const [, nodeStateTracker] of this.unreferencedNodesState) {\n\t\t\tnodeStateTracker.stopTracking();\n\t\t}\n\t\tthis.unreferencedNodesState.clear();\n\n\t\t// If running sweep, the tombstone state represents the list of nodes that have been deleted during sweep.\n\t\t// If running in tombstone mode, the tombstone state represents the list of nodes that have been marked as\n\t\t// tombstones.\n\t\t// If this call is because we are refreshing from a snapshot due to an ack, it is likely that the GC state\n\t\t// in the snapshot is newer than this client's. And so, the deleted / tombstone nodes need to be updated.\n\t\tif (this.configs.shouldRunSweep) {\n\t\t\tconst snapshotDeletedNodes = snapshotData?.deletedNodes\n\t\t\t\t? new Set(snapshotData.deletedNodes)\n\t\t\t\t: undefined;\n\t\t\t// If the snapshot contains deleted nodes that are not yet deleted by this client, ask the runtime to\n\t\t\t// delete them.\n\t\t\tif (snapshotDeletedNodes !== undefined) {\n\t\t\t\tconst newDeletedNodes: string[] = [];\n\t\t\t\tfor (const nodeId of snapshotDeletedNodes) {\n\t\t\t\t\tif (!this.deletedNodes.has(nodeId)) {\n\t\t\t\t\t\tnewDeletedNodes.push(nodeId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (newDeletedNodes.length > 0) {\n\t\t\t\t\t// Call container runtime to delete these nodes and add deleted nodes to this.deletedNodes.\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (this.configs.tombstoneMode) {\n\t\t\t// The snapshot may contain more or fewer tombstone nodes than this client. Update tombstone state and\n\t\t\t// notify the runtime to update its state as well.\n\t\t\tthis.tombstones = snapshotData?.tombstones ? Array.from(snapshotData.tombstones) : [];\n\t\t\tthis.runtime.updateTombstonedRoutes(this.tombstones);\n\t\t}\n\n\t\t// If there is no snapshot data, it means this snapshot was generated with GC disabled. Unset all GC state.\n\t\tif (snapshotData?.gcState === undefined) {\n\t\t\tthis.gcDataFromLastRun = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\t// Update unreferenced state tracking as per the GC state in the snapshot data and update gcDataFromLastRun\n\t\t// to the GC data from the snapshot data.\n\t\tconst gcNodes: { [id: string]: string[] } = {};\n\t\tfor (const [nodeId, nodeData] of Object.entries(snapshotData.gcState.gcNodes)) {\n\t\t\tif (nodeData.unreferencedTimestampMs !== undefined) {\n\t\t\t\tthis.unreferencedNodesState.set(\n\t\t\t\t\tnodeId,\n\t\t\t\t\tnew UnreferencedStateTracker(\n\t\t\t\t\t\tnodeData.unreferencedTimestampMs,\n\t\t\t\t\t\tthis.configs.inactiveTimeoutMs,\n\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\tthis.configs.sweepTimeoutMs,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t\tgcNodes[nodeId] = Array.from(nodeData.outboundRoutes);\n\t\t}\n\t\tthis.gcDataFromLastRun = { gcNodes };\n\t}\n\n\t/**\n\t * Called when the connection state of the runtime changes, i.e., it connects or disconnects. GC subscribes to this\n\t * to initialize the base state for non-summarizer clients so that they can track inactive / sweep ready nodes.\n\t * @param connected - Whether the runtime connected / disconnected.\n\t * @param clientId - The clientId of this runtime.\n\t */\n\tpublic setConnectionState(connected: boolean, clientId?: string | undefined): void {\n\t\t/**\n\t\t * For all clients, initialize the base state when the container becomes active, i.e., it transitions\n\t\t * to \"write\" mode. This will ensure that the container's own join op is processed and there is a recent\n\t\t * reference timestamp that will be used to update the state of unreferenced nodes. Also, all trailing ops which\n\t\t * could affect the GC state will have been processed.\n\t\t *\n\t\t * If GC is up-to-date for the client and the summarizing client, there will be an doubling of both\n\t\t * InactiveObject_Loaded and SweepReady_Loaded errors, as there will be one from the sending client and one from\n\t\t * the receiving summarizer client.\n\t\t *\n\t\t * Ideally, this initialization should only be done for summarizer client. However, we are currently rolling out\n\t\t * sweep in phases and we want to track when inactive and sweep ready objects are used in any client.\n\t\t */\n\t\tif (this.activeConnection() && this.configs.shouldRunGC) {\n\t\t\tthis.initializeGCStateFromBaseSnapshotP.catch((error) => {});\n\t\t}\n\t}\n\n\t/**\n\t * Returns a the GC details generated from the base summary. This is used to initialize the GC state of the nodes\n\t * in the container.\n\t */\n\tpublic async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n\t\treturn this.baseGCDetailsP;\n\t}\n\n\t/**\n\t * Runs garbage collection and updates the reference / used state of the nodes in the container.\n\t * @returns stats of the GC run or undefined if GC did not run.\n\t */\n\tpublic async collectGarbage(\n\t\toptions: {\n\t\t\t/** Logger to use for logging GC events */\n\t\t\tlogger?: ITelemetryLoggerExt;\n\t\t\t/** True to run GC sweep phase after the mark phase */\n\t\t\trunSweep?: boolean;\n\t\t\t/** True to generate full GC data */\n\t\t\tfullGC?: boolean;\n\t\t},\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<IGCStats | undefined> {\n\t\tconst fullGC =\n\t\t\toptions.fullGC ??\n\t\t\t(this.configs.runFullGC === true || this.summaryStateTracker.doesSummaryStateNeedReset);\n\n\t\t// Add the options that are used to run GC to the telemetry context.\n\t\ttelemetryContext?.setMultiple(\"fluid_GC\", \"Options\", {\n\t\t\tfullGC,\n\t\t\trunSweep: options.runSweep,\n\t\t});\n\n\t\tconst logger = options.logger\n\t\t\t? createChildLogger({\n\t\t\t\t\tlogger: options.logger,\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tall: { completedGCRuns: () => this.completedRuns },\n\t\t\t\t\t},\n\t\t\t })\n\t\t\t: this.mc.logger;\n\n\t\t/**\n\t\t * If there is no current reference timestamp, skip running GC. We need the current timestamp to track\n\t\t * how long objects have been unreferenced and if they should be deleted.\n\t\t *\n\t\t * Note that the only scenario where GC is called and there is no reference timestamp is when no ops have ever\n\t\t * been processed for this container and it is in read mode. In this scenario, there is no point in running GC\n\t\t * anyway because references in the container do not change without any ops, i.e., there is nothing to collect.\n\t\t */\n\t\tconst currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n\t\tif (currentReferenceTimestampMs === undefined) {\n\t\t\t// Log an event so we can evaluate how often we run into this scenario.\n\t\t\tlogger.sendErrorEvent({\n\t\t\t\teventName: \"CollectGarbageCalledWithoutTimestamp\",\n\t\t\t\tgcConfigs: JSON.stringify(this.configs),\n\t\t\t});\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"GarbageCollection\" },\n\t\t\tasync (event) => {\n\t\t\t\t/** Pre-GC steps */\n\t\t\t\t// Ensure that state has been initialized from the base snapshot data.\n\t\t\t\tawait this.initializeGCStateFromBaseSnapshotP;\n\t\t\t\t// Let the runtime update its pending state before GC runs.\n\t\t\t\tawait this.runtime.updateStateBeforeGC();\n\n\t\t\t\t/** GC step */\n\t\t\t\tconst gcStats = await this.runGC(fullGC, currentReferenceTimestampMs, logger);\n\t\t\t\tevent.end({ ...gcStats, timestamp: currentReferenceTimestampMs });\n\n\t\t\t\t/** Post-GC steps */\n\t\t\t\t// Log pending unreferenced events such as a node being used after inactive. This is done after GC runs and\n\t\t\t\t// updates its state so that we don't send false positives based on intermediate state. For example, we may get\n\t\t\t\t// reference to an unreferenced node from another unreferenced node which means the node wasn't revived.\n\t\t\t\tawait this.telemetryTracker.logPendingEvents(logger);\n\t\t\t\t// Update the state of summary state tracker from this run's stats.\n\t\t\t\tthis.summaryStateTracker.updateStateFromGCRunStats(gcStats);\n\t\t\t\tthis.newReferencesSinceLastRun.clear();\n\t\t\t\tthis.completedRuns++;\n\n\t\t\t\treturn gcStats;\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t}\n\n\t/**\n\t * Runs garbage collection. It does the following:\n\t * 1. It generates / analyzes the runtime's reference graph.\n\t * 2. Generates stats for the GC run based on previous / current GC state.\n\t * 3. Runs Mark phase.\n\t * 4. Runs Sweep phase.\n\t */\n\tprivate async runGC(\n\t\tfullGC: boolean,\n\t\tcurrentReferenceTimestampMs: number,\n\t\tlogger: ITelemetryLoggerExt,\n\t): Promise<IGCStats> {\n\t\t// 1. Generate / analyze the runtime's reference graph.\n\t\t// Get the reference graph (gcData) and run GC algorithm to get referenced / unreferenced nodes.\n\t\tconst gcData = await this.runtime.getGCData(fullGC);\n\t\tconst gcResult = runGarbageCollection(gcData.gcNodes, [\"/\"]);\n\t\t// Get all referenced nodes - References in this run + references between the previous and current runs.\n\t\tconst allReferencedNodeIds =\n\t\t\tthis.findAllNodesReferencedBetweenGCs(gcData, this.gcDataFromLastRun, logger) ??\n\t\t\tgcResult.referencedNodeIds;\n\n\t\t// 2. Generate stats based on the previous / current GC state.\n\t\t// Must happen before running Mark / Sweep phase because previous GC state will be updated in these stages.\n\t\tconst gcStats = this.generateStats(gcResult);\n\n\t\t// 3. Run the Mark phase.\n\t\t// It will mark nodes as referenced / unreferenced and return a list of node ids that are ready to be swept.\n\t\tconst sweepReadyNodeIds = this.runMarkPhase(\n\t\t\tgcResult,\n\t\t\tallReferencedNodeIds,\n\t\t\tcurrentReferenceTimestampMs,\n\t\t);\n\n\t\t// 4. Run the Sweep phase.\n\t\t// It will delete sweep ready nodes and return a list of deleted node ids.\n\t\tconst deletedNodeIds = this.runSweepPhase(\n\t\t\tgcResult,\n\t\t\tsweepReadyNodeIds,\n\t\t\tcurrentReferenceTimestampMs,\n\t\t\tlogger,\n\t\t);\n\n\t\tthis.gcDataFromLastRun = cloneGCData(\n\t\t\tgcData,\n\t\t\t(id: string) => deletedNodeIds.includes(id) /* filter out deleted nodes */,\n\t\t);\n\t\treturn gcStats;\n\t}\n\n\t/**\n\t * Runs the GC Mark phase. It does the following:\n\t *\n\t * 1. Marks all referenced nodes in this run by clearing tracking for them.\n\t *\n\t * 2. Marks unreferenced nodes in this run by starting tracking for them.\n\t *\n\t * 3. Calls the runtime to update nodes that were marked referenced.\n\t *\n\t * @param gcResult - The result of the GC run on the gcData.\n\t * @param allReferencedNodeIds - Nodes referenced in this GC run + referenced between previous and current GC run.\n\t * @param currentReferenceTimestampMs - The timestamp to be used for unreferenced nodes' timestamp.\n\t * @returns A list of sweep ready nodes, i.e., nodes that ready to be deleted.\n\t */\n\tprivate runMarkPhase(\n\t\tgcResult: IGCResult,\n\t\tallReferencedNodeIds: string[],\n\t\tcurrentReferenceTimestampMs: number,\n\t): string[] {\n\t\t// 1. Marks all referenced nodes by clearing their unreferenced tracker, if any.\n\t\tfor (const nodeId of allReferencedNodeIds) {\n\t\t\tconst nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n\t\t\tif (nodeStateTracker !== undefined) {\n\t\t\t\t// Stop tracking so as to clear out any running timers.\n\t\t\t\tnodeStateTracker.stopTracking();\n\t\t\t\t// Delete the node as we don't need to track it any more.\n\t\t\t\tthis.unreferencedNodesState.delete(nodeId);\n\t\t\t}\n\t\t}\n\n\t\t// 2. Mark unreferenced nodes in this run by starting unreferenced tracking for them.\n\t\tconst sweepReadyNodeIds: string[] = [];\n\t\tfor (const nodeId of gcResult.deletedNodeIds) {\n\t\t\tconst nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n\t\t\tif (nodeStateTracker === undefined) {\n\t\t\t\tthis.unreferencedNodesState.set(\n\t\t\t\t\tnodeId,\n\t\t\t\t\tnew UnreferencedStateTracker(\n\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\tthis.configs.inactiveTimeoutMs,\n\t\t\t\t\t\tcurrentReferenceTimestampMs,\n\t\t\t\t\t\tthis.configs.sweepTimeoutMs,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// If a node was already unreferenced, update its tracking information. Since the current reference time\n\t\t\t\t// is from the ops seen, this will ensure that we keep updating unreferenced state as time moves forward.\n\t\t\t\tnodeStateTracker.updateTracking(currentReferenceTimestampMs);\n\n\t\t\t\t// If a node is sweep ready, store it so it can be returned.\n\t\t\t\tif (nodeStateTracker.state === UnreferencedState.SweepReady) {\n\t\t\t\t\tsweepReadyNodeIds.push(nodeId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 3. Call the runtime to update referenced nodes in this run.\n\t\tthis.runtime.updateUsedRoutes(gcResult.referencedNodeIds);\n\n\t\treturn sweepReadyNodeIds;\n\t}\n\n\t/**\n\t * Runs the GC Sweep phase. It does the following:\n\t * 1. Calls the runtime to delete nodes that are sweep ready.\n\t * 2. Clears tracking for deleted nodes.\n\t *\n\t * @param gcResult - The result of the GC run on the gcData.\n\t * @param sweepReadyNodes - List of nodes that are sweep ready.\n\t * @param currentReferenceTimestampMs - The timestamp to be used for unreferenced nodes' timestamp.\n\t * @param logger - The logger to be used to log any telemetry.\n\t * @returns A list of nodes that have been deleted.\n\t */\n\tprivate runSweepPhase(\n\t\tgcResult: IGCResult,\n\t\tsweepReadyNodes: string[],\n\t\tcurrentReferenceTimestampMs: number,\n\t\tlogger: ITelemetryLoggerExt,\n\t): string[] {\n\t\t// Log events for objects that are ready to be deleted by sweep. This will give us data on sweep when\n\t\t// its not enabled.\n\t\tthis.telemetryTracker.logSweepEvents(\n\t\t\tlogger,\n\t\t\tcurrentReferenceTimestampMs,\n\t\t\tthis.unreferencedNodesState,\n\t\t\tthis.completedRuns,\n\t\t\tthis.getLastSummaryTimestampMs(),\n\t\t);\n\n\t\t/**\n\t\t * Currently, there are 3 modes for sweep:\n\t\t * Test mode - Unreferenced nodes are immediately deleted without waiting for them to be sweep ready.\n\t\t * Tombstone mode - Sweep ready modes are marked as tombstones instead of being deleted.\n\t\t * Sweep mode - Sweep ready modes are deleted.\n\t\t *\n\t\t * These modes serve as staging for applications that want to enable sweep by providing an incremental\n\t\t * way to test and validate sweep works as expected.\n\t\t */\n\t\tif (this.configs.testMode) {\n\t\t\t// If we are running in GC test mode, unreferenced nodes (gcResult.deletedNodeIds) are deleted.\n\t\t\tthis.runtime.updateUnusedRoutes(gcResult.deletedNodeIds);\n\t\t\treturn [];\n\t\t}\n\n\t\tif (this.configs.tombstoneMode) {\n\t\t\tthis.tombstones = sweepReadyNodes;\n\t\t\t// If we are running in GC tombstone mode, update tombstoned routes. This enables testing scenarios\n\t\t\t// involving access to \"deleted\" data without actually deleting the data from summaries.\n\t\t\tthis.runtime.updateTombstonedRoutes(this.tombstones);\n\t\t\treturn [];\n\t\t}\n\n\t\tif (!this.configs.shouldRunSweep) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// 1. Call the runtime to delete sweep ready nodes. The runtime returns a list of nodes it deleted.\n\t\t// TODO: GC:Validation - validate that removed routes are not double delete and that the child routes of\n\t\t// removed routes are deleted as well.\n\t\tconst deletedNodeIds = this.runtime.deleteSweepReadyNodes(sweepReadyNodes);\n\n\t\t// 2. Clear unreferenced state tracking for deleted nodes.\n\t\tfor (const nodeId of deletedNodeIds) {\n\t\t\tconst nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n\t\t\t// TODO: GC:Validation - assert that the nodeStateTracker is defined\n\t\t\tif (nodeStateTracker !== undefined) {\n\t\t\t\t// Stop tracking so as to clear out any running timers.\n\t\t\t\tnodeStateTracker.stopTracking();\n\t\t\t\t// Delete the node as we don't need to track it any more.\n\t\t\t\tthis.unreferencedNodesState.delete(nodeId);\n\t\t\t}\n\t\t\t// TODO: GC:Validation - assert that the deleted node is not a duplicate\n\t\t\tthis.deletedNodes.add(nodeId);\n\t\t}\n\t\treturn deletedNodeIds;\n\t}\n\n\t/**\n\t * Since GC runs periodically, the GC data that is generated only tells us the state of the world at that point in\n\t * time. There can be nodes that were referenced in between two runs and their unreferenced state needs to be\n\t * updated. For example, in the following scenarios not updating the unreferenced timestamp can lead to deletion of\n\t * these objects while there can be in-memory referenced to it:\n\t * 1. A node transitions from `unreferenced -> referenced -> unreferenced` between two runs. When the reference is\n\t * added, the object may have been accessed and in-memory reference to it added.\n\t * 2. A reference is added from one unreferenced node to one or more unreferenced nodes. Even though the node[s] were\n\t * unreferenced, they could have been accessed and in-memory reference to them added.\n\t *\n\t * This function identifies nodes that were referenced since the last run.\n\t * If these nodes are currently unreferenced, they will be assigned new unreferenced state by the current run.\n\t *\n\t * @returns A list of all nodes referenced from the last local summary until now.\n\t */\n\tprivate findAllNodesReferencedBetweenGCs(\n\t\tcurrentGCData: IGarbageCollectionData,\n\t\tpreviousGCData: IGarbageCollectionData | undefined,\n\t\tlogger: ITelemetryLoggerExt,\n\t): string[] | undefined {\n\t\t// If we haven't run GC before there is nothing to do.\n\t\t// No previousGCData, means nothing is unreferenced, and there are no reference state trackers to clear\n\t\tif (previousGCData === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t/**\n\t\t * If there are references that were not explicitly notified to GC, log an error because this should never happen.\n\t\t * If it does, this may result in the unreferenced timestamps of these nodes not updated when they were referenced.\n\t\t */\n\t\tthis.telemetryTracker.logIfMissingExplicitReferences(\n\t\t\tcurrentGCData,\n\t\t\tpreviousGCData,\n\t\t\tthis.newReferencesSinceLastRun,\n\t\t\tlogger,\n\t\t);\n\n\t\t// No references were added since the last run so we don't have to update reference states of any unreferenced\n\t\t// nodes. There is no in between state at this point.\n\t\tif (this.newReferencesSinceLastRun.size === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t/**\n\t\t * Generate a super set of the GC data that contains the nodes and edges from last run, plus any new node and\n\t\t * edges that have been added since then. To do this, combine the GC data from the last run and the current\n\t\t * run, and then add the references since last run.\n\t\t *\n\t\t * Note on why we need to combine the data from previous run, current run and all references in between -\n\t\t * 1. We need data from last run because some of its references may have been deleted since then. If those\n\t\t * references added new outbound references before they were deleted, we need to detect them.\n\t\t *\n\t\t * 2. We need new outbound references since last run because some of them may have been deleted later. If those\n\t\t * references added new outbound references before they were deleted, we need to detect them.\n\t\t *\n\t\t * 3. We need data from the current run because currently we may not detect when DDSes are referenced:\n\t\t * - We don't require DDSes handles to be stored in a referenced DDS.\n\t\t * - A new data store may have \"root\" DDSes already created and we don't detect them today.\n\t\t */\n\t\tconst gcDataSuperSet = concatGarbageCollectionData(previousGCData, currentGCData);\n\t\tconst newOutboundRoutesSinceLastRun: string[] = [];\n\t\tthis.newReferencesSinceLastRun.forEach((outboundRoutes: string[], sourceNodeId: string) => {\n\t\t\tif (gcDataSuperSet.gcNodes[sourceNodeId] === undefined) {\n\t\t\t\tgcDataSuperSet.gcNodes[sourceNodeId] = outboundRoutes;\n\t\t\t} else {\n\t\t\t\tgcDataSuperSet.gcNodes[sourceNodeId].push(...outboundRoutes);\n\t\t\t}\n\t\t\tnewOutboundRoutesSinceLastRun.push(...outboundRoutes);\n\t\t});\n\n\t\t/**\n\t\t * Run GC on the above reference graph starting with root and all new outbound routes. This will generate a\n\t\t * list of all nodes that could have been referenced since the last run. If any of these nodes are unreferenced,\n\t\t * unreferenced, stop tracking them and remove from unreferenced list.\n\t\t * Note that some of these nodes may be unreferenced now and if so, the current run will mark them as\n\t\t * unreferenced and add unreferenced state.\n\t\t */\n\t\tconst gcResult = runGarbageCollection(gcDataSuperSet.gcNodes, [\n\t\t\t\"/\",\n\t\t\t...newOutboundRoutesSinceLastRun,\n\t\t]);\n\t\treturn gcResult.referencedNodeIds;\n\t}\n\n\t/**\n\t * Summarizes the GC data and returns it as a summary tree.\n\t * We current write the entire GC state in a single blob. This can be modified later to write multiple\n\t * blobs. All the blob keys should start with `gcBlobPrefix`.\n\t */\n\tpublic summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummarizeResult | undefined {\n\t\tif (!this.configs.shouldRunGC || this.gcDataFromLastRun === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst gcState: IGarbageCollectionState = { gcNodes: {} };\n\t\tfor (const [nodeId, outboundRoutes] of Object.entries(this.gcDataFromLastRun.gcNodes)) {\n\t\t\tgcState.gcNodes[nodeId] = {\n\t\t\t\toutboundRoutes,\n\t\t\t\tunreferencedTimestampMs:\n\t\t\t\t\tthis.unreferencedNodesState.get(nodeId)?.unreferencedTimestampMs,\n\t\t\t};\n\t\t}\n\n\t\treturn this.summaryStateTracker.summarize(\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\tgcState,\n\t\t\tthis.deletedNodes,\n\t\t\tthis.tombstones,\n\t\t);\n\t}\n\n\tpublic getMetadata(): IGCMetadata {\n\t\treturn {\n\t\t\t/**\n\t\t\t * If GC is enabled, the GC data is written using the GC version in effect and that is the gcFeature that goes\n\t\t\t * into the metadata blob. If GC is disabled, the gcFeature is 0.\n\t\t\t */\n\t\t\tgcFeature: this.configs.gcEnabled ? this.configs.gcVersionInEffect : 0,\n\t\t\tgcFeatureMatrix: this.configs.persistedGcFeatureMatrix,\n\t\t\tsessionExpiryTimeoutMs: this.configs.sessionExpiryTimeoutMs,\n\t\t\tsweepEnabled: false, // DEPRECATED - to be removed\n\t\t\tsweepTimeoutMs: this.configs.sweepTimeoutMs,\n\t\t};\n\t}\n\n\t/**\n\t * Called to refresh the latest summary state. This happens when either a pending summary is acked.\n\t */\n\tpublic async refreshLatestSummary(result: IRefreshSummaryResult): Promise<void> {\n\t\treturn this.summaryStateTracker.refreshLatestSummary(result);\n\t}\n\n\t/**\n\t * Called when a node with the given id is updated. If the node is inactive, log an error.\n\t * @param nodePath - The path of the node that changed.\n\t * @param reason - Whether the node was loaded or changed.\n\t * @param timestampMs - The timestamp when the node changed.\n\t * @param packagePath - The package path of the node. This may not be available if the node hasn't been loaded yet.\n\t * @param requestHeaders - If the node was loaded via request path, the headers in the request.\n\t */\n\tpublic nodeUpdated(\n\t\tnodePath: string,\n\t\treason: \"Loaded\" | \"Changed\",\n\t\ttimestampMs?: number,\n\t\tpackagePath?: readonly string[],\n\t\trequestHeaders?: IRequestHeader,\n\t) {\n\t\tif (!this.configs.shouldRunGC) {\n\t\t\treturn;\n\t\t}\n\n\t\t// This will log if appropriate\n\t\tthis.telemetryTracker.nodeUsed({\n\t\t\tid: nodePath,\n\t\t\tusageType: reason,\n\t\t\tcurrentReferenceTimestampMs:\n\t\t\t\ttimestampMs ?? this.runtime.getCurrentReferenceTimestampMs(),\n\t\t\tpackagePath,\n\t\t\tcompletedGCRuns: this.completedRuns,\n\t\t\tisTombstoned: this.tombstones.includes(nodePath),\n\t\t\tlastSummaryTime: this.getLastSummaryTimestampMs(),\n\t\t\tviaHandle: requestHeaders?.[RuntimeHeaders.viaHandle],\n\t\t});\n\n\t\t// Unless this is a Loaded event, we're done after telemetry tracking\n\t\tif (reason !== \"Loaded\") {\n\t\t\treturn;\n\t\t}\n\n\t\t// We may throw when loading an Inactive object, depending on these preconditions\n\t\tconst shouldThrowOnInactiveLoad =\n\t\t\t!this.isSummarizerClient &&\n\t\t\tthis.configs.throwOnInactiveLoad === true &&\n\t\t\trequestHeaders?.[AllowInactiveRequestHeaderKey] !== true;\n\t\tconst state = this.unreferencedNodesState.get(nodePath)?.state;\n\n\t\tif (shouldThrowOnInactiveLoad && state === \"Inactive\") {\n\t\t\tconst request: IRequest = { url: nodePath };\n\t\t\tconst error = responseToException(\n\t\t\t\tcreateResponseError(404, \"Object is inactive\", request, {\n\t\t\t\t\t[InactiveResponseHeaderKey]: true,\n\t\t\t\t}),\n\t\t\t\trequest,\n\t\t\t);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Called when an outbound reference is added to a node. This is used to identify all nodes that have been\n\t * referenced between summaries so that their unreferenced timestamp can be reset.\n\t *\n\t * @param fromNodePath - The node from which the reference is added.\n\t * @param toNodePath - The node to which the reference is added.\n\t */\n\tpublic addedOutboundReference(fromNodePath: string, toNodePath: string) {\n\t\tif (!this.configs.shouldRunGC) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst outboundRoutes = this.newReferencesSinceLastRun.get(fromNodePath) ?? [];\n\t\toutboundRoutes.push(toNodePath);\n\t\tthis.newReferencesSinceLastRun.set(fromNodePath, outboundRoutes);\n\n\t\tthis.telemetryTracker.nodeUsed({\n\t\t\tid: toNodePath,\n\t\t\tusageType: \"Revived\",\n\t\t\tcurrentReferenceTimestampMs: this.runtime.getCurrentReferenceTimestampMs(),\n\t\t\tpackagePath: undefined,\n\t\t\tcompletedGCRuns: this.completedRuns,\n\t\t\tisTombstoned: this.tombstones.includes(toNodePath),\n\t\t\tlastSummaryTime: this.getLastSummaryTimestampMs(),\n\t\t\tfromId: fromNodePath,\n\t\t});\n\t}\n\n\t/**\n\t * Returns whether a node with the given path has been deleted or not. This can be used by the runtime to identify\n\t * cases where objects are used after they are deleted and throw / log errors accordingly.\n\t */\n\tpublic isNodeDeleted(nodePath: string): boolean {\n\t\treturn this.deletedNodes.has(nodePath);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.sessionExpiryTimer?.clear();\n\t\tthis.sessionExpiryTimer = undefined;\n\t}\n\n\t/**\n\t * Generates the stats of a garbage collection run from the given results of the run.\n\t * @param gcResult - The result of a GC run.\n\t * @returns the GC stats of the GC run.\n\t */\n\tprivate generateStats(gcResult: IGCResult): IGCStats {\n\t\tconst gcStats: IGCStats = {\n\t\t\tnodeCount: 0,\n\t\t\tdataStoreCount: 0,\n\t\t\tattachmentBlobCount: 0,\n\t\t\tunrefNodeCount: 0,\n\t\t\tunrefDataStoreCount: 0,\n\t\t\tunrefAttachmentBlobCount: 0,\n\t\t\tupdatedNodeCount: 0,\n\t\t\tupdatedDataStoreCount: 0,\n\t\t\tupdatedAttachmentBlobCount: 0,\n\t\t};\n\n\t\tconst updateNodeStats = (nodeId: string, referenced: boolean) => {\n\t\t\tgcStats.nodeCount++;\n\t\t\t// If there is no previous GC data, every node's state is generated and is considered as updated.\n\t\t\t// Otherwise, find out if any node went from referenced to unreferenced or vice-versa.\n\t\t\tconst stateUpdated =\n\t\t\t\tthis.gcDataFromLastRun === undefined ||\n\t\t\t\tthis.unreferencedNodesState.has(nodeId) === referenced;\n\t\t\tif (stateUpdated) {\n\t\t\t\tgcStats.updatedNodeCount++;\n\t\t\t}\n\t\t\tif (!referenced) {\n\t\t\t\tgcStats.unrefNodeCount++;\n\t\t\t}\n\n\t\t\tif (this.runtime.getNodeType(nodeId) === GCNodeType.DataStore) {\n\t\t\t\tgcStats.dataStoreCount++;\n\t\t\t\tif (stateUpdated) {\n\t\t\t\t\tgcStats.updatedDataStoreCount++;\n\t\t\t\t}\n\t\t\t\tif (!referenced) {\n\t\t\t\t\tgcStats.unrefDataStoreCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.runtime.getNodeType(nodeId) === GCNodeType.Blob) {\n\t\t\t\tgcStats.attachmentBlobCount++;\n\t\t\t\tif (stateUpdated) {\n\t\t\t\t\tgcStats.updatedAttachmentBlobCount++;\n\t\t\t\t}\n\t\t\t\tif (!referenced) {\n\t\t\t\t\tgcStats.unrefAttachmentBlobCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tfor (const nodeId of gcResult.referencedNodeIds) {\n\t\t\tupdateNodeStats(nodeId, true /* referenced */);\n\t\t}\n\n\t\tfor (const nodeId of gcResult.deletedNodeIds) {\n\t\t\tupdateNodeStats(nodeId, false /* referenced */);\n\t\t}\n\n\t\treturn gcStats;\n\t}\n}\n"]}
@@ -9,7 +9,7 @@ import { IGarbageCollectionData, IGarbageCollectionDetailsBase, ISummarizeResult
9
9
  import { ReadAndParseBlob } from "@fluidframework/runtime-utils";
10
10
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
11
11
  import { IContainerRuntimeMetadata, ICreateContainerMetadata, IRefreshSummaryResult } from "../summary";
12
- export declare type GCVersion = number;
12
+ export type GCVersion = number;
13
13
  /** The stable/default version of GC Data */
14
14
  export declare const stableGCVersion: GCVersion;
15
15
  /** The next version of GC Data, to bump to in case we need to regenerate all GC Data across all files. */
@@ -138,7 +138,7 @@ export declare const GCNodeType: {
138
138
  Blob: string;
139
139
  Other: string;
140
140
  };
141
- export declare type GCNodeType = typeof GCNodeType[keyof typeof GCNodeType];
141
+ export type GCNodeType = (typeof GCNodeType)[keyof typeof GCNodeType];
142
142
  /**
143
143
  * Defines the APIs for the runtime object to be passed to the garbage collector.
144
144
  */
@@ -223,22 +223,11 @@ export interface IGCRuntimeOptions {
223
223
  * GC has mark phase and sweep phase. In mark phase, unreferenced objects are identified
224
224
  * and marked as such in the summary. This option enables the mark phase.
225
225
  * In sweep phase, unreferenced objects are eventually deleted from the container if they meet certain conditions.
226
- * Sweep phase can be enabled via the "sweepAllowed" option.
226
+ * Sweep phase can be enabled using the "gcSweepGeneration" option.
227
227
  *
228
228
  * Note: This setting is persisted in the container's summary and cannot be changed.
229
229
  */
230
230
  gcAllowed?: boolean;
231
- /**
232
- * @deprecated - @see gcSweepGenerationOptionName and @see GCFeatureMatrix.sweepGeneration
233
- *
234
- * Flag that if true, enables GC's sweep phase for a new container.
235
- *
236
- * This will allow GC to eventually delete unreferenced objects from the container.
237
- * This flag should only be set to true if "gcAllowed" is true.
238
- *
239
- * Note: This setting is persisted in the container's summary and cannot be changed.
240
- */
241
- sweepAllowed?: boolean;
242
231
  /**
243
232
  * Flag that if true, will disable garbage collection for the session.
244
233
  * Can be used to disable running GC on containers where it is allowed via the gcAllowed option.
@@ -321,7 +310,7 @@ export declare const UnreferencedState: {
321
310
  /** The node is ready to be deleted by the sweep phase. */
322
311
  readonly SweepReady: "SweepReady";
323
312
  };
324
- export declare type UnreferencedState = typeof UnreferencedState[keyof typeof UnreferencedState];
313
+ export type UnreferencedState = (typeof UnreferencedState)[keyof typeof UnreferencedState];
325
314
  /**
326
315
  * Represents the result of a GC run.
327
316
  */