@fluidframework/container-runtime 2.1.0-274160 → 2.1.0-276985

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 (201) hide show
  1. package/README.md +14 -5
  2. package/container-runtime.test-files.tar +0 -0
  3. package/{lib → dist/blobManager}/blobManager.d.ts +9 -28
  4. package/dist/blobManager/blobManager.d.ts.map +1 -0
  5. package/dist/{blobManager.js → blobManager/blobManager.js} +23 -83
  6. package/dist/blobManager/blobManager.js.map +1 -0
  7. package/dist/blobManager/blobManagerSnapSum.d.ts +30 -0
  8. package/dist/blobManager/blobManagerSnapSum.d.ts.map +1 -0
  9. package/dist/blobManager/blobManagerSnapSum.js +82 -0
  10. package/dist/blobManager/blobManagerSnapSum.js.map +1 -0
  11. package/dist/blobManager/index.d.ts +7 -0
  12. package/dist/blobManager/index.d.ts.map +1 -0
  13. package/dist/blobManager/index.js +16 -0
  14. package/dist/blobManager/index.js.map +1 -0
  15. package/dist/channelCollection.d.ts +1 -0
  16. package/dist/channelCollection.d.ts.map +1 -1
  17. package/dist/channelCollection.js +23 -13
  18. package/dist/channelCollection.js.map +1 -1
  19. package/dist/containerRuntime.d.ts +20 -7
  20. package/dist/containerRuntime.d.ts.map +1 -1
  21. package/dist/containerRuntime.js +82 -77
  22. package/dist/containerRuntime.js.map +1 -1
  23. package/dist/dataStoreContext.d.ts +1 -0
  24. package/dist/dataStoreContext.d.ts.map +1 -1
  25. package/dist/dataStoreContext.js +7 -2
  26. package/dist/dataStoreContext.js.map +1 -1
  27. package/dist/gc/garbageCollection.js +2 -2
  28. package/dist/gc/garbageCollection.js.map +1 -1
  29. package/dist/gc/gcDefinitions.d.ts +9 -0
  30. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  31. package/dist/gc/gcDefinitions.js +1 -0
  32. package/dist/gc/gcDefinitions.js.map +1 -1
  33. package/dist/index.d.ts +1 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js.map +1 -1
  36. package/dist/legacy.d.ts +1 -1
  37. package/dist/messageTypes.d.ts +1 -0
  38. package/dist/messageTypes.d.ts.map +1 -1
  39. package/dist/messageTypes.js +1 -0
  40. package/dist/messageTypes.js.map +1 -1
  41. package/dist/opLifecycle/batchManager.d.ts +4 -0
  42. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  43. package/dist/opLifecycle/batchManager.js.map +1 -1
  44. package/dist/opLifecycle/outbox.d.ts +8 -4
  45. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  46. package/dist/opLifecycle/outbox.js +18 -16
  47. package/dist/opLifecycle/outbox.js.map +1 -1
  48. package/dist/opLifecycle/remoteMessageProcessor.d.ts +17 -1
  49. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  50. package/dist/opLifecycle/remoteMessageProcessor.js +43 -5
  51. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  52. package/dist/packageVersion.d.ts +1 -1
  53. package/dist/packageVersion.js +1 -1
  54. package/dist/packageVersion.js.map +1 -1
  55. package/dist/pendingStateManager.d.ts +11 -7
  56. package/dist/pendingStateManager.d.ts.map +1 -1
  57. package/dist/pendingStateManager.js +34 -15
  58. package/dist/pendingStateManager.js.map +1 -1
  59. package/dist/summary/documentSchema.d.ts +8 -0
  60. package/dist/summary/documentSchema.d.ts.map +1 -1
  61. package/dist/summary/documentSchema.js +2 -0
  62. package/dist/summary/documentSchema.js.map +1 -1
  63. package/dist/summary/index.d.ts +1 -1
  64. package/dist/summary/index.d.ts.map +1 -1
  65. package/dist/summary/index.js +1 -2
  66. package/dist/summary/index.js.map +1 -1
  67. package/dist/summary/orderedClientElection.d.ts +1 -0
  68. package/dist/summary/orderedClientElection.d.ts.map +1 -1
  69. package/dist/summary/orderedClientElection.js.map +1 -1
  70. package/dist/summary/runWhileConnectedCoordinator.d.ts +1 -0
  71. package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  72. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  73. package/dist/summary/summarizer.d.ts +1 -0
  74. package/dist/summary/summarizer.d.ts.map +1 -1
  75. package/dist/summary/summarizer.js +1 -0
  76. package/dist/summary/summarizer.js.map +1 -1
  77. package/dist/summary/summarizerTypes.d.ts +29 -0
  78. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  79. package/dist/summary/summarizerTypes.js.map +1 -1
  80. package/dist/summary/summaryCollection.d.ts +10 -0
  81. package/dist/summary/summaryCollection.d.ts.map +1 -1
  82. package/dist/summary/summaryCollection.js +1 -0
  83. package/dist/summary/summaryCollection.js.map +1 -1
  84. package/dist/summary/summaryFormat.d.ts +8 -1
  85. package/dist/summary/summaryFormat.d.ts.map +1 -1
  86. package/dist/summary/summaryFormat.js +3 -3
  87. package/dist/summary/summaryFormat.js.map +1 -1
  88. package/{dist → lib/blobManager}/blobManager.d.ts +9 -28
  89. package/lib/blobManager/blobManager.d.ts.map +1 -0
  90. package/lib/{blobManager.js → blobManager/blobManager.js} +21 -83
  91. package/lib/blobManager/blobManager.js.map +1 -0
  92. package/lib/blobManager/blobManagerSnapSum.d.ts +30 -0
  93. package/lib/blobManager/blobManagerSnapSum.d.ts.map +1 -0
  94. package/lib/blobManager/blobManagerSnapSum.js +75 -0
  95. package/lib/blobManager/blobManagerSnapSum.js.map +1 -0
  96. package/lib/blobManager/index.d.ts +7 -0
  97. package/lib/blobManager/index.d.ts.map +1 -0
  98. package/lib/blobManager/index.js +7 -0
  99. package/lib/blobManager/index.js.map +1 -0
  100. package/lib/channelCollection.d.ts +1 -0
  101. package/lib/channelCollection.d.ts.map +1 -1
  102. package/lib/channelCollection.js +23 -13
  103. package/lib/channelCollection.js.map +1 -1
  104. package/lib/containerRuntime.d.ts +20 -7
  105. package/lib/containerRuntime.d.ts.map +1 -1
  106. package/lib/containerRuntime.js +31 -26
  107. package/lib/containerRuntime.js.map +1 -1
  108. package/lib/dataStoreContext.d.ts +1 -0
  109. package/lib/dataStoreContext.d.ts.map +1 -1
  110. package/lib/dataStoreContext.js +7 -2
  111. package/lib/dataStoreContext.js.map +1 -1
  112. package/lib/gc/garbageCollection.js +2 -2
  113. package/lib/gc/garbageCollection.js.map +1 -1
  114. package/lib/gc/gcDefinitions.d.ts +9 -0
  115. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  116. package/lib/gc/gcDefinitions.js +1 -0
  117. package/lib/gc/gcDefinitions.js.map +1 -1
  118. package/lib/index.d.ts +1 -1
  119. package/lib/index.d.ts.map +1 -1
  120. package/lib/index.js.map +1 -1
  121. package/lib/legacy.d.ts +1 -1
  122. package/lib/messageTypes.d.ts +1 -0
  123. package/lib/messageTypes.d.ts.map +1 -1
  124. package/lib/messageTypes.js +1 -0
  125. package/lib/messageTypes.js.map +1 -1
  126. package/lib/opLifecycle/batchManager.d.ts +4 -0
  127. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  128. package/lib/opLifecycle/batchManager.js.map +1 -1
  129. package/lib/opLifecycle/outbox.d.ts +8 -4
  130. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  131. package/lib/opLifecycle/outbox.js +18 -16
  132. package/lib/opLifecycle/outbox.js.map +1 -1
  133. package/lib/opLifecycle/remoteMessageProcessor.d.ts +17 -1
  134. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  135. package/lib/opLifecycle/remoteMessageProcessor.js +41 -3
  136. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  137. package/lib/packageVersion.d.ts +1 -1
  138. package/lib/packageVersion.js +1 -1
  139. package/lib/packageVersion.js.map +1 -1
  140. package/lib/pendingStateManager.d.ts +11 -7
  141. package/lib/pendingStateManager.d.ts.map +1 -1
  142. package/lib/pendingStateManager.js +35 -16
  143. package/lib/pendingStateManager.js.map +1 -1
  144. package/lib/summary/documentSchema.d.ts +8 -0
  145. package/lib/summary/documentSchema.d.ts.map +1 -1
  146. package/lib/summary/documentSchema.js +2 -0
  147. package/lib/summary/documentSchema.js.map +1 -1
  148. package/lib/summary/index.d.ts +1 -1
  149. package/lib/summary/index.d.ts.map +1 -1
  150. package/lib/summary/index.js +1 -1
  151. package/lib/summary/index.js.map +1 -1
  152. package/lib/summary/orderedClientElection.d.ts +1 -0
  153. package/lib/summary/orderedClientElection.d.ts.map +1 -1
  154. package/lib/summary/orderedClientElection.js.map +1 -1
  155. package/lib/summary/runWhileConnectedCoordinator.d.ts +1 -0
  156. package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  157. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
  158. package/lib/summary/summarizer.d.ts +1 -0
  159. package/lib/summary/summarizer.d.ts.map +1 -1
  160. package/lib/summary/summarizer.js +1 -0
  161. package/lib/summary/summarizer.js.map +1 -1
  162. package/lib/summary/summarizerTypes.d.ts +29 -0
  163. package/lib/summary/summarizerTypes.d.ts.map +1 -1
  164. package/lib/summary/summarizerTypes.js.map +1 -1
  165. package/lib/summary/summaryCollection.d.ts +10 -0
  166. package/lib/summary/summaryCollection.d.ts.map +1 -1
  167. package/lib/summary/summaryCollection.js +1 -0
  168. package/lib/summary/summaryCollection.js.map +1 -1
  169. package/lib/summary/summaryFormat.d.ts +8 -1
  170. package/lib/summary/summaryFormat.d.ts.map +1 -1
  171. package/lib/summary/summaryFormat.js +1 -1
  172. package/lib/summary/summaryFormat.js.map +1 -1
  173. package/package.json +23 -23
  174. package/src/{blobManager.ts → blobManager/blobManager.ts} +38 -122
  175. package/src/blobManager/blobManagerSnapSum.ts +133 -0
  176. package/src/blobManager/index.ts +19 -0
  177. package/src/channelCollection.ts +23 -13
  178. package/src/containerRuntime.ts +57 -39
  179. package/src/dataStoreContext.ts +8 -2
  180. package/src/gc/garbageCollection.ts +2 -2
  181. package/src/gc/gcDefinitions.ts +9 -0
  182. package/src/index.ts +1 -1
  183. package/src/messageTypes.ts +1 -0
  184. package/src/opLifecycle/batchManager.ts +4 -0
  185. package/src/opLifecycle/outbox.ts +19 -21
  186. package/src/opLifecycle/remoteMessageProcessor.ts +63 -6
  187. package/src/packageVersion.ts +1 -1
  188. package/src/pendingStateManager.ts +43 -20
  189. package/src/summary/documentSchema.ts +8 -0
  190. package/src/summary/index.ts +0 -1
  191. package/src/summary/orderedClientElection.ts +1 -0
  192. package/src/summary/runWhileConnectedCoordinator.ts +1 -0
  193. package/src/summary/summarizer.ts +1 -0
  194. package/src/summary/summarizerTypes.ts +29 -0
  195. package/src/summary/summaryCollection.ts +10 -0
  196. package/src/summary/summaryFormat.ts +9 -1
  197. package/dist/blobManager.d.ts.map +0 -1
  198. package/dist/blobManager.js.map +0 -1
  199. package/lib/blobManager.d.ts.map +0 -1
  200. package/lib/blobManager.js.map +0 -1
  201. /package/api-report/{container-runtime.alpha.api.md → container-runtime.legacy.alpha.api.md} +0 -0
