@fluidframework/container-runtime 2.1.0 → 2.3.0-288113

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 (198) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +2 -2
  3. package/api-report/container-runtime.legacy.alpha.api.md +4 -3
  4. package/container-runtime.test-files.tar +0 -0
  5. package/dist/batchTracker.d.ts.map +1 -1
  6. package/dist/batchTracker.js.map +1 -1
  7. package/dist/blobManager/blobManager.d.ts.map +1 -1
  8. package/dist/blobManager/blobManager.js +9 -0
  9. package/dist/blobManager/blobManager.js.map +1 -1
  10. package/dist/channelCollection.d.ts +0 -14
  11. package/dist/channelCollection.d.ts.map +1 -1
  12. package/dist/channelCollection.js +2 -12
  13. package/dist/channelCollection.js.map +1 -1
  14. package/dist/containerRuntime.d.ts +34 -6
  15. package/dist/containerRuntime.d.ts.map +1 -1
  16. package/dist/containerRuntime.js +176 -81
  17. package/dist/containerRuntime.js.map +1 -1
  18. package/dist/dataStoreContext.d.ts +9 -18
  19. package/dist/dataStoreContext.d.ts.map +1 -1
  20. package/dist/dataStoreContext.js +40 -78
  21. package/dist/dataStoreContext.js.map +1 -1
  22. package/dist/gc/garbageCollection.d.ts +0 -6
  23. package/dist/gc/garbageCollection.d.ts.map +1 -1
  24. package/dist/gc/garbageCollection.js +23 -66
  25. package/dist/gc/garbageCollection.js.map +1 -1
  26. package/dist/gc/gcConfigs.d.ts.map +1 -1
  27. package/dist/gc/gcConfigs.js +11 -34
  28. package/dist/gc/gcConfigs.js.map +1 -1
  29. package/dist/gc/gcDefinitions.d.ts +9 -52
  30. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  31. package/dist/gc/gcDefinitions.js +3 -23
  32. package/dist/gc/gcDefinitions.js.map +1 -1
  33. package/dist/gc/gcHelpers.d.ts.map +1 -1
  34. package/dist/gc/gcHelpers.js +2 -6
  35. package/dist/gc/gcHelpers.js.map +1 -1
  36. package/dist/gc/gcSummaryStateTracker.d.ts +1 -1
  37. package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
  38. package/dist/gc/gcSummaryStateTracker.js +4 -8
  39. package/dist/gc/gcSummaryStateTracker.js.map +1 -1
  40. package/dist/gc/gcTelemetry.d.ts +1 -9
  41. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  42. package/dist/gc/gcTelemetry.js +3 -25
  43. package/dist/gc/gcTelemetry.js.map +1 -1
  44. package/dist/gc/index.d.ts +2 -2
  45. package/dist/gc/index.d.ts.map +1 -1
  46. package/dist/gc/index.js +2 -7
  47. package/dist/gc/index.js.map +1 -1
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +1 -2
  51. package/dist/index.js.map +1 -1
  52. package/dist/messageTypes.d.ts +6 -5
  53. package/dist/messageTypes.d.ts.map +1 -1
  54. package/dist/messageTypes.js.map +1 -1
  55. package/dist/metadata.d.ts +9 -1
  56. package/dist/metadata.d.ts.map +1 -1
  57. package/dist/metadata.js +6 -1
  58. package/dist/metadata.js.map +1 -1
  59. package/dist/opLifecycle/index.d.ts +1 -1
  60. package/dist/opLifecycle/index.d.ts.map +1 -1
  61. package/dist/opLifecycle/index.js.map +1 -1
  62. package/dist/opLifecycle/opGroupingManager.d.ts +8 -0
  63. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  64. package/dist/opLifecycle/opGroupingManager.js +34 -2
  65. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  66. package/dist/opLifecycle/outbox.d.ts +1 -0
  67. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  68. package/dist/opLifecycle/outbox.js +20 -0
  69. package/dist/opLifecycle/outbox.js.map +1 -1
  70. package/dist/opLifecycle/remoteMessageProcessor.d.ts +34 -15
  71. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  72. package/dist/opLifecycle/remoteMessageProcessor.js +59 -46
  73. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  74. package/dist/packageVersion.d.ts +1 -1
  75. package/dist/packageVersion.d.ts.map +1 -1
  76. package/dist/packageVersion.js +1 -1
  77. package/dist/packageVersion.js.map +1 -1
  78. package/dist/pendingStateManager.d.ts +28 -27
  79. package/dist/pendingStateManager.d.ts.map +1 -1
  80. package/dist/pendingStateManager.js +143 -112
  81. package/dist/pendingStateManager.js.map +1 -1
  82. package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  83. package/dist/summary/summarizerNode/summarizerNode.js +5 -1
  84. package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
  85. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +3 -4
  86. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  87. package/dist/summary/summarizerNode/summarizerNodeWithGc.js +16 -15
  88. package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  89. package/lib/batchTracker.d.ts.map +1 -1
  90. package/lib/batchTracker.js.map +1 -1
  91. package/lib/blobManager/blobManager.d.ts.map +1 -1
  92. package/lib/blobManager/blobManager.js +9 -0
  93. package/lib/blobManager/blobManager.js.map +1 -1
  94. package/lib/channelCollection.d.ts +0 -14
  95. package/lib/channelCollection.d.ts.map +1 -1
  96. package/lib/channelCollection.js +2 -11
  97. package/lib/channelCollection.js.map +1 -1
  98. package/lib/containerRuntime.d.ts +34 -6
  99. package/lib/containerRuntime.d.ts.map +1 -1
  100. package/lib/containerRuntime.js +176 -81
  101. package/lib/containerRuntime.js.map +1 -1
  102. package/lib/dataStoreContext.d.ts +9 -18
  103. package/lib/dataStoreContext.d.ts.map +1 -1
  104. package/lib/dataStoreContext.js +27 -65
  105. package/lib/dataStoreContext.js.map +1 -1
  106. package/lib/gc/garbageCollection.d.ts +0 -6
  107. package/lib/gc/garbageCollection.d.ts.map +1 -1
  108. package/lib/gc/garbageCollection.js +25 -68
  109. package/lib/gc/garbageCollection.js.map +1 -1
  110. package/lib/gc/gcConfigs.d.ts.map +1 -1
  111. package/lib/gc/gcConfigs.js +12 -35
  112. package/lib/gc/gcConfigs.js.map +1 -1
  113. package/lib/gc/gcDefinitions.d.ts +9 -52
  114. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  115. package/lib/gc/gcDefinitions.js +2 -22
  116. package/lib/gc/gcDefinitions.js.map +1 -1
  117. package/lib/gc/gcHelpers.d.ts.map +1 -1
  118. package/lib/gc/gcHelpers.js +2 -6
  119. package/lib/gc/gcHelpers.js.map +1 -1
  120. package/lib/gc/gcSummaryStateTracker.d.ts +1 -1
  121. package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -1
  122. package/lib/gc/gcSummaryStateTracker.js +4 -8
  123. package/lib/gc/gcSummaryStateTracker.js.map +1 -1
  124. package/lib/gc/gcTelemetry.d.ts +1 -9
  125. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  126. package/lib/gc/gcTelemetry.js +3 -24
  127. package/lib/gc/gcTelemetry.js.map +1 -1
  128. package/lib/gc/index.d.ts +2 -2
  129. package/lib/gc/index.d.ts.map +1 -1
  130. package/lib/gc/index.js +2 -2
  131. package/lib/gc/index.js.map +1 -1
  132. package/lib/index.d.ts +1 -1
  133. package/lib/index.d.ts.map +1 -1
  134. package/lib/index.js +1 -1
  135. package/lib/index.js.map +1 -1
  136. package/lib/messageTypes.d.ts +6 -5
  137. package/lib/messageTypes.d.ts.map +1 -1
  138. package/lib/messageTypes.js.map +1 -1
  139. package/lib/metadata.d.ts +9 -1
  140. package/lib/metadata.d.ts.map +1 -1
  141. package/lib/metadata.js +4 -0
  142. package/lib/metadata.js.map +1 -1
  143. package/lib/opLifecycle/index.d.ts +1 -1
  144. package/lib/opLifecycle/index.d.ts.map +1 -1
  145. package/lib/opLifecycle/index.js.map +1 -1
  146. package/lib/opLifecycle/opGroupingManager.d.ts +8 -0
  147. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
  148. package/lib/opLifecycle/opGroupingManager.js +34 -2
  149. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  150. package/lib/opLifecycle/outbox.d.ts +1 -0
  151. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  152. package/lib/opLifecycle/outbox.js +20 -0
  153. package/lib/opLifecycle/outbox.js.map +1 -1
  154. package/lib/opLifecycle/remoteMessageProcessor.d.ts +34 -15
  155. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  156. package/lib/opLifecycle/remoteMessageProcessor.js +59 -46
  157. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  158. package/lib/packageVersion.d.ts +1 -1
  159. package/lib/packageVersion.d.ts.map +1 -1
  160. package/lib/packageVersion.js +1 -1
  161. package/lib/packageVersion.js.map +1 -1
  162. package/lib/pendingStateManager.d.ts +28 -27
  163. package/lib/pendingStateManager.d.ts.map +1 -1
  164. package/lib/pendingStateManager.js +144 -113
  165. package/lib/pendingStateManager.js.map +1 -1
  166. package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  167. package/lib/summary/summarizerNode/summarizerNode.js +5 -1
  168. package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
  169. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +3 -4
  170. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  171. package/lib/summary/summarizerNode/summarizerNodeWithGc.js +16 -15
  172. package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  173. package/package.json +22 -35
  174. package/src/batchTracker.ts +4 -2
  175. package/src/blobManager/blobManager.ts +9 -0
  176. package/src/channelCollection.ts +2 -11
  177. package/src/containerRuntime.ts +211 -109
  178. package/src/dataStoreContext.ts +29 -93
  179. package/src/gc/garbageCollection.ts +26 -79
  180. package/src/gc/gcConfigs.ts +12 -45
  181. package/src/gc/gcDefinitions.ts +10 -55
  182. package/src/gc/gcHelpers.ts +10 -8
  183. package/src/gc/gcSummaryStateTracker.ts +6 -9
  184. package/src/gc/gcTelemetry.ts +3 -38
  185. package/src/gc/index.ts +2 -6
  186. package/src/index.ts +0 -1
  187. package/src/messageTypes.ts +12 -11
  188. package/src/metadata.ts +16 -2
  189. package/src/opLifecycle/index.ts +1 -0
  190. package/src/opLifecycle/opGroupingManager.ts +42 -3
  191. package/src/opLifecycle/outbox.ts +30 -0
  192. package/src/opLifecycle/remoteMessageProcessor.ts +98 -62
  193. package/src/packageVersion.ts +1 -1
  194. package/src/pendingStateManager.ts +199 -177
  195. package/src/summary/README.md +31 -28
  196. package/src/summary/summarizerNode/summarizerNode.ts +6 -1
  197. package/src/summary/summarizerNode/summarizerNodeWithGc.ts +20 -43
  198. package/src/summary/summaryFormats.md +25 -22
