@fluidframework/container-runtime 2.1.0-276985 → 2.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 (199) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +71 -18
  3. package/api-extractor/api-extractor.current.json +5 -0
  4. package/api-extractor/api-extractor.legacy.json +1 -1
  5. package/api-extractor.json +1 -1
  6. package/api-report/container-runtime.legacy.public.api.md +9 -0
  7. package/container-runtime.test-files.tar +0 -0
  8. package/dist/blobManager/blobManager.d.ts +10 -0
  9. package/dist/blobManager/blobManager.d.ts.map +1 -1
  10. package/dist/blobManager/blobManager.js +19 -0
  11. package/dist/blobManager/blobManager.js.map +1 -1
  12. package/dist/channelCollection.d.ts +1 -1
  13. package/dist/channelCollection.d.ts.map +1 -1
  14. package/dist/channelCollection.js +40 -8
  15. package/dist/channelCollection.js.map +1 -1
  16. package/dist/containerRuntime.d.ts +14 -5
  17. package/dist/containerRuntime.d.ts.map +1 -1
  18. package/dist/containerRuntime.js +151 -99
  19. package/dist/containerRuntime.js.map +1 -1
  20. package/dist/dataStoreContext.d.ts +4 -0
  21. package/dist/dataStoreContext.d.ts.map +1 -1
  22. package/dist/dataStoreContext.js +9 -3
  23. package/dist/dataStoreContext.js.map +1 -1
  24. package/dist/gc/garbageCollection.d.ts +1 -1
  25. package/dist/gc/garbageCollection.d.ts.map +1 -1
  26. package/dist/gc/garbageCollection.js +14 -8
  27. package/dist/gc/garbageCollection.js.map +1 -1
  28. package/dist/gc/gcDefinitions.d.ts +4 -2
  29. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  30. package/dist/gc/gcDefinitions.js.map +1 -1
  31. package/dist/gc/gcHelpers.d.ts.map +1 -1
  32. package/dist/gc/gcHelpers.js +12 -0
  33. package/dist/gc/gcHelpers.js.map +1 -1
  34. package/dist/gc/gcTelemetry.d.ts +3 -2
  35. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  36. package/dist/gc/gcTelemetry.js +6 -6
  37. package/dist/gc/gcTelemetry.js.map +1 -1
  38. package/dist/legacy.d.ts +1 -1
  39. package/dist/metadata.d.ts +7 -1
  40. package/dist/metadata.d.ts.map +1 -1
  41. package/dist/metadata.js +6 -0
  42. package/dist/metadata.js.map +1 -1
  43. package/dist/opLifecycle/batchManager.d.ts +8 -1
  44. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  45. package/dist/opLifecycle/batchManager.js +37 -16
  46. package/dist/opLifecycle/batchManager.js.map +1 -1
  47. package/dist/opLifecycle/definitions.d.ts +1 -1
  48. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  49. package/dist/opLifecycle/definitions.js.map +1 -1
  50. package/dist/opLifecycle/index.d.ts +2 -2
  51. package/dist/opLifecycle/index.d.ts.map +1 -1
  52. package/dist/opLifecycle/index.js +3 -1
  53. package/dist/opLifecycle/index.js.map +1 -1
  54. package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
  55. package/dist/opLifecycle/opCompressor.js +12 -8
  56. package/dist/opLifecycle/opCompressor.js.map +1 -1
  57. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  58. package/dist/opLifecycle/opGroupingManager.js +14 -11
  59. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  60. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  61. package/dist/opLifecycle/opSplitter.js +11 -6
  62. package/dist/opLifecycle/opSplitter.js.map +1 -1
  63. package/dist/opLifecycle/outbox.d.ts +22 -6
  64. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  65. package/dist/opLifecycle/outbox.js +43 -21
  66. package/dist/opLifecycle/outbox.js.map +1 -1
  67. package/dist/opLifecycle/remoteMessageProcessor.d.ts +10 -8
  68. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  69. package/dist/opLifecycle/remoteMessageProcessor.js +39 -15
  70. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  71. package/dist/packageVersion.d.ts +1 -1
  72. package/dist/packageVersion.d.ts.map +1 -1
  73. package/dist/packageVersion.js +1 -1
  74. package/dist/packageVersion.js.map +1 -1
  75. package/dist/pendingStateManager.d.ts +37 -13
  76. package/dist/pendingStateManager.d.ts.map +1 -1
  77. package/dist/pendingStateManager.js +95 -45
  78. package/dist/pendingStateManager.js.map +1 -1
  79. package/dist/public.d.ts +1 -1
  80. package/dist/scheduleManager.js +4 -0
  81. package/dist/scheduleManager.js.map +1 -1
  82. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  83. package/dist/summary/summarizerNode/summarizerNodeUtils.js +2 -0
  84. package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  85. package/dist/summary/summaryFormat.d.ts.map +1 -1
  86. package/dist/summary/summaryFormat.js +4 -1
  87. package/dist/summary/summaryFormat.js.map +1 -1
  88. package/internal.d.ts +1 -1
  89. package/legacy.d.ts +1 -1
  90. package/lib/blobManager/blobManager.d.ts +10 -0
  91. package/lib/blobManager/blobManager.d.ts.map +1 -1
  92. package/lib/blobManager/blobManager.js +19 -0
  93. package/lib/blobManager/blobManager.js.map +1 -1
  94. package/lib/channelCollection.d.ts +1 -1
  95. package/lib/channelCollection.d.ts.map +1 -1
  96. package/lib/channelCollection.js +40 -8
  97. package/lib/channelCollection.js.map +1 -1
  98. package/lib/containerRuntime.d.ts +14 -5
  99. package/lib/containerRuntime.d.ts.map +1 -1
  100. package/lib/containerRuntime.js +152 -100
  101. package/lib/containerRuntime.js.map +1 -1
  102. package/lib/dataStoreContext.d.ts +4 -0
  103. package/lib/dataStoreContext.d.ts.map +1 -1
  104. package/lib/dataStoreContext.js +10 -4
  105. package/lib/dataStoreContext.js.map +1 -1
  106. package/lib/gc/garbageCollection.d.ts +1 -1
  107. package/lib/gc/garbageCollection.d.ts.map +1 -1
  108. package/lib/gc/garbageCollection.js +14 -8
  109. package/lib/gc/garbageCollection.js.map +1 -1
  110. package/lib/gc/gcDefinitions.d.ts +4 -2
  111. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  112. package/lib/gc/gcDefinitions.js.map +1 -1
  113. package/lib/gc/gcHelpers.d.ts.map +1 -1
  114. package/lib/gc/gcHelpers.js +12 -0
  115. package/lib/gc/gcHelpers.js.map +1 -1
  116. package/lib/gc/gcTelemetry.d.ts +3 -2
  117. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  118. package/lib/gc/gcTelemetry.js +6 -6
  119. package/lib/gc/gcTelemetry.js.map +1 -1
  120. package/lib/legacy.d.ts +1 -1
  121. package/lib/metadata.d.ts +7 -1
  122. package/lib/metadata.d.ts.map +1 -1
  123. package/lib/metadata.js +4 -1
  124. package/lib/metadata.js.map +1 -1
  125. package/lib/opLifecycle/batchManager.d.ts +8 -1
  126. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  127. package/lib/opLifecycle/batchManager.js +35 -15
  128. package/lib/opLifecycle/batchManager.js.map +1 -1
  129. package/lib/opLifecycle/definitions.d.ts +1 -1
  130. package/lib/opLifecycle/definitions.d.ts.map +1 -1
  131. package/lib/opLifecycle/definitions.js.map +1 -1
  132. package/lib/opLifecycle/index.d.ts +2 -2
  133. package/lib/opLifecycle/index.d.ts.map +1 -1
  134. package/lib/opLifecycle/index.js +2 -2
  135. package/lib/opLifecycle/index.js.map +1 -1
  136. package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
  137. package/lib/opLifecycle/opCompressor.js +12 -8
  138. package/lib/opLifecycle/opCompressor.js.map +1 -1
  139. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
  140. package/lib/opLifecycle/opGroupingManager.js +14 -11
  141. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  142. package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
  143. package/lib/opLifecycle/opSplitter.js +11 -6
  144. package/lib/opLifecycle/opSplitter.js.map +1 -1
  145. package/lib/opLifecycle/outbox.d.ts +22 -6
  146. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  147. package/lib/opLifecycle/outbox.js +44 -22
  148. package/lib/opLifecycle/outbox.js.map +1 -1
  149. package/lib/opLifecycle/remoteMessageProcessor.d.ts +10 -8
  150. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  151. package/lib/opLifecycle/remoteMessageProcessor.js +37 -14
  152. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  153. package/lib/packageVersion.d.ts +1 -1
  154. package/lib/packageVersion.d.ts.map +1 -1
  155. package/lib/packageVersion.js +1 -1
  156. package/lib/packageVersion.js.map +1 -1
  157. package/lib/pendingStateManager.d.ts +37 -13
  158. package/lib/pendingStateManager.d.ts.map +1 -1
  159. package/lib/pendingStateManager.js +95 -45
  160. package/lib/pendingStateManager.js.map +1 -1
  161. package/lib/public.d.ts +1 -1
  162. package/lib/scheduleManager.js +4 -0
  163. package/lib/scheduleManager.js.map +1 -1
  164. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  165. package/lib/summary/summarizerNode/summarizerNodeUtils.js +2 -0
  166. package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  167. package/lib/summary/summaryFormat.d.ts.map +1 -1
  168. package/lib/summary/summaryFormat.js +4 -1
  169. package/lib/summary/summaryFormat.js.map +1 -1
  170. package/package.json +46 -31
  171. package/src/blobManager/blobManager.ts +19 -0
  172. package/src/channelCollection.ts +48 -11
  173. package/src/containerRuntime.ts +203 -133
  174. package/src/dataStoreContext.ts +22 -4
  175. package/src/gc/garbageCollection.ts +15 -10
  176. package/src/gc/gcDefinitions.ts +7 -2
  177. package/src/gc/gcHelpers.ts +18 -6
  178. package/src/gc/gcTelemetry.ts +20 -8
  179. package/src/metadata.ts +11 -1
  180. package/src/opLifecycle/README.md +0 -8
  181. package/src/opLifecycle/batchManager.ts +49 -16
  182. package/src/opLifecycle/definitions.ts +1 -1
  183. package/src/opLifecycle/index.ts +13 -2
  184. package/src/opLifecycle/opCompressor.ts +12 -8
  185. package/src/opLifecycle/opGroupingManager.ts +14 -11
  186. package/src/opLifecycle/opSplitter.ts +10 -6
  187. package/src/opLifecycle/outbox.ts +64 -26
  188. package/src/opLifecycle/remoteMessageProcessor.ts +56 -17
  189. package/src/packageVersion.ts +1 -1
  190. package/src/pendingStateManager.ts +173 -74
  191. package/src/scheduleManager.ts +6 -2
  192. package/src/summary/README.md +81 -0
  193. package/src/summary/summarizerNode/summarizerNodeUtils.ts +3 -1
  194. package/src/summary/summaryFormat.ts +3 -1
  195. package/src/summary/summaryFormats.md +69 -8
  196. package/tsconfig.json +0 -1
  197. package/src/summary/images/appTree.png +0 -0
  198. package/src/summary/images/protocolAndAppTree.png +0 -0
  199. package/src/summary/images/summaryTree.png +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"scheduleManager.js","sourceRoot":"","sources":["../src/scheduleManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAK7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAEN,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,gCAAgC,GAChC,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAQjD;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAe;IAK3B,YACkB,YAAwE,EACxE,OAAqB,EAC7B,WAAqC,EAC7B,MAA2B;QAH3B,iBAAY,GAAZ,YAAY,CAA4D;QACxE,YAAO,GAAP,OAAO,CAAc;QAC7B,gBAAW,GAAX,WAAW,CAA0B;QAC7B,WAAM,GAAN,MAAM,CAAqB;QANrC,aAAQ,GAAG,KAAK,CAAC;QAQxB,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,CACvC,IAAI,CAAC,YAAY,EACjB,iBAAiB,CAAC,EAA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+FAA+F;QAC/F,qEAAqE;QAErE,IAAI,aAAa,EAAE,CAAC;YACnB,MAAM,CACL,IAAI,CAAC,oBAAoB,KAAK,SAAS,EACvC,KAAK,CAAC,mCAAmC,CACzC,CAAC;YACF,MAAM,CACL,CAAC,IAAI,CAAC,WAAW,EACjB,KAAK,CAAC,iEAAiE,CACvE,CAAC;YACF,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC;YAClD,+FAA+F;YAC/F,4EAA4E;YAC5E,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,QAAkB,CAAC;YACvD,qBAAqB;YACrB,mDAAmD;YACnD,+FAA+F;YAC/F,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC5C,IAAI,CAAC,UAAU,EAAE,CAAC;YACnB,CAAC;QACF,CAAC;aAAM,IAAI,aAAa,KAAK,KAAK,EAAE,CAAC;YACpC,MAAM,CACL,IAAI,CAAC,mBAAmB,KAAK,SAAS,EACtC,KAAK,CAAC,0CAA0C,CAChD,CAAC;YACF,wCAAwC;YACxC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;YACpD,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;YACrC,IAAI,CAAC,oBAAoB,GAAG,SAAS,CAAC;QACvC,CAAC;aAAM,CAAC;YACP,4CAA4C;YAC5C,MAAM,CAAC,IAAI,CAAC,oBAAoB,KAAK,SAAS,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC5E,CAAC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { EventEmitter } from \"@fluid-internal/client-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { isRuntimeMessage } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tDataCorruptionError,\n\tDataProcessingError,\n\tcreateChildLogger,\n\textractSafePropertiesFromMessage,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { DeltaScheduler } from \"./deltaScheduler.js\";\nimport { IBatchMetadata } from \"./metadata.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\n\ntype IRuntimeMessageMetadata =\n\t| undefined\n\t| {\n\t\t\tbatch?: boolean;\n\t };\n\n/**\n * This class has the following responsibilities:\n *\n * 1. It tracks batches as we process ops and raises \"batchBegin\" and \"batchEnd\" events.\n * As part of it, it validates batch correctness (i.e. no system ops in the middle of batch)\n *\n * 2. It creates instance of ScheduleManagerCore that ensures we never start processing ops from batch\n * unless all ops of the batch are in.\n */\nexport class ScheduleManager {\n\tprivate readonly deltaScheduler: DeltaScheduler;\n\tprivate batchClientId: string | undefined;\n\tprivate hitError = false;\n\n\tconstructor(\n\t\tprivate readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tprivate readonly emitter: EventEmitter,\n\t\treadonly getClientId: () => string | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.deltaScheduler = new DeltaScheduler(\n\t\t\tthis.deltaManager,\n\t\t\tcreateChildLogger({ logger: this.logger, namespace: \"DeltaScheduler\" }),\n\t\t);\n\t\tvoid new ScheduleManagerCore(deltaManager, getClientId, logger);\n\t}\n\n\tpublic beforeOpProcessing(message: ISequencedDocumentMessage) {\n\t\tif (this.batchClientId !== message.clientId) {\n\t\t\tassert(\n\t\t\t\tthis.batchClientId === undefined,\n\t\t\t\t0x2a2 /* \"Batch is interrupted by other client op. Should be caught by trackPending()\" */,\n\t\t\t);\n\n\t\t\t// This could be the beginning of a new batch or an individual message.\n\t\t\tthis.emitter.emit(\"batchBegin\", message);\n\t\t\tthis.deltaScheduler.batchBegin(message);\n\n\t\t\tconst batch = (message?.metadata as IRuntimeMessageMetadata)?.batch;\n\t\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\tthis.batchClientId = batch ? (message.clientId as string) : undefined;\n\t\t}\n\t}\n\n\tpublic afterOpProcessing(error: any | undefined, message: ISequencedDocumentMessage) {\n\t\t// If this is no longer true, we need to revisit what we do where we set this.hitError.\n\t\tassert(!this.hitError, 0x2a3 /* \"container should be closed on any error\" */);\n\n\t\tif (error) {\n\t\t\t// We assume here that loader will close container and stop processing all future ops.\n\t\t\t// This is implicit dependency. If this flow changes, this code might no longer be correct.\n\t\t\tthis.hitError = true;\n\t\t\tthis.batchClientId = undefined;\n\t\t\tthis.emitter.emit(\"batchEnd\", error, message);\n\t\t\tthis.deltaScheduler.batchEnd(message);\n\t\t\treturn;\n\t\t}\n\n\t\tconst batch = (message?.metadata as IRuntimeMessageMetadata)?.batch;\n\t\t// If no batchClientId has been set then we're in an individual batch. Else, if we get\n\t\t// batch end metadata, this is end of the current batch.\n\t\tif (this.batchClientId === undefined || batch === false) {\n\t\t\tthis.batchClientId = undefined;\n\t\t\tthis.emitter.emit(\"batchEnd\", undefined, message);\n\t\t\tthis.deltaScheduler.batchEnd(message);\n\t\t\treturn;\n\t\t}\n\t}\n}\n\n/**\n * This class controls pausing and resuming of inbound queue to ensure that we never\n * start processing ops in a batch IF we do not have all ops in the batch.\n */\nclass ScheduleManagerCore {\n\tprivate pauseSequenceNumber: number | undefined;\n\tprivate currentBatchClientId: string | undefined;\n\tprivate localPaused = false;\n\tprivate timePaused = 0;\n\tprivate batchCount = 0;\n\n\tconstructor(\n\t\tprivate readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tprivate readonly getClientId: () => string | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\t// Listen for delta manager sends and add batch metadata to messages\n\t\tthis.deltaManager.on(\"prepareSend\", (messages: IDocumentMessage[]) => {\n\t\t\tif (messages.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// First message will have the batch flag set to true if doing a batched send\n\t\t\tconst firstMessageMetadata = messages[0].metadata as IRuntimeMessageMetadata;\n\t\t\tif (!firstMessageMetadata?.batch) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the batch contains only a single op, clear the batch flag.\n\t\t\tif (messages.length === 1) {\n\t\t\t\tdelete firstMessageMetadata.batch;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Set the batch flag to false on the last message to indicate the end of the send batch\n\t\t\tconst lastMessage = messages[messages.length - 1];\n\t\t\t// TODO: It's not clear if this shallow clone is required, as opposed to just setting \"batch\" to false.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\tlastMessage.metadata = { ...(lastMessage.metadata as any), batch: false };\n\t\t});\n\n\t\t// Listen for updates and peek at the inbound\n\t\tthis.deltaManager.inbound.on(\"push\", (message: ISequencedDocumentMessage) => {\n\t\t\tthis.trackPending(message);\n\t\t});\n\n\t\t// Start with baseline - empty inbound queue.\n\t\tassert(!this.localPaused, 0x293 /* \"initial state\" */);\n\n\t\tconst allPending = this.deltaManager.inbound.toArray();\n\t\tfor (const pending of allPending) {\n\t\t\tthis.trackPending(pending);\n\t\t}\n\n\t\t// We are intentionally directly listening to the \"op\" to inspect system ops as well.\n\t\t// If we do not observe system ops, we are likely to hit 0x296 assert when system ops\n\t\t// precedes start of incomplete batch.\n\t\tthis.deltaManager.on(\"op\", (message) => this.afterOpProcessing(message));\n\t}\n\n\t/**\n\t * The only public function in this class - called when we processed an op,\n\t * to make decision if op processing should be paused or not after that.\n\t */\n\tpublic afterOpProcessing(message: ISequencedDocumentMessage) {\n\t\tassert(\n\t\t\t!this.localPaused,\n\t\t\t0x294 /* \"can't have op processing paused if we are processing an op\" */,\n\t\t);\n\n\t\t// If the inbound queue is ever empty, nothing to do!\n\t\tif (this.deltaManager.inbound.length === 0) {\n\t\t\tassert(\n\t\t\t\tthis.pauseSequenceNumber === undefined,\n\t\t\t\t0x295 /* \"there should be no pending batch if we have no ops\" */,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// The queue is\n\t\t// 1. paused only when the next message to be processed is the beginning of a batch. Done in two places:\n\t\t// - here (processing ops until reaching start of incomplete batch)\n\t\t// - in trackPending(), when queue was empty and start of batch showed up.\n\t\t// 2. resumed when batch end comes in (in trackPending())\n\n\t\t// do we have incomplete batch to worry about?\n\t\tif (this.pauseSequenceNumber !== undefined) {\n\t\t\tif (message.sequenceNumber >= this.pauseSequenceNumber) {\n\t\t\t\tthrow DataProcessingError.create(\n\t\t\t\t\t// Former assert 0x296\n\t\t\t\t\t\"Incomplete batch\",\n\t\t\t\t\t\"ScheduleManager\",\n\t\t\t\t\tmessage,\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: message.type,\n\t\t\t\t\t\tcontentType: typeof message.contents,\n\t\t\t\t\t\tbatch: (message.metadata as IBatchMetadata | undefined)?.batch,\n\t\t\t\t\t\tcompression: message.compression,\n\t\t\t\t\t\tpauseSeqNum: this.pauseSequenceNumber,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// If the next op is the start of incomplete batch, then we can't process it until it's fully in - pause!\n\t\t\tif (message.sequenceNumber + 1 === this.pauseSequenceNumber) {\n\t\t\t\tthis.pauseQueue();\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate pauseQueue() {\n\t\tassert(!this.localPaused, 0x297 /* \"always called from resumed state\" */);\n\t\tthis.localPaused = true;\n\t\tthis.timePaused = performance.now();\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tthis.deltaManager.inbound.pause();\n\t}\n\n\tprivate resumeQueue(startBatch: number, messageEndBatch: ISequencedDocumentMessage) {\n\t\tconst endBatch = messageEndBatch.sequenceNumber;\n\t\tconst duration = this.localPaused ? performance.now() - this.timePaused : undefined;\n\n\t\tthis.batchCount++;\n\t\tif (this.batchCount % 1000 === 1) {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"BatchStats\",\n\t\t\t\tsequenceNumber: endBatch,\n\t\t\t\tlength: endBatch - startBatch + 1,\n\t\t\t\tmsnDistance: endBatch - messageEndBatch.minimumSequenceNumber,\n\t\t\t\tduration,\n\t\t\t\tbatchCount: this.batchCount,\n\t\t\t\tinterrupted: this.localPaused,\n\t\t\t});\n\t\t}\n\n\t\t// Return early if no change in value\n\t\tif (!this.localPaused) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.localPaused = false;\n\n\t\tthis.deltaManager.inbound.resume();\n\t}\n\n\t/**\n\t * Called for each incoming op (i.e. inbound \"push\" notification)\n\t */\n\tprivate trackPending(message: ISequencedDocumentMessage) {\n\t\tassert(\n\t\t\tthis.deltaManager.inbound.length !== 0,\n\t\t\t0x298 /* \"we have something in the queue that generates this event\" */,\n\t\t);\n\n\t\tassert(\n\t\t\t(this.currentBatchClientId === undefined) === (this.pauseSequenceNumber === undefined),\n\t\t\t0x299 /* \"non-synchronized state\" */,\n\t\t);\n\n\t\tconst metadata = message.metadata as IRuntimeMessageMetadata;\n\t\t// batchMetadata will be true for the message that starts a batch, false for the one that ends it, and\n\t\t// undefined for all other messages.\n\t\tconst batchMetadata = metadata?.batch;\n\n\t\t// Protocol messages are never part of a runtime batch of messages\n\t\tif (!isRuntimeMessage(message)) {\n\t\t\t// Protocol messages should never show up in the middle of the batch!\n\t\t\tif (this.currentBatchClientId !== undefined) {\n\t\t\t\tthrow DataProcessingError.create(\n\t\t\t\t\t\"Received a system message during batch processing\", // Formerly known as assert 0x29a\n\t\t\t\t\t\"trackPending\",\n\t\t\t\t\tmessage,\n\t\t\t\t\t{\n\t\t\t\t\t\truntimeVersion: pkgVersion,\n\t\t\t\t\t\tbatchClientId:\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\t\t\t\t\t\t\tthis.currentBatchClientId === null ? \"null\" : this.currentBatchClientId,\n\t\t\t\t\t\tpauseSequenceNumber: this.pauseSequenceNumber,\n\t\t\t\t\t\tlocalBatch: this.currentBatchClientId === this.getClientId(),\n\t\t\t\t\t\tmessageType: message.type,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tassert(batchMetadata === undefined, 0x29b /* \"system op in a batch?\" */);\n\t\t\tassert(\n\t\t\t\t!this.localPaused,\n\t\t\t\t0x29c /* \"we should be processing ops when there is no active batch\" */,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.currentBatchClientId === undefined && batchMetadata === undefined) {\n\t\t\tassert(\n\t\t\t\t!this.localPaused,\n\t\t\t\t0x29d /* \"we should be processing ops when there is no active batch\" */,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// If we got here, the message is part of a batch. Either starting, in progress, or ending.\n\n\t\t// If this is not the start of the batch, error out if the message was sent by a client other than the one that\n\t\t// started the current batch (it should not be possible for ops from other clients to get interleaved with a batch).\n\t\tif (\n\t\t\tthis.currentBatchClientId !== undefined &&\n\t\t\tthis.currentBatchClientId !== message.clientId\n\t\t) {\n\t\t\tthrow new DataCorruptionError(\"OpBatchIncomplete\", {\n\t\t\t\truntimeVersion: pkgVersion,\n\t\t\t\tbatchClientId:\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\t\t\t\t\tthis.currentBatchClientId === null ? \"null\" : this.currentBatchClientId,\n\t\t\t\tpauseSequenceNumber: this.pauseSequenceNumber,\n\t\t\t\tlocalBatch: this.currentBatchClientId === this.getClientId(),\n\t\t\t\tlocalMessage: message.clientId === this.getClientId(),\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t});\n\t\t}\n\n\t\t// The queue is\n\t\t// 1. paused only when the next message to be processed is the beginning of a batch. Done in two places:\n\t\t// - in afterOpProcessing() - processing ops until reaching start of incomplete batch\n\t\t// - here, when queue was empty and start of batch showed up (batchMetadata === true below).\n\t\t// 2. resumed when batch end comes in (batchMetadata === false below)\n\n\t\tif (batchMetadata) {\n\t\t\tassert(\n\t\t\t\tthis.currentBatchClientId === undefined,\n\t\t\t\t0x29e /* \"there can't be active batch\" */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\t!this.localPaused,\n\t\t\t\t0x29f /* \"we should be processing ops when there is no active batch\" */,\n\t\t\t);\n\t\t\tthis.pauseSequenceNumber = message.sequenceNumber;\n\t\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\tthis.currentBatchClientId = message.clientId as string;\n\t\t\t// Start of the batch\n\t\t\t// Only pause processing if queue has no other ops!\n\t\t\t// If there are any other ops in the queue, processing will be stopped when they are processed!\n\t\t\tif (this.deltaManager.inbound.length === 1) {\n\t\t\t\tthis.pauseQueue();\n\t\t\t}\n\t\t} else if (batchMetadata === false) {\n\t\t\tassert(\n\t\t\t\tthis.pauseSequenceNumber !== undefined,\n\t\t\t\t0x2a0 /* \"batch presence was validated above\" */,\n\t\t\t);\n\t\t\t// Batch is complete, we can process it!\n\t\t\tthis.resumeQueue(this.pauseSequenceNumber, message);\n\t\t\tthis.pauseSequenceNumber = undefined;\n\t\t\tthis.currentBatchClientId = undefined;\n\t\t} else {\n\t\t\t// Continuation of current batch. Do nothing\n\t\t\tassert(this.currentBatchClientId !== undefined, 0x2a1 /* \"logic error\" */);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"scheduleManager.js","sourceRoot":"","sources":["../src/scheduleManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAK7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAA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,IAAI,CAAC,mBAAmB,KAAK,SAAS,EACtC,KAAK,CAAC,0CAA0C,CAChD,CAAC;YACF,wCAAwC;YACxC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;YACpD,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;YACrC,IAAI,CAAC,oBAAoB,GAAG,SAAS,CAAC;QACvC,CAAC;aAAM,CAAC;YACP,4CAA4C;YAC5C,MAAM,CAAC,IAAI,CAAC,oBAAoB,KAAK,SAAS,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC5E,CAAC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { EventEmitter } from \"@fluid-internal/client-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { isRuntimeMessage } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tDataCorruptionError,\n\tDataProcessingError,\n\tcreateChildLogger,\n\textractSafePropertiesFromMessage,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { DeltaScheduler } from \"./deltaScheduler.js\";\nimport { IBatchMetadata } from \"./metadata.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\n\ntype IRuntimeMessageMetadata =\n\t| undefined\n\t| {\n\t\t\tbatch?: boolean;\n\t };\n\n/**\n * This class has the following responsibilities:\n *\n * 1. It tracks batches as we process ops and raises \"batchBegin\" and \"batchEnd\" events.\n * As part of it, it validates batch correctness (i.e. no system ops in the middle of batch)\n *\n * 2. It creates instance of ScheduleManagerCore that ensures we never start processing ops from batch\n * unless all ops of the batch are in.\n */\nexport class ScheduleManager {\n\tprivate readonly deltaScheduler: DeltaScheduler;\n\tprivate batchClientId: string | undefined;\n\tprivate hitError = false;\n\n\tconstructor(\n\t\tprivate readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tprivate readonly emitter: EventEmitter,\n\t\treadonly getClientId: () => string | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.deltaScheduler = new DeltaScheduler(\n\t\t\tthis.deltaManager,\n\t\t\tcreateChildLogger({ logger: this.logger, namespace: \"DeltaScheduler\" }),\n\t\t);\n\t\tvoid new ScheduleManagerCore(deltaManager, getClientId, logger);\n\t}\n\n\tpublic beforeOpProcessing(message: ISequencedDocumentMessage) {\n\t\tif (this.batchClientId !== message.clientId) {\n\t\t\tassert(\n\t\t\t\tthis.batchClientId === undefined,\n\t\t\t\t0x2a2 /* \"Batch is interrupted by other client op. Should be caught by trackPending()\" */,\n\t\t\t);\n\n\t\t\t// This could be the beginning of a new batch or an individual message.\n\t\t\tthis.emitter.emit(\"batchBegin\", message);\n\t\t\tthis.deltaScheduler.batchBegin(message);\n\n\t\t\tconst batch = (message?.metadata as IRuntimeMessageMetadata)?.batch;\n\t\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\tthis.batchClientId = batch ? (message.clientId as string) : undefined;\n\t\t}\n\t}\n\n\tpublic afterOpProcessing(error: any | undefined, message: ISequencedDocumentMessage) {\n\t\t// If this is no longer true, we need to revisit what we do where we set this.hitError.\n\t\tassert(!this.hitError, 0x2a3 /* \"container should be closed on any error\" */);\n\n\t\tif (error) {\n\t\t\t// We assume here that loader will close container and stop processing all future ops.\n\t\t\t// This is implicit dependency. If this flow changes, this code might no longer be correct.\n\t\t\tthis.hitError = true;\n\t\t\tthis.batchClientId = undefined;\n\t\t\tthis.emitter.emit(\"batchEnd\", error, message);\n\t\t\tthis.deltaScheduler.batchEnd(message);\n\t\t\treturn;\n\t\t}\n\n\t\tconst batch = (message?.metadata as IRuntimeMessageMetadata)?.batch;\n\t\t// If no batchClientId has been set then we're in an individual batch. Else, if we get\n\t\t// batch end metadata, this is end of the current batch.\n\t\tif (this.batchClientId === undefined || batch === false) {\n\t\t\tthis.batchClientId = undefined;\n\t\t\tthis.emitter.emit(\"batchEnd\", undefined, message);\n\t\t\tthis.deltaScheduler.batchEnd(message);\n\t\t\treturn;\n\t\t}\n\t}\n}\n\n/**\n * This class controls pausing and resuming of inbound queue to ensure that we never\n * start processing ops in a batch IF we do not have all ops in the batch.\n */\nclass ScheduleManagerCore {\n\tprivate pauseSequenceNumber: number | undefined;\n\tprivate currentBatchClientId: string | undefined;\n\tprivate localPaused = false;\n\tprivate timePaused = 0;\n\tprivate batchCount = 0;\n\n\tconstructor(\n\t\tprivate readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tprivate readonly getClientId: () => string | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\t// Listen for delta manager sends and add batch metadata to messages\n\t\tthis.deltaManager.on(\"prepareSend\", (messages: IDocumentMessage[]) => {\n\t\t\tif (messages.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// First message will have the batch flag set to true if doing a batched send\n\t\t\t// Non null asserting because of the length check above\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst firstMessageMetadata = messages[0]!.metadata as IRuntimeMessageMetadata;\n\t\t\tif (!firstMessageMetadata?.batch) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the batch contains only a single op, clear the batch flag.\n\t\t\tif (messages.length === 1) {\n\t\t\t\tdelete firstMessageMetadata.batch;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Set the batch flag to false on the last message to indicate the end of the send batch\n\t\t\t// Non null asserting here because of the length check at the start of the function\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst lastMessage = messages[messages.length - 1]!;\n\t\t\t// TODO: It's not clear if this shallow clone is required, as opposed to just setting \"batch\" to false.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\tlastMessage.metadata = { ...(lastMessage.metadata as any), batch: false };\n\t\t});\n\n\t\t// Listen for updates and peek at the inbound\n\t\tthis.deltaManager.inbound.on(\"push\", (message: ISequencedDocumentMessage) => {\n\t\t\tthis.trackPending(message);\n\t\t});\n\n\t\t// Start with baseline - empty inbound queue.\n\t\tassert(!this.localPaused, 0x293 /* \"initial state\" */);\n\n\t\tconst allPending = this.deltaManager.inbound.toArray();\n\t\tfor (const pending of allPending) {\n\t\t\tthis.trackPending(pending);\n\t\t}\n\n\t\t// We are intentionally directly listening to the \"op\" to inspect system ops as well.\n\t\t// If we do not observe system ops, we are likely to hit 0x296 assert when system ops\n\t\t// precedes start of incomplete batch.\n\t\tthis.deltaManager.on(\"op\", (message) => this.afterOpProcessing(message));\n\t}\n\n\t/**\n\t * The only public function in this class - called when we processed an op,\n\t * to make decision if op processing should be paused or not after that.\n\t */\n\tpublic afterOpProcessing(message: ISequencedDocumentMessage) {\n\t\tassert(\n\t\t\t!this.localPaused,\n\t\t\t0x294 /* \"can't have op processing paused if we are processing an op\" */,\n\t\t);\n\n\t\t// If the inbound queue is ever empty, nothing to do!\n\t\tif (this.deltaManager.inbound.length === 0) {\n\t\t\tassert(\n\t\t\t\tthis.pauseSequenceNumber === undefined,\n\t\t\t\t0x295 /* \"there should be no pending batch if we have no ops\" */,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// The queue is\n\t\t// 1. paused only when the next message to be processed is the beginning of a batch. Done in two places:\n\t\t// - here (processing ops until reaching start of incomplete batch)\n\t\t// - in trackPending(), when queue was empty and start of batch showed up.\n\t\t// 2. resumed when batch end comes in (in trackPending())\n\n\t\t// do we have incomplete batch to worry about?\n\t\tif (this.pauseSequenceNumber !== undefined) {\n\t\t\tif (message.sequenceNumber >= this.pauseSequenceNumber) {\n\t\t\t\tthrow DataProcessingError.create(\n\t\t\t\t\t// Former assert 0x296\n\t\t\t\t\t\"Incomplete batch\",\n\t\t\t\t\t\"ScheduleManager\",\n\t\t\t\t\tmessage,\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: message.type,\n\t\t\t\t\t\tcontentType: typeof message.contents,\n\t\t\t\t\t\tbatch: (message.metadata as IBatchMetadata | undefined)?.batch,\n\t\t\t\t\t\tcompression: message.compression,\n\t\t\t\t\t\tpauseSeqNum: this.pauseSequenceNumber,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// If the next op is the start of incomplete batch, then we can't process it until it's fully in - pause!\n\t\t\tif (message.sequenceNumber + 1 === this.pauseSequenceNumber) {\n\t\t\t\tthis.pauseQueue();\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate pauseQueue() {\n\t\tassert(!this.localPaused, 0x297 /* \"always called from resumed state\" */);\n\t\tthis.localPaused = true;\n\t\tthis.timePaused = performance.now();\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tthis.deltaManager.inbound.pause();\n\t}\n\n\tprivate resumeQueue(startBatch: number, messageEndBatch: ISequencedDocumentMessage) {\n\t\tconst endBatch = messageEndBatch.sequenceNumber;\n\t\tconst duration = this.localPaused ? performance.now() - this.timePaused : undefined;\n\n\t\tthis.batchCount++;\n\t\tif (this.batchCount % 1000 === 1) {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"BatchStats\",\n\t\t\t\tsequenceNumber: endBatch,\n\t\t\t\tlength: endBatch - startBatch + 1,\n\t\t\t\tmsnDistance: endBatch - messageEndBatch.minimumSequenceNumber,\n\t\t\t\tduration,\n\t\t\t\tbatchCount: this.batchCount,\n\t\t\t\tinterrupted: this.localPaused,\n\t\t\t});\n\t\t}\n\n\t\t// Return early if no change in value\n\t\tif (!this.localPaused) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.localPaused = false;\n\n\t\tthis.deltaManager.inbound.resume();\n\t}\n\n\t/**\n\t * Called for each incoming op (i.e. inbound \"push\" notification)\n\t */\n\tprivate trackPending(message: ISequencedDocumentMessage) {\n\t\tassert(\n\t\t\tthis.deltaManager.inbound.length !== 0,\n\t\t\t0x298 /* \"we have something in the queue that generates this event\" */,\n\t\t);\n\n\t\tassert(\n\t\t\t(this.currentBatchClientId === undefined) === (this.pauseSequenceNumber === undefined),\n\t\t\t0x299 /* \"non-synchronized state\" */,\n\t\t);\n\n\t\tconst metadata = message.metadata as IRuntimeMessageMetadata;\n\t\t// batchMetadata will be true for the message that starts a batch, false for the one that ends it, and\n\t\t// undefined for all other messages.\n\t\tconst batchMetadata = metadata?.batch;\n\n\t\t// Protocol messages are never part of a runtime batch of messages\n\t\tif (!isRuntimeMessage(message)) {\n\t\t\t// Protocol messages should never show up in the middle of the batch!\n\t\t\tif (this.currentBatchClientId !== undefined) {\n\t\t\t\tthrow DataProcessingError.create(\n\t\t\t\t\t\"Received a system message during batch processing\", // Formerly known as assert 0x29a\n\t\t\t\t\t\"trackPending\",\n\t\t\t\t\tmessage,\n\t\t\t\t\t{\n\t\t\t\t\t\truntimeVersion: pkgVersion,\n\t\t\t\t\t\tbatchClientId:\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\t\t\t\t\t\t\tthis.currentBatchClientId === null ? \"null\" : this.currentBatchClientId,\n\t\t\t\t\t\tpauseSequenceNumber: this.pauseSequenceNumber,\n\t\t\t\t\t\tlocalBatch: this.currentBatchClientId === this.getClientId(),\n\t\t\t\t\t\tmessageType: message.type,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tassert(batchMetadata === undefined, 0x29b /* \"system op in a batch?\" */);\n\t\t\tassert(\n\t\t\t\t!this.localPaused,\n\t\t\t\t0x29c /* \"we should be processing ops when there is no active batch\" */,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.currentBatchClientId === undefined && batchMetadata === undefined) {\n\t\t\tassert(\n\t\t\t\t!this.localPaused,\n\t\t\t\t0x29d /* \"we should be processing ops when there is no active batch\" */,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// If we got here, the message is part of a batch. Either starting, in progress, or ending.\n\n\t\t// If this is not the start of the batch, error out if the message was sent by a client other than the one that\n\t\t// started the current batch (it should not be possible for ops from other clients to get interleaved with a batch).\n\t\tif (\n\t\t\tthis.currentBatchClientId !== undefined &&\n\t\t\tthis.currentBatchClientId !== message.clientId\n\t\t) {\n\t\t\tthrow new DataCorruptionError(\"OpBatchIncomplete\", {\n\t\t\t\truntimeVersion: pkgVersion,\n\t\t\t\tbatchClientId:\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\t\t\t\t\tthis.currentBatchClientId === null ? \"null\" : this.currentBatchClientId,\n\t\t\t\tpauseSequenceNumber: this.pauseSequenceNumber,\n\t\t\t\tlocalBatch: this.currentBatchClientId === this.getClientId(),\n\t\t\t\tlocalMessage: message.clientId === this.getClientId(),\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t});\n\t\t}\n\n\t\t// The queue is\n\t\t// 1. paused only when the next message to be processed is the beginning of a batch. Done in two places:\n\t\t// - in afterOpProcessing() - processing ops until reaching start of incomplete batch\n\t\t// - here, when queue was empty and start of batch showed up (batchMetadata === true below).\n\t\t// 2. resumed when batch end comes in (batchMetadata === false below)\n\n\t\tif (batchMetadata) {\n\t\t\tassert(\n\t\t\t\tthis.currentBatchClientId === undefined,\n\t\t\t\t0x29e /* \"there can't be active batch\" */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\t!this.localPaused,\n\t\t\t\t0x29f /* \"we should be processing ops when there is no active batch\" */,\n\t\t\t);\n\t\t\tthis.pauseSequenceNumber = message.sequenceNumber;\n\t\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\tthis.currentBatchClientId = message.clientId as string;\n\t\t\t// Start of the batch\n\t\t\t// Only pause processing if queue has no other ops!\n\t\t\t// If there are any other ops in the queue, processing will be stopped when they are processed!\n\t\t\tif (this.deltaManager.inbound.length === 1) {\n\t\t\t\tthis.pauseQueue();\n\t\t\t}\n\t\t} else if (batchMetadata === false) {\n\t\t\tassert(\n\t\t\t\tthis.pauseSequenceNumber !== undefined,\n\t\t\t\t0x2a0 /* \"batch presence was validated above\" */,\n\t\t\t);\n\t\t\t// Batch is complete, we can process it!\n\t\t\tthis.resumeQueue(this.pauseSequenceNumber, message);\n\t\t\tthis.pauseSequenceNumber = undefined;\n\t\t\tthis.currentBatchClientId = undefined;\n\t\t} else {\n\t\t\t// Continuation of current batch. Do nothing\n\t\t\tassert(this.currentBatchClientId !== undefined, 0x2a1 /* \"logic error\" */);\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"summarizerNodeUtils.d.ts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAE5E,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,MAAM,0CAA0C,CAAC;AAElD,MAAM,WAAW,qBAAqB;IACrC,4DAA4D;IAC5D,gBAAgB,EAAE,OAAO,CAAC;IAC1B,sFAAsF;IACtF,cAAc,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IACnC,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,6HAA6H;IAC7H,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAC9B;IACA,OAAO,EAAE,IAAI,CAAC;CACb,G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c,IAAI,WAAW,GAAG,SAAS,CAEnD;IACD,IAAW,cAAc,CAAC,cAAc,EAAE,WAAW,GAAG,SAAS,EAEhE;gBAEiB,OAAO,EAAE;QACzB,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;QACzC,QAAQ,CAAC,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAC;QAC3C,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;QAChC,cAAc,CAAC,EAAE,WAAW,CAAC;KAC7B;IAGF,wEAAwE;IACxE,IAAW,QAAQ,IAAI,WAAW,CAEjC;IAED;;;OAGG;IACH,IAAW,mBAAmB,IAAI,WAAW,CAI5C;IAED;;;OAGG;IACI,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW;CAO9C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,2CAA2C;IAC3C,aAAa,EAAE,WAAW,GAAG,SAAS,CAAC;IACvC,yDAAyD;IACzD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qEAAqE;IACrE,eAAe,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa;IACpE,4CAA4C;IAC5C,YAAY,EAAE,CAAC,CAAC;IAChB,uDAAuD;IACvD,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACtC,WAAW,EAAE,aAAa,GACxB,YAAY,CAAC,aAAa,CAAC,CAa7B"}
1
+ {"version":3,"file":"summarizerNodeUtils.d.ts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAE5E,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,MAAM,0CAA0C,CAAC;AAElD,MA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AIG;AACH,wBAAgB,uBAAuB,CACtC,WAAW,EAAE,aAAa,GACxB,YAAY,CAAC,aAAa,CAAC,CAa7B"}
@@ -14,6 +14,8 @@ export class EscapedPath {
14
14
  static createAndConcat(pathParts) {
15
15
  let ret = EscapedPath.create(pathParts[0] ?? "");
16
16
  for (let i = 1; i < pathParts.length; i++) {
17
+ // Non null asserting here since we are iterating over pathParts
18
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
17
19
  ret = ret.concat(EscapedPath.create(pathParts[i]));
18
20
  }
19
21
  return ret;
@@ -1 +1 @@
1
- {"version":3,"file":"summarizerNodeUtils.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AA2DhF,+DAA+D;AAC/D,MAAM,OAAO,WAAW;IACvB,YAAoC,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAC7C,MAAM,CAAC,MAAM,CAAC,IAAY;QAChC,OAAO,IAAI,WAAW,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IAClD,CAAC;IACM,MAAM,CAAC,eAAe,CAAC,SAAmB;QAChD,IAAI,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3C,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;IACM,QAAQ;QACd,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IACM,MAAM,CAAC,IAAiB;QAC9B,OAA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CAAC,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,EAAU;QAC/B,OAAO,IAAI,WAAW,CAAC;YACtB,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;YACrD,QAAQ,EAAE,IAAI,CAAC,mBAAmB;YAClC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;SACjC,CAAC,CAAC;IACJ,CAAC;CACD;AAqBD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACtC,WAA0B;IAE1B,2EAA2E;IAC3E,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC5D,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO;YACN,YAAY,EAAE,eAAe;YAC7B,gBAAgB,EAAE,gBAAgB;SAClC,CAAC;IACH,CAAC;IACD,OAAO;QACN,YAAY,EAAE,WAAW;QACzB,gBAAgB,EAAE,SAAS;KAC3B,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SummaryObject } from \"@fluidframework/driver-definitions\";\nimport { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport { channelsTreeName } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tTelemetryDataTag,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nexport interface IRefreshSummaryResult {\n\t/** Tells whether this summary is tracked by this client. */\n\tisSummaryTracked: boolean;\n\t/** Tells whether this summary is newer than the latest one tracked by this client. */\n\tisSummaryNewer: boolean;\n}\n\nexport interface IStartSummaryResult {\n\t/** The number of summarizerNodes at the start of the summary. */\n\tnodes: number;\n\t/** The number of summarizerNodes in the wrong state. */\n\tinvalidNodes: number;\n\t/** The invalid sequence numbers and their values. It should be in the format of validateSequenceNumber-nodeSequenceNumber */\n\tmismatchNumbers: Set<string>;\n}\n\n/**\n * Return type of validateSummary function. In case of success, the object returned should have success: true.\n * In case of failure, the object returned should have success: false and additional properties to indicate what\n * the failure was, where it was, can it be retried, etc.\n */\nexport type ValidateSummaryResult =\n\t| {\n\t\t\tsuccess: true;\n\t }\n\t| {\n\t\t\tsuccess: false;\n\t\t\t/** The failure reason */\n\t\t\treason: string;\n\t\t\t/** id of the node that failed during validation */\n\t\t\tid: {\n\t\t\t\ttag: TelemetryDataTag.CodeArtifact;\n\t\t\t\tvalue: string | undefined;\n\t\t\t};\n\t\t\t/** If the error can be retried, time to wait before retrying */\n\t\t\tretryAfterSeconds?: number;\n\t };\n\nexport interface ISummarizerNodeRootContract {\n\tstartSummary(\n\t\treferenceSequenceNumber: number,\n\t\tsummaryLogger: ITelemetryLoggerExt,\n\t\tlatestSummaryRefSeqNum: number,\n\t): IStartSummaryResult;\n\tvalidateSummary(): ValidateSummaryResult;\n\tcompleteSummary(proposalHandle: string): void;\n\tclearSummary(): void;\n\trefreshLatestSummary(\n\t\tproposalHandle: string,\n\t\tsummaryRefSeq: number,\n\t): Promise<IRefreshSummaryResult>;\n}\n\n/** Path for nodes in a tree with escaped special characters */\nexport class EscapedPath {\n\tprivate constructor(public readonly path: string) {}\n\tpublic static create(path: string): EscapedPath {\n\t\treturn new EscapedPath(encodeURIComponent(path));\n\t}\n\tpublic static createAndConcat(pathParts: string[]): EscapedPath {\n\t\tlet ret = EscapedPath.create(pathParts[0] ?? \"\");\n\t\tfor (let i = 1; i < pathParts.length; i++) {\n\t\t\tret = ret.concat(EscapedPath.create(pathParts[i]));\n\t\t}\n\t\treturn ret;\n\t}\n\tpublic toString(): string {\n\t\treturn this.path;\n\t}\n\tpublic concat(path: EscapedPath): EscapedPath {\n\t\treturn new EscapedPath(`${this.path}/${path.path}`);\n\t}\n}\n\n/** Information about a summary relevant to a specific node in the tree */\nexport class SummaryNode {\n\t/** Creates an instance that is valid for the root with specific basePath and localPath */\n\tpublic static createForRoot(referenceSequenceNumber: number): SummaryNode {\n\t\treturn new SummaryNode({\n\t\t\treferenceSequenceNumber,\n\t\t\tbasePath: undefined,\n\t\t\tlocalPath: EscapedPath.create(\"\"), // root hard-coded to \"\"\n\t\t});\n\t}\n\n\t/** Summary reference sequence number, i.e. last sequence number seen when it was created */\n\tpublic get referenceSequenceNumber(): number {\n\t\treturn this.summary.referenceSequenceNumber;\n\t}\n\t/** Full path to parent node, or undefined if this is the root */\n\tpublic get basePath(): EscapedPath | undefined {\n\t\treturn this.summary.basePath;\n\t}\n\t/** Relative path to this node from its parent node */\n\tpublic get localPath(): EscapedPath {\n\t\treturn this.summary.localPath;\n\t}\n\t/** Relative path from this node to its node innermost base summary */\n\tpublic get additionalPath(): EscapedPath | undefined {\n\t\treturn this.summary.additionalPath;\n\t}\n\tpublic set additionalPath(additionalPath: EscapedPath | undefined) {\n\t\tthis.summary.additionalPath = additionalPath;\n\t}\n\tconstructor(\n\t\tprivate readonly summary: {\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\n\t/** Gets the full path to this node, to be used when sending a handle */\n\tpublic get fullPath(): EscapedPath {\n\t\treturn this.basePath?.concat(this.localPath) ?? this.localPath;\n\t}\n\n\t/**\n\t * Gets the full path to this node's innermost base summary.\n\t * The children nodes can use this as their basePath to determine their path.\n\t */\n\tpublic get fullPathForChildren(): EscapedPath {\n\t\treturn this.additionalPath !== undefined\n\t\t\t? this.fullPath.concat(this.additionalPath)\n\t\t\t: this.fullPath;\n\t}\n\n\t/**\n\t * Creates a new node within the same summary for a child of this node.\n\t * @param id - id of the child node\n\t */\n\tpublic createForChild(id: string): SummaryNode {\n\t\treturn new SummaryNode({\n\t\t\treferenceSequenceNumber: this.referenceSequenceNumber,\n\t\t\tbasePath: this.fullPathForChildren,\n\t\t\tlocalPath: EscapedPath.create(id),\n\t\t});\n\t}\n}\n\n/**\n * Represents the details needed to create a child summarizer node.\n */\nexport interface ICreateChildDetails {\n\t/** Latest summary from server node data */\n\tlatestSummary: SummaryNode | undefined;\n\t/** Sequence number of latest known change to the node */\n\tchangeSequenceNumber: number;\n\t/** A unique id of this child to be logged when sending telemetry. */\n\ttelemetryNodeId: string;\n}\n\nexport interface ISubtreeInfo<T extends ISnapshotTree | SummaryObject> {\n\t/** Tree to use to find children subtrees */\n\tchildrenTree: T;\n\t/** Additional path part where children are isolated */\n\tchildrenPathPart: string | undefined;\n}\n\n/**\n * Checks if the summary contains .channels subtree where the children subtrees\n * would be located if exists.\n * @param baseSummary - summary to check\n */\nexport function parseSummaryForSubtrees(\n\tbaseSummary: ISnapshotTree,\n): ISubtreeInfo<ISnapshotTree> {\n\t// New versions of snapshots have child nodes isolated in .channels subtree\n\tconst channelsSubtree = baseSummary.trees[channelsTreeName];\n\tif (channelsSubtree !== undefined) {\n\t\treturn {\n\t\t\tchildrenTree: channelsSubtree,\n\t\t\tchildrenPathPart: channelsTreeName,\n\t\t};\n\t}\n\treturn {\n\t\tchildrenTree: baseSummary,\n\t\tchildrenPathPart: undefined,\n\t};\n}\n"]}
1
+ {"version":3,"file":"summarizerNodeUtils.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AA2DhF,+DAA+D;AAC/D,MAAM,OAAO,WAAW;IACvB,YAAoC,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAC7C,MAAM,CAAC,MAAM,CAAC,IAAY;QAChC,OAAO,IAAI,WAAW,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IAClD,CAAC;IACM,MAAM,CAAC,eAAe,CAAC,SAAmB;QAChD,IAAI,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACjD,KAAK,IA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YAAO,GAAP,OAAO,CAKvB;IACC,CAAC;IAEJ,wEAAwE;IACxE,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC;IAChE,CAAC;IAED;;;OAGG;IACH,IAAW,mBAAmB;QAC7B,OAAO,IAAI,CAAC,cAAc,KAAK,SAAS;YACvC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC;YAC3C,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,EAAU;QAC/B,OAAO,IAAI,WAAW,CAAC;YACtB,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;YACrD,QAAQ,EAAE,IAAI,CAAC,mBAAmB;YAClC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;SACjC,CAAC,CAAC;IACJ,CAAC;CACD;AAqBD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACtC,WAA0B;IAE1B,2EAA2E;IAC3E,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC5D,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO;YACN,YAAY,EAAE,eAAe;YAC7B,gBAAgB,EAAE,gBAAgB;SAClC,CAAC;IACH,CAAC;IACD,OAAO;QACN,YAAY,EAAE,WAAW;QACzB,gBAAgB,EAAE,SAAS;KAC3B,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SummaryObject } from \"@fluidframework/driver-definitions\";\nimport { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport { channelsTreeName } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tTelemetryDataTag,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nexport interface IRefreshSummaryResult {\n\t/** Tells whether this summary is tracked by this client. */\n\tisSummaryTracked: boolean;\n\t/** Tells whether this summary is newer than the latest one tracked by this client. */\n\tisSummaryNewer: boolean;\n}\n\nexport interface IStartSummaryResult {\n\t/** The number of summarizerNodes at the start of the summary. */\n\tnodes: number;\n\t/** The number of summarizerNodes in the wrong state. */\n\tinvalidNodes: number;\n\t/** The invalid sequence numbers and their values. It should be in the format of validateSequenceNumber-nodeSequenceNumber */\n\tmismatchNumbers: Set<string>;\n}\n\n/**\n * Return type of validateSummary function. In case of success, the object returned should have success: true.\n * In case of failure, the object returned should have success: false and additional properties to indicate what\n * the failure was, where it was, can it be retried, etc.\n */\nexport type ValidateSummaryResult =\n\t| {\n\t\t\tsuccess: true;\n\t }\n\t| {\n\t\t\tsuccess: false;\n\t\t\t/** The failure reason */\n\t\t\treason: string;\n\t\t\t/** id of the node that failed during validation */\n\t\t\tid: {\n\t\t\t\ttag: TelemetryDataTag.CodeArtifact;\n\t\t\t\tvalue: string | undefined;\n\t\t\t};\n\t\t\t/** If the error can be retried, time to wait before retrying */\n\t\t\tretryAfterSeconds?: number;\n\t };\n\nexport interface ISummarizerNodeRootContract {\n\tstartSummary(\n\t\treferenceSequenceNumber: number,\n\t\tsummaryLogger: ITelemetryLoggerExt,\n\t\tlatestSummaryRefSeqNum: number,\n\t): IStartSummaryResult;\n\tvalidateSummary(): ValidateSummaryResult;\n\tcompleteSummary(proposalHandle: string): void;\n\tclearSummary(): void;\n\trefreshLatestSummary(\n\t\tproposalHandle: string,\n\t\tsummaryRefSeq: number,\n\t): Promise<IRefreshSummaryResult>;\n}\n\n/** Path for nodes in a tree with escaped special characters */\nexport class EscapedPath {\n\tprivate constructor(public readonly path: string) {}\n\tpublic static create(path: string): EscapedPath {\n\t\treturn new EscapedPath(encodeURIComponent(path));\n\t}\n\tpublic static createAndConcat(pathParts: string[]): EscapedPath {\n\t\tlet ret = EscapedPath.create(pathParts[0] ?? \"\");\n\t\tfor (let i = 1; i < pathParts.length; i++) {\n\t\t\t// Non null asserting here since we are iterating over pathParts\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tret = ret.concat(EscapedPath.create(pathParts[i]!));\n\t\t}\n\t\treturn ret;\n\t}\n\tpublic toString(): string {\n\t\treturn this.path;\n\t}\n\tpublic concat(path: EscapedPath): EscapedPath {\n\t\treturn new EscapedPath(`${this.path}/${path.path}`);\n\t}\n}\n\n/** Information about a summary relevant to a specific node in the tree */\nexport class SummaryNode {\n\t/** Creates an instance that is valid for the root with specific basePath and localPath */\n\tpublic static createForRoot(referenceSequenceNumber: number): SummaryNode {\n\t\treturn new SummaryNode({\n\t\t\treferenceSequenceNumber,\n\t\t\tbasePath: undefined,\n\t\t\tlocalPath: EscapedPath.create(\"\"), // root hard-coded to \"\"\n\t\t});\n\t}\n\n\t/** Summary reference sequence number, i.e. last sequence number seen when it was created */\n\tpublic get referenceSequenceNumber(): number {\n\t\treturn this.summary.referenceSequenceNumber;\n\t}\n\t/** Full path to parent node, or undefined if this is the root */\n\tpublic get basePath(): EscapedPath | undefined {\n\t\treturn this.summary.basePath;\n\t}\n\t/** Relative path to this node from its parent node */\n\tpublic get localPath(): EscapedPath {\n\t\treturn this.summary.localPath;\n\t}\n\t/** Relative path from this node to its node innermost base summary */\n\tpublic get additionalPath(): EscapedPath | undefined {\n\t\treturn this.summary.additionalPath;\n\t}\n\tpublic set additionalPath(additionalPath: EscapedPath | undefined) {\n\t\tthis.summary.additionalPath = additionalPath;\n\t}\n\tconstructor(\n\t\tprivate readonly summary: {\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\n\t/** Gets the full path to this node, to be used when sending a handle */\n\tpublic get fullPath(): EscapedPath {\n\t\treturn this.basePath?.concat(this.localPath) ?? this.localPath;\n\t}\n\n\t/**\n\t * Gets the full path to this node's innermost base summary.\n\t * The children nodes can use this as their basePath to determine their path.\n\t */\n\tpublic get fullPathForChildren(): EscapedPath {\n\t\treturn this.additionalPath !== undefined\n\t\t\t? this.fullPath.concat(this.additionalPath)\n\t\t\t: this.fullPath;\n\t}\n\n\t/**\n\t * Creates a new node within the same summary for a child of this node.\n\t * @param id - id of the child node\n\t */\n\tpublic createForChild(id: string): SummaryNode {\n\t\treturn new SummaryNode({\n\t\t\treferenceSequenceNumber: this.referenceSequenceNumber,\n\t\t\tbasePath: this.fullPathForChildren,\n\t\t\tlocalPath: EscapedPath.create(id),\n\t\t});\n\t}\n}\n\n/**\n * Represents the details needed to create a child summarizer node.\n */\nexport interface ICreateChildDetails {\n\t/** Latest summary from server node data */\n\tlatestSummary: SummaryNode | undefined;\n\t/** Sequence number of latest known change to the node */\n\tchangeSequenceNumber: number;\n\t/** A unique id of this child to be logged when sending telemetry. */\n\ttelemetryNodeId: string;\n}\n\nexport interface ISubtreeInfo<T extends ISnapshotTree | SummaryObject> {\n\t/** Tree to use to find children subtrees */\n\tchildrenTree: T;\n\t/** Additional path part where children are isolated */\n\tchildrenPathPart: string | undefined;\n}\n\n/**\n * Checks if the summary contains .channels subtree where the children subtrees\n * would be located if exists.\n * @param baseSummary - summary to check\n */\nexport function parseSummaryForSubtrees(\n\tbaseSummary: ISnapshotTree,\n): ISubtreeInfo<ISnapshotTree> {\n\t// New versions of snapshots have child nodes isolated in .channels subtree\n\tconst channelsSubtree = baseSummary.trees[channelsTreeName];\n\tif (channelsSubtree !== undefined) {\n\t\treturn {\n\t\t\tchildrenTree: channelsSubtree,\n\t\t\tchildrenPathPart: channelsTreeName,\n\t\t};\n\t}\n\treturn {\n\t\tchildrenTree: baseSummary,\n\t\tchildrenPathPart: undefined,\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"summaryFormat.d.ts","sourceRoot":"","sources":["../../src/summary/summaryFormat.ts"],"names":[],"mapp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annelsTree(summarizeResult) {
124
124
  summarizeResult.stats.treeNodeCount++;
125
125
  }
126
126
  export async function getFluidDataStoreAttributes(storage, snapshot) {
127
- const attributes = await readAndParse(storage, snapshot.blobs[dataStoreAttributesBlobName]);
127
+ const attributes = await readAndParse(storage,
128
+ // TODO why are we non null asserting here?
129
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
130
+ snapshot.blobs[dataStoreAttributesBlobName]);
128
131
  // Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.
129
132
  // For snapshotFormatVersion = "0.1" (1) or above, pkg is jsonified, otherwise it is just a string.
130
133
  // However the feature of loading a detached container from snapshot, is added when the
@@ -1 +1 @@
1
- {"version":3,"file":"summaryFormat.js","sourceRoot":"","sources":["../../src/summary/summaryFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAMjE,OAAO,EACN,mBAAmB,IAAI,sBAAsB,EAC7C,YAAY,GACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEN,gBAAgB,EAChB,SAAS,GACT,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAgFxD,MAAM,UAAU,0BAA0B,CAAC,UAAwC;IAClF,IAAI,UAAU,CAAC,oBAAoB,EAAE,CAAC;QACrC;;;WAGG;QACH,OAAO,UAAU,CAAC,oBAAoB,CAAC;IACxC,CAAC;SAAM,IAAI,UAAU,CAAC,qBAAqB,KAAK,KAAK,EAAE,CAAC;QACvD;;;WAGG;QACH,OAAO,CAAC,CAAC;IACV,CAAC;IACD;;;OAGG;IACH,OAAO,CAAC,CAAC;AACV,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,UAAwC;IAC3E,OAAO,CAAC,CAAC,UAAU,CAAC,oBAAoB,IAAI,CAAC,UAAU,CAAC,uBAAuB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AAY,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,yBAAyB,CAAC,eAAsC;IAC/E,eAAe,CAAC,OAAO,GAAG;QACzB,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,EAAE,eAAe,CAAC,OAAO,EAAE;KACrD,CAAC;IACF,eAAe,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;AACvC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAChD,OAAgC,EAChC,QAAuB;IAEvB,MAAM,UAAU,GAAG,MAAM,YAAY,CACpC,OAAO,EACP,QAAQ,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAC3C,CAAC;IACF,qFAAqF;IACrF,mGAAmG;IACnG,uFAAuF;IACvF,0FAA0F;IAC1F,MAAM,aAAa,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;IAC7D,MAAM,CAAC,aAAa,GAAG,CAAC,EAAE,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACvE,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { SummaryType } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentStorageService,\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tblobHeadersBlobName as blobNameForBlobHeaders,\n\treadAndParse,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\tISummaryTreeWithStats,\n\tchannelsTreeName,\n\tgcTreeKey,\n} from \"@fluidframework/runtime-definitions/internal\";\n\nimport { blobsTreeName } from \"../blobManager/index.js\";\nimport { IGCMetadata } from \"../gc/index.js\";\n\nimport { IDocumentSchema } from \"./documentSchema.js\";\n\n/**\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n * @legacy\n * @alpha\n */\nexport type OmitAttributesVersions<T> = Omit<\n\tT,\n\t\"snapshotFormatVersion\" | \"summaryFormatVersion\"\n>;\n\n/**\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n * @legacy\n * @alpha\n */\nexport interface IFluidDataStoreAttributes0 {\n\treadonly snapshotFormatVersion?: undefined;\n\treadonly summaryFormatVersion?: undefined;\n\tpkg: string;\n\t/**\n\t * This tells whether a data store is root. Root data stores are never collected.\n\t * Non-root data stores may be collected if they are not used. If this is not present, default it to\n\t * true. This will ensure that older data stores are incorrectly collected.\n\t */\n\treadonly isRootDataStore?: boolean;\n}\n\n/**\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n * @legacy\n * @alpha\n */\nexport interface IFluidDataStoreAttributes1\n\textends OmitAttributesVersions<IFluidDataStoreAttributes0> {\n\treadonly snapshotFormatVersion: \"0.1\";\n\treadonly summaryFormatVersion?: undefined;\n}\n\n/**\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n * @legacy\n * @alpha\n */\nexport interface IFluidDataStoreAttributes2\n\textends OmitAttributesVersions<IFluidDataStoreAttributes1> {\n\t/** Switch from snapshotFormatVersion to summaryFormatVersion */\n\treadonly snapshotFormatVersion?: undefined;\n\treadonly summaryFormatVersion: 2;\n\t/**\n\t * True if channels are not isolated in .channels subtrees, otherwise isolated.\n\t * This is required in both datastore attributes as well as the root container,\n\t * because reused summary handles may cause different format versions in each\n\t * datastore subtree within the summary.\n\t */\n\treadonly disableIsolatedChannels?: true;\n}\n/**\n * Added IFluidDataStoreAttributes similar to IChannelAttributes which will tell the attributes of a\n * store like the package, snapshotFormatVersion to take different decisions based on a particular\n * snapshotFormatVersion.\n *\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n *\n * @legacy\n * @alpha\n *\n */\nexport type ReadFluidDataStoreAttributes =\n\t| IFluidDataStoreAttributes0\n\t| IFluidDataStoreAttributes1\n\t| IFluidDataStoreAttributes2;\nexport type WriteFluidDataStoreAttributes =\n\t| IFluidDataStoreAttributes1\n\t| IFluidDataStoreAttributes2;\n\nexport function getAttributesFormatVersion(attributes: ReadFluidDataStoreAttributes): number {\n\tif (attributes.summaryFormatVersion) {\n\t\t/**\n\t\t * Version 2+: Introduces .channels trees for isolation of\n\t\t * channel trees from data store objects.\n\t\t */\n\t\treturn attributes.summaryFormatVersion;\n\t} else if (attributes.snapshotFormatVersion === \"0.1\") {\n\t\t/**\n\t\t * Version 1: from this version the pkg within the data store\n\t\t * attributes blob is a JSON array rather than a string.\n\t\t */\n\t\treturn 1;\n\t}\n\t/**\n\t * Version 0: format version is missing from summary.\n\t * This indicates it is an older version.\n\t */\n\treturn 0;\n}\n\nexport function hasIsolatedChannels(attributes: ReadFluidDataStoreAttributes): boolean {\n\treturn !!attributes.summaryFormatVersion && !attributes.disableIsolatedChannels;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGCMetadata {\n\treadonly summaryFormatVersion: 1;\n\t/** @deprecated - used by old (prior to 2.0 RC3) runtimes */\n\treadonly message?: ISummaryMetadataMessage;\n\t/** The last message processed at the time of summary. Only primitive property types are added to the summary. */\n\treadonly lastMessage?: ISummaryMetadataMessage;\n\t/** True if channels are not isolated in .channels subtrees, otherwise isolated. */\n\treadonly disableIsolatedChannels?: true;\n\t/** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */\n\treadonly summaryNumber?: number;\n\t/** GUID to identify a document in telemetry */\n\treadonly telemetryDocumentId?: string;\n\n\treadonly documentSchema?: IDocumentSchema;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ICreateContainerMetadata {\n\t/** Runtime version of the container when it was first created */\n\tcreateContainerRuntimeVersion?: string;\n\t/** Timestamp of the container when it was first created */\n\tcreateContainerTimestamp?: number;\n}\n\n/**\n * The properties of an ISequencedDocumentMessage to be stored in the metadata blob in summary.\n * @legacy\n * @alpha\n */\nexport type ISummaryMetadataMessage = Pick<\n\tISequencedDocumentMessage,\n\t| \"clientId\"\n\t| \"clientSequenceNumber\"\n\t| \"minimumSequenceNumber\"\n\t| \"referenceSequenceNumber\"\n\t| \"sequenceNumber\"\n\t| \"timestamp\"\n\t| \"type\"\n>;\n\n/**\n * Extracts the properties from an ISequencedDocumentMessage as defined by ISummaryMetadataMessage. This message is\n * added to the metadata blob in summary.\n */\nexport const extractSummaryMetadataMessage = (\n\tmessage?: ISequencedDocumentMessage,\n): ISummaryMetadataMessage | undefined =>\n\tmessage === undefined\n\t\t? undefined\n\t\t: {\n\t\t\t\tclientId: message.clientId,\n\t\t\t\tclientSequenceNumber: message.clientSequenceNumber,\n\t\t\t\tminimumSequenceNumber: message.minimumSequenceNumber,\n\t\t\t\treferenceSequenceNumber: message.referenceSequenceNumber,\n\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\ttimestamp: message.timestamp,\n\t\t\t\ttype: message.type,\n\t\t\t};\n\nexport function getMetadataFormatVersion(metadata?: IContainerRuntimeMetadata): number {\n\t/**\n\t * Version 2+: Introduces runtime sequence number for data verification.\n\t *\n\t * Version 1+: Introduces .metadata blob and .channels trees for isolation of\n\t * data store trees from container-level objects.\n\t * Also introduces enableGC option stored in the summary.\n\t *\n\t * Version 0: metadata blob missing; format version is missing from summary.\n\t * This indicates it is an older version.\n\t */\n\treturn metadata?.summaryFormatVersion ?? 0;\n}\n\nexport const aliasBlobName = \".aliases\";\nexport const metadataBlobName = \".metadata\";\nexport const chunksBlobName = \".chunks\";\nexport const electedSummarizerBlobName = \".electedSummarizer\";\nexport const idCompressorBlobName = \".idCompressor\";\nexport const blobHeadersBlobName = blobNameForBlobHeaders;\n\nexport function rootHasIsolatedChannels(metadata?: IContainerRuntimeMetadata): boolean {\n\treturn !!metadata && !metadata.disableIsolatedChannels;\n}\n\nexport const protocolTreeName = \".protocol\";\n\n/**\n * List of tree IDs at the container level which are reserved.\n * This is for older versions of summaries that do not yet have an\n * isolated data stores namespace. Without the namespace, this must\n * be used to prevent name collisions with data store IDs.\n */\nexport const nonDataStorePaths = [\n\tprotocolTreeName,\n\t\".logTail\",\n\t\".serviceProtocol\",\n\tblobsTreeName,\n\tgcTreeKey,\n\tidCompressorBlobName,\n];\n\nexport const dataStoreAttributesBlobName = \".component\";\n\n/**\n * Modifies summary tree and stats to put tree under .channels tree.\n *\n * @param summarizeResult - Summary tree and stats to modify\n *\n * @example\n *\n * Converts from:\n *\n * ```typescript\n * {\n * type: SummaryType.Tree,\n * tree: { a: {...}, b: {...}, c: {...} },\n * }\n * ```\n *\n * to:\n *\n * ```typescript\n * {\n * type: SummaryType.Tree,\n * tree: {\n * \".channels\": {\n * type: SummaryType.Tree,\n * tree: { a: {...}, b: {...}, c: {...} }\n * },\n * },\n * }\n * ```\n *\n * And adds +1 to treeNodeCount in stats.\n */\nexport function wrapSummaryInChannelsTree(summarizeResult: ISummaryTreeWithStats): void {\n\tsummarizeResult.summary = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: { [channelsTreeName]: summarizeResult.summary },\n\t};\n\tsummarizeResult.stats.treeNodeCount++;\n}\n\nexport async function getFluidDataStoreAttributes(\n\tstorage: IDocumentStorageService,\n\tsnapshot: ISnapshotTree,\n): Promise<ReadFluidDataStoreAttributes> {\n\tconst attributes = await readAndParse<ReadFluidDataStoreAttributes>(\n\t\tstorage,\n\t\tsnapshot.blobs[dataStoreAttributesBlobName],\n\t);\n\t// Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.\n\t// For snapshotFormatVersion = \"0.1\" (1) or above, pkg is jsonified, otherwise it is just a string.\n\t// However the feature of loading a detached container from snapshot, is added when the\n\t// snapshotFormatVersion is at least \"0.1\" (1), so we don't expect it to be anything else.\n\tconst formatVersion = getAttributesFormatVersion(attributes);\n\tassert(formatVersion > 0, 0x1d5 /* Invalid snapshot format version */);\n\treturn attributes;\n}\n"]}
1
+ {"version":3,"file":"summaryFormat.js","sourceRoot":"","sources":["../../src/summary/summaryFormat.ts"],"names":[],"mappings":"AAAA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,CAAC;IACF,qFAAqF;IACrF,mGAAmG;IACnG,uFAAuF;IACvF,0FAA0F;IAC1F,MAAM,aAAa,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;IAC7D,MAAM,CAAC,aAAa,GAAG,CAAC,EAAE,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACvE,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { SummaryType } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentStorageService,\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tblobHeadersBlobName as blobNameForBlobHeaders,\n\treadAndParse,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\tISummaryTreeWithStats,\n\tchannelsTreeName,\n\tgcTreeKey,\n} from \"@fluidframework/runtime-definitions/internal\";\n\nimport { blobsTreeName } from \"../blobManager/index.js\";\nimport { IGCMetadata } from \"../gc/index.js\";\n\nimport { IDocumentSchema } from \"./documentSchema.js\";\n\n/**\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n * @legacy\n * @alpha\n */\nexport type OmitAttributesVersions<T> = Omit<\n\tT,\n\t\"snapshotFormatVersion\" | \"summaryFormatVersion\"\n>;\n\n/**\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n * @legacy\n * @alpha\n */\nexport interface IFluidDataStoreAttributes0 {\n\treadonly snapshotFormatVersion?: undefined;\n\treadonly summaryFormatVersion?: undefined;\n\tpkg: string;\n\t/**\n\t * This tells whether a data store is root. Root data stores are never collected.\n\t * Non-root data stores may be collected if they are not used. If this is not present, default it to\n\t * true. This will ensure that older data stores are incorrectly collected.\n\t */\n\treadonly isRootDataStore?: boolean;\n}\n\n/**\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n * @legacy\n * @alpha\n */\nexport interface IFluidDataStoreAttributes1\n\textends OmitAttributesVersions<IFluidDataStoreAttributes0> {\n\treadonly snapshotFormatVersion: \"0.1\";\n\treadonly summaryFormatVersion?: undefined;\n}\n\n/**\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n * @legacy\n * @alpha\n */\nexport interface IFluidDataStoreAttributes2\n\textends OmitAttributesVersions<IFluidDataStoreAttributes1> {\n\t/** Switch from snapshotFormatVersion to summaryFormatVersion */\n\treadonly snapshotFormatVersion?: undefined;\n\treadonly summaryFormatVersion: 2;\n\t/**\n\t * True if channels are not isolated in .channels subtrees, otherwise isolated.\n\t * This is required in both datastore attributes as well as the root container,\n\t * because reused summary handles may cause different format versions in each\n\t * datastore subtree within the summary.\n\t */\n\treadonly disableIsolatedChannels?: true;\n}\n/**\n * Added IFluidDataStoreAttributes similar to IChannelAttributes which will tell the attributes of a\n * store like the package, snapshotFormatVersion to take different decisions based on a particular\n * snapshotFormatVersion.\n *\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n *\n * @legacy\n * @alpha\n *\n */\nexport type ReadFluidDataStoreAttributes =\n\t| IFluidDataStoreAttributes0\n\t| IFluidDataStoreAttributes1\n\t| IFluidDataStoreAttributes2;\nexport type WriteFluidDataStoreAttributes =\n\t| IFluidDataStoreAttributes1\n\t| IFluidDataStoreAttributes2;\n\nexport function getAttributesFormatVersion(attributes: ReadFluidDataStoreAttributes): number {\n\tif (attributes.summaryFormatVersion) {\n\t\t/**\n\t\t * Version 2+: Introduces .channels trees for isolation of\n\t\t * channel trees from data store objects.\n\t\t */\n\t\treturn attributes.summaryFormatVersion;\n\t} else if (attributes.snapshotFormatVersion === \"0.1\") {\n\t\t/**\n\t\t * Version 1: from this version the pkg within the data store\n\t\t * attributes blob is a JSON array rather than a string.\n\t\t */\n\t\treturn 1;\n\t}\n\t/**\n\t * Version 0: format version is missing from summary.\n\t * This indicates it is an older version.\n\t */\n\treturn 0;\n}\n\nexport function hasIsolatedChannels(attributes: ReadFluidDataStoreAttributes): boolean {\n\treturn !!attributes.summaryFormatVersion && !attributes.disableIsolatedChannels;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGCMetadata {\n\treadonly summaryFormatVersion: 1;\n\t/** @deprecated - used by old (prior to 2.0 RC3) runtimes */\n\treadonly message?: ISummaryMetadataMessage;\n\t/** The last message processed at the time of summary. Only primitive property types are added to the summary. */\n\treadonly lastMessage?: ISummaryMetadataMessage;\n\t/** True if channels are not isolated in .channels subtrees, otherwise isolated. */\n\treadonly disableIsolatedChannels?: true;\n\t/** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */\n\treadonly summaryNumber?: number;\n\t/** GUID to identify a document in telemetry */\n\treadonly telemetryDocumentId?: string;\n\n\treadonly documentSchema?: IDocumentSchema;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ICreateContainerMetadata {\n\t/** Runtime version of the container when it was first created */\n\tcreateContainerRuntimeVersion?: string;\n\t/** Timestamp of the container when it was first created */\n\tcreateContainerTimestamp?: number;\n}\n\n/**\n * The properties of an ISequencedDocumentMessage to be stored in the metadata blob in summary.\n * @legacy\n * @alpha\n */\nexport type ISummaryMetadataMessage = Pick<\n\tISequencedDocumentMessage,\n\t| \"clientId\"\n\t| \"clientSequenceNumber\"\n\t| \"minimumSequenceNumber\"\n\t| \"referenceSequenceNumber\"\n\t| \"sequenceNumber\"\n\t| \"timestamp\"\n\t| \"type\"\n>;\n\n/**\n * Extracts the properties from an ISequencedDocumentMessage as defined by ISummaryMetadataMessage. This message is\n * added to the metadata blob in summary.\n */\nexport const extractSummaryMetadataMessage = (\n\tmessage?: ISequencedDocumentMessage,\n): ISummaryMetadataMessage | undefined =>\n\tmessage === undefined\n\t\t? undefined\n\t\t: {\n\t\t\t\tclientId: message.clientId,\n\t\t\t\tclientSequenceNumber: message.clientSequenceNumber,\n\t\t\t\tminimumSequenceNumber: message.minimumSequenceNumber,\n\t\t\t\treferenceSequenceNumber: message.referenceSequenceNumber,\n\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\ttimestamp: message.timestamp,\n\t\t\t\ttype: message.type,\n\t\t\t};\n\nexport function getMetadataFormatVersion(metadata?: IContainerRuntimeMetadata): number {\n\t/**\n\t * Version 2+: Introduces runtime sequence number for data verification.\n\t *\n\t * Version 1+: Introduces .metadata blob and .channels trees for isolation of\n\t * data store trees from container-level objects.\n\t * Also introduces enableGC option stored in the summary.\n\t *\n\t * Version 0: metadata blob missing; format version is missing from summary.\n\t * This indicates it is an older version.\n\t */\n\treturn metadata?.summaryFormatVersion ?? 0;\n}\n\nexport const aliasBlobName = \".aliases\";\nexport const metadataBlobName = \".metadata\";\nexport const chunksBlobName = \".chunks\";\nexport const electedSummarizerBlobName = \".electedSummarizer\";\nexport const idCompressorBlobName = \".idCompressor\";\nexport const blobHeadersBlobName = blobNameForBlobHeaders;\n\nexport function rootHasIsolatedChannels(metadata?: IContainerRuntimeMetadata): boolean {\n\treturn !!metadata && !metadata.disableIsolatedChannels;\n}\n\nexport const protocolTreeName = \".protocol\";\n\n/**\n * List of tree IDs at the container level which are reserved.\n * This is for older versions of summaries that do not yet have an\n * isolated data stores namespace. Without the namespace, this must\n * be used to prevent name collisions with data store IDs.\n */\nexport const nonDataStorePaths = [\n\tprotocolTreeName,\n\t\".logTail\",\n\t\".serviceProtocol\",\n\tblobsTreeName,\n\tgcTreeKey,\n\tidCompressorBlobName,\n];\n\nexport const dataStoreAttributesBlobName = \".component\";\n\n/**\n * Modifies summary tree and stats to put tree under .channels tree.\n *\n * @param summarizeResult - Summary tree and stats to modify\n *\n * @example\n *\n * Converts from:\n *\n * ```typescript\n * {\n * type: SummaryType.Tree,\n * tree: { a: {...}, b: {...}, c: {...} },\n * }\n * ```\n *\n * to:\n *\n * ```typescript\n * {\n * type: SummaryType.Tree,\n * tree: {\n * \".channels\": {\n * type: SummaryType.Tree,\n * tree: { a: {...}, b: {...}, c: {...} }\n * },\n * },\n * }\n * ```\n *\n * And adds +1 to treeNodeCount in stats.\n */\nexport function wrapSummaryInChannelsTree(summarizeResult: ISummaryTreeWithStats): void {\n\tsummarizeResult.summary = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: { [channelsTreeName]: summarizeResult.summary },\n\t};\n\tsummarizeResult.stats.treeNodeCount++;\n}\n\nexport async function getFluidDataStoreAttributes(\n\tstorage: IDocumentStorageService,\n\tsnapshot: ISnapshotTree,\n): Promise<ReadFluidDataStoreAttributes> {\n\tconst attributes = await readAndParse<ReadFluidDataStoreAttributes>(\n\t\tstorage,\n\t\t// TODO why are we non null asserting here?\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tsnapshot.blobs[dataStoreAttributesBlobName]!,\n\t);\n\t// Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.\n\t// For snapshotFormatVersion = \"0.1\" (1) or above, pkg is jsonified, otherwise it is just a string.\n\t// However the feature of loading a detached container from snapshot, is added when the\n\t// snapshotFormatVersion is at least \"0.1\" (1), so we don't expect it to be anything else.\n\tconst formatVersion = getAttributesFormatVersion(attributes);\n\tassert(formatVersion > 0, 0x1d5 /* Invalid snapshot format version */);\n\treturn attributes;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/container-runtime",
3
- "version": "2.1.0-276985",
3
+ "version": "2.1.0",
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-276985",
131
- "@fluidframework/container-definitions": "2.1.0-276985",
132
- "@fluidframework/container-runtime-definitions": "2.1.0-276985",
133
- "@fluidframework/core-interfaces": "2.1.0-276985",
134
- "@fluidframework/core-utils": "2.1.0-276985",
135
- "@fluidframework/datastore": "2.1.0-276985",
136
- "@fluidframework/driver-definitions": "2.1.0-276985",
137
- "@fluidframework/driver-utils": "2.1.0-276985",
138
- "@fluidframework/id-compressor": "2.1.0-276985",
139
- "@fluidframework/runtime-definitions": "2.1.0-276985",
140
- "@fluidframework/runtime-utils": "2.1.0-276985",
141
- "@fluidframework/telemetry-utils": "2.1.0-276985",
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",
142
142
  "@tylerbu/sorted-btree-es6": "^1.8.0",
143
143
  "double-ended-queue": "^2.1.0-0",
144
144
  "lz4js": "^0.2.0",
@@ -146,17 +146,17 @@
146
146
  },
147
147
  "devDependencies": {
148
148
  "@arethetypeswrong/cli": "^0.15.2",
149
- "@biomejs/biome": "^1.7.3",
150
- "@fluid-internal/mocha-test-setup": "2.1.0-276985",
151
- "@fluid-private/stochastic-test-utils": "2.1.0-276985",
152
- "@fluid-private/test-pairwise-generator": "2.1.0-276985",
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
153
  "@fluid-tools/benchmark": "^0.48.0",
154
- "@fluid-tools/build-cli": "^0.39.0",
154
+ "@fluid-tools/build-cli": "^0.41.0",
155
155
  "@fluidframework/build-common": "^2.0.3",
156
- "@fluidframework/build-tools": "^0.39.0",
157
- "@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.0.0-rc.5.0.0",
156
+ "@fluidframework/build-tools": "^0.41.0",
157
+ "@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.0.0",
158
158
  "@fluidframework/eslint-config-fluid": "^5.3.0",
159
- "@fluidframework/test-runtime-utils": "2.1.0-276985",
159
+ "@fluidframework/test-runtime-utils": "~2.1.0",
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,25 +178,39 @@
178
178
  "typescript": "~5.4.5"
179
179
  },
180
180
  "typeValidation": {
181
- "broken": {}
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
+ }
182
195
  },
183
196
  "scripts": {
184
197
  "api": "fluid-build . --task api",
185
198
  "api-extractor:commonjs": "flub generate entrypoints --outDir ./dist",
186
199
  "api-extractor:esnext": "flub generate entrypoints --outDir ./lib --node10TypeCompat",
187
200
  "build": "fluid-build . --task build",
201
+ "build:api-reports": "concurrently \"npm:build:api-reports:*\"",
202
+ "build:api-reports:current": "api-extractor run --local --config api-extractor/api-extractor.current.json",
203
+ "build:api-reports:legacy": "api-extractor run --local --config api-extractor/api-extractor.legacy.json",
188
204
  "build:commonjs": "fluid-build . --task commonjs",
189
205
  "build:compile": "fluid-build . --task compile",
190
- "build:docs": "concurrently \"npm:build:docs:*\"",
191
- "build:docs:current": "api-extractor run --local",
192
- "build:docs:legacy": "api-extractor run --local --config api-extractor/api-extractor.legacy.json",
206
+ "build:docs": "api-extractor run --local",
193
207
  "build:esnext": "tsc --project ./tsconfig.json",
194
208
  "build:genver": "gen-version",
195
209
  "build:test": "npm run build:test:esm && npm run build:test:cjs",
196
210
  "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
197
211
  "build:test:esm": "tsc --project ./src/test/tsconfig.json",
198
212
  "check:are-the-types-wrong": "attw --pack . --exclude-entrypoints ./internal/test/containerRuntime ./internal/test/deltaScheduler ./internal/test/scheduleManager ./internal/test/blobManager ./internal/test/summary ./internal/test/gc",
199
- "check:biome": "biome check . --formatter-enabled=true",
213
+ "check:biome": "biome check .",
200
214
  "check:exports": "concurrently \"npm:check:exports:*\"",
201
215
  "check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
202
216
  "check:exports:cjs:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.cjs.json",
@@ -205,20 +219,21 @@
205
219
  "check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
206
220
  "check:format": "npm run check:biome",
207
221
  "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
208
- "ci:build:docs": "concurrently \"npm:ci:build:docs:*\"",
209
- "ci:build:docs:current": "api-extractor run",
210
- "ci:build:docs:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
222
+ "ci:build:api-reports": "concurrently \"npm:ci:build:api-reports:*\"",
223
+ "ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor.current.json",
224
+ "ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
225
+ "ci:build:docs": "api-extractor run",
211
226
  "clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
212
227
  "eslint": "eslint --format stylish src",
213
228
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
214
229
  "format": "npm run format:biome",
215
- "format:biome": "biome check . --formatter-enabled=true --apply",
230
+ "format:biome": "biome check . --write",
216
231
  "format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
217
232
  "lint": "fluid-build . --task lint",
218
233
  "lint:fix": "fluid-build . --task eslint:fix --task format",
219
234
  "place:cjs:package-stub": "copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
220
235
  "test": "npm run test:mocha",
221
- "test:benchmark:report": "mocha --timeout 999999 --perfMode --parentProcess --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js \"./dist/**/*.perf.spec.*js\"",
236
+ "test:benchmark:report": "mocha --timeout 10s --perfMode --parentProcess --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js \"./dist/**/*.perf.spec.*js\" --exit",
222
237
  "test:coverage": "c8 npm test",
223
238
  "test:mocha": "npm run test:mocha:esm && echo skipping cjs to avoid overhead - npm run test:mocha:cjs",
224
239
  "test:mocha:cjs": "mocha --recursive \"dist/test/**/*.spec.*js\" --exit",
@@ -385,9 +385,11 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
385
385
  0x384 /* requesting handle for unknown blob */,
386
386
  );
387
387
  const pending = this.pendingBlobs.get(id);
388
+ // Create a callback function for once the blob has been attached
388
389
  const callback = pending
389
390
  ? () => {
390
391
  pending.attached = true;
392
+ // Notify listeners (e.g. serialization process) that blob has been attached
391
393
  this.emit("blobAttached", pending);
392
394
  this.deletePendingBlobMaybe(id);
393
395
  }
@@ -772,6 +774,16 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
772
774
  }
773
775
  }
774
776
 
777
+ /**
778
+ * Part of container serialization when imminent closure is enabled (Currently when calling closeAndGetPendingLocalState).
779
+ * This asynchronous function resolves all pending createBlob calls and waits for each blob
780
+ * to be attached. It will also send BlobAttach ops for each pending blob that hasn't sent it
781
+ * yet so that serialized container can resubmit them when rehydrated.
782
+ *
783
+ * @param stopBlobAttachingSignal - Optional signal to abort the blob attaching process.
784
+ * @returns - A promise that resolves with the details of the attached blobs,
785
+ * or undefined if no blobs were processed.
786
+ */
775
787
  public async attachAndGetPendingBlobs(
776
788
  stopBlobAttachingSignal?: AbortSignal,
777
789
  ): Promise<IPendingBlobs | undefined> {
@@ -784,12 +796,17 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
784
796
  }
785
797
  const blobs = {};
786
798
  const localBlobs = new Set<PendingBlob>();
799
+ // This while is used to stash blobs created while attaching and getting blobs
787
800
  while (localBlobs.size < this.pendingBlobs.size) {
788
801
  const attachBlobsP: Promise<void>[] = [];
789
802
  for (const [id, entry] of this.pendingBlobs) {
790
803
  if (!localBlobs.has(entry)) {
791
804
  localBlobs.add(entry);
805
+ // Resolving the blob handle to let hosts continue with their operations (it will resolve
806
+ // original createBlob call) and let them attach the blob. This is a lie we told since the upload
807
+ // hasn't finished yet, but it's fine since we will retry on rehydration.
792
808
  entry.handleP.resolve(this.getBlobHandle(id));
809
+ // Array of promises that will resolve when blobs get attached.
793
810
  attachBlobsP.push(
794
811
  new Promise<void>((resolve, reject) => {
795
812
  stopBlobAttachingSignal?.addEventListener(
@@ -815,6 +832,8 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
815
832
  );
816
833
  }
817
834
  }
835
+ // Wait for all blobs to be attached. This is important, otherwise serialized container
836
+ // could send the blobAttach op without any op that references the blob, making it useless.
818
837
  await Promise.allSettled(attachBlobsP).catch(() => {});
819
838
  }
820
839