@@ -125,6 +125,7 @@ class ClientSummaryWatcher {
125
125
  * Data structure that looks at the op stream to track summaries as they
126
126
  * are broadcast, acked and nacked.
127
127
  * It provides functionality for watching specific summaries.
128
+ * @legacy
128
129
  * @alpha
129
130
  */
130
131
  class SummaryCollection extends client_utils_1.TypedEventEmitter {
@@ -1 +1 @@
1
- {"version":3,"file":"summaryCollection.js","sourceRoot":"","sources":["../../src/summary/summaryCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAGjE,kEAAuE;AACvE,0EAOqD;AAmDrD,IAAK,YAKJ;AALD,WAAK,YAAY;IAChB,iDAAS,CAAA;IACT,yDAAa,CAAA;IACb,iDAAS,CAAA;IACT,oDAAW,CAAA;AACZ,CAAC,EALI,YAAY,KAAZ,YAAY,QAKhB;AAED,MAAM,OAAO;IACL,MAAM,CAAC,WAAW,CAAC,QAAgB,EAAE,oBAA4B;QACvE,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IACpD,CAAC;IACM,MAAM,CAAC,YAAY,CAAC,EAAqB;QAC/C,+FAA+F;QAC/F,4EAA4E;QAC5E,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,CAAC,QAAkB,E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C;YACF,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;YAClC,IAAI,CAAC,kBAAkB,GAAG,IAAI,mBAAQ,EAAQ,CAAC;YAC/C,IAAI,CAAC,IAAI,CAAC,sBAAW,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IAEO,iBAAiB,CAAC,EAAuB;QAChD,MAAM,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,qBAAqB,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAI,OAAO,EAAE,CAAC;YACb,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACpB,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,CAAC,IAAI,CAAC,sBAAW,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACxC,CAAC;IACF,CAAC;CACD;AA1OD,8CA0OC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { IDisposable, IEvent } from \"@fluidframework/core-interfaces\";\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDocumentMessage,\n\tISummaryAck,\n\tISummaryContent,\n\tISummaryNack,\n\tMessageType,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Interface for summary op messages with typed contents.\n * @alpha\n */\nexport interface ISummaryOpMessage extends ISequencedDocumentMessage {\n\ttype: MessageType.Summarize;\n\tcontents: ISummaryContent;\n}\n\n/**\n * Interface for summary ack messages with typed contents.\n * @alpha\n */\nexport interface ISummaryAckMessage extends ISequencedDocumentMessage {\n\ttype: MessageType.SummaryAck;\n\tcontents: ISummaryAck;\n}\n\n/**\n * Interface for summary nack messages with typed contents.\n * @alpha\n */\nexport interface ISummaryNackMessage extends ISequencedDocumentMessage {\n\ttype: MessageType.SummaryNack;\n\tcontents: ISummaryNack;\n}\n\n/**\n * A single summary which can be tracked as it goes through its life cycle.\n * The life cycle is: Local to Broadcast to Acked/Nacked.\n * @alpha\n */\nexport interface ISummary {\n\treadonly clientId: string;\n\treadonly clientSequenceNumber: number;\n\twaitBroadcast(): Promise<ISummaryOpMessage>;\n\twaitAckNack(): Promise<ISummaryAckMessage | ISummaryNackMessage>;\n}\n\n/**\n * A single summary which has already been acked by the server.\n * @alpha\n */\nexport interface IAckedSummary {\n\treadonly summaryOp: ISummaryOpMessage;\n\treadonly summaryAck: ISummaryAckMessage;\n}\n\nenum SummaryState {\n\tLocal = 0,\n\tBroadcast = 1,\n\tAcked = 2,\n\tNacked = -1,\n}\n\nclass Summary implements ISummary {\n\tpublic static createLocal(clientId: string, clientSequenceNumber: number) {\n\t\treturn new Summary(clientId, clientSequenceNumber);\n\t}\n\tpublic static createFromOp(op: ISummaryOpMessage) {\n\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\tconst summary = new Summary(op.clientId as string, op.clientSequenceNumber);\n\t\tsummary.broadcast(op);\n\t\treturn summary;\n\t}\n\n\tprivate state = SummaryState.Local;\n\n\tprivate _summaryOp?: ISummaryOpMessage;\n\tprivate _summaryAckNack?: ISummaryAckMessage | ISummaryNackMessage;\n\n\tprivate readonly defSummaryOp = new Deferred<void>();\n\tprivate readonly defSummaryAck = new Deferred<void>();\n\n\tpublic get summaryOp() {\n\t\treturn this._summaryOp;\n\t}\n\tpublic get summaryAckNack() {\n\t\treturn this._summaryAckNack;\n\t}\n\n\tprivate constructor(\n\t\tpublic readonly clientId: string,\n\t\tpublic readonly clientSequenceNumber: number,\n\t) {}\n\n\tpublic hasBeenAcked(): this is IAckedSummary {\n\t\treturn this.state === SummaryState.Acked;\n\t}\n\n\tpublic broadcast(op: ISummaryOpMessage) {\n\t\tassert(\n\t\t\tthis.state === SummaryState.Local,\n\t\t\t0x175 /* \"Can only broadcast if summarizer starts in local state\" */,\n\t\t);\n\t\tthis._summaryOp = op;\n\t\tthis.defSummaryOp.resolve();\n\t\tthis.state = SummaryState.Broadcast;\n\t\treturn true;\n\t}\n\n\tpublic ackNack(op: ISummaryAckMessage | ISummaryNackMessage) {\n\t\tassert(\n\t\t\tthis.state === SummaryState.Broadcast,\n\t\t\t0x176 /* \"Can only ack/nack if summarizer is in broadcasting state\" */,\n\t\t);\n\t\tthis._summaryAckNack = op;\n\t\tthis.defSummaryAck.resolve();\n\t\tthis.state = op.type === MessageType.SummaryAck ? SummaryState.Acked : SummaryState.Nacked;\n\t\treturn true;\n\t}\n\n\tpublic async waitBroadcast(): Promise<ISummaryOpMessage> {\n\t\tawait this.defSummaryOp.promise;\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn this._summaryOp!;\n\t}\n\n\tpublic async waitAckNack(): Promise<ISummaryAckMessage | ISummaryNackMessage> {\n\t\tawait this.defSummaryAck.promise;\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn this._summaryAckNack!;\n\t}\n}\n\n/**\n * Watches summaries created by a specific client.\n * @alpha\n */\nexport interface IClientSummaryWatcher extends IDisposable {\n\twatchSummary(clientSequenceNumber: number): ISummary;\n\twaitFlushed(): Promise<IAckedSummary | undefined>;\n}\n\n/**\n * This class watches summaries created by a specific client.\n * It should be created and managed from a SummaryCollection.\n */\nclass ClientSummaryWatcher implements IClientSummaryWatcher {\n\t// key: clientSeqNum\n\tprivate readonly localSummaries = new Map<number, Summary>();\n\tprivate _disposed = false;\n\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\n\tpublic constructor(\n\t\tpublic readonly clientId: string,\n\t\tprivate readonly summaryCollection: SummaryCollection,\n\t) {}\n\n\t/**\n\t * Watches for a specific sent summary op.\n\t * @param clientSequenceNumber - client sequence number of sent summary op\n\t */\n\tpublic watchSummary(clientSequenceNumber: number): ISummary {\n\t\tlet summary = this.localSummaries.get(clientSequenceNumber);\n\t\tif (!summary) {\n\t\t\tsummary = Summary.createLocal(this.clientId, clientSequenceNumber);\n\t\t\tthis.localSummaries.set(summary.clientSequenceNumber, summary);\n\t\t}\n\t\treturn summary;\n\t}\n\n\t/**\n\t * Waits until all of the pending summaries in the underlying SummaryCollection\n\t * are acked/nacked.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tpublic waitFlushed() {\n\t\treturn this.summaryCollection.waitFlushed();\n\t}\n\n\t/**\n\t * Gets a watched summary or returns undefined if not watched.\n\t * @param clientSequenceNumber - client sequence number of sent summary op\n\t */\n\tpublic tryGetSummary(clientSequenceNumber: number) {\n\t\treturn this.localSummaries.get(clientSequenceNumber);\n\t}\n\n\t/**\n\t * Starts watching a summary made by this client.\n\t * @param summary - summary to start watching\n\t */\n\tpublic setSummary(summary: Summary) {\n\t\tthis.localSummaries.set(summary.clientSequenceNumber, summary);\n\t}\n\n\tpublic dispose() {\n\t\tthis.summaryCollection.removeWatcher(this.clientId);\n\t\tthis._disposed = true;\n\t}\n}\n/**\n * @alpha\n */\nexport type OpActionEventName =\n\t| MessageType.Summarize\n\t| MessageType.SummaryAck\n\t| MessageType.SummaryNack\n\t| \"default\";\n\n/**\n * @alpha\n */\nexport type OpActionEventListener = (op: ISequencedDocumentMessage) => void;\n\n/**\n * @alpha\n */\nexport interface ISummaryCollectionOpEvents extends IEvent {\n\t(event: OpActionEventName, listener: OpActionEventListener);\n}\n\n/**\n * Data structure that looks at the op stream to track summaries as they\n * are broadcast, acked and nacked.\n * It provides functionality for watching specific summaries.\n * @alpha\n */\nexport class SummaryCollection extends TypedEventEmitter<ISummaryCollectionOpEvents> {\n\t// key: clientId\n\tprivate readonly summaryWatchers = new Map<string, ClientSummaryWatcher>();\n\t// key: summarySeqNum\n\tprivate readonly pendingSummaries = new Map<number, Summary>();\n\tprivate refreshWaitNextAck = new Deferred<void>();\n\n\tprivate lastSummaryTimestamp: number | undefined;\n\tprivate maxAckWaitTime: number | undefined;\n\tprivate pendingAckTimerTimeoutCallback: (() => void) | undefined;\n\tprivate lastAck: IAckedSummary | undefined;\n\n\tpublic get latestAck(): IAckedSummary | undefined {\n\t\treturn this.lastAck;\n\t}\n\n\tpublic emit(event: OpActionEventName, ...args: Parameters<OpActionEventListener>): boolean {\n\t\treturn super.emit(event, ...args);\n\t}\n\n\tpublic get opsSinceLastAck() {\n\t\treturn (\n\t\t\tthis.deltaManager.lastSequenceNumber -\n\t\t\t(this.lastAck?.summaryAck.sequenceNumber ?? this.deltaManager.initialSequenceNumber)\n\t\t);\n\t}\n\n\tpublic addOpListener(listener: () => void) {\n\t\tthis.deltaManager.on(\"op\", listener);\n\t}\n\n\tpublic removeOpListener(listener: () => void) {\n\t\tthis.deltaManager.off(\"op\", listener);\n\t}\n\n\tpublic constructor(\n\t\tprivate readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tsuper();\n\t\tthis.deltaManager.on(\"op\", (op) => this.handleOp(op));\n\t}\n\n\t/**\n\t * Creates and returns a summary watcher for a specific client.\n\t * This will allow for local sent summaries to be better tracked.\n\t * @param clientId - client id for watcher\n\t */\n\tpublic createWatcher(clientId: string): IClientSummaryWatcher {\n\t\tconst watcher = new ClientSummaryWatcher(clientId, this);\n\t\tthis.summaryWatchers.set(clientId, watcher);\n\t\treturn watcher;\n\t}\n\n\tpublic removeWatcher(clientId: string) {\n\t\tthis.summaryWatchers.delete(clientId);\n\t}\n\n\tpublic setPendingAckTimerTimeoutCallback(\n\t\tmaxAckWaitTime: number,\n\t\ttimeoutCallback: () => void,\n\t) {\n\t\tthis.maxAckWaitTime = maxAckWaitTime;\n\t\tthis.pendingAckTimerTimeoutCallback = timeoutCallback;\n\t}\n\n\tpublic unsetPendingAckTimerTimeoutCallback() {\n\t\tthis.maxAckWaitTime = undefined;\n\t\tthis.pendingAckTimerTimeoutCallback = undefined;\n\t}\n\n\t/**\n\t * Returns a promise that resolves once all pending summary ops\n\t * have been acked or nacked.\n\t */\n\tpublic async waitFlushed(): Promise<IAckedSummary | undefined> {\n\t\twhile (this.pendingSummaries.size > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\t\t\tconst promises = Array.from(this.pendingSummaries, ([, summary]) =>\n\t\t\t\tsummary.waitAckNack(),\n\t\t\t);\n\t\t\tawait Promise.all(promises);\n\t\t}\n\t\treturn this.lastAck;\n\t}\n\n\t/**\n\t * Returns a promise that resolves once a summary is acked that has a reference\n\t * sequence number greater than or equal to the passed in sequence number.\n\t * @param referenceSequenceNumber - reference sequence number to wait for\n\t * @returns The latest acked summary\n\t */\n\tpublic async waitSummaryAck(referenceSequenceNumber: number): Promise<IAckedSummary> {\n\t\twhile (\n\t\t\t!this.lastAck ||\n\t\t\tthis.lastAck.summaryOp.referenceSequenceNumber < referenceSequenceNumber\n\t\t) {\n\t\t\tawait this.refreshWaitNextAck.promise;\n\t\t}\n\t\treturn this.lastAck;\n\t}\n\n\tprivate parseContent(op: ISequencedDocumentMessage) {\n\t\t// back-compat: ADO #1385: Make this unconditional in the future,\n\t\t// when Container.processRemoteMessage stops parsing contents. That said, we should move to\n\t\t// listen for \"op\" events from ContainerRuntime, and parsing may not be required at all if\n\t\t// ContainerRuntime.process() would parse it for all types of ops.\n\t\t// Can make either of those changes only when LTS moves to a version that has no content\n\t\t// parsing in loader layer!\n\t\tif (typeof op.contents === \"string\") {\n\t\t\top.contents = JSON.parse(op.contents);\n\t\t}\n\t}\n\n\t/**\n\t * Handler for ops; only handles ops relating to summaries.\n\t * @param op - op message to handle\n\t */\n\tprivate handleOp(opArg: ISequencedDocumentMessage) {\n\t\tconst op = { ...opArg };\n\n\t\tswitch (op.type) {\n\t\t\tcase MessageType.Summarize:\n\t\t\t\tthis.parseContent(op);\n\t\t\t\treturn this.handleSummaryOp(op as ISummaryOpMessage);\n\t\t\tcase MessageType.SummaryAck:\n\t\t\tcase MessageType.SummaryNack:\n\t\t\t\t// Old files (prior to PR #10077) may not contain this info\n\t\t\t\t// back-compat: ADO #1385: remove cast when ISequencedDocumentMessage changes are propagated\n\t\t\t\tif ((op as any).data !== undefined) {\n\t\t\t\t\top.contents = JSON.parse((op as any).data);\n\t\t\t\t} else {\n\t\t\t\t\tthis.parseContent(op);\n\t\t\t\t}\n\t\t\t\treturn op.type === MessageType.SummaryAck\n\t\t\t\t\t? this.handleSummaryAck(op as ISummaryAckMessage)\n\t\t\t\t\t: this.handleSummaryNack(op as ISummaryNackMessage);\n\t\t\tdefault: {\n\t\t\t\t// If the difference between timestamp of current op and last summary op is greater than\n\t\t\t\t// the maxAckWaitTime, then we need to inform summarizer to not wait and summarize\n\t\t\t\t// immediately as we have already waited for maxAckWaitTime.\n\t\t\t\tconst lastOpTimestamp = op.timestamp;\n\t\t\t\tif (\n\t\t\t\t\tthis.lastSummaryTimestamp !== undefined &&\n\t\t\t\t\tthis.maxAckWaitTime !== undefined &&\n\t\t\t\t\tlastOpTimestamp - this.lastSummaryTimestamp >= this.maxAckWaitTime\n\t\t\t\t) {\n\t\t\t\t\tthis.pendingAckTimerTimeoutCallback?.();\n\t\t\t\t}\n\t\t\t\tthis.emit(\"default\", op);\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate handleSummaryOp(op: ISummaryOpMessage) {\n\t\tlet summary: Summary | undefined;\n\n\t\t// Check if summary already being watched, broadcast if so\n\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\tconst watcher = this.summaryWatchers.get(op.clientId as string);\n\t\tif (watcher) {\n\t\t\tsummary = watcher.tryGetSummary(op.clientSequenceNumber);\n\t\t\tif (summary) {\n\t\t\t\tsummary.broadcast(op);\n\t\t\t}\n\t\t}\n\n\t\t// If not watched, create from op\n\t\tif (!summary) {\n\t\t\tsummary = Summary.createFromOp(op);\n\t\t\tif (watcher) {\n\t\t\t\twatcher.setSummary(summary);\n\t\t\t}\n\t\t}\n\t\tthis.pendingSummaries.set(op.sequenceNumber, summary);\n\t\tthis.lastSummaryTimestamp = op.timestamp;\n\t\tthis.emit(MessageType.Summarize, op);\n\t}\n\n\tprivate handleSummaryAck(op: ISummaryAckMessage) {\n\t\tconst seq = op.contents.summaryProposal.summarySequenceNumber;\n\t\tconst summary = this.pendingSummaries.get(seq);\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- optional chain is not logically equivalent\n\t\tif (!summary || summary.summaryOp === undefined) {\n\t\t\t// Summary ack without an op should be rare. We could fetch the\n\t\t\t// reference sequence number from the snapshot, but instead we\n\t\t\t// will not emit this ack. It should be the case that the summary\n\t\t\t// op that this ack is for is earlier than this file was loaded\n\t\t\t// from. i.e. initialSequenceNumber > summarySequenceNumber.\n\t\t\t// We really don't care about it for now, since it is older than\n\t\t\t// the one we loaded from.\n\t\t\tif (seq > this.deltaManager.initialSequenceNumber) {\n\t\t\t\t// Potential causes for it to be later than our initialSequenceNumber\n\t\t\t\t// are that the summaryOp was nacked then acked, double-acked, or\n\t\t\t\t// the summarySequenceNumber is incorrect.\n\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"SummaryAckWithoutOp\",\n\t\t\t\t\tsequenceNumber: op.sequenceNumber, // summary ack seq #\n\t\t\t\t\tsummarySequenceNumber: seq, // missing summary seq #\n\t\t\t\t\tinitialSequenceNumber: this.deltaManager.initialSequenceNumber,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tsummary.ackNack(op);\n\t\tthis.pendingSummaries.delete(seq);\n\n\t\t// Track latest ack\n\t\tif (\n\t\t\t!this.lastAck ||\n\t\t\tseq > this.lastAck.summaryAck.contents.summaryProposal.summarySequenceNumber\n\t\t) {\n\t\t\tthis.lastAck = {\n\t\t\t\tsummaryOp: summary.summaryOp,\n\t\t\t\tsummaryAck: op,\n\t\t\t};\n\t\t\tthis.refreshWaitNextAck.resolve();\n\t\t\tthis.refreshWaitNextAck = new Deferred<void>();\n\t\t\tthis.emit(MessageType.SummaryAck, op);\n\t\t}\n\t}\n\n\tprivate handleSummaryNack(op: ISummaryNackMessage) {\n\t\tconst seq = op.contents.summaryProposal.summarySequenceNumber;\n\t\tconst summary = this.pendingSummaries.get(seq);\n\t\tif (summary) {\n\t\t\tsummary.ackNack(op);\n\t\t\tthis.pendingSummaries.delete(seq);\n\t\t\tthis.emit(MessageType.SummaryNack, op);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"summaryCollection.js","sourceRoot":"","sources":["../../src/summary/summaryCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAGjE,kEAAuE;AACvE,0EAOqD;AAwDrD,IAAK,YAKJ;AALD,WAAK,YAAY;IAChB,iDAAS,CAAA;IACT,yDAAa,CAAA;IACb,iDAAS,CAAA;IACT,oDAAW,CAAA;AACZ,CAAC,EALI,YAAY,KAAZ,YAAY,QAKhB;AAED,MAAM,OAAO;IACL,MAAM,CAAC,WAAW,CAAC,QAAgB,EAAE,oBAA4B;QACvE,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IACpD,CAAC;IACM,MAAM,CAAC,YAAY,CAAC,EAAqB;QAC/C,+FAA+F;QAC/F,4EAA4E;QAC5E,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,CAAC,QAAkB,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAC;QAC5E,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACtB,OAAO,OAAO,CAAC;IAChB,CAAC;IAUD,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,U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AE,EAAE,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IAEO,iBAAiB,CAAC,EAAuB;QAChD,MAAM,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,qBAAqB,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAI,OAAO,EAAE,CAAC;YACb,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACpB,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,CAAC,IAAI,CAAC,sBAAW,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACxC,CAAC;IACF,CAAC;CACD;AA1OD,8CA0OC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { IDisposable, IEvent } from \"@fluidframework/core-interfaces\";\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDocumentMessage,\n\tISummaryAck,\n\tISummaryContent,\n\tISummaryNack,\n\tMessageType,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Interface for summary op messages with typed contents.\n * @legacy\n * @alpha\n */\nexport interface ISummaryOpMessage extends ISequencedDocumentMessage {\n\ttype: MessageType.Summarize;\n\tcontents: ISummaryContent;\n}\n\n/**\n * Interface for summary ack messages with typed contents.\n * @legacy\n * @alpha\n */\nexport interface ISummaryAckMessage extends ISequencedDocumentMessage {\n\ttype: MessageType.SummaryAck;\n\tcontents: ISummaryAck;\n}\n\n/**\n * Interface for summary nack messages with typed contents.\n * @legacy\n * @alpha\n */\nexport interface ISummaryNackMessage extends ISequencedDocumentMessage {\n\ttype: MessageType.SummaryNack;\n\tcontents: ISummaryNack;\n}\n\n/**\n * A single summary which can be tracked as it goes through its life cycle.\n * The life cycle is: Local to Broadcast to Acked/Nacked.\n * @legacy\n * @alpha\n */\nexport interface ISummary {\n\treadonly clientId: string;\n\treadonly clientSequenceNumber: number;\n\twaitBroadcast(): Promise<ISummaryOpMessage>;\n\twaitAckNack(): Promise<ISummaryAckMessage | ISummaryNackMessage>;\n}\n\n/**\n * A single summary which has already been acked by the server.\n * @legacy\n * @alpha\n */\nexport interface IAckedSummary {\n\treadonly summaryOp: ISummaryOpMessage;\n\treadonly summaryAck: ISummaryAckMessage;\n}\n\nenum SummaryState {\n\tLocal = 0,\n\tBroadcast = 1,\n\tAcked = 2,\n\tNacked = -1,\n}\n\nclass Summary implements ISummary {\n\tpublic static createLocal(clientId: string, clientSequenceNumber: number) {\n\t\treturn new Summary(clientId, clientSequenceNumber);\n\t}\n\tpublic static createFromOp(op: ISummaryOpMessage) {\n\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\tconst summary = new Summary(op.clientId as string, op.clientSequenceNumber);\n\t\tsummary.broadcast(op);\n\t\treturn summary;\n\t}\n\n\tprivate state = SummaryState.Local;\n\n\tprivate _summaryOp?: ISummaryOpMessage;\n\tprivate _summaryAckNack?: ISummaryAckMessage | ISummaryNackMessage;\n\n\tprivate readonly defSummaryOp = new Deferred<void>();\n\tprivate readonly defSummaryAck = new Deferred<void>();\n\n\tpublic get summaryOp() {\n\t\treturn this._summaryOp;\n\t}\n\tpublic get summaryAckNack() {\n\t\treturn this._summaryAckNack;\n\t}\n\n\tprivate constructor(\n\t\tpublic readonly clientId: string,\n\t\tpublic readonly clientSequenceNumber: number,\n\t) {}\n\n\tpublic hasBeenAcked(): this is IAckedSummary {\n\t\treturn this.state === SummaryState.Acked;\n\t}\n\n\tpublic broadcast(op: ISummaryOpMessage) {\n\t\tassert(\n\t\t\tthis.state === SummaryState.Local,\n\t\t\t0x175 /* \"Can only broadcast if summarizer starts in local state\" */,\n\t\t);\n\t\tthis._summaryOp = op;\n\t\tthis.defSummaryOp.resolve();\n\t\tthis.state = SummaryState.Broadcast;\n\t\treturn true;\n\t}\n\n\tpublic ackNack(op: ISummaryAckMessage | ISummaryNackMessage) {\n\t\tassert(\n\t\t\tthis.state === SummaryState.Broadcast,\n\t\t\t0x176 /* \"Can only ack/nack if summarizer is in broadcasting state\" */,\n\t\t);\n\t\tthis._summaryAckNack = op;\n\t\tthis.defSummaryAck.resolve();\n\t\tthis.state = op.type === MessageType.SummaryAck ? SummaryState.Acked : SummaryState.Nacked;\n\t\treturn true;\n\t}\n\n\tpublic async waitBroadcast(): Promise<ISummaryOpMessage> {\n\t\tawait this.defSummaryOp.promise;\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn this._summaryOp!;\n\t}\n\n\tpublic async waitAckNack(): Promise<ISummaryAckMessage | ISummaryNackMessage> {\n\t\tawait this.defSummaryAck.promise;\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn this._summaryAckNack!;\n\t}\n}\n\n/**\n * Watches summaries created by a specific client.\n * @legacy\n * @alpha\n */\nexport interface IClientSummaryWatcher extends IDisposable {\n\twatchSummary(clientSequenceNumber: number): ISummary;\n\twaitFlushed(): Promise<IAckedSummary | undefined>;\n}\n\n/**\n * This class watches summaries created by a specific client.\n * It should be created and managed from a SummaryCollection.\n */\nclass ClientSummaryWatcher implements IClientSummaryWatcher {\n\t// key: clientSeqNum\n\tprivate readonly localSummaries = new Map<number, Summary>();\n\tprivate _disposed = false;\n\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\n\tpublic constructor(\n\t\tpublic readonly clientId: string,\n\t\tprivate readonly summaryCollection: SummaryCollection,\n\t) {}\n\n\t/**\n\t * Watches for a specific sent summary op.\n\t * @param clientSequenceNumber - client sequence number of sent summary op\n\t */\n\tpublic watchSummary(clientSequenceNumber: number): ISummary {\n\t\tlet summary = this.localSummaries.get(clientSequenceNumber);\n\t\tif (!summary) {\n\t\t\tsummary = Summary.createLocal(this.clientId, clientSequenceNumber);\n\t\t\tthis.localSummaries.set(summary.clientSequenceNumber, summary);\n\t\t}\n\t\treturn summary;\n\t}\n\n\t/**\n\t * Waits until all of the pending summaries in the underlying SummaryCollection\n\t * are acked/nacked.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tpublic waitFlushed() {\n\t\treturn this.summaryCollection.waitFlushed();\n\t}\n\n\t/**\n\t * Gets a watched summary or returns undefined if not watched.\n\t * @param clientSequenceNumber - client sequence number of sent summary op\n\t */\n\tpublic tryGetSummary(clientSequenceNumber: number) {\n\t\treturn this.localSummaries.get(clientSequenceNumber);\n\t}\n\n\t/**\n\t * Starts watching a summary made by this client.\n\t * @param summary - summary to start watching\n\t */\n\tpublic setSummary(summary: Summary) {\n\t\tthis.localSummaries.set(summary.clientSequenceNumber, summary);\n\t}\n\n\tpublic dispose() {\n\t\tthis.summaryCollection.removeWatcher(this.clientId);\n\t\tthis._disposed = true;\n\t}\n}\n/**\n * @legacy\n * @alpha\n */\nexport type OpActionEventName =\n\t| MessageType.Summarize\n\t| MessageType.SummaryAck\n\t| MessageType.SummaryNack\n\t| \"default\";\n\n/**\n * @legacy\n * @alpha\n */\nexport type OpActionEventListener = (op: ISequencedDocumentMessage) => void;\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummaryCollectionOpEvents extends IEvent {\n\t(event: OpActionEventName, listener: OpActionEventListener);\n}\n\n/**\n * Data structure that looks at the op stream to track summaries as they\n * are broadcast, acked and nacked.\n * It provides functionality for watching specific summaries.\n * @legacy\n * @alpha\n */\nexport class SummaryCollection extends TypedEventEmitter<ISummaryCollectionOpEvents> {\n\t// key: clientId\n\tprivate readonly summaryWatchers = new Map<string, ClientSummaryWatcher>();\n\t// key: summarySeqNum\n\tprivate readonly pendingSummaries = new Map<number, Summary>();\n\tprivate refreshWaitNextAck = new Deferred<void>();\n\n\tprivate lastSummaryTimestamp: number | undefined;\n\tprivate maxAckWaitTime: number | undefined;\n\tprivate pendingAckTimerTimeoutCallback: (() => void) | undefined;\n\tprivate lastAck: IAckedSummary | undefined;\n\n\tpublic get latestAck(): IAckedSummary | undefined {\n\t\treturn this.lastAck;\n\t}\n\n\tpublic emit(event: OpActionEventName, ...args: Parameters<OpActionEventListener>): boolean {\n\t\treturn super.emit(event, ...args);\n\t}\n\n\tpublic get opsSinceLastAck() {\n\t\treturn (\n\t\t\tthis.deltaManager.lastSequenceNumber -\n\t\t\t(this.lastAck?.summaryAck.sequenceNumber ?? this.deltaManager.initialSequenceNumber)\n\t\t);\n\t}\n\n\tpublic addOpListener(listener: () => void) {\n\t\tthis.deltaManager.on(\"op\", listener);\n\t}\n\n\tpublic removeOpListener(listener: () => void) {\n\t\tthis.deltaManager.off(\"op\", listener);\n\t}\n\n\tpublic constructor(\n\t\tprivate readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tsuper();\n\t\tthis.deltaManager.on(\"op\", (op) => this.handleOp(op));\n\t}\n\n\t/**\n\t * Creates and returns a summary watcher for a specific client.\n\t * This will allow for local sent summaries to be better tracked.\n\t * @param clientId - client id for watcher\n\t */\n\tpublic createWatcher(clientId: string): IClientSummaryWatcher {\n\t\tconst watcher = new ClientSummaryWatcher(clientId, this);\n\t\tthis.summaryWatchers.set(clientId, watcher);\n\t\treturn watcher;\n\t}\n\n\tpublic removeWatcher(clientId: string) {\n\t\tthis.summaryWatchers.delete(clientId);\n\t}\n\n\tpublic setPendingAckTimerTimeoutCallback(\n\t\tmaxAckWaitTime: number,\n\t\ttimeoutCallback: () => void,\n\t) {\n\t\tthis.maxAckWaitTime = maxAckWaitTime;\n\t\tthis.pendingAckTimerTimeoutCallback = timeoutCallback;\n\t}\n\n\tpublic unsetPendingAckTimerTimeoutCallback() {\n\t\tthis.maxAckWaitTime = undefined;\n\t\tthis.pendingAckTimerTimeoutCallback = undefined;\n\t}\n\n\t/**\n\t * Returns a promise that resolves once all pending summary ops\n\t * have been acked or nacked.\n\t */\n\tpublic async waitFlushed(): Promise<IAckedSummary | undefined> {\n\t\twhile (this.pendingSummaries.size > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\t\t\tconst promises = Array.from(this.pendingSummaries, ([, summary]) =>\n\t\t\t\tsummary.waitAckNack(),\n\t\t\t);\n\t\t\tawait Promise.all(promises);\n\t\t}\n\t\treturn this.lastAck;\n\t}\n\n\t/**\n\t * Returns a promise that resolves once a summary is acked that has a reference\n\t * sequence number greater than or equal to the passed in sequence number.\n\t * @param referenceSequenceNumber - reference sequence number to wait for\n\t * @returns The latest acked summary\n\t */\n\tpublic async waitSummaryAck(referenceSequenceNumber: number): Promise<IAckedSummary> {\n\t\twhile (\n\t\t\t!this.lastAck ||\n\t\t\tthis.lastAck.summaryOp.referenceSequenceNumber < referenceSequenceNumber\n\t\t) {\n\t\t\tawait this.refreshWaitNextAck.promise;\n\t\t}\n\t\treturn this.lastAck;\n\t}\n\n\tprivate parseContent(op: ISequencedDocumentMessage) {\n\t\t// back-compat: ADO #1385: Make this unconditional in the future,\n\t\t// when Container.processRemoteMessage stops parsing contents. That said, we should move to\n\t\t// listen for \"op\" events from ContainerRuntime, and parsing may not be required at all if\n\t\t// ContainerRuntime.process() would parse it for all types of ops.\n\t\t// Can make either of those changes only when LTS moves to a version that has no content\n\t\t// parsing in loader layer!\n\t\tif (typeof op.contents === \"string\") {\n\t\t\top.contents = JSON.parse(op.contents);\n\t\t}\n\t}\n\n\t/**\n\t * Handler for ops; only handles ops relating to summaries.\n\t * @param op - op message to handle\n\t */\n\tprivate handleOp(opArg: ISequencedDocumentMessage) {\n\t\tconst op = { ...opArg };\n\n\t\tswitch (op.type) {\n\t\t\tcase MessageType.Summarize:\n\t\t\t\tthis.parseContent(op);\n\t\t\t\treturn this.handleSummaryOp(op as ISummaryOpMessage);\n\t\t\tcase MessageType.SummaryAck:\n\t\t\tcase MessageType.SummaryNack:\n\t\t\t\t// Old files (prior to PR #10077) may not contain this info\n\t\t\t\t// back-compat: ADO #1385: remove cast when ISequencedDocumentMessage changes are propagated\n\t\t\t\tif ((op as any).data !== undefined) {\n\t\t\t\t\top.contents = JSON.parse((op as any).data);\n\t\t\t\t} else {\n\t\t\t\t\tthis.parseContent(op);\n\t\t\t\t}\n\t\t\t\treturn op.type === MessageType.SummaryAck\n\t\t\t\t\t? this.handleSummaryAck(op as ISummaryAckMessage)\n\t\t\t\t\t: this.handleSummaryNack(op as ISummaryNackMessage);\n\t\t\tdefault: {\n\t\t\t\t// If the difference between timestamp of current op and last summary op is greater than\n\t\t\t\t// the maxAckWaitTime, then we need to inform summarizer to not wait and summarize\n\t\t\t\t// immediately as we have already waited for maxAckWaitTime.\n\t\t\t\tconst lastOpTimestamp = op.timestamp;\n\t\t\t\tif (\n\t\t\t\t\tthis.lastSummaryTimestamp !== undefined &&\n\t\t\t\t\tthis.maxAckWaitTime !== undefined &&\n\t\t\t\t\tlastOpTimestamp - this.lastSummaryTimestamp >= this.maxAckWaitTime\n\t\t\t\t) {\n\t\t\t\t\tthis.pendingAckTimerTimeoutCallback?.();\n\t\t\t\t}\n\t\t\t\tthis.emit(\"default\", op);\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate handleSummaryOp(op: ISummaryOpMessage) {\n\t\tlet summary: Summary | undefined;\n\n\t\t// Check if summary already being watched, broadcast if so\n\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\tconst watcher = this.summaryWatchers.get(op.clientId as string);\n\t\tif (watcher) {\n\t\t\tsummary = watcher.tryGetSummary(op.clientSequenceNumber);\n\t\t\tif (summary) {\n\t\t\t\tsummary.broadcast(op);\n\t\t\t}\n\t\t}\n\n\t\t// If not watched, create from op\n\t\tif (!summary) {\n\t\t\tsummary = Summary.createFromOp(op);\n\t\t\tif (watcher) {\n\t\t\t\twatcher.setSummary(summary);\n\t\t\t}\n\t\t}\n\t\tthis.pendingSummaries.set(op.sequenceNumber, summary);\n\t\tthis.lastSummaryTimestamp = op.timestamp;\n\t\tthis.emit(MessageType.Summarize, op);\n\t}\n\n\tprivate handleSummaryAck(op: ISummaryAckMessage) {\n\t\tconst seq = op.contents.summaryProposal.summarySequenceNumber;\n\t\tconst summary = this.pendingSummaries.get(seq);\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- optional chain is not logically equivalent\n\t\tif (!summary || summary.summaryOp === undefined) {\n\t\t\t// Summary ack without an op should be rare. We could fetch the\n\t\t\t// reference sequence number from the snapshot, but instead we\n\t\t\t// will not emit this ack. It should be the case that the summary\n\t\t\t// op that this ack is for is earlier than this file was loaded\n\t\t\t// from. i.e. initialSequenceNumber > summarySequenceNumber.\n\t\t\t// We really don't care about it for now, since it is older than\n\t\t\t// the one we loaded from.\n\t\t\tif (seq > this.deltaManager.initialSequenceNumber) {\n\t\t\t\t// Potential causes for it to be later than our initialSequenceNumber\n\t\t\t\t// are that the summaryOp was nacked then acked, double-acked, or\n\t\t\t\t// the summarySequenceNumber is incorrect.\n\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"SummaryAckWithoutOp\",\n\t\t\t\t\tsequenceNumber: op.sequenceNumber, // summary ack seq #\n\t\t\t\t\tsummarySequenceNumber: seq, // missing summary seq #\n\t\t\t\t\tinitialSequenceNumber: this.deltaManager.initialSequenceNumber,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tsummary.ackNack(op);\n\t\tthis.pendingSummaries.delete(seq);\n\n\t\t// Track latest ack\n\t\tif (\n\t\t\t!this.lastAck ||\n\t\t\tseq > this.lastAck.summaryAck.contents.summaryProposal.summarySequenceNumber\n\t\t) {\n\t\t\tthis.lastAck = {\n\t\t\t\tsummaryOp: summary.summaryOp,\n\t\t\t\tsummaryAck: op,\n\t\t\t};\n\t\t\tthis.refreshWaitNextAck.resolve();\n\t\t\tthis.refreshWaitNextAck = new Deferred<void>();\n\t\t\tthis.emit(MessageType.SummaryAck, op);\n\t\t}\n\t}\n\n\tprivate handleSummaryNack(op: ISummaryNackMessage) {\n\t\tconst seq = op.contents.summaryProposal.summarySequenceNumber;\n\t\tconst summary = this.pendingSummaries.get(seq);\n\t\tif (summary) {\n\t\t\tsummary.ackNack(op);\n\t\t\tthis.pendingSummaries.delete(seq);\n\t\t\tthis.emit(MessageType.SummaryNack, op);\n\t\t}\n\t}\n}\n"]}
@@ -8,11 +8,13 @@ import { IGCMetadata } from "../gc/index.js";
8
8
  import { IDocumentSchema } from "./documentSchema.js";
9
9
  /**
10
10
  * @deprecated - This interface will no longer be exported in the future(AB#8004).
11
+ * @legacy
11
12
  * @alpha
12
13
  */
13
14
  export type OmitAttributesVersions<T> = Omit<T, "snapshotFormatVersion" | "summaryFormatVersion">;
14
15
  /**
15
16
  * @deprecated - This interface will no longer be exported in the future(AB#8004).
17
+ * @legacy
16
18
  * @alpha
17
19
  */
18
20
  export interface IFluidDataStoreAttributes0 {
@@ -28,6 +30,7 @@ export interface IFluidDataStoreAttributes0 {
28
30
  }
29
31
  /**
30
32
  * @deprecated - This interface will no longer be exported in the future(AB#8004).
33
+ * @legacy
31
34
  * @alpha
32
35
  */
33
36
  export interface IFluidDataStoreAttributes1 extends OmitAttributesVersions<IFluidDataStoreAttributes0> {
@@ -36,6 +39,7 @@ export interface IFluidDataStoreAttributes1 extends OmitAttributesVersions<IFlui
36
39
  }
37
40
  /**
38
41
  * @deprecated - This interface will no longer be exported in the future(AB#8004).
42
+ * @legacy
39
43
  * @alpha
40
44
  */
41
45
  export interface IFluidDataStoreAttributes2 extends OmitAttributesVersions<IFluidDataStoreAttributes1> {
@@ -57,6 +61,7 @@ export interface IFluidDataStoreAttributes2 extends OmitAttributesVersions<IFlui
57
61
  *
58
62
  * @deprecated - This interface will no longer be exported in the future(AB#8004).
59
63
  *
64
+ * @legacy
60
65
  * @alpha
61
66
  *
62
67
  */
@@ -65,6 +70,7 @@ export type WriteFluidDataStoreAttributes = IFluidDataStoreAttributes1 | IFluidD
65
70
  export declare function getAttributesFormatVersion(attributes: ReadFluidDataStoreAttributes): number;
66
71
  export declare function hasIsolatedChannels(attributes: ReadFluidDataStoreAttributes): boolean;
67
72
  /**
73
+ * @legacy
68
74
  * @alpha
69
75
  */
70
76
  export interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGCMetadata {
@@ -82,6 +88,7 @@ export interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGC
82
88
  readonly documentSchema?: IDocumentSchema;
83
89
  }
84
90
  /**
91
+ * @legacy
85
92
  * @alpha
86
93
  */
87
94
  export interface ICreateContainerMetadata {
@@ -92,6 +99,7 @@ export interface ICreateContainerMetadata {
92
99
  }
93
100
  /**
94
101
  * The properties of an ISequencedDocumentMessage to be stored in the metadata blob in summary.
102
+ * @legacy
95
103
  * @alpha
96
104
  */
97
105
  export type ISummaryMetadataMessage = Pick<ISequencedDocumentMessage, "clientId" | "clientSequenceNumber" | "minimumSequenceNumber" | "referenceSequenceNumber" | "sequenceNumber" | "timestamp" | "type">;
@@ -105,7 +113,6 @@ export declare const aliasBlobName = ".aliases";
105
113
  export declare const metadataBlobName = ".metadata";
106
114
  export declare const chunksBlobName = ".chunks";
107
115
  export declare const electedSummarizerBlobName = ".electedSummarizer";
108
- export declare const blobsTreeName = ".blobs";
109
116
  export declare const idCompressorBlobName = ".idCompressor";
110
117
  export declare const blobHeadersBlobName = ".metadata.blobHeaders";
111
118
  export declare function rootHasIsolatedChannels(metadata?: IContainerRuntimeMetadata): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"summaryFormat.d.ts","sourceRoot":"","sources":["../../src/summary/summaryFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,uBAAuB,EACv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  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.getFluidDataStoreAttributes = exports.wrapSummaryInChannelsTree = exports.dataStoreAttributesBlobName = exports.nonDataStorePaths = exports.protocolTreeName = exports.rootHasIsolatedChannels = exports.blobHeadersBlobName = exports.idCompressorBlobName = exports.blobsTreeName = exports.electedSummarizerBlobName = exports.chunksBlobName = exports.metadataBlobName = exports.aliasBlobName = exports.getMetadataFormatVersion = exports.extractSummaryMetadataMessage = exports.hasIsolatedChannels = exports.getAttributesFormatVersion = void 0;
7
+ exports.getFluidDataStoreAttributes = exports.wrapSummaryInChannelsTree = exports.dataStoreAttributesBlobName = exports.nonDataStorePaths = exports.protocolTreeName = exports.rootHasIsolatedChannels = exports.blobHeadersBlobName = exports.idCompressorBlobName = exports.electedSummarizerBlobName = exports.chunksBlobName = exports.metadataBlobName = exports.aliasBlobName = exports.getMetadataFormatVersion = exports.extractSummaryMetadataMessage = exports.hasIsolatedChannels = exports.getAttributesFormatVersion = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const driver_definitions_1 = require("@fluidframework/driver-definitions");
10
10
  const internal_2 = require("@fluidframework/driver-utils/internal");
11
11
  const internal_3 = require("@fluidframework/runtime-definitions/internal");
12
+ const index_js_1 = require("../blobManager/index.js");
12
13
  function getAttributesFormatVersion(attributes) {
13
14
  if (attributes.summaryFormatVersion) {
14
15
  /**
@@ -69,7 +70,6 @@ exports.aliasBlobName = ".aliases";
69
70
  exports.metadataBlobName = ".metadata";
70
71
  exports.chunksBlobName = ".chunks";
71
72
  exports.electedSummarizerBlobName = ".electedSummarizer";
72
- exports.blobsTreeName = ".blobs";
73
73
  exports.idCompressorBlobName = ".idCompressor";
74
74
  exports.blobHeadersBlobName = internal_2.blobHeadersBlobName;
75
75
  function rootHasIsolatedChannels(metadata) {
@@ -87,7 +87,7 @@ exports.nonDataStorePaths = [
87
87
  exports.protocolTreeName,
88
88
  ".logTail",
89
89
  ".serviceProtocol",
90
- exports.blobsTreeName,
90
+ index_js_1.blobsTreeName,
91
91
  internal_3.gcTreeKey,
92
92
  exports.idCompressorBlobName,
93
93
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"summaryFormat.js","sourceRoot":"","sources":["../../src/summary/summaryFormat.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,2EAAiE;AAMjE,oEAG+C;AAC/C,2EAIsD;AA4EtD,SAAgB,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;AAnBD,gEAmBC;AAED,SAAgB,mBAAmB,CAAC,UAAwC;IAC3E,OAAO,CAAC,CAAC,UAAU,CAAC,oBAAoB,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC;AACjF,CAAC;AAFD,kDAEC;AA8CD;;;GAGG;AACI,MAAM,6BAA6B,GAAG,CAC5C,OAAmC,EACG,EAAE,CACxC,OAAO,KAAK,SAAS;IACpB,CAAC,CAAC,SAAS;IACX,CAAC,CAAC;QACA,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;QAClD,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;QACpD,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;QACxD,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,IAAI,EAAE,OAAO,CAAC,IAAI;KAClB,CAAC;AAbQ,QAAA,6BAA6B,iCAarC;AAEL,SAAgB,wBAAwB,CAAC,QAAoC;IAC5E;;;;;;;;;OASG;IACH,OAAO,QAAQ,EAAE,o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B,CAAC,UAAU,CAAC,CAAC;IAC7D,IAAA,iBAAM,EAAC,aAAa,GAAG,CAAC,EAAE,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACvE,OAAO,UAAU,CAAC;AACnB,CAAC;AAfD,kEAeC","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 { 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 * @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 * @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 * @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 * @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 * @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 * @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 * @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 * @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 blobsTreeName = \".blobs\";\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;;;GAGG;;;AAEH,kEAA6D;AAC7D,2EAAiE;AAMjE,oEAG+C;AAC/C,2EAIsD;AAEtD,sDAAwD;AAgFxD,SAAgB,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;AAnBD,gEAmBC;AAED,SAAgB,mBAAmB,CAAC,UAAwC;IAC3E,OAAO,CAAC,CAAC,UAAU,CAAC,oBAAoB,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC;AACjF,CAAC;AAFD,kDAEC;AAiDD;;;GAGG;AACI,MAAM,6BAA6B,GAAG,CAC5C,OAAmC,EACG,EAAE,CACxC,OAAO,KA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IAAI,EAAE,EAAE,CAAC,2BAAgB,CAAC,EAAE,eAAe,CAAC,OAAO,EAAE;KACrD,CAAC;IACF,eAAe,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;AACvC,CAAC;AAND,8DAMC;AAEM,KAAK,UAAU,2BAA2B,CAChD,OAAgC,EAChC,QAAuB;IAEvB,MAAM,UAAU,GAAG,MAAM,IAAA,uBAAY,EACpC,OAAO,EACP,QAAQ,CAAC,KAAK,CAAC,mCAA2B,CAAC,CAC3C,CAAC;IACF,qFAAqF;IACrF,mGAAmG;IACnG,uFAAuF;IACvF,0FAA0F;IAC1F,MAAM,aAAa,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;IAC7D,IAAA,iBAAM,EAAC,aAAa,GAAG,CAAC,EAAE,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACvE,OAAO,UAAU,CAAC;AACnB,CAAC;AAfD,kEAeC","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"]}
@@ -6,9 +6,10 @@ import { TypedEventEmitter } from "@fluid-internal/client-utils";
6
6
  import { ICriticalContainerError } from "@fluidframework/container-definitions";
7
7
  import { IContainerRuntime, IContainerRuntimeEvents } from "@fluidframework/container-runtime-definitions/internal";
8
8
  import { IFluidHandleContext, type IFluidHandleInternal } from "@fluidframework/core-interfaces/internal";
9
- import { IDocumentStorageService, ISnapshotTree, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
9
+ import { IDocumentStorageService, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
10
10
  import { IGarbageCollectionData, ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions/internal";
11
11
  import { FluidHandleBase } from "@fluidframework/runtime-utils/internal";
12
+ import { type IBlobManagerLoadInfo } from "./blobManagerSnapSum.js";
12
13
  /**
13
14
  * This class represents blob (long string)
14
15
  * This object is used only when creating (writing) new blob and serialization purposes.
@@ -28,14 +29,6 @@ export declare class BlobHandle extends FluidHandleBase<ArrayBufferLike> {
28
29
  attachGraph(): void;
29
30
  bind(handle: IFluidHandleInternal): void;
30
31
  }
31
- /**
32
- * Information from a snapshot needed to load BlobManager
33
- * @alpha
34
- */
35
- export interface IBlobManagerLoadInfo {
36
- ids?: string[];
37
- redirectTable?: [string, string][];
38
- }
39
32
  export type IBlobManagerRuntime = Pick<IContainerRuntime, "attachState" | "connected" | "baseLogger" | "clientDetails"> & TypedEventEmitter<IContainerRuntimeEvents>;
40
33
  export interface IPendingBlobs {
41
34
  [id: string]: {
@@ -49,9 +42,8 @@ export interface IPendingBlobs {
49
42
  export interface IBlobManagerEvents {
50
43
  (event: "noPendingBlobs", listener: () => void): any;
51
44
  }
45
+ export declare const blobManagerBasePath: "_blobs";
52
46
  export declare class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
53
- static readonly basePath = "_blobs";
54
- private static readonly redirectTableBlobName;
55
47
  private readonly mc;
56
48
  /**
57
49
  * Map of local IDs to storage IDs. Contains identity entries (id → id) for storage IDs. All requested IDs should
@@ -108,11 +100,6 @@ export declare class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
108
100
  * Upload blobs added while offline. This must be completed before connecting and resubmitting ops.
109
101
  */
110
102
  trackPendingStashedUploads(): Promise<void>;
111
- /**
112
- * Set of actual storage IDs (i.e., IDs that can be requested from storage). This will be empty if the container is
113
- * detached or there are no (non-pending) attachment blobs in the document
114
- */
115
- private get storageIds();
116
103
  getBlob(blobId: string): Promise<ArrayBufferLike>;
117
104
  private getBlobHandle;
118
105
  private createBlobDetached;
@@ -133,17 +120,6 @@ export declare class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
133
120
  */
134
121
  reSubmit(metadata: Record<string, unknown> | undefined): void;
135
122
  processBlobAttachOp(message: ISequencedDocumentMessage, local: boolean): void;
136
- /**
137
- * Reads blobs needed to load BlobManager from storage.
138
- * @param blobsTree - Tree containing IDs of previously attached blobs. We
139
- * look for the IDs in the blob entries of the tree since the both the r11s
140
- * and SPO drivers replace the attachment types returned in snapshot() with blobs.
141
- */
142
- static load(blobsTree: ISnapshotTree | undefined, tryFetchBlob: (id: string) => Promise<[string, string][]>): Promise<IBlobManagerLoadInfo>;
143
- /**
144
- * Load a set of previously attached blob IDs and redirect table from a previous snapshot.
145
- */
146
- private load;
147
123
  summarize(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
148
124
  /**
149
125
  * Generates data used for garbage collection. Each blob uploaded represents a node in the GC graph as it can be
@@ -161,7 +137,7 @@ export declare class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
161
137
  deleteSweepReadyNodes(sweepReadyBlobRoutes: readonly string[]): readonly string[];
162
138
  /**
163
139
  * Delete blobs with the given routes from the redirect table.
164
- * The routes are GC nodes paths of format -`/<BlobManager.basePath>/<blobId>`. The blob ids are all local ids.
140
+ * The routes are GC nodes paths of format -`/<blobManagerBasePath>/<blobId>`. The blob ids are all local ids.
165
141
  * Deleting the blobs involves 2 steps:
166
142
  * 1. The redirect table entry for the local ids are deleted.
167
143
  * 2. If the storage ids corresponding to the deleted local ids are not in-use anymore, the redirect table entries
@@ -179,4 +155,9 @@ export declare class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
179
155
  setRedirectTable(table: Map<string, string>): void;
180
156
  attachAndGetPendingBlobs(stopBlobAttachingSignal?: AbortSignal): Promise<IPendingBlobs | undefined>;
181
157
  }
158
+ /**
159
+ * Returns whether a given path is for attachment blobs that are in the format - "/blobManagerBasePath/...".
160
+ */
161
+ export declare const isBlobPath: (path: string) => path is `/_blobs/${string}`;
162
+ export declare const areBlobPathParts: (pathParts: string[]) => pathParts is ["", "_blobs", string];
182
163
  //# sourceMappingURL=blobManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blobManager.d.ts","sourceRoot":"","sources":["../../src/blobManager/blobManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,iBAAiB,EAGjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAe,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EACN,iBAAiB,EACjB,uBAAuB,EACvB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EACN,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACN,uBAAuB,EAEvB,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EACN,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,eAAe,EAIf,MAAM,wCAAwC,CAAC;AAahD,OAAO,EAIN,KAAK,oBAAoB,EACzB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;GAMG;AACH,qBAAa,UAAW,SAAQ,eAAe,CAAC,eAAe,CAAC;aAU9C,IAAI,EAAE,MAAM;aACZ,YAAY,EAAE,mBAAmB;IAC1C,GAAG,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC;IAC1C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;IAZhC,OAAO,CAAC,QAAQ,CAAkB;IAElC,IAAW,UAAU,IAAI,OAAO,CAE/B;IAED,SAAgB,YAAY,EAAE,MAAM,CAAC;gBAGpB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,mBAAmB,EAC1C,GAAG,EAAE,MAAM,OAAO,CAAC,eAAe,C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E,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAiBtD,mBAAmB,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO;IAoDtE,SAAS,CAAC,gBAAgB,CAAC,EAAE,iBAAiB,GAAG,qBAAqB;IAI7E;;;;;OAKG;IACI,SAAS,CAAC,MAAM,GAAE,OAAe,GAAG,sBAAsB;IAejE;;;;;OAKG;IACI,qBAAqB,CAAC,oBAAoB,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE;IAKxF;;;;;;;;;;OAUG;IACH,OAAO,CAAC,4BAA4B;IA8CpC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAqBrB,gBAAgB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAiBrC,wBAAwB,CACpC,uBAAuB,CAAC,EAAE,WAAW,GACnC,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAoErC;AAkBD;;GAEG;AACH,eAAO,MAAM,UAAU,SAAU,MAAM,gCACL,CAAC;AAEnC,eAAO,MAAM,gBAAgB,cACjB,MAAM,EAAE,wCAE2C,CAAC"}
@@ -6,9 +6,10 @@ import { TypedEventEmitter, bufferToString, stringToBuffer, } from "@fluid-inter
6
6
  import { AttachState } from "@fluidframework/container-definitions";
7
7
  import { assert, Deferred } from "@fluidframework/core-utils/internal";
8
8
  import { canRetryOnError, runWithRetry } from "@fluidframework/driver-utils/internal";
9
- import { FluidHandleBase, SummaryTreeBuilder, createResponseError, generateHandleContextPath, responseToException, } from "@fluidframework/runtime-utils/internal";
9
+ import { FluidHandleBase, createResponseError, generateHandleContextPath, responseToException, } from "@fluidframework/runtime-utils/internal";
10
10
  import { GenericError, LoggingError, PerformanceEvent, createChildMonitoringContext, wrapError, } from "@fluidframework/telemetry-utils/internal";
11
11
  import { v4 as uuid } from "uuid";
12
+ import { getStorageIds, summarizeBlobManagerState, toRedirectTable, } from "./blobManagerSnapSum.js";
12
13
  /**
13
14
  * This class represents blob (long string)
14
15
  * This object is used only when creating (writing) new blob and serialization purposes.
@@ -45,6 +46,7 @@ const stashedPendingBlobOverrides = {
45
46
  minTTLInSeconds: undefined,
46
47
  uploadTime: undefined,
47
48
  };
49
+ export const blobManagerBasePath = "_blobs";
48
50
  export class BlobManager extends TypedEventEmitter {
49
51
  constructor(props) {
50
52
  super();
@@ -70,7 +72,7 @@ export class BlobManager extends TypedEventEmitter {
70
72
  logger: this.runtime.baseLogger,
71
73
  namespace: "BlobManager",
72
74
  });
73
- this.redirectTable = this.load(snapshot);
75
+ this.redirectTable = toRedirectTable(snapshot, this.mc.logger, this.runtime.attachState);
74
76
  // Begin uploading stashed blobs from previous container instance
75
77
  Object.entries(stashedBlobs ?? {}).forEach(([localId, entry]) => {
76
78
  const { acked, storageId, minTTLInSeconds, uploadTime } = entry;
@@ -161,20 +163,6 @@ export class BlobManager extends TypedEventEmitter {
161
163
  count: pendingUploads.length,
162
164
  }, async () => Promise.all(pendingUploads), { start: true, end: true });
163
165
  }
164
- /**
165
- * Set of actual storage IDs (i.e., IDs that can be requested from storage). This will be empty if the container is
166
- * detached or there are no (non-pending) attachment blobs in the document
167
- */
168
- get storageIds() {
169
- const ids = new Set(this.redirectTable.values());
170
- // If we are detached, we will not have storage IDs, only undefined
171
- const undefinedValueInTable = ids.delete(undefined);
172
- // For a detached container, entries are inserted into the redirect table with an undefined storage ID.
173
- // For an attached container, entries are inserted w/storage ID after the BlobAttach op round-trips.
174
- assert(!undefinedValueInTable ||
175
- (this.runtime.attachState === AttachState.Detached && ids.size === 0), 0x382 /* 'redirectTable' must contain only undefined while detached / defined values while attached */);
176
- return ids;
177
- }
178
166
  async getBlob(blobId) {
179
167
  // Verify that the blob is not deleted, i.e., it has not been garbage collected. If it is, this will throw
180
168
  // an error, failing the call.
@@ -213,7 +201,7 @@ export class BlobManager extends TypedEventEmitter {
213
201
  this.deletePendingBlobMaybe(id);
214
202
  }
215
203
  : undefined;
216
- return new BlobHandle(`${BlobManager.basePath}/${id}`, this.routeContext, async () => this.getBlob(id), callback);
204
+ return new BlobHandle(getGCNodePathFromBlobId(id), this.routeContext, async () => this.getBlob(id), callback);
217
205
  }
218
206
  async createBlobDetached(blob) {
219
207
  // Blobs created while the container is detached are stored in IDetachedBlobStorage.
@@ -321,7 +309,8 @@ export class BlobManager extends TypedEventEmitter {
321
309
  if (!entry.opsent) {
322
310
  this.sendBlobAttachOp(localId, response.id);
323
311
  }
324
- if (this.storageIds.has(response.id)) {
312
+ const storageIds = getStorageIds(this.redirectTable, this.runtime.attachState);
313
+ if (storageIds.has(response.id)) {
325
314
  // The blob is de-duped. Set up a local ID to storage ID mapping and return the blob. Since this is
326
315
  // an existing blob, we don't have to wait for the op to be ack'd since this step has already
327
316
  // happened before and so, the server won't delete it.
@@ -399,60 +388,8 @@ export class BlobManager extends TypedEventEmitter {
399
388
  }
400
389
  }
401
390
  }
402
- /**
403
- * Reads blobs needed to load BlobManager from storage.
404
- * @param blobsTree - Tree containing IDs of previously attached blobs. We
405
- * look for the IDs in the blob entries of the tree since the both the r11s
406
- * and SPO drivers replace the attachment types returned in snapshot() with blobs.
407
- */
408
- static async load(blobsTree, tryFetchBlob) {
409
- if (!blobsTree) {
410
- return {};
411
- }
412
- let redirectTable;
413
- const tableId = blobsTree.blobs[this.redirectTableBlobName];
414
- if (tableId) {
415
- redirectTable = await tryFetchBlob(tableId);
416
- }
417
- const ids = Object.entries(blobsTree.blobs)
418
- .filter(([k, _]) => k !== this.redirectTableBlobName)
419
- .map(([_, v]) => v);
420
- return { ids, redirectTable };
421
- }
422
- /**
423
- * Load a set of previously attached blob IDs and redirect table from a previous snapshot.
424
- */
425
- load(snapshot) {
426
- this.mc.logger.sendTelemetryEvent({
427
- eventName: "AttachmentBlobsLoaded",
428
- count: snapshot.ids?.length ?? 0,
429
- redirectTable: snapshot.redirectTable?.length,
430
- });
431
- const table = new Map(snapshot.redirectTable);
432
- if (snapshot.ids) {
433
- const detached = this.runtime.attachState === AttachState.Detached;
434
- // If we are detached, we don't have storage IDs yet, so set to undefined
435
- // Otherwise, set identity (id -> id) entries
436
- snapshot.ids.forEach((entry) => table.set(entry, detached ? undefined : entry));
437
- }
438
- return table;
439
- }
440
391
  summarize(telemetryContext) {
441
- // if storageIds is empty, it means we are detached and have only local IDs, or that there are no blobs attached
442
- const blobIds = this.storageIds.size > 0
443
- ? Array.from(this.storageIds)
444
- : Array.from(this.redirectTable.keys());
445
- const builder = new SummaryTreeBuilder();
446
- blobIds.forEach((blobId) => {
447
- builder.addAttachment(blobId);
448
- });
449
- // Any non-identity entries in the table need to be saved in the summary
450
- if (this.redirectTable.size > blobIds.length) {
451
- builder.addBlob(BlobManager.redirectTableBlobName,
452
- // filter out identity entries
453
- JSON.stringify(Array.from(this.redirectTable.entries()).filter(([localId, storageId]) => localId !== storageId)));
454
- }
455
- return builder.getSummaryTree();
392
+ return summarizeBlobManagerState(this.redirectTable, this.runtime.attachState);
456
393
  }
457
394
  /**
458
395
  * Generates data used for garbage collection. Each blob uploaded represents a node in the GC graph as it can be
@@ -486,7 +423,7 @@ export class BlobManager extends TypedEventEmitter {
486
423
  }
487
424
  /**
488
425
  * Delete blobs with the given routes from the redirect table.
489
- * The routes are GC nodes paths of format -`/<BlobManager.basePath>/<blobId>`. The blob ids are all local ids.
426
+ * The routes are GC nodes paths of format -`/<blobManagerBasePath>/<blobId>`. The blob ids are all local ids.
490
427
  * Deleting the blobs involves 2 steps:
491
428
  * 1. The redirect table entry for the local ids are deleted.
492
429
  * 2. If the storage ids corresponding to the deleted local ids are not in-use anymore, the redirect table entries
@@ -550,7 +487,7 @@ export class BlobManager extends TypedEventEmitter {
550
487
  // Only log deleted events. Tombstone events are logged by garbage collector.
551
488
  this.mc.logger.sendErrorEvent({
552
489
  eventName: "GC_Deleted_Blob_Requested",
553
- pkg: BlobManager.basePath,
490
+ pkg: blobManagerBasePath,
554
491
  }, error);
555
492
  throw error;
556
493
  }
@@ -623,22 +560,23 @@ export class BlobManager extends TypedEventEmitter {
623
560
  });
624
561
  }
625
562
  }
626
- BlobManager.basePath = "_blobs";
627
- BlobManager.redirectTableBlobName = ".redirectTable";
628
563
  /**
629
- * For a blobId, returns its path in GC's graph. The node path is of the format `/<BlobManager.basePath>/<blobId>`.
564
+ * For a blobId, returns its path in GC's graph. The node path is of the format `/<blobManagerBasePath>/<blobId>`.
630
565
  * This path must match the path of the blob handle returned by the createBlob API because blobs are marked
631
566
  * referenced by storing these handles in a referenced DDS.
632
567
  */
633
- function getGCNodePathFromBlobId(blobId) {
634
- return `/${BlobManager.basePath}/${blobId}`;
635
- }
568
+ const getGCNodePathFromBlobId = (blobId) => `/${blobManagerBasePath}/${blobId}`;
636
569
  /**
637
- * For a given GC node path, return the blobId. The node path is of the format `/<BlobManager.basePath>/<blobId>`.
570
+ * For a given GC node path, return the blobId. The node path is of the format `/<basePath>/<blobId>`.
638
571
  */
639
- function getBlobIdFromGCNodePath(nodePath) {
572
+ const getBlobIdFromGCNodePath = (nodePath) => {
640
573
  const pathParts = nodePath.split("/");
641
- assert(pathParts.length === 3 && pathParts[1] === BlobManager.basePath, 0x5bd /* Invalid blob node path */);
574
+ assert(areBlobPathParts(pathParts), 0x5bd /* Invalid blob node path */);
642
575
  return pathParts[2];
643
- }
576
+ };
577
+ /**
578
+ * Returns whether a given path is for attachment blobs that are in the format - "/blobManagerBasePath/...".
579
+ */
580
+ export const isBlobPath = (path) => areBlobPathParts(path.split("/"));
581
+ export const areBlobPathParts = (pathParts) => pathParts.length === 3 && pathParts[1] === blobManagerBasePath;
644
582
  //# sourceMappingURL=blobManager.js.map