@@ -1 +1 @@
1
- {"version":3,"file":"summarizerNodeWithGc.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeWithGc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAa1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EACN,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,GAChB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAKN,WAAW,GAEX,MAAM,0BAA0B,CAAC;AAMlC,wDAAwD;AACxD,MAAM,iBAAkB,SAAQ,WAAW;IAC1C,YACiB,oBAAwC,EACxD,OAKC;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QARC,yBAAoB,GAApB,oBAAoB,CAAoB;IASzD,CAAC;CACD;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,oBAAqB,SAAQ,cAAc;IA4BvD;;;OAGG;IACH,YACC,MAA4B,EACX,WAKqB,EACtC,MAAmC,EACnC,oBAA4B;IAC5B,8CAA8C;IAC9C,aAA2B,EAC3B,gBAAuC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;OAIG;IACK,mBAAmB;QAC1B,uEAAuE;QACvE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,OAAO,KAAK,CAAC;QACd,CAAC;QAED,OAAO,CACN,IAAI,CAAC,mBAAmB,KAAK,SAAS;YACtC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAC5E,CAAC;IACH,CAAC;CACD;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAC7C,MAA4B,EAC5B,mBAAwC,EACxC,oBAA4B,EAC5B,uBAA2C,EAC3C,SAAsC,EAAE,EACxC,WAAmE,EACnE,kBAAiE,EACrC,EAAE,CAC9B,IAAI,oBAAoB,CACvB,MAAM,EACN,mBAAmB,EACnB,MAAM,EACN,oBAAoB,EACpB,uBAAuB,KAAK,SAAS;IACpC,CAAC,CAAC,SAAS;IACX,CAAC,CAAC,WAAW,CAAC,aAAa,CAAC,uBAAuB,CAAC,EACrD,SAAS,CAAC,sBAAsB,EAChC,WAAW,EACX,kBAAkB,EAClB,EAAE,CAAC,iBAAiB,CACpB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIExperimentalIncrementalSummaryContext,\n\tITelemetryContext,\n\tIGarbageCollectionData,\n\tCreateChildSummarizerNodeParam,\n\tIGarbageCollectionDetailsBase,\n\tISummarizeInternalResult,\n\tISummarizeResult,\n\tISummarizerNodeConfigWithGC,\n\tISummarizerNodeWithGC,\n\tSummarizeInternalFn,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { unpackChildNodesUsedRoutes } from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tLoggingError,\n\tTelemetryDataTag,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { cloneGCData, unpackChildNodesGCDetails } from \"../../gc/index.js\";\n\nimport { SummarizerNode } from \"./summarizerNode.js\";\nimport {\n\tEscapedPath,\n\tICreateChildDetails,\n\tIStartSummaryResult,\n\tISummarizerNodeRootContract,\n\tSummaryNode,\n\tValidateSummaryResult,\n} from \"./summarizerNodeUtils.js\";\n\nexport interface IRootSummarizerNodeWithGC\n\textends ISummarizerNodeWithGC,\n\t\tISummarizerNodeRootContract {}\n\n// Extend SummaryNode to add used routes tracking to it.\nclass SummaryNodeWithGC extends SummaryNode {\n\tconstructor(\n\t\tpublic readonly serializedUsedRoutes: string | undefined,\n\t\tsummary: {\n\t\t\treadonly referenceSequenceNumber: number;\n\t\t\treadonly basePath: EscapedPath | undefined;\n\t\t\treadonly localPath: EscapedPath;\n\t\t\tadditionalPath?: EscapedPath;\n\t\t},\n\t) {\n\t\tsuper(summary);\n\t}\n}\n\n/**\n * Extends the functionality of SummarizerNode to manage this node's garbage collection data:\n *\n * - Adds a new API `getGCData` to return GC data of this node.\n *\n * - Caches the result of `getGCData` to be used if nothing changes between summaries.\n *\n * - Manages the used routes of this node. These are used to identify if this node is referenced in the document\n * and to determine if the node's used state changed since last summary.\n *\n * - Adds trackState param to summarize. If trackState is false, it bypasses the SummarizerNode and calls\n * directly into summarizeInternal method.\n */\nexport class SummarizerNodeWithGC extends SummarizerNode implements IRootSummarizerNodeWithGC {\n\t// Tracks the work-in-progress used routes during summary.\n\tprivate wipSerializedUsedRoutes: string | undefined;\n\n\t// This is the last known used routes of this node as seen by the server as part of a summary.\n\tprivate referenceUsedRoutes: string[] | undefined;\n\n\t// The base GC details of this node used to initialize the GC state.\n\tprivate readonly baseGCDetailsP: Promise<IGarbageCollectionDetailsBase>;\n\n\t// Keeps track of whether we have loaded the base details to ensure that we only do it once.\n\tprivate baseGCDetailsLoaded: boolean = false;\n\n\t// The base GC details for the child nodes. This is passed to child nodes when creating them.\n\tprivate readonly childNodesBaseGCDetailsP: Promise<\n\t\tMap<string, IGarbageCollectionDetailsBase>\n\t>;\n\n\tprivate gcData: IGarbageCollectionData | undefined;\n\n\t// Set used routes to have self route by default. This makes the node referenced by default. This is done to ensure\n\t// that this node is not marked as collected when running GC has been disabled. Once, the option to disable GC is\n\t// removed (from runGC flag in IContainerRuntimeOptions), this should be changed to be have no routes by default.\n\tprivate usedRoutes: string[] = [\"\"];\n\n\t// True if GC is disabled for this node. If so, do not track GC specific state for a summary.\n\tprivate readonly gcDisabled: boolean;\n\n\t/**\n\t * Do not call constructor directly.\n\t * Use createRootSummarizerNodeWithGC to create root node, or createChild to create child nodes.\n\t */\n\tpublic constructor(\n\t\tlogger: ITelemetryBaseLogger,\n\t\tprivate readonly summarizeFn: (\n\t\t\tfullTree: boolean,\n\t\t\ttrackState: boolean,\n\t\t\ttelemetryContext?: ITelemetryContext,\n\t\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t\t) => Promise<ISummarizeInternalResult>,\n\t\tconfig: ISummarizerNodeConfigWithGC,\n\t\tchangeSequenceNumber: number,\n\t\t/** Undefined means created without summary */\n\t\tlatestSummary?: SummaryNode,\n\t\twipSummaryLogger?: ITelemetryBaseLogger,\n\t\tprivate readonly getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\t\tgetBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n\t\t/** A unique id of this node to be logged when sending telemetry. */\n\t\ttelemetryId?: string,\n\t) {\n\t\tsuper(\n\t\t\tlogger,\n\t\t\tasync (\n\t\t\t\tfullTree: boolean,\n\t\t\t\t_trackState: boolean,\n\t\t\t\ttelemetryContext?: ITelemetryContext,\n\t\t\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t\t\t) =>\n\t\t\t\tsummarizeFn(\n\t\t\t\t\tfullTree,\n\t\t\t\t\ttrue /* trackState */,\n\t\t\t\t\ttelemetryContext,\n\t\t\t\t\tincrementalSummaryContext,\n\t\t\t\t),\n\t\t\tconfig,\n\t\t\tchangeSequenceNumber,\n\t\t\tlatestSummary,\n\t\t\twipSummaryLogger,\n\t\t\ttelemetryId,\n\t\t);\n\n\t\tthis.gcDisabled = config.gcDisabled === true;\n\n\t\tthis.baseGCDetailsP = new LazyPromise(async () => {\n\t\t\treturn (await getBaseGCDetailsFn?.()) ?? { usedRoutes: [] };\n\t\t});\n\n\t\tthis.childNodesBaseGCDetailsP = new LazyPromise(async () => {\n\t\t\tawait this.loadBaseGCDetails();\n\t\t\treturn unpackChildNodesGCDetails({ gcData: this.gcData, usedRoutes: this.usedRoutes });\n\t\t});\n\t}\n\n\t/**\n\t * Loads state from this node's initial GC summary details. This contains the following data from the last summary\n\t * seen by the server for this client:\n\t * - usedRoutes: This is used to figure out if the used state of this node changed since last summary.\n\t * - gcData: The garbage collection data of this node that is required for running GC.\n\t */\n\tprivate async loadBaseGCDetails() {\n\t\tif (this.baseGCDetailsLoaded) {\n\t\t\treturn;\n\t\t}\n\t\tconst baseGCDetails = await this.baseGCDetailsP;\n\n\t\t// Possible race - If there were parallel calls to loadBaseGCDetails, we want to make sure that we update\n\t\t// the state from the base details only once.\n\t\tif (this.baseGCDetailsLoaded) {\n\t\t\treturn;\n\t\t}\n\t\tthis.baseGCDetailsLoaded = true;\n\n\t\t// Update GC data, used routes and reference used routes. The used routes are sorted because they are compared\n\t\t// across GC runs to check if they changed. Sorting ensures that the elements are in the same order.\n\t\t// If the GC details has GC data, initialize our GC data from it.\n\t\tif (baseGCDetails.gcData !== undefined) {\n\t\t\tthis.gcData = cloneGCData(baseGCDetails.gcData);\n\t\t}\n\t\tif (baseGCDetails.usedRoutes !== undefined) {\n\t\t\tthis.usedRoutes = Array.from(baseGCDetails.usedRoutes).sort();\n\t\t\tthis.referenceUsedRoutes = Array.from(baseGCDetails.usedRoutes).sort();\n\t\t}\n\t}\n\n\tpublic async summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\t// If GC is not disabled and a summary is in progress, GC should have run and updated the used routes for this\n\t\t// summary by calling updateUsedRoutes which sets wipSerializedUsedRoutes.\n\t\tif (!this.gcDisabled && this.isSummaryInProgress()) {\n\t\t\tassert(\n\t\t\t\tthis.wipSerializedUsedRoutes !== undefined,\n\t\t\t\t0x1b1 /* \"wip used routes should be set if tracking a summary\" */,\n\t\t\t);\n\t\t}\n\n\t\t// If trackState is true, get summary from base summarizer node which tracks summary state.\n\t\t// If trackState is false, get summary from summarizeInternal.\n\t\treturn trackState\n\t\t\t? super.summarize(fullTree, true /* trackState */, telemetryContext)\n\t\t\t: this.summarizeFn(fullTree, trackState, telemetryContext);\n\t}\n\n\t/**\n\t * Returns the GC data of this node. If nothing has changed since last summary, it tries to reuse the data from\n\t * the previous summary. Else, it gets new GC data from the underlying Fluid object.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tassert(\n\t\t\t!this.gcDisabled,\n\t\t\t0x1b2 /* \"Getting GC data should not be called when GC is disabled!\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.getGCDataFn !== undefined,\n\t\t\t0x1b3 /* \"GC data cannot be retrieved without getGCDataFn\" */,\n\t\t);\n\n\t\t// Load GC details from the initial summary, if not already loaded. If this is the first time this function is\n\t\t// called and the node's data has not changed since last summary, the GC data in initial details is returned.\n\t\tawait this.loadBaseGCDetails();\n\n\t\t// If there is no new data since last summary and we have GC data from the previous run, return it. The previous\n\t\t// GC data may not be available if loaded from a snapshot with either GC disabled or before GC was added.\n\t\t// Note - canReuseHandle is checked to be consistent with summarize - generate GC data for nodes for which\n\t\t// summary must be generated.\n\t\tif (\n\t\t\tthis.canReuseHandle &&\n\t\t\t!fullGC &&\n\t\t\t!this.hasDataChanged() &&\n\t\t\tthis.gcData !== undefined\n\t\t) {\n\t\t\treturn cloneGCData(this.gcData);\n\t\t}\n\n\t\tconst gcData = await this.getGCDataFn(fullGC);\n\t\tthis.gcData = cloneGCData(gcData);\n\t\treturn gcData;\n\t}\n\n\t/**\n\t * Called during the start of a summary. Updates the work-in-progress used routes.\n\t */\n\tpublic startSummary(\n\t\treferenceSequenceNumber: number,\n\t\tsummaryLogger: ITelemetryBaseLogger,\n\t\tlatestSummaryRefSeqNum: number,\n\t): IStartSummaryResult {\n\t\t// If GC is disabled, skip setting wip used routes since we should not track GC state.\n\t\tif (!this.gcDisabled) {\n\t\t\tassert(\n\t\t\t\tthis.wipSerializedUsedRoutes === undefined,\n\t\t\t\t0x1b4 /* \"We should not already be tracking used routes when to track a new summary\" */,\n\t\t\t);\n\t\t}\n\t\treturn super.startSummary(referenceSequenceNumber, summaryLogger, latestSummaryRefSeqNum);\n\t}\n\n\t/**\n\t * Validates that the in-progress summary is correct for all nodes, i.e., GC should have run for non-skipped nodes.\n\t * @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when running GC.\n\t * In that case, the children will not have work-in-progress state.\n\t *\n\t * @returns ValidateSummaryResult which contains a boolean success indicating whether the validation was successful.\n\t * In case of failure, additional information is returned indicating type of failure and where it was.\n\t */\n\tprotected validateSummaryCore(parentSkipRecursion: boolean): ValidateSummaryResult {\n\t\tif (this.wasGCMissed()) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\treason: \"NodeDidNotRunGC\",\n\t\t\t\tid: {\n\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\tvalue: this.telemetryNodeId,\n\t\t\t\t},\n\t\t\t\t// These errors are usually transient and should go away when summarize / GC is retried.\n\t\t\t\tretryAfterSeconds: 1,\n\t\t\t};\n\t\t}\n\t\treturn super.validateSummaryCore(parentSkipRecursion);\n\t}\n\n\tprivate wasGCMissed(): boolean {\n\t\t// If GC is disabled, it should not have run so it was not missed.\n\t\t// Otherwise, GC should have been called on this node and wipSerializedUsedRoutes must be set.\n\t\tif (this.gcDisabled || this.wipSerializedUsedRoutes !== undefined) {\n\t\t\treturn false;\n\t\t}\n\t\t/**\n\t\t * The absence of wip used routes indicates that GC was not run on this node. This can happen if:\n\t\t * 1. A child node was created after GC was already run on the parent. For example, a data store\n\t\t * is realized (loaded) after GC was run on it creating summarizer nodes for its DDSes. In this\n\t\t * case, the parent will pass on used routes to the child nodes and it will have wip used routes.\n\t\t * 2. A new node was created but GC was never run on it. This can mean that the GC data generated\n\t\t * during summarize is incomplete.\n\t\t *\n\t\t * This happens due to scenarios such as data store created during summarize. Such errors should go away when\n\t\t * summarize is attempted again.\n\t\t */\n\t\treturn true;\n\t}\n\n\t/**\n\t * Called after summary has been uploaded to the server. Add the work-in-progress state to the pending\n\t * summary queue. We track this until we get an ack from the server for this summary.\n\t * @param proposalHandle - The handle of the summary that was uploaded to the server.\n\t * @param parentPath - The path of the parent node which is used to build the path of this node.\n\t * @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when summarizing.\n\t * In that case, the children will not have work-in-progress state.\n\t */\n\tprotected completeSummaryCore(\n\t\tproposalHandle: string,\n\t\tparentPath: EscapedPath | undefined,\n\t\tparentSkipRecursion: boolean,\n\t) {\n\t\tlet wipSerializedUsedRoutes: string | undefined;\n\t\t// If GC is disabled, don't set wip used routes.\n\t\tif (!this.gcDisabled) {\n\t\t\twipSerializedUsedRoutes = this.wipSerializedUsedRoutes;\n\t\t}\n\n\t\tsuper.completeSummaryCore(proposalHandle, parentPath, parentSkipRecursion);\n\n\t\t// If GC is disabled, skip setting pending summary with GC state.\n\t\tif (!this.gcDisabled) {\n\t\t\tconst summaryNode = this.pendingSummaries.get(proposalHandle);\n\t\t\tif (summaryNode !== undefined) {\n\t\t\t\tconst summaryNodeWithGC = new SummaryNodeWithGC(wipSerializedUsedRoutes, summaryNode);\n\t\t\t\tthis.pendingSummaries.set(proposalHandle, summaryNodeWithGC);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Clears the work-in-progress state.\n\t */\n\tpublic clearSummary() {\n\t\tthis.wipSerializedUsedRoutes = undefined;\n\t\tsuper.clearSummary();\n\t}\n\n\t/**\n\t * Called when we get an ack from the server for a summary we sent. Update the reference state of this node\n\t * from the state in the pending summary queue.\n\t */\n\tprotected refreshLatestSummaryFromPending(\n\t\tproposalHandle: string,\n\t\treferenceSequenceNumber: number,\n\t): void {\n\t\t// If GC is disabled, skip setting referenced used routes since we are not tracking GC state.\n\t\tif (!this.gcDisabled) {\n\t\t\tconst summaryNode = this.pendingSummaries.get(proposalHandle);\n\t\t\tif (summaryNode !== undefined) {\n\t\t\t\t// If a pending summary exists, it must have used routes since GC is enabled.\n\t\t\t\tconst summaryNodeWithGC = summaryNode as SummaryNodeWithGC;\n\t\t\t\tif (summaryNodeWithGC.serializedUsedRoutes === undefined) {\n\t\t\t\t\tconst error = new LoggingError(\"MissingGCStateInPendingSummary\", {\n\t\t\t\t\t\tproposalHandle,\n\t\t\t\t\t\treferenceSequenceNumber,\n\t\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\t\tid: this.telemetryNodeId,\n\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: error.message,\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror,\n\t\t\t\t\t);\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tthis.referenceUsedRoutes = JSON.parse(summaryNodeWithGC.serializedUsedRoutes);\n\t\t\t}\n\t\t}\n\n\t\treturn super.refreshLatestSummaryFromPending(proposalHandle, referenceSequenceNumber);\n\t}\n\n\t/**\n\t * Override the createChild method to return an instance of SummarizerNodeWithGC.\n\t */\n\tpublic createChild(\n\t\t/** Summarize function */\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\t/** Initial id or path part of this node */\n\t\tid: string,\n\t\t/**\n\t\t * Information needed to create the node.\n\t\t * If it is from a base summary, it will assert that a summary has been seen.\n\t\t * Attach information if it is created from an attach op.\n\t\t */\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t\tconfig: ISummarizerNodeConfigWithGC = {},\n\t\tgetGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\t): ISummarizerNodeWithGC {\n\t\tassert(!this.children.has(id), 0x1b6 /* \"Create SummarizerNode child already exists\" */);\n\t\t/**\n\t\t * Update the child node's base GC details from this node's current GC details instead of updating from the base\n\t\t * GC details of this node. This will handle scenarios where the GC details was updated during refresh from\n\t\t * snapshot and the child node wasn't created then. If a child is created after that, its GC details should be\n\t\t * the one from the downloaded snapshot and not the base GC details.\n\t\t */\n\t\tconst getChildBaseGCDetailsFn = async () => {\n\t\t\tconst childNodesBaseGCDetails = await this.childNodesBaseGCDetailsP;\n\t\t\treturn childNodesBaseGCDetails.get(id) ?? {};\n\t\t};\n\n\t\tconst createDetails: ICreateChildDetails = this.getCreateDetailsForChild(id, createParam);\n\t\tconst child = new SummarizerNodeWithGC(\n\t\t\tthis.logger,\n\t\t\tsummarizeInternalFn,\n\t\t\t{\n\t\t\t\t...config,\n\t\t\t\t// Propagate our gcDisabled state to the child if its not explicity specified in child's config.\n\t\t\t\tgcDisabled: config.gcDisabled ?? this.gcDisabled,\n\t\t\t},\n\t\t\tcreateDetails.changeSequenceNumber,\n\t\t\tcreateDetails.latestSummary,\n\t\t\tthis.wipSummaryLogger,\n\t\t\tgetGCDataFn,\n\t\t\tgetChildBaseGCDetailsFn,\n\t\t\tcreateDetails.telemetryNodeId,\n\t\t);\n\n\t\t// There may be additional state that has to be updated in this child. For example, if a summary is being\n\t\t// tracked, the child's summary tracking state needs to be updated too.\n\t\tthis.maybeUpdateChildState(child, id);\n\n\t\tthis.children.set(id, child);\n\t\treturn child;\n\t}\n\n\t/**\n\t * Updates the state of the child if required. For example, if a summary is currently being tracked, the child's\n\t * summary tracking state needs to be updated too.\n\t * Also, in case a child node gets realized in between Summary Op and Summary Ack, let's initialize the child's\n\t * pending summary as well. Finally, if the pendingSummaries entries have serializedRoutes, replicate them to the\n\t * pendingSummaries from the child nodes.\n\t * @param child - The child node whose state is to be updated.\n\t * @param id - Initial id or path part of this node\n\t */\n\tprotected maybeUpdateChildState(child: SummarizerNodeWithGC, id: string) {\n\t\tsuper.maybeUpdateChildState(child, id);\n\n\t\t// In case we have pending summaries on the parent, let's initialize it on the child.\n\t\tif (child.latestSummary !== undefined) {\n\t\t\tfor (const [key, value] of this.pendingSummaries.entries()) {\n\t\t\t\tconst summaryNodeWithGC = value as SummaryNodeWithGC;\n\t\t\t\tif (summaryNodeWithGC.serializedUsedRoutes !== undefined) {\n\t\t\t\t\tconst childNodeUsedRoutes = unpackChildNodesUsedRoutes(\n\t\t\t\t\t\tJSON.parse(summaryNodeWithGC.serializedUsedRoutes),\n\t\t\t\t\t);\n\t\t\t\t\tconst newSerializedRoutes = childNodeUsedRoutes.get(id) ?? [\"\"];\n\t\t\t\t\tconst newLatestSummaryNode = new SummaryNodeWithGC(\n\t\t\t\t\t\tJSON.stringify(newSerializedRoutes),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treferenceSequenceNumber: value.referenceSequenceNumber,\n\t\t\t\t\t\t\tbasePath: child.latestSummary.basePath,\n\t\t\t\t\t\t\tlocalPath: child.latestSummary.localPath,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t\tchild.addPendingSummary(key, newLatestSummaryNode);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Deletes the child node with the given id.\n\t */\n\tpublic deleteChild(id: string): void {\n\t\tthis.children.delete(id);\n\t}\n\n\t/**\n\t * Override the getChild method to return an instance of SummarizerNodeWithGC.\n\t */\n\tpublic getChild(id: string): ISummarizerNodeWithGC | undefined {\n\t\treturn this.children.get(id) as SummarizerNodeWithGC;\n\t}\n\n\tpublic isReferenced(): boolean {\n\t\treturn this.usedRoutes.includes(\"\") || this.usedRoutes.includes(\"/\");\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t// Sort the given routes before updating. This will ensure that the routes compared in hasUsedStateChanged()\n\t\t// are in the same order.\n\t\tthis.usedRoutes = usedRoutes.sort();\n\n\t\t// If GC is not disabled and a summary is in progress, update the work-in-progress used routes so that it can\n\t\t// be tracked for this summary.\n\t\tif (!this.gcDisabled && this.isSummaryInProgress()) {\n\t\t\tthis.wipSerializedUsedRoutes = JSON.stringify(this.usedRoutes);\n\t\t}\n\t}\n\n\t/**\n\t * Override the hasChanged method. If this node data or its used state changed, the node is considered changed.\n\t */\n\tprotected hasChanged(): boolean {\n\t\treturn this.hasDataChanged() || this.hasUsedStateChanged();\n\t}\n\n\t/**\n\t * This tells whether the data in this node has changed or not.\n\t */\n\tprivate hasDataChanged(): boolean {\n\t\treturn super.hasChanged();\n\t}\n\n\t/**\n\t * This tells whether the used state of this node has changed since last successful summary. If the used routes\n\t * of this node changed, its used state is considered changed. Basically, if this node or any of its child nodes\n\t * was previously used and became unused (or vice versa), its used state has changed.\n\t */\n\tprivate hasUsedStateChanged(): boolean {\n\t\t// If GC is disabled, it should not affect summary state, return false.\n\t\tif (this.gcDisabled) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn (\n\t\t\tthis.referenceUsedRoutes === undefined ||\n\t\t\tJSON.stringify(this.usedRoutes) !== JSON.stringify(this.referenceUsedRoutes)\n\t\t);\n\t}\n}\n\n/**\n * Creates a root summarizer node with GC functionality built-in.\n * @param logger - Logger to use within SummarizerNode\n * @param summarizeInternalFn - Function to generate summary\n * @param changeSequenceNumber - Sequence number of latest change to new node/subtree\n * @param referenceSequenceNumber - Reference sequence number of last acked summary,\n * or undefined if not loaded from summary\n * @param config - Configure behavior of summarizer node\n * @param getGCDataFn - Function to get the GC data of this node\n * @param baseGCDetailsP - Function to get the initial GC details of this node\n */\nexport const createRootSummarizerNodeWithGC = (\n\tlogger: ITelemetryBaseLogger,\n\tsummarizeInternalFn: SummarizeInternalFn,\n\tchangeSequenceNumber: number,\n\treferenceSequenceNumber: number | undefined,\n\tconfig: ISummarizerNodeConfigWithGC = {},\n\tgetGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\tgetBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n): IRootSummarizerNodeWithGC =>\n\tnew SummarizerNodeWithGC(\n\t\tlogger,\n\t\tsummarizeInternalFn,\n\t\tconfig,\n\t\tchangeSequenceNumber,\n\t\treferenceSequenceNumber === undefined\n\t\t\t? undefined\n\t\t\t: SummaryNode.createForRoot(referenceSequenceNumber),\n\t\tundefined /* wipSummaryLogger */,\n\t\tgetGCDataFn,\n\t\tgetBaseGCDetailsFn,\n\t\t\"\" /* telemetryId */,\n\t);\n"]}
1
+ {"version":3,"file":"summarizerNodeWithGc.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeWithGc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAS1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EACN,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,GAChB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAKN,WAAW,GAEX,MAAM,0BAA0B,CAAC;AAMlC,wDAAwD;AACxD,MAAM,iBAAkB,SAAQ,WAAW;IAC1C,YACiB,oBAAwC,EACxD,OAKC;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QARC,yBAAoB,GAApB,oBAAoB,CAAoB;IASzD,CAAC;CACD;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,oBAAqB,SAAQ,cAAc;IA+BvD;;;OAGG;IACH,YACC,MAA4B,EAC5B,mBAAwC,EACxC,MAAmC,EACnC,oBAA4B;I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S,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAC5E,CAAC;IACH,CAAC;CACD;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAC7C,MAA4B,EAC5B,mBAAwC,EACxC,oBAA4B,EAC5B,uBAA2C,EAC3C,SAAsC,EAAE,EACxC,WAAmE,EACnE,kBAAiE,EACrC,EAAE,CAC9B,IAAI,oBAAoB,CACvB,MAAM,EACN,mBAAmB,EACnB,MAAM,EACN,oBAAoB,EACpB,uBAAuB,KAAK,SAAS;IACpC,CAAC,CAAC,SAAS;IACX,CAAC,CAAC,WAAW,CAAC,aAAa,CAAC,uBAAuB,CAAC,EACrD,SAAS,CAAC,sBAAsB,EAChC,WAAW,EACX,kBAAkB,EAClB,EAAE,CAAC,iBAAiB,CACpB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIGarbageCollectionData,\n\tCreateChildSummarizerNodeParam,\n\tIGarbageCollectionDetailsBase,\n\tISummarizerNodeConfigWithGC,\n\tISummarizerNodeWithGC,\n\tSummarizeInternalFn,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { unpackChildNodesUsedRoutes } from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tLoggingError,\n\tTelemetryDataTag,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { cloneGCData, unpackChildNodesGCDetails } from \"../../gc/index.js\";\n\nimport { SummarizerNode } from \"./summarizerNode.js\";\nimport {\n\tEscapedPath,\n\tICreateChildDetails,\n\tIStartSummaryResult,\n\tISummarizerNodeRootContract,\n\tSummaryNode,\n\tValidateSummaryResult,\n} from \"./summarizerNodeUtils.js\";\n\nexport interface IRootSummarizerNodeWithGC\n\textends ISummarizerNodeWithGC,\n\t\tISummarizerNodeRootContract {}\n\n// Extend SummaryNode to add used routes tracking to it.\nclass SummaryNodeWithGC extends SummaryNode {\n\tconstructor(\n\t\tpublic readonly serializedUsedRoutes: string | undefined,\n\t\tsummary: {\n\t\t\treadonly referenceSequenceNumber: number;\n\t\t\treadonly basePath: EscapedPath | undefined;\n\t\t\treadonly localPath: EscapedPath;\n\t\t\tadditionalPath?: EscapedPath;\n\t\t},\n\t) {\n\t\tsuper(summary);\n\t}\n}\n\n/**\n * Extends the functionality of SummarizerNode to manage this node's garbage collection data:\n *\n * - Adds a new API `getGCData` to return GC data of this node.\n *\n * - Caches the result of `getGCData` to be used if nothing changes between summaries.\n *\n * - Manages the used routes of this node. These are used to identify if this node is referenced in the document\n * and to determine if the node's used state changed since last summary.\n *\n * - Adds trackState param to summarize. If trackState is false, it bypasses the SummarizerNode and calls\n * directly into summarizeInternal method.\n */\nexport class SummarizerNodeWithGC extends SummarizerNode implements IRootSummarizerNodeWithGC {\n\t// Tracks the work-in-progress used routes during summary.\n\tprivate wipSerializedUsedRoutes: string | undefined;\n\n\t// Tracks the work-in-progress used routes of child nodes during summary.\n\tprivate wipChildNodesUsedRoutes: Map<string, string[]> | undefined;\n\n\t// This is the last known used routes of this node as seen by the server as part of a summary.\n\tprivate referenceUsedRoutes: string[] | undefined;\n\n\t// The base GC details of this node used to initialize the GC state.\n\tprivate readonly baseGCDetailsP: Promise<IGarbageCollectionDetailsBase>;\n\n\t// Keeps track of whether we have loaded the base details to ensure that we only do it once.\n\tprivate baseGCDetailsLoaded: boolean = false;\n\n\t// The base GC details for the child nodes. This is passed to child nodes when creating them.\n\tprivate readonly childNodesBaseGCDetailsP: Promise<\n\t\tMap<string, IGarbageCollectionDetailsBase>\n\t>;\n\n\tprivate gcData: IGarbageCollectionData | undefined;\n\n\t// Set used routes to have self route by default. This makes the node referenced by default. This is done to ensure\n\t// that this node is not marked as collected when running GC has been disabled. Once, the option to disable GC is\n\t// removed (from runGC flag in IContainerRuntimeOptions), this should be changed to be have no routes by default.\n\tprivate usedRoutes: string[] = [\"\"];\n\n\t// True if GC is disabled for this node. If so, do not track GC specific state for a summary.\n\tprivate readonly gcDisabled: boolean;\n\n\t/**\n\t * Do not call constructor directly.\n\t * Use createRootSummarizerNodeWithGC to create root node, or createChild to create child nodes.\n\t */\n\tpublic constructor(\n\t\tlogger: ITelemetryBaseLogger,\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\tconfig: ISummarizerNodeConfigWithGC,\n\t\tchangeSequenceNumber: number,\n\t\t/** Undefined means created without summary */\n\t\tlatestSummary?: SummaryNode,\n\t\twipSummaryLogger?: ITelemetryBaseLogger,\n\t\tprivate readonly getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\t\tgetBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n\t\t/** A unique id of this node to be logged when sending telemetry. */\n\t\ttelemetryId?: string,\n\t) {\n\t\tsuper(\n\t\t\tlogger,\n\t\t\tsummarizeInternalFn,\n\t\t\tconfig,\n\t\t\tchangeSequenceNumber,\n\t\t\tlatestSummary,\n\t\t\twipSummaryLogger,\n\t\t\ttelemetryId,\n\t\t);\n\n\t\tthis.gcDisabled = config.gcDisabled === true;\n\n\t\tthis.baseGCDetailsP = new LazyPromise(async () => {\n\t\t\treturn (await getBaseGCDetailsFn?.()) ?? { usedRoutes: [] };\n\t\t});\n\n\t\tthis.childNodesBaseGCDetailsP = new LazyPromise(async () => {\n\t\t\tawait this.loadBaseGCDetails();\n\t\t\treturn unpackChildNodesGCDetails({ gcData: this.gcData, usedRoutes: this.usedRoutes });\n\t\t});\n\t}\n\n\t/**\n\t * Loads state from this node's initial GC summary details. This contains the following data from the last summary\n\t * seen by the server for this client:\n\t * - usedRoutes: This is used to figure out if the used state of this node changed since last summary.\n\t * - gcData: The garbage collection data of this node that is required for running GC.\n\t */\n\tprivate async loadBaseGCDetails() {\n\t\tif (this.baseGCDetailsLoaded) {\n\t\t\treturn;\n\t\t}\n\t\tconst baseGCDetails = await this.baseGCDetailsP;\n\n\t\t// Possible race - If there were parallel calls to loadBaseGCDetails, we want to make sure that we update\n\t\t// the state from the base details only once.\n\t\tif (this.baseGCDetailsLoaded) {\n\t\t\treturn;\n\t\t}\n\t\tthis.baseGCDetailsLoaded = true;\n\n\t\t// Update GC data, used routes and reference used routes. The used routes are sorted because they are compared\n\t\t// across GC runs to check if they changed. Sorting ensures that the elements are in the same order.\n\t\t// If the GC details has GC data, initialize our GC data from it.\n\t\tif (baseGCDetails.gcData !== undefined) {\n\t\t\tthis.gcData = cloneGCData(baseGCDetails.gcData);\n\t\t}\n\t\tif (baseGCDetails.usedRoutes !== undefined) {\n\t\t\tthis.usedRoutes = Array.from(baseGCDetails.usedRoutes).sort();\n\t\t\tthis.referenceUsedRoutes = Array.from(baseGCDetails.usedRoutes).sort();\n\t\t}\n\t}\n\n\t/**\n\t * Returns the GC data of this node. If nothing has changed since last summary, it tries to reuse the data from\n\t * the previous summary. Else, it gets new GC data from the underlying Fluid object.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tassert(\n\t\t\t!this.gcDisabled,\n\t\t\t0x1b2 /* \"Getting GC data should not be called when GC is disabled!\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.getGCDataFn !== undefined,\n\t\t\t0x1b3 /* \"GC data cannot be retrieved without getGCDataFn\" */,\n\t\t);\n\n\t\t// Load GC details from the initial summary, if not already loaded. If this is the first time this function is\n\t\t// called and the node's data has not changed since last summary, the GC data in initial details is returned.\n\t\tawait this.loadBaseGCDetails();\n\n\t\t// If there is no new data since last summary and we have GC data from the previous run, return it. The previous\n\t\t// GC data may not be available if loaded from a snapshot with either GC disabled or before GC was added.\n\t\t// Note - canReuseHandle is checked to be consistent with summarize - generate GC data for nodes for which\n\t\t// summary must be generated.\n\t\tif (\n\t\t\tthis.canReuseHandle &&\n\t\t\t!fullGC &&\n\t\t\t!this.hasDataChanged() &&\n\t\t\tthis.gcData !== undefined\n\t\t) {\n\t\t\treturn cloneGCData(this.gcData);\n\t\t}\n\n\t\tconst gcData = await this.getGCDataFn(fullGC);\n\t\tthis.gcData = cloneGCData(gcData);\n\t\treturn gcData;\n\t}\n\n\t/**\n\t * Called during the start of a summary. Updates the work-in-progress used routes.\n\t */\n\tpublic startSummary(\n\t\treferenceSequenceNumber: number,\n\t\tsummaryLogger: ITelemetryBaseLogger,\n\t\tlatestSummaryRefSeqNum: number,\n\t): IStartSummaryResult {\n\t\t// If GC is disabled, skip setting wip used routes since we should not track GC state.\n\t\tif (!this.gcDisabled) {\n\t\t\tassert(\n\t\t\t\tthis.wipSerializedUsedRoutes === undefined,\n\t\t\t\t0x1b4 /* \"We should not already be tracking used routes when to track a new summary\" */,\n\t\t\t);\n\t\t}\n\t\treturn super.startSummary(referenceSequenceNumber, summaryLogger, latestSummaryRefSeqNum);\n\t}\n\n\t/**\n\t * Validates that the in-progress summary is correct for all nodes, i.e., GC should have run for non-skipped nodes.\n\t * @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when running GC.\n\t * In that case, the children will not have work-in-progress state.\n\t *\n\t * @returns ValidateSummaryResult which contains a boolean success indicating whether the validation was successful.\n\t * In case of failure, additional information is returned indicating type of failure and where it was.\n\t */\n\tprotected validateSummaryCore(parentSkipRecursion: boolean): ValidateSummaryResult {\n\t\tif (this.wasGCMissed()) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\treason: \"NodeDidNotRunGC\",\n\t\t\t\tid: {\n\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\tvalue: this.telemetryNodeId,\n\t\t\t\t},\n\t\t\t\t// These errors are usually transient and should go away when summarize / GC is retried.\n\t\t\t\tretryAfterSeconds: 1,\n\t\t\t};\n\t\t}\n\t\treturn super.validateSummaryCore(parentSkipRecursion);\n\t}\n\n\tprivate wasGCMissed(): boolean {\n\t\t// If GC is disabled, it should not have run so it was not missed.\n\t\t// Otherwise, GC should have been called on this node and wipSerializedUsedRoutes must be set.\n\t\tif (this.gcDisabled || this.wipSerializedUsedRoutes !== undefined) {\n\t\t\treturn false;\n\t\t}\n\t\t/**\n\t\t * The absence of wip used routes indicates that GC was not run on this node. This can happen if:\n\t\t * 1. A child node was created after GC was already run on the parent. For example, a data store\n\t\t * is realized (loaded) after GC was run on it creating summarizer nodes for its DDSes. In this\n\t\t * case, the parent will pass on used routes to the child nodes and it will have wip used routes.\n\t\t * 2. A new node was created but GC was never run on it. This can mean that the GC data generated\n\t\t * during summarize is incomplete.\n\t\t *\n\t\t * This happens due to scenarios such as data store created during summarize. Such errors should go away when\n\t\t * summarize is attempted again.\n\t\t */\n\t\treturn true;\n\t}\n\n\t/**\n\t * Called after summary has been uploaded to the server. Add the work-in-progress state to the pending\n\t * summary queue. We track this until we get an ack from the server for this summary.\n\t * @param proposalHandle - The handle of the summary that was uploaded to the server.\n\t * @param parentPath - The path of the parent node which is used to build the path of this node.\n\t * @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when summarizing.\n\t * In that case, the children will not have work-in-progress state.\n\t */\n\tprotected completeSummaryCore(\n\t\tproposalHandle: string,\n\t\tparentPath: EscapedPath | undefined,\n\t\tparentSkipRecursion: boolean,\n\t) {\n\t\tlet wipSerializedUsedRoutes: string | undefined;\n\t\t// If GC is disabled, don't set wip used routes.\n\t\tif (!this.gcDisabled) {\n\t\t\twipSerializedUsedRoutes = this.wipSerializedUsedRoutes;\n\t\t}\n\n\t\tsuper.completeSummaryCore(proposalHandle, parentPath, parentSkipRecursion);\n\n\t\t// If GC is disabled, skip setting pending summary with GC state.\n\t\tif (!this.gcDisabled) {\n\t\t\tconst summaryNode = this.pendingSummaries.get(proposalHandle);\n\t\t\tif (summaryNode !== undefined) {\n\t\t\t\tconst summaryNodeWithGC = new SummaryNodeWithGC(wipSerializedUsedRoutes, summaryNode);\n\t\t\t\tthis.pendingSummaries.set(proposalHandle, summaryNodeWithGC);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Clears the work-in-progress state.\n\t */\n\tpublic clearSummary() {\n\t\tthis.wipSerializedUsedRoutes = undefined;\n\t\tthis.wipChildNodesUsedRoutes = undefined;\n\t\tsuper.clearSummary();\n\t}\n\n\t/**\n\t * Called when we get an ack from the server for a summary we sent. Update the reference state of this node\n\t * from the state in the pending summary queue.\n\t */\n\tprotected refreshLatestSummaryFromPending(\n\t\tproposalHandle: string,\n\t\treferenceSequenceNumber: number,\n\t): void {\n\t\t// If GC is disabled, skip setting referenced used routes since we are not tracking GC state.\n\t\tif (!this.gcDisabled) {\n\t\t\tconst summaryNode = this.pendingSummaries.get(proposalHandle);\n\t\t\tif (summaryNode !== undefined) {\n\t\t\t\t// If a pending summary exists, it must have used routes since GC is enabled.\n\t\t\t\tconst summaryNodeWithGC = summaryNode as SummaryNodeWithGC;\n\t\t\t\tif (summaryNodeWithGC.serializedUsedRoutes === undefined) {\n\t\t\t\t\tconst error = new LoggingError(\"MissingGCStateInPendingSummary\", {\n\t\t\t\t\t\tproposalHandle,\n\t\t\t\t\t\treferenceSequenceNumber,\n\t\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\t\tid: this.telemetryNodeId,\n\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: error.message,\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror,\n\t\t\t\t\t);\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tthis.referenceUsedRoutes = JSON.parse(summaryNodeWithGC.serializedUsedRoutes);\n\t\t\t}\n\t\t}\n\n\t\treturn super.refreshLatestSummaryFromPending(proposalHandle, referenceSequenceNumber);\n\t}\n\n\t/**\n\t * Override the createChild method to return an instance of SummarizerNodeWithGC.\n\t */\n\tpublic createChild(\n\t\t/** Summarize function */\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\t/** Initial id or path part of this node */\n\t\tid: string,\n\t\t/**\n\t\t * Information needed to create the node.\n\t\t * If it is from a base summary, it will assert that a summary has been seen.\n\t\t * Attach information if it is created from an attach op.\n\t\t */\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t\tconfig: ISummarizerNodeConfigWithGC = {},\n\t\tgetGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\t): ISummarizerNodeWithGC {\n\t\tassert(!this.children.has(id), 0x1b6 /* \"Create SummarizerNode child already exists\" */);\n\t\t/**\n\t\t * Update the child node's base GC details from this node's current GC details instead of updating from the base\n\t\t * GC details of this node. This will handle scenarios where the GC details was updated during refresh from\n\t\t * snapshot and the child node wasn't created then. If a child is created after that, its GC details should be\n\t\t * the one from the downloaded snapshot and not the base GC details.\n\t\t */\n\t\tconst getChildBaseGCDetailsFn = async () => {\n\t\t\tconst childNodesBaseGCDetails = await this.childNodesBaseGCDetailsP;\n\t\t\treturn childNodesBaseGCDetails.get(id) ?? {};\n\t\t};\n\n\t\tconst createDetails: ICreateChildDetails = this.getCreateDetailsForChild(id, createParam);\n\t\tconst child = new SummarizerNodeWithGC(\n\t\t\tthis.logger,\n\t\t\tsummarizeInternalFn,\n\t\t\t{\n\t\t\t\t...config,\n\t\t\t\t// Propagate our gcDisabled state to the child if its not explicity specified in child's config.\n\t\t\t\tgcDisabled: config.gcDisabled ?? this.gcDisabled,\n\t\t\t},\n\t\t\tcreateDetails.changeSequenceNumber,\n\t\t\tcreateDetails.latestSummary,\n\t\t\tthis.wipSummaryLogger,\n\t\t\tgetGCDataFn,\n\t\t\tgetChildBaseGCDetailsFn,\n\t\t\tcreateDetails.telemetryNodeId,\n\t\t);\n\n\t\t// There may be additional state that has to be updated in this child. For example, if a summary is being\n\t\t// tracked, the child's summary tracking state needs to be updated too.\n\t\tthis.maybeUpdateChildState(child, id);\n\n\t\tthis.children.set(id, child);\n\t\treturn child;\n\t}\n\n\t/**\n\t * Updates the state of the child if required. For example, if a summary is currently being tracked, the child's\n\t * summary tracking state needs to be updated too.\n\t * Also, in case a child node gets realized in between Summary Op and Summary Ack, let's initialize the child's\n\t * pending summary as well. Finally, if the pendingSummaries entries have serializedRoutes, replicate them to the\n\t * pendingSummaries from the child nodes.\n\t * @param child - The child node whose state is to be updated.\n\t * @param id - Initial id or path part of this node\n\t */\n\tprotected maybeUpdateChildState(child: SummarizerNodeWithGC, id: string) {\n\t\tsuper.maybeUpdateChildState(child, id);\n\n\t\t// If GC has run on this node and summarization isn't complete, this.wipSerializedUsedRoutes will be defined.\n\t\t// In that case, update the used routes of the child node. This can happen in scenarios where a data store\n\t\t// doesn't have any ops but its reference state changed. So, it gets realized during summarize after GC ran\n\t\t// so GC would not have run on this node which is fine.\n\t\tif (this.wipSerializedUsedRoutes !== undefined) {\n\t\t\t// If the child route used routes are not defined, initialize it now and it can be used for all child nodes\n\t\t\t// created until this summarization process is completed. This is an optimization to unpack the used routes\n\t\t\t// only when needed.\n\t\t\tif (this.wipChildNodesUsedRoutes === undefined) {\n\t\t\t\tthis.wipChildNodesUsedRoutes = unpackChildNodesUsedRoutes(this.usedRoutes);\n\t\t\t}\n\t\t\tchild.updateUsedRoutes(this.wipChildNodesUsedRoutes.get(id) ?? [\"\"]);\n\t\t}\n\n\t\t// In case we have pending summaries on the parent, let's initialize it on the child.\n\t\tif (child.latestSummary !== undefined) {\n\t\t\tfor (const [key, value] of this.pendingSummaries.entries()) {\n\t\t\t\tconst summaryNodeWithGC = value as SummaryNodeWithGC;\n\t\t\t\tif (summaryNodeWithGC.serializedUsedRoutes !== undefined) {\n\t\t\t\t\tconst childNodeUsedRoutes = unpackChildNodesUsedRoutes(\n\t\t\t\t\t\tJSON.parse(summaryNodeWithGC.serializedUsedRoutes),\n\t\t\t\t\t);\n\t\t\t\t\tconst newSerializedRoutes = childNodeUsedRoutes.get(id) ?? [\"\"];\n\t\t\t\t\tconst newLatestSummaryNode = new SummaryNodeWithGC(\n\t\t\t\t\t\tJSON.stringify(newSerializedRoutes),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treferenceSequenceNumber: value.referenceSequenceNumber,\n\t\t\t\t\t\t\tbasePath: child.latestSummary.basePath,\n\t\t\t\t\t\t\tlocalPath: child.latestSummary.localPath,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t\tchild.addPendingSummary(key, newLatestSummaryNode);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Deletes the child node with the given id.\n\t */\n\tpublic deleteChild(id: string): void {\n\t\tthis.children.delete(id);\n\t}\n\n\t/**\n\t * Override the getChild method to return an instance of SummarizerNodeWithGC.\n\t */\n\tpublic getChild(id: string): ISummarizerNodeWithGC | undefined {\n\t\treturn this.children.get(id) as SummarizerNodeWithGC;\n\t}\n\n\tpublic isReferenced(): boolean {\n\t\treturn this.usedRoutes.includes(\"\") || this.usedRoutes.includes(\"/\");\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t// Sort the given routes before updating. This will ensure that the routes compared in hasUsedStateChanged()\n\t\t// are in the same order.\n\t\tthis.usedRoutes = usedRoutes.sort();\n\n\t\t// If GC is not disabled and a summary is in progress, update the work-in-progress used routes so that it can\n\t\t// be tracked for this summary.\n\t\tif (!this.gcDisabled && this.isSummaryInProgress()) {\n\t\t\tthis.wipSerializedUsedRoutes = JSON.stringify(this.usedRoutes);\n\t\t}\n\t}\n\n\t/**\n\t * Override the hasChanged method. If this node data or its used state changed, the node is considered changed.\n\t */\n\tprotected hasChanged(): boolean {\n\t\treturn this.hasDataChanged() || this.hasUsedStateChanged();\n\t}\n\n\t/**\n\t * This tells whether the data in this node has changed or not.\n\t */\n\tprivate hasDataChanged(): boolean {\n\t\treturn super.hasChanged();\n\t}\n\n\t/**\n\t * This tells whether the used state of this node has changed since last successful summary. If the used routes\n\t * of this node changed, its used state is considered changed. Basically, if this node or any of its child nodes\n\t * was previously used and became unused (or vice versa), its used state has changed.\n\t */\n\tprivate hasUsedStateChanged(): boolean {\n\t\t// If GC is disabled, it should not affect summary state, return false.\n\t\tif (this.gcDisabled) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn (\n\t\t\tthis.referenceUsedRoutes === undefined ||\n\t\t\tJSON.stringify(this.usedRoutes) !== JSON.stringify(this.referenceUsedRoutes)\n\t\t);\n\t}\n}\n\n/**\n * Creates a root summarizer node with GC functionality built-in.\n * @param logger - Logger to use within SummarizerNode\n * @param summarizeInternalFn - Function to generate summary\n * @param changeSequenceNumber - Sequence number of latest change to new node/subtree\n * @param referenceSequenceNumber - Reference sequence number of last acked summary,\n * or undefined if not loaded from summary\n * @param config - Configure behavior of summarizer node\n * @param getGCDataFn - Function to get the GC data of this node\n * @param baseGCDetailsP - Function to get the initial GC details of this node\n */\nexport const createRootSummarizerNodeWithGC = (\n\tlogger: ITelemetryBaseLogger,\n\tsummarizeInternalFn: SummarizeInternalFn,\n\tchangeSequenceNumber: number,\n\treferenceSequenceNumber: number | undefined,\n\tconfig: ISummarizerNodeConfigWithGC = {},\n\tgetGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\tgetBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n): IRootSummarizerNodeWithGC =>\n\tnew SummarizerNodeWithGC(\n\t\tlogger,\n\t\tsummarizeInternalFn,\n\t\tconfig,\n\t\tchangeSequenceNumber,\n\t\treferenceSequenceNumber === undefined\n\t\t\t? undefined\n\t\t\t: SummaryNode.createForRoot(referenceSequenceNumber),\n\t\tundefined /* wipSummaryLogger */,\n\t\tgetGCDataFn,\n\t\tgetBaseGCDetailsFn,\n\t\t\"\" /* telemetryId */,\n\t);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/container-runtime",
3
- "version": "2.1.0",
3
+ "version": "2.3.0-288113",
4
4
  "description": "Fluid container runtime",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -127,18 +127,18 @@
127
127
  "temp-directory": "nyc/.nyc_output"
128
128
  },
129
129
  "dependencies": {
130
- "@fluid-internal/client-utils": "~2.1.0",
131
- "@fluidframework/container-definitions": "~2.1.0",
132
- "@fluidframework/container-runtime-definitions": "~2.1.0",
133
- "@fluidframework/core-interfaces": "~2.1.0",
134
- "@fluidframework/core-utils": "~2.1.0",
135
- "@fluidframework/datastore": "~2.1.0",
136
- "@fluidframework/driver-definitions": "~2.1.0",
137
- "@fluidframework/driver-utils": "~2.1.0",
138
- "@fluidframework/id-compressor": "~2.1.0",
139
- "@fluidframework/runtime-definitions": "~2.1.0",
140
- "@fluidframework/runtime-utils": "~2.1.0",
141
- "@fluidframework/telemetry-utils": "~2.1.0",
130
+ "@fluid-internal/client-utils": "2.3.0-288113",
131
+ "@fluidframework/container-definitions": "2.3.0-288113",
132
+ "@fluidframework/container-runtime-definitions": "2.3.0-288113",
133
+ "@fluidframework/core-interfaces": "2.3.0-288113",
134
+ "@fluidframework/core-utils": "2.3.0-288113",
135
+ "@fluidframework/datastore": "2.3.0-288113",
136
+ "@fluidframework/driver-definitions": "2.3.0-288113",
137
+ "@fluidframework/driver-utils": "2.3.0-288113",
138
+ "@fluidframework/id-compressor": "2.3.0-288113",
139
+ "@fluidframework/runtime-definitions": "2.3.0-288113",
140
+ "@fluidframework/runtime-utils": "2.3.0-288113",
141
+ "@fluidframework/telemetry-utils": "2.3.0-288113",
142
142
  "@tylerbu/sorted-btree-es6": "^1.8.0",
143
143
  "double-ended-queue": "^2.1.0-0",
144
144
  "lz4js": "^0.2.0",
@@ -147,16 +147,16 @@
147
147
  "devDependencies": {
148
148
  "@arethetypeswrong/cli": "^0.15.2",
149
149
  "@biomejs/biome": "~1.8.3",
150
- "@fluid-internal/mocha-test-setup": "~2.1.0",
151
- "@fluid-private/stochastic-test-utils": "~2.1.0",
152
- "@fluid-private/test-pairwise-generator": "~2.1.0",
153
- "@fluid-tools/benchmark": "^0.48.0",
154
- "@fluid-tools/build-cli": "^0.41.0",
150
+ "@fluid-internal/mocha-test-setup": "2.3.0-288113",
151
+ "@fluid-private/stochastic-test-utils": "2.3.0-288113",
152
+ "@fluid-private/test-pairwise-generator": "2.3.0-288113",
153
+ "@fluid-tools/benchmark": "^0.50.0",
154
+ "@fluid-tools/build-cli": "^0.43.0",
155
155
  "@fluidframework/build-common": "^2.0.3",
156
- "@fluidframework/build-tools": "^0.41.0",
157
- "@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.0.0",
156
+ "@fluidframework/build-tools": "^0.43.0",
157
+ "@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.2.0",
158
158
  "@fluidframework/eslint-config-fluid": "^5.3.0",
159
- "@fluidframework/test-runtime-utils": "~2.1.0",
159
+ "@fluidframework/test-runtime-utils": "2.3.0-288113",
160
160
  "@microsoft/api-extractor": "^7.45.1",
161
161
  "@types/double-ended-queue": "^2.1.0",
162
162
  "@types/mocha": "^9.1.1",
@@ -178,20 +178,7 @@
178
178
  "typescript": "~5.4.5"
179
179
  },
180
180
  "typeValidation": {
181
- "broken": {
182
- "Class_LocalFluidDataStoreContext": {
183
- "forwardCompat": false
184
- },
185
- "Class_FluidDataStoreContext": {
186
- "forwardCompat": false
187
- },
188
- "Class_LocalFluidDataStoreContextBase": {
189
- "forwardCompat": false
190
- },
191
- "Interface_IGCNodeUpdatedProps": {
192
- "backCompat": false
193
- }
194
- }
181
+ "broken": {}
195
182
  },
196
183
  "scripts": {
197
184
  "api": "fluid-build . --task api",
@@ -13,6 +13,8 @@ import {
13
13
  createChildLogger,
14
14
  } from "@fluidframework/telemetry-utils/internal";
15
15
 
16
+ type BatchTrackerMessage = Pick<ISequencedDocumentMessage, "sequenceNumber">;
17
+
16
18
  export class BatchTracker {
17
19
  private readonly logger: ITelemetryLoggerExt;
18
20
  private startBatchSequenceNumber: number | undefined;
@@ -28,7 +30,7 @@ export class BatchTracker {
28
30
  ) {
29
31
  this.logger = createChildLogger({ logger, namespace: "Batching" });
30
32
 
31
- this.batchEventEmitter.on("batchBegin", (message: ISequencedDocumentMessage) => {
33
+ this.batchEventEmitter.on("batchBegin", (message: BatchTrackerMessage) => {
32
34
  this.startBatchSequenceNumber = message.sequenceNumber;
33
35
  this.batchProcessingStartTimeStamp = dateTimeProvider();
34
36
  this.trackedBatchCount++;
@@ -36,7 +38,7 @@ export class BatchTracker {
36
38
 
37
39
  this.batchEventEmitter.on(
38
40
  "batchEnd",
39
- (error: any | undefined, message: ISequencedDocumentMessage) => {
41
+ (error: any | undefined, message: BatchTrackerMessage) => {
40
42
  assert(
41
43
  this.startBatchSequenceNumber !== undefined &&
42
44
  this.batchProcessingStartTimeStamp !== undefined,
@@ -490,6 +490,11 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
490
490
  ).then(
491
491
  (response) => this.onUploadResolve(localId, response),
492
492
  (error) => {
493
+ this.mc.logger.sendTelemetryEvent({
494
+ eventName: "UploadBlobReject",
495
+ error,
496
+ localId,
497
+ });
493
498
  // it will only reject if we haven't sent an op
494
499
  // and is a non-retriable error. It will only reject
495
500
  // the promise but not throw any error outside.
@@ -526,6 +531,10 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
526
531
  const entry = this.pendingBlobs.get(localId);
527
532
  assert(entry !== undefined, 0x6c8 /* pending blob entry not found for uploaded blob */);
528
533
  if ((entry.abortSignal?.aborted === true && !entry.opsent) || this.stopAttaching) {
534
+ this.mc.logger.sendTelemetryEvent({
535
+ eventName: "BlobAborted",
536
+ localId,
537
+ });
529
538
  this.deletePendingBlob(localId);
530
539
  return;
531
540
  }
@@ -119,11 +119,6 @@ export enum RuntimeHeaders {
119
119
  * @alpha
120
120
  */
121
121
  export const AllowTombstoneRequestHeaderKey = "allowTombstone"; // Belongs in the enum above, but avoiding the breaking change
122
- /**
123
- * [IRRELEVANT IF throwOnInactiveLoad OPTION NOT SET] True if an inactive object should be returned without erroring
124
- * @internal
125
- */
126
- export const AllowInactiveRequestHeaderKey = "allowInactive"; // Belongs in the enum above, but avoiding the breaking change
127
122
 
128
123
  type PendingAliasResolve = (success: boolean) => void;
129
124
 
@@ -213,7 +208,7 @@ export function wrapContext(context: IFluidParentContext): IFluidParentContext {
213
208
  * @param parentContext - the {@link IFluidParentContext} to wrap
214
209
  * @returns A wrapped {@link IFluidParentContext}
215
210
  */
216
- export function wrapContextForInnerChannel(
211
+ function wrapContextForInnerChannel(
217
212
  id: string,
218
213
  parentContext: IFluidParentContext,
219
214
  ): IFluidParentContext {
@@ -1460,14 +1455,10 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
1460
1455
  if (typeof request.headers?.[AllowTombstoneRequestHeaderKey] === "boolean") {
1461
1456
  headerData.allowTombstone = request.headers[AllowTombstoneRequestHeaderKey];
1462
1457
  }
1463
- if (typeof request.headers?.[AllowInactiveRequestHeaderKey] === "boolean") {
1464
- headerData.allowInactive = request.headers[AllowInactiveRequestHeaderKey];
1465
- }
1466
1458
 
1467
- // We allow Tombstone/Inactive requests for sub-DataStore objects
1459
+ // We allow Tombstone requests for sub-DataStore objects
1468
1460
  if (requestForChild) {
1469
1461
  headerData.allowTombstone = true;
1470
- headerData.allowInactive = true;
1471
1462
  }
1472
1463
 
1473
1464
  await this.waitIfPendingAlias(id);