@fluidframework/container-runtime 2.23.0 → 2.30.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 (234) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/api-report/container-runtime.legacy.alpha.api.md +0 -246
  3. package/dist/blobManager/blobManager.d.ts +11 -9
  4. package/dist/blobManager/blobManager.d.ts.map +1 -1
  5. package/dist/blobManager/blobManager.js +38 -39
  6. package/dist/blobManager/blobManager.js.map +1 -1
  7. package/dist/blobManager/blobManagerSnapSum.d.ts +2 -4
  8. package/dist/blobManager/blobManagerSnapSum.d.ts.map +1 -1
  9. package/dist/blobManager/blobManagerSnapSum.js +6 -6
  10. package/dist/blobManager/blobManagerSnapSum.js.map +1 -1
  11. package/dist/channelCollection.d.ts +1 -7
  12. package/dist/channelCollection.d.ts.map +1 -1
  13. package/dist/channelCollection.js +1 -26
  14. package/dist/channelCollection.js.map +1 -1
  15. package/dist/connectionTelemetry.d.ts +0 -43
  16. package/dist/connectionTelemetry.d.ts.map +1 -1
  17. package/dist/connectionTelemetry.js.map +1 -1
  18. package/dist/containerRuntime.d.ts +21 -141
  19. package/dist/containerRuntime.d.ts.map +1 -1
  20. package/dist/containerRuntime.js +49 -290
  21. package/dist/containerRuntime.js.map +1 -1
  22. package/dist/dataStoreContext.d.ts +0 -13
  23. package/dist/dataStoreContext.d.ts.map +1 -1
  24. package/dist/dataStoreContext.js +2 -25
  25. package/dist/dataStoreContext.js.map +1 -1
  26. package/dist/gc/garbageCollection.d.ts.map +1 -1
  27. package/dist/gc/garbageCollection.js +2 -20
  28. package/dist/gc/garbageCollection.js.map +1 -1
  29. package/dist/gc/gcConfigs.d.ts.map +1 -1
  30. package/dist/gc/gcConfigs.js +0 -2
  31. package/dist/gc/gcConfigs.js.map +1 -1
  32. package/dist/gc/gcDefinitions.d.ts +8 -24
  33. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  34. package/dist/gc/gcDefinitions.js +1 -3
  35. package/dist/gc/gcDefinitions.js.map +1 -1
  36. package/dist/gc/gcHelpers.d.ts.map +1 -1
  37. package/dist/gc/gcHelpers.js +1 -4
  38. package/dist/gc/gcHelpers.js.map +1 -1
  39. package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
  40. package/dist/gc/gcSummaryStateTracker.js +0 -1
  41. package/dist/gc/gcSummaryStateTracker.js.map +1 -1
  42. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  43. package/dist/gc/gcTelemetry.js +4 -16
  44. package/dist/gc/gcTelemetry.js.map +1 -1
  45. package/dist/index.d.ts +2 -2
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +2 -2
  48. package/dist/index.js.map +1 -1
  49. package/dist/legacy.d.ts +0 -29
  50. package/dist/messageTypes.d.ts.map +1 -1
  51. package/dist/messageTypes.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/signalTelemetryProcessing.d.ts +33 -0
  56. package/dist/signalTelemetryProcessing.d.ts.map +1 -0
  57. package/dist/signalTelemetryProcessing.js +149 -0
  58. package/dist/signalTelemetryProcessing.js.map +1 -0
  59. package/dist/summary/documentSchema.d.ts +7 -31
  60. package/dist/summary/documentSchema.d.ts.map +1 -1
  61. package/dist/summary/documentSchema.js +2 -18
  62. package/dist/summary/documentSchema.js.map +1 -1
  63. package/dist/summary/index.d.ts +2 -1
  64. package/dist/summary/index.d.ts.map +1 -1
  65. package/dist/summary/index.js +7 -1
  66. package/dist/summary/index.js.map +1 -1
  67. package/dist/summary/orderedClientElection.d.ts +1 -3
  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 -3
  71. package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  72. package/dist/summary/runWhileConnectedCoordinator.js +2 -7
  73. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  74. package/dist/summary/runningSummarizer.d.ts +1 -2
  75. package/dist/summary/runningSummarizer.d.ts.map +1 -1
  76. package/dist/summary/runningSummarizer.js +4 -23
  77. package/dist/summary/runningSummarizer.js.map +1 -1
  78. package/dist/summary/summarizer.d.ts +2 -5
  79. package/dist/summary/summarizer.d.ts.map +1 -1
  80. package/dist/summary/summarizer.js +3 -11
  81. package/dist/summary/summarizer.js.map +1 -1
  82. package/dist/summary/summarizerClientElection.d.ts.map +1 -1
  83. package/dist/summary/summarizerClientElection.js +0 -1
  84. package/dist/summary/summarizerClientElection.js.map +1 -1
  85. package/dist/summary/summarizerHeuristics.d.ts +1 -1
  86. package/dist/summary/summarizerHeuristics.d.ts.map +1 -1
  87. package/dist/summary/summarizerHeuristics.js.map +1 -1
  88. package/dist/summary/summarizerTypes.d.ts +109 -22
  89. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  90. package/dist/summary/summarizerTypes.js.map +1 -1
  91. package/dist/summary/summaryFormat.d.ts +3 -9
  92. package/dist/summary/summaryFormat.d.ts.map +1 -1
  93. package/dist/summary/summaryFormat.js.map +1 -1
  94. package/dist/summary/summaryGenerator.d.ts.map +1 -1
  95. package/dist/summary/summaryGenerator.js +3 -9
  96. package/dist/summary/summaryGenerator.js.map +1 -1
  97. package/dist/summary/summaryHelpers.d.ts +19 -0
  98. package/dist/summary/summaryHelpers.d.ts.map +1 -0
  99. package/dist/summary/summaryHelpers.js +90 -0
  100. package/dist/summary/summaryHelpers.js.map +1 -0
  101. package/dist/summary/summaryManager.d.ts.map +1 -1
  102. package/dist/summary/summaryManager.js +0 -2
  103. package/dist/summary/summaryManager.js.map +1 -1
  104. package/lib/blobManager/blobManager.d.ts +11 -9
  105. package/lib/blobManager/blobManager.d.ts.map +1 -1
  106. package/lib/blobManager/blobManager.js +37 -37
  107. package/lib/blobManager/blobManager.js.map +1 -1
  108. package/lib/blobManager/blobManagerSnapSum.d.ts +2 -4
  109. package/lib/blobManager/blobManagerSnapSum.d.ts.map +1 -1
  110. package/lib/blobManager/blobManagerSnapSum.js +6 -6
  111. package/lib/blobManager/blobManagerSnapSum.js.map +1 -1
  112. package/lib/channelCollection.d.ts +1 -7
  113. package/lib/channelCollection.d.ts.map +1 -1
  114. package/lib/channelCollection.js +2 -29
  115. package/lib/channelCollection.js.map +1 -1
  116. package/lib/connectionTelemetry.d.ts +0 -43
  117. package/lib/connectionTelemetry.d.ts.map +1 -1
  118. package/lib/connectionTelemetry.js.map +1 -1
  119. package/lib/containerRuntime.d.ts +21 -141
  120. package/lib/containerRuntime.d.ts.map +1 -1
  121. package/lib/containerRuntime.js +51 -298
  122. package/lib/containerRuntime.js.map +1 -1
  123. package/lib/dataStoreContext.d.ts +0 -13
  124. package/lib/dataStoreContext.d.ts.map +1 -1
  125. package/lib/dataStoreContext.js +2 -25
  126. package/lib/dataStoreContext.js.map +1 -1
  127. package/lib/gc/garbageCollection.d.ts.map +1 -1
  128. package/lib/gc/garbageCollection.js +3 -23
  129. package/lib/gc/garbageCollection.js.map +1 -1
  130. package/lib/gc/gcConfigs.d.ts.map +1 -1
  131. package/lib/gc/gcConfigs.js +0 -2
  132. package/lib/gc/gcConfigs.js.map +1 -1
  133. package/lib/gc/gcDefinitions.d.ts +8 -24
  134. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  135. package/lib/gc/gcDefinitions.js +1 -3
  136. package/lib/gc/gcDefinitions.js.map +1 -1
  137. package/lib/gc/gcHelpers.d.ts.map +1 -1
  138. package/lib/gc/gcHelpers.js +1 -4
  139. package/lib/gc/gcHelpers.js.map +1 -1
  140. package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -1
  141. package/lib/gc/gcSummaryStateTracker.js +0 -1
  142. package/lib/gc/gcSummaryStateTracker.js.map +1 -1
  143. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  144. package/lib/gc/gcTelemetry.js +5 -19
  145. package/lib/gc/gcTelemetry.js.map +1 -1
  146. package/lib/index.d.ts +2 -2
  147. package/lib/index.d.ts.map +1 -1
  148. package/lib/index.js +2 -2
  149. package/lib/index.js.map +1 -1
  150. package/lib/legacy.d.ts +0 -29
  151. package/lib/messageTypes.d.ts.map +1 -1
  152. package/lib/messageTypes.js.map +1 -1
  153. package/lib/packageVersion.d.ts +1 -1
  154. package/lib/packageVersion.js +1 -1
  155. package/lib/packageVersion.js.map +1 -1
  156. package/lib/signalTelemetryProcessing.d.ts +33 -0
  157. package/lib/signalTelemetryProcessing.d.ts.map +1 -0
  158. package/lib/signalTelemetryProcessing.js +145 -0
  159. package/lib/signalTelemetryProcessing.js.map +1 -0
  160. package/lib/summary/documentSchema.d.ts +7 -31
  161. package/lib/summary/documentSchema.d.ts.map +1 -1
  162. package/lib/summary/documentSchema.js +2 -18
  163. package/lib/summary/documentSchema.js.map +1 -1
  164. package/lib/summary/index.d.ts +2 -1
  165. package/lib/summary/index.d.ts.map +1 -1
  166. package/lib/summary/index.js +1 -0
  167. package/lib/summary/index.js.map +1 -1
  168. package/lib/summary/orderedClientElection.d.ts +1 -3
  169. package/lib/summary/orderedClientElection.d.ts.map +1 -1
  170. package/lib/summary/orderedClientElection.js.map +1 -1
  171. package/lib/summary/runWhileConnectedCoordinator.d.ts +1 -3
  172. package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  173. package/lib/summary/runWhileConnectedCoordinator.js +2 -7
  174. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
  175. package/lib/summary/runningSummarizer.d.ts +1 -2
  176. package/lib/summary/runningSummarizer.d.ts.map +1 -1
  177. package/lib/summary/runningSummarizer.js +4 -23
  178. package/lib/summary/runningSummarizer.js.map +1 -1
  179. package/lib/summary/summarizer.d.ts +2 -5
  180. package/lib/summary/summarizer.d.ts.map +1 -1
  181. package/lib/summary/summarizer.js +3 -11
  182. package/lib/summary/summarizer.js.map +1 -1
  183. package/lib/summary/summarizerClientElection.d.ts.map +1 -1
  184. package/lib/summary/summarizerClientElection.js +0 -1
  185. package/lib/summary/summarizerClientElection.js.map +1 -1
  186. package/lib/summary/summarizerHeuristics.d.ts +1 -1
  187. package/lib/summary/summarizerHeuristics.d.ts.map +1 -1
  188. package/lib/summary/summarizerHeuristics.js.map +1 -1
  189. package/lib/summary/summarizerTypes.d.ts +109 -22
  190. package/lib/summary/summarizerTypes.d.ts.map +1 -1
  191. package/lib/summary/summarizerTypes.js.map +1 -1
  192. package/lib/summary/summaryFormat.d.ts +3 -9
  193. package/lib/summary/summaryFormat.d.ts.map +1 -1
  194. package/lib/summary/summaryFormat.js.map +1 -1
  195. package/lib/summary/summaryGenerator.d.ts.map +1 -1
  196. package/lib/summary/summaryGenerator.js +3 -9
  197. package/lib/summary/summaryGenerator.js.map +1 -1
  198. package/lib/summary/summaryHelpers.d.ts +19 -0
  199. package/lib/summary/summaryHelpers.d.ts.map +1 -0
  200. package/lib/summary/summaryHelpers.js +84 -0
  201. package/lib/summary/summaryHelpers.js.map +1 -0
  202. package/lib/summary/summaryManager.d.ts.map +1 -1
  203. package/lib/summary/summaryManager.js +0 -2
  204. package/lib/summary/summaryManager.js.map +1 -1
  205. package/package.json +27 -20
  206. package/src/blobManager/blobManager.ts +70 -62
  207. package/src/blobManager/blobManagerSnapSum.ts +7 -9
  208. package/src/channelCollection.ts +3 -31
  209. package/src/connectionTelemetry.ts +0 -51
  210. package/src/containerRuntime.ts +111 -522
  211. package/src/dataStoreContext.ts +2 -32
  212. package/src/gc/garbageCollection.ts +9 -26
  213. package/src/gc/gcConfigs.ts +3 -6
  214. package/src/gc/gcDefinitions.ts +10 -28
  215. package/src/gc/gcHelpers.ts +0 -5
  216. package/src/gc/gcSummaryStateTracker.ts +1 -2
  217. package/src/gc/gcTelemetry.ts +6 -13
  218. package/src/index.ts +6 -6
  219. package/src/messageTypes.ts +0 -2
  220. package/src/packageVersion.ts +1 -1
  221. package/src/signalTelemetryProcessing.ts +233 -0
  222. package/src/summary/documentSchema.ts +7 -38
  223. package/src/summary/index.ts +12 -0
  224. package/src/summary/orderedClientElection.ts +1 -3
  225. package/src/summary/runWhileConnectedCoordinator.ts +3 -8
  226. package/src/summary/runningSummarizer.ts +12 -20
  227. package/src/summary/summarizer.ts +6 -18
  228. package/src/summary/summarizerClientElection.ts +0 -2
  229. package/src/summary/summarizerHeuristics.ts +1 -2
  230. package/src/summary/summarizerTypes.ts +119 -23
  231. package/src/summary/summaryFormat.ts +4 -13
  232. package/src/summary/summaryGenerator.ts +1 -8
  233. package/src/summary/summaryHelpers.ts +118 -0
  234. package/src/summary/summaryManager.ts +0 -2
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { TypedEventEmitter, bufferToString, stringToBuffer, } from "@fluid-internal/client-utils";
6
6
  import { AttachState } from "@fluidframework/container-definitions";
7
- import { assert, Deferred, LazyPromise } from "@fluidframework/core-utils/internal";
7
+ import { assert, Deferred } from "@fluidframework/core-utils/internal";
8
8
  import { canRetryOnError, runWithRetry } from "@fluidframework/driver-utils/internal";
9
9
  import { FluidHandleBase, createResponseError, generateHandleContextPath, responseToException, } from "@fluidframework/runtime-utils/internal";
10
10
  import { LoggingError, PerformanceEvent, createChildMonitoringContext, wrapError, } from "@fluidframework/telemetry-utils/internal";
@@ -47,9 +47,13 @@ const stashedPendingBlobOverrides = {
47
47
  uploadTime: undefined,
48
48
  };
49
49
  export const blobManagerBasePath = "_blobs";
50
- export class BlobManager extends TypedEventEmitter {
50
+ export class BlobManager {
51
+ get events() {
52
+ return this.publicEvents;
53
+ }
51
54
  constructor(props) {
52
- super();
55
+ this.publicEvents = new TypedEventEmitter();
56
+ this.internalEvents = new TypedEventEmitter();
53
57
  /**
54
58
  * Blobs which we have not yet seen a BlobAttach op round-trip and not yet attached to a DDS.
55
59
  */
@@ -62,9 +66,9 @@ export class BlobManager extends TypedEventEmitter {
62
66
  this.opsInFlight = new Map();
63
67
  this.stopAttaching = false;
64
68
  this.pendingStashedBlobs = new Map();
65
- const { routeContext, snapshot, getStorage, sendBlobAttachOp, blobRequested, isBlobDeleted, runtime, stashedBlobs, localBlobIdGenerator, } = props;
69
+ const { routeContext, blobManagerLoadInfo, storage, sendBlobAttachOp, blobRequested, isBlobDeleted, runtime, stashedBlobs, localBlobIdGenerator, } = props;
66
70
  this.routeContext = routeContext;
67
- this.getStorage = getStorage;
71
+ this.storage = storage;
68
72
  this.blobRequested = blobRequested;
69
73
  this.isBlobDeleted = isBlobDeleted;
70
74
  this.runtime = runtime;
@@ -73,7 +77,7 @@ export class BlobManager extends TypedEventEmitter {
73
77
  logger: this.runtime.baseLogger,
74
78
  namespace: "BlobManager",
75
79
  });
76
- this.redirectTable = toRedirectTable(snapshot, this.mc.logger, this.runtime.attachState);
80
+ this.redirectTable = toRedirectTable(blobManagerLoadInfo, this.mc.logger, this.runtime.attachState);
77
81
  // Begin uploading stashed blobs from previous container instance
78
82
  for (const [localId, entry] of Object.entries(stashedBlobs ?? {})) {
79
83
  const { acked, storageId, minTTLInSeconds, uploadTime } = entry;
@@ -104,7 +108,7 @@ export class BlobManager extends TypedEventEmitter {
104
108
  uploadP: this.pendingStashedBlobs.get(localId),
105
109
  });
106
110
  }
107
- this.stashedBlobsUploadP = new LazyPromise(async () => PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "BlobUploadProcessStashedChanges", count: this.pendingStashedBlobs.size }, async () => Promise.all(this.pendingStashedBlobs.values()), { start: true, end: true })).finally(() => {
111
+ this.stashedBlobsUploadP = PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "BlobUploadProcessStashedChanges", count: this.pendingStashedBlobs.size }, async () => Promise.all(this.pendingStashedBlobs.values()), { start: true, end: true }).finally(() => {
108
112
  this.pendingStashedBlobs.clear();
109
113
  });
110
114
  this.sendBlobAttachOp = (localId, blobId) => {
@@ -133,11 +137,11 @@ export class BlobManager extends TypedEventEmitter {
133
137
  }
134
138
  }
135
139
  pendingEntry.opsent = true;
136
- return sendBlobAttachOp(localId, blobId);
140
+ sendBlobAttachOp(localId, blobId);
137
141
  };
138
142
  }
139
143
  get allBlobsAttached() {
140
- for (const [, entry] of this.pendingBlobs) {
144
+ for (const entry of this.pendingBlobs.values()) {
141
145
  if (entry.attached === false) {
142
146
  return false;
143
147
  }
@@ -182,9 +186,7 @@ export class BlobManager extends TypedEventEmitter {
182
186
  storageId = attachedStorageId;
183
187
  }
184
188
  return PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "AttachmentReadBlob", id: storageId }, async (event) => {
185
- return this.getStorage()
186
- .readBlob(storageId)
187
- .catch((error) => {
189
+ return this.storage.readBlob(storageId).catch((error) => {
188
190
  if (this.runtime.disposed) {
189
191
  // If the runtime is disposed, this is not an error we care to track, it's expected behavior.
190
192
  event.cancel({ category: "generic" });
@@ -193,24 +195,24 @@ export class BlobManager extends TypedEventEmitter {
193
195
  });
194
196
  }, { end: true, cancel: "error" });
195
197
  }
196
- getBlobHandle(id) {
197
- assert(this.redirectTable.has(id) || this.pendingBlobs.has(id), 0x384 /* requesting handle for unknown blob */);
198
- const pending = this.pendingBlobs.get(id);
198
+ getBlobHandle(localId) {
199
+ assert(this.redirectTable.has(localId) || this.pendingBlobs.has(localId), 0x384 /* requesting handle for unknown blob */);
200
+ const pending = this.pendingBlobs.get(localId);
199
201
  // Create a callback function for once the blob has been attached
200
202
  const callback = pending
201
203
  ? () => {
202
204
  pending.attached = true;
203
205
  // Notify listeners (e.g. serialization process) that blob has been attached
204
- this.emit("blobAttached", pending);
205
- this.deletePendingBlobMaybe(id);
206
+ this.internalEvents.emit("blobAttached", pending);
207
+ this.deletePendingBlobMaybe(localId);
206
208
  }
207
209
  : undefined;
208
- return new BlobHandle(getGCNodePathFromBlobId(id), this.routeContext, async () => this.getBlob(id), callback);
210
+ return new BlobHandle(getGCNodePathFromBlobId(localId), this.routeContext, async () => this.getBlob(localId), callback);
209
211
  }
210
212
  async createBlobDetached(blob) {
211
213
  // Blobs created while the container is detached are stored in IDetachedBlobStorage.
212
214
  // The 'IDocumentStorageService.createBlob()' call below will respond with a localId.
213
- const response = await this.getStorage().createBlob(blob);
215
+ const response = await this.storage.createBlob(blob);
214
216
  this.setRedirection(response.id, undefined);
215
217
  return this.getBlobHandle(response.id);
216
218
  }
@@ -253,7 +255,7 @@ export class BlobManager extends TypedEventEmitter {
253
255
  async uploadBlob(localId, blob) {
254
256
  return runWithRetry(async () => {
255
257
  try {
256
- return await this.getStorage().createBlob(blob);
258
+ return await this.storage.createBlob(blob);
257
259
  }
258
260
  catch (error) {
259
261
  const entry = this.pendingBlobs.get(localId);
@@ -287,17 +289,17 @@ export class BlobManager extends TypedEventEmitter {
287
289
  setRedirection(fromId, toId) {
288
290
  this.redirectTable.set(fromId, toId);
289
291
  }
290
- deletePendingBlobMaybe(id) {
291
- if (this.pendingBlobs.has(id)) {
292
- const entry = this.pendingBlobs.get(id);
292
+ deletePendingBlobMaybe(localId) {
293
+ if (this.pendingBlobs.has(localId)) {
294
+ const entry = this.pendingBlobs.get(localId);
293
295
  if (entry?.attached && entry?.acked) {
294
- this.deletePendingBlob(id);
296
+ this.deletePendingBlob(localId);
295
297
  }
296
298
  }
297
299
  }
298
300
  deletePendingBlob(id) {
299
301
  if (this.pendingBlobs.delete(id) && !this.hasPendingBlobs) {
300
- this.emit("noPendingBlobs");
302
+ this.publicEvents.emit("noPendingBlobs");
301
303
  }
302
304
  }
303
305
  onUploadResolve(localId, response) {
@@ -552,7 +554,7 @@ export class BlobManager extends TypedEventEmitter {
552
554
  // This while is used to stash blobs created while attaching and getting blobs
553
555
  while (localBlobs.size < this.pendingBlobs.size) {
554
556
  const attachBlobsP = [];
555
- for (const [id, entry] of this.pendingBlobs) {
557
+ for (const [localId, entry] of this.pendingBlobs) {
556
558
  if (!localBlobs.has(entry)) {
557
559
  localBlobs.add(entry);
558
560
  // In order to follow natural blob creation flow we need to:
@@ -560,12 +562,12 @@ export class BlobManager extends TypedEventEmitter {
560
562
  // 2 resolve the blob handle
561
563
  // 3 wait for op referencing the blob
562
564
  if (!entry.opsent) {
563
- this.sendBlobAttachOp(id, entry.storageId);
565
+ this.sendBlobAttachOp(localId, entry.storageId);
564
566
  }
565
567
  // Resolving the blob handle to let hosts continue with their operations (it will resolve
566
568
  // original createBlob call) and let them attach the blob. This is a lie we told since the upload
567
569
  // hasn't finished yet, but it's fine since we will retry on rehydration.
568
- entry.handleP.resolve(this.getBlobHandle(id));
570
+ entry.handleP.resolve(this.getBlobHandle(localId));
569
571
  // Array of promises that will resolve when blobs get attached.
570
572
  attachBlobsP.push(new Promise((resolve, reject) => {
571
573
  stopBlobAttachingSignal?.addEventListener("abort", () => {
@@ -574,7 +576,7 @@ export class BlobManager extends TypedEventEmitter {
574
576
  }, { once: true });
575
577
  const onBlobAttached = (attachedEntry) => {
576
578
  if (attachedEntry === entry) {
577
- this.off("blobAttached", onBlobAttached);
579
+ this.internalEvents.off("blobAttached", onBlobAttached);
578
580
  resolve();
579
581
  }
580
582
  };
@@ -582,27 +584,25 @@ export class BlobManager extends TypedEventEmitter {
582
584
  resolve();
583
585
  }
584
586
  else {
585
- this.on("blobAttached", onBlobAttached);
587
+ this.internalEvents.on("blobAttached", onBlobAttached);
586
588
  }
587
589
  }));
588
590
  }
589
591
  }
590
592
  // Wait for all blobs to be attached. This is important, otherwise serialized container
591
593
  // could send the blobAttach op without any op that references the blob, making it useless.
592
- await Promise.allSettled(attachBlobsP).catch(() => {
593
- return undefined;
594
- });
594
+ await Promise.allSettled(attachBlobsP);
595
595
  }
596
- for (const [id, entry] of this.pendingBlobs) {
596
+ for (const [localId, entry] of this.pendingBlobs) {
597
597
  if (stopBlobAttachingSignal?.aborted && !entry.attached) {
598
598
  this.mc.logger.sendTelemetryEvent({
599
599
  eventName: "UnableToStashBlob",
600
- id,
600
+ id: localId,
601
601
  });
602
602
  continue;
603
603
  }
604
604
  assert(entry.attached === true, 0x790 /* stashed blob should be attached */);
605
- blobs[id] = {
605
+ blobs[localId] = {
606
606
  blob: bufferToString(entry.blob, "base64"),
607
607
  storageId: entry.storageId,
608
608
  acked: entry.acked,
@@ -632,5 +632,5 @@ const getBlobIdFromGCNodePath = (nodePath) => {
632
632
  * Returns whether a given path is for attachment blobs that are in the format - "/blobManagerBasePath/...".
633
633
  */
634
634
  export const isBlobPath = (path) => areBlobPathParts(path.split("/"));
635
- export const areBlobPathParts = (pathParts) => pathParts.length === 3 && pathParts[1] === blobManagerBasePath;
635
+ const areBlobPathParts = (pathParts) => pathParts.length === 3 && pathParts[1] === blobManagerBasePath;
636
636
  //# sourceMappingURL=blobManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"blobManager.js","sourceRoot":"","sources":["../../src/blobManager/blobManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,cAAc,GACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AASpE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAKpF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAOtF,OAAO,EACN,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,GACnB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,YAAY,EAEZ,gBAAgB,EAChB,4BAA4B,EAC5B,SAAS,GACT,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAIlC,OAAO,EACN,aAAa,EACb,yBAAyB,EACzB,eAAe,GAGf,MAAM,yBAAyB,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,OAAO,UAAW,SAAQ,eAAgC;IAG/D,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC;IACtD,CAAC;IAID,YACiB,IAAY,EACZ,YAAiC,EAC1C,GAAmC,EACzB,aAA0B;QAE3C,KAAK,EAAE,CAAC;QALQ,SAAI,GA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CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1D,CAAC,CACD,CAAC;IACH,CAAC;CACD;AAED;;;;GAIG;AACH,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAU,EAAE,CAC1D,IAAI,mBAAmB,IAAI,MAAM,EAAE,CAAC;AAErC;;GAEG;AACH,MAAM,uBAAuB,GAAG,CAAC,QAAgB,EAAU,EAAE;IAC5D,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACxE,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAsD,EAAE,CAC9F,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAEnC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC/B,SAAmB,EACqC,EAAE,CAC1D,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,mBAAmB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tTypedEventEmitter,\n\tbufferToString,\n\tstringToBuffer,\n} from \"@fluid-internal/client-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\tIContainerRuntime,\n\tIContainerRuntimeEvents,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport {\n\tIFluidHandleContext,\n\ttype IFluidHandleInternal,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { assert, Deferred, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDocumentStorageService,\n\tICreateBlobResponse,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { canRetryOnError, runWithRetry } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\ttype ISequencedMessageEnvelope,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tFluidHandleBase,\n\tcreateResponseError,\n\tgenerateHandleContextPath,\n\tresponseToException,\n} from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tLoggingError,\n\tMonitoringContext,\n\tPerformanceEvent,\n\tcreateChildMonitoringContext,\n\twrapError,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { IBlobMetadata } from \"../metadata.js\";\n\nimport {\n\tgetStorageIds,\n\tsummarizeBlobManagerState,\n\ttoRedirectTable,\n\t// eslint-disable-next-line import/no-deprecated\n\ttype IBlobManagerLoadInfo,\n} from \"./blobManagerSnapSum.js\";\n\n/**\n * This class represents blob (long string)\n * This object is used only when creating (writing) new blob and serialization purposes.\n * De-serialization process goes through FluidObjectHandle and request flow:\n * DataObject.request() recognizes requests in the form of `/blobs/<id>`\n * and loads blob.\n */\nexport class BlobHandle extends FluidHandleBase<ArrayBufferLike> {\n\tprivate attached: boolean = false;\n\n\tpublic get isAttached(): boolean {\n\t\treturn this.routeContext.isAttached && this.attached;\n\t}\n\n\tpublic readonly absolutePath: string;\n\n\tconstructor(\n\t\tpublic readonly path: string,\n\t\tpublic readonly routeContext: IFluidHandleContext,\n\t\tpublic get: () => Promise<ArrayBufferLike>,\n\t\tprivate readonly onAttachGraph?: () => void,\n\t) {\n\t\tsuper();\n\t\tthis.absolutePath = generateHandleContextPath(path, this.routeContext);\n\t}\n\n\tpublic attachGraph(): void {\n\t\tif (!this.attached) {\n\t\t\tthis.attached = true;\n\t\t\tthis.onAttachGraph?.();\n\t\t}\n\t}\n\n\tpublic bind(handle: IFluidHandleInternal): void {\n\t\tthrow new Error(\"Cannot bind to blob handle\");\n\t}\n}\n\n// Restrict the IContainerRuntime interface to the subset required by BlobManager. This helps to make\n// the contract explicit and reduces the amount of mocking required for tests.\nexport type IBlobManagerRuntime = Pick<\n\tIContainerRuntime,\n\t\"attachState\" | \"connected\" | \"baseLogger\" | \"clientDetails\" | \"disposed\"\n> &\n\tTypedEventEmitter<IContainerRuntimeEvents>;\n\ntype ICreateBlobResponseWithTTL = ICreateBlobResponse &\n\tPartial<Record<\"minTTLInSeconds\", number>>;\n\ninterface PendingBlob {\n\tblob: ArrayBufferLike;\n\topsent?: boolean;\n\tstorageId?: string;\n\thandleP: Deferred<BlobHandle>;\n\tuploadP?: Promise<ICreateBlobResponse | void>;\n\tuploadTime?: number;\n\tminTTLInSeconds?: number;\n\tattached?: boolean;\n\tacked?: boolean;\n\tabortSignal?: AbortSignal;\n\tstashedUpload?: boolean;\n}\n\nexport interface IPendingBlobs {\n\t[id: string]: {\n\t\tblob: string;\n\t\tstorageId?: string;\n\t\tuploadTime?: number;\n\t\tminTTLInSeconds?: number;\n\t\tacked?: boolean;\n\t};\n}\n\nexport interface IBlobManagerEvents {\n\t(event: \"noPendingBlobs\", listener: () => void);\n}\n\nconst stashedPendingBlobOverrides: Pick<\n\tPendingBlob,\n\t\"stashedUpload\" | \"storageId\" | \"minTTLInSeconds\" | \"uploadTime\"\n> = {\n\tstashedUpload: true,\n\tstorageId: undefined,\n\tminTTLInSeconds: undefined,\n\tuploadTime: undefined,\n} as const;\n\nexport const blobManagerBasePath = \"_blobs\" as const;\n\nexport class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {\n\tprivate readonly mc: MonitoringContext;\n\n\t/**\n\t * Map of local IDs to storage IDs. Contains identity entries (id → id) for storage IDs. All requested IDs should\n\t * be a key in this map. Blobs created while the container is detached are stored in IDetachedBlobStorage which\n\t * gives local IDs; the storage IDs are filled in at attach time.\n\t * Note: It contains mappings from all clients, i.e., from remote clients as well. local ID comes from the client\n\t * that uploaded the blob but its mapping to storage ID is needed in all clients in order to retrieve the blob.\n\t */\n\tprivate readonly redirectTable: Map<string, string | undefined>;\n\n\t/**\n\t * Blobs which we have not yet seen a BlobAttach op round-trip and not yet attached to a DDS.\n\t */\n\tprivate readonly pendingBlobs: Map<string, PendingBlob> = new Map();\n\n\t/**\n\t * Track ops in flight for online flow. This is used for optimizations where if we receive an ack for a storage ID,\n\t * we can resolve all pending blobs with the same storage ID even though they may have different local IDs. That's\n\t * because we know that the server will not delete the blob corresponding to that storage ID.\n\t */\n\tprivate readonly opsInFlight: Map<string, string[]> = new Map();\n\n\tprivate readonly sendBlobAttachOp: (localId: string, storageId?: string) => void;\n\tprivate stopAttaching: boolean = false;\n\n\tprivate readonly routeContext: IFluidHandleContext;\n\tprivate readonly getStorage: () => IDocumentStorageService;\n\t// Called when a blob node is requested. blobPath is the path of the blob's node in GC's graph.\n\t// blobPath's format - `/<basePath>/<blobId>`.\n\tprivate readonly blobRequested: (blobPath: string) => void;\n\t// Called to check if a blob has been deleted by GC.\n\t// blobPath's format - `/<basePath>/<blobId>`.\n\tprivate readonly isBlobDeleted: (blobPath: string) => boolean;\n\tprivate readonly runtime: IBlobManagerRuntime;\n\tprivate readonly localBlobIdGenerator: () => string;\n\tprivate readonly pendingStashedBlobs: Map<string, Promise<ICreateBlobResponse | void>> =\n\t\tnew Map();\n\tpublic readonly stashedBlobsUploadP: Promise<(void | ICreateBlobResponse)[]>;\n\n\tconstructor(props: {\n\t\treadonly routeContext: IFluidHandleContext;\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tsnapshot: IBlobManagerLoadInfo;\n\t\treadonly getStorage: () => IDocumentStorageService;\n\t\t/**\n\t\t * Submit a BlobAttach op. When a blob is uploaded, there is a short grace period before which the blob is\n\t\t * deleted. The BlobAttach op notifies the server that blob is in use. The server will then not delete the\n\t\t * the blob as long as it is listed as referenced in future summaries. The summarizing client will know to\n\t\t * include the storage ID in the summary when it sees the op.\n\t\t *\n\t\t * The op will also include a local ID to inform all clients of the relation to the storage ID, without\n\t\t * knowledge of which they cannot request the blob from storage. It's important that this op is sequenced\n\t\t * before any ops that reference the local ID, otherwise, an invalid handle could be added to the document.\n\t\t */\n\t\tsendBlobAttachOp: (localId: string, storageId?: string) => void;\n\t\t// Called when a blob node is requested. blobPath is the path of the blob's node in GC's graph.\n\t\t// blobPath's format - `/<basePath>/<blobId>`.\n\t\treadonly blobRequested: (blobPath: string) => void;\n\t\t// Called to check if a blob has been deleted by GC.\n\t\t// blobPath's format - `/<basePath>/<blobId>`.\n\t\treadonly isBlobDeleted: (blobPath: string) => boolean;\n\t\treadonly runtime: IBlobManagerRuntime;\n\t\tstashedBlobs: IPendingBlobs | undefined;\n\t\treadonly localBlobIdGenerator?: (() => string) | undefined;\n\t}) {\n\t\tsuper();\n\t\tconst {\n\t\t\trouteContext,\n\t\t\tsnapshot,\n\t\t\tgetStorage,\n\t\t\tsendBlobAttachOp,\n\t\t\tblobRequested,\n\t\t\tisBlobDeleted,\n\t\t\truntime,\n\t\t\tstashedBlobs,\n\t\t\tlocalBlobIdGenerator,\n\t\t} = props;\n\t\tthis.routeContext = routeContext;\n\t\tthis.getStorage = getStorage;\n\t\tthis.blobRequested = blobRequested;\n\t\tthis.isBlobDeleted = isBlobDeleted;\n\t\tthis.runtime = runtime;\n\t\tthis.localBlobIdGenerator = localBlobIdGenerator ?? uuid;\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.runtime.baseLogger,\n\t\t\tnamespace: \"BlobManager\",\n\t\t});\n\n\t\tthis.redirectTable = toRedirectTable(snapshot, this.mc.logger, this.runtime.attachState);\n\n\t\t// Begin uploading stashed blobs from previous container instance\n\t\tfor (const [localId, entry] of Object.entries(stashedBlobs ?? {})) {\n\t\t\tconst { acked, storageId, minTTLInSeconds, uploadTime } = entry;\n\t\t\tconst blob = stringToBuffer(entry.blob, \"base64\");\n\t\t\tconst pendingEntry: PendingBlob = {\n\t\t\t\tblob,\n\t\t\t\topsent: true,\n\t\t\t\thandleP: new Deferred(),\n\t\t\t\tstorageId,\n\t\t\t\tuploadP: undefined,\n\t\t\t\tuploadTime,\n\t\t\t\tminTTLInSeconds,\n\t\t\t\tattached: true,\n\t\t\t\tacked,\n\t\t\t};\n\t\t\tthis.pendingBlobs.set(localId, pendingEntry);\n\n\t\t\tif (storageId !== undefined && minTTLInSeconds && uploadTime) {\n\t\t\t\tconst timeLapseSinceLocalUpload = (Date.now() - uploadTime) / 1000;\n\t\t\t\t// stashed entries with more than half-life in storage will not be reuploaded\n\t\t\t\tif (minTTLInSeconds - timeLapseSinceLocalUpload > minTTLInSeconds / 2) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.pendingStashedBlobs.set(localId, this.uploadBlob(localId, blob));\n\t\t\tthis.pendingBlobs.set(localId, {\n\t\t\t\t...pendingEntry,\n\t\t\t\t...stashedPendingBlobOverrides,\n\t\t\t\tuploadP: this.pendingStashedBlobs.get(localId),\n\t\t\t});\n\t\t}\n\n\t\tthis.stashedBlobsUploadP = new LazyPromise(async () =>\n\t\t\tPerformanceEvent.timedExecAsync(\n\t\t\t\tthis.mc.logger,\n\t\t\t\t{ eventName: \"BlobUploadProcessStashedChanges\", count: this.pendingStashedBlobs.size },\n\t\t\t\tasync () => Promise.all(this.pendingStashedBlobs.values()),\n\t\t\t\t{ start: true, end: true },\n\t\t\t),\n\t\t).finally(() => {\n\t\t\tthis.pendingStashedBlobs.clear();\n\t\t});\n\n\t\tthis.sendBlobAttachOp = (localId: string, blobId?: string) => {\n\t\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\t\t\tassert(\n\t\t\t\tpendingEntry !== undefined,\n\t\t\t\t0x725 /* Must have pending blob entry for upcoming op */,\n\t\t\t);\n\t\t\tif (pendingEntry?.uploadTime && pendingEntry?.minTTLInSeconds) {\n\t\t\t\tconst secondsSinceUpload = (Date.now() - pendingEntry.uploadTime) / 1000;\n\t\t\t\tconst expired = pendingEntry.minTTLInSeconds - secondsSinceUpload < 0;\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"sendBlobAttach\",\n\t\t\t\t\tsecondsSinceUpload,\n\t\t\t\t\tminTTLInSeconds: pendingEntry.minTTLInSeconds,\n\t\t\t\t\texpired,\n\t\t\t\t});\n\t\t\t\tif (expired) {\n\t\t\t\t\t// reupload blob and reset previous fields\n\t\t\t\t\tthis.pendingBlobs.set(localId, {\n\t\t\t\t\t\t...pendingEntry,\n\t\t\t\t\t\tstorageId: undefined,\n\t\t\t\t\t\tuploadTime: undefined,\n\t\t\t\t\t\tminTTLInSeconds: undefined,\n\t\t\t\t\t\topsent: false,\n\t\t\t\t\t\tuploadP: this.uploadBlob(localId, pendingEntry.blob),\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tpendingEntry.opsent = true;\n\t\t\treturn sendBlobAttachOp(localId, blobId);\n\t\t};\n\t}\n\n\tpublic get allBlobsAttached(): boolean {\n\t\tfor (const [, entry] of this.pendingBlobs) {\n\t\t\tif (entry.attached === false) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic get hasPendingBlobs(): boolean {\n\t\treturn (\n\t\t\t(this.runtime.attachState !== AttachState.Attached && this.redirectTable.size > 0) ||\n\t\t\tthis.pendingBlobs.size > 0\n\t\t);\n\t}\n\n\tprivate createAbortError(pending?: PendingBlob): LoggingError {\n\t\treturn new LoggingError(\"uploadBlob aborted\", {\n\t\t\tacked: pending?.acked,\n\t\t\tuploadTime: pending?.uploadTime,\n\t\t});\n\t}\n\n\tpublic hasPendingStashedUploads(): boolean {\n\t\treturn [...this.pendingBlobs.values()].some((e) => e.stashedUpload === true);\n\t}\n\n\tpublic async getBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\t// Verify that the blob is not deleted, i.e., it has not been garbage collected. If it is, this will throw\n\t\t// an error, failing the call.\n\t\tthis.verifyBlobNotDeleted(blobId);\n\t\t// Let runtime know that the corresponding GC node was requested.\n\t\t// Note that this will throw if the blob is inactive or tombstoned and throwing on incorrect usage\n\t\t// is configured.\n\t\tthis.blobRequested(getGCNodePathFromBlobId(blobId));\n\n\t\tconst pending = this.pendingBlobs.get(blobId);\n\t\tif (pending) {\n\t\t\treturn pending.blob;\n\t\t}\n\n\t\tlet storageId: string;\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\tassert(this.redirectTable.has(blobId), 0x383 /* requesting unknown blobs */);\n\n\t\t\t// Blobs created while the container is detached are stored in IDetachedBlobStorage.\n\t\t\t// The 'IDocumentStorageService.readBlob()' call below will retrieve these via localId.\n\t\t\tstorageId = blobId;\n\t\t} else {\n\t\t\tconst attachedStorageId = this.redirectTable.get(blobId);\n\t\t\tassert(!!attachedStorageId, 0x11f /* \"requesting unknown blobs\" */);\n\t\t\tstorageId = attachedStorageId;\n\t\t}\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{ eventName: \"AttachmentReadBlob\", id: storageId },\n\t\t\tasync (event) => {\n\t\t\t\treturn this.getStorage()\n\t\t\t\t\t.readBlob(storageId)\n\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\tif (this.runtime.disposed) {\n\t\t\t\t\t\t\t// If the runtime is disposed, this is not an error we care to track, it's expected behavior.\n\t\t\t\t\t\t\tevent.cancel({ category: \"generic\" });\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t});\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t}\n\n\tprivate getBlobHandle(id: string): BlobHandle {\n\t\tassert(\n\t\t\tthis.redirectTable.has(id) || this.pendingBlobs.has(id),\n\t\t\t0x384 /* requesting handle for unknown blob */,\n\t\t);\n\t\tconst pending = this.pendingBlobs.get(id);\n\t\t// Create a callback function for once the blob has been attached\n\t\tconst callback = pending\n\t\t\t? () => {\n\t\t\t\t\tpending.attached = true;\n\t\t\t\t\t// Notify listeners (e.g. serialization process) that blob has been attached\n\t\t\t\t\tthis.emit(\"blobAttached\", pending);\n\t\t\t\t\tthis.deletePendingBlobMaybe(id);\n\t\t\t\t}\n\t\t\t: undefined;\n\t\treturn new BlobHandle(\n\t\t\tgetGCNodePathFromBlobId(id),\n\t\t\tthis.routeContext,\n\t\t\tasync () => this.getBlob(id),\n\t\t\tcallback,\n\t\t);\n\t}\n\n\tprivate async createBlobDetached(\n\t\tblob: ArrayBufferLike,\n\t): Promise<IFluidHandleInternal<ArrayBufferLike>> {\n\t\t// Blobs created while the container is detached are stored in IDetachedBlobStorage.\n\t\t// The 'IDocumentStorageService.createBlob()' call below will respond with a localId.\n\t\tconst response = await this.getStorage().createBlob(blob);\n\t\tthis.setRedirection(response.id, undefined);\n\t\treturn this.getBlobHandle(response.id);\n\t}\n\n\tpublic async createBlob(\n\t\tblob: ArrayBufferLike,\n\t\tsignal?: AbortSignal,\n\t): Promise<IFluidHandleInternal<ArrayBufferLike>> {\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\treturn this.createBlobDetached(blob);\n\t\t}\n\t\tif (this.runtime.attachState === AttachState.Attaching) {\n\t\t\t// blob upload is not supported in \"Attaching\" state\n\t\t\tthis.mc.logger.sendTelemetryEvent({ eventName: \"CreateBlobWhileAttaching\" });\n\t\t\tawait new Promise<void>((resolve) => this.runtime.once(\"attached\", resolve));\n\t\t}\n\t\tassert(\n\t\t\tthis.runtime.attachState === AttachState.Attached,\n\t\t\t0x385 /* For clarity and paranoid defense against adding future attachment states */,\n\t\t);\n\n\t\tif (signal?.aborted) {\n\t\t\tthrow this.createAbortError();\n\t\t}\n\n\t\t// Create a local ID for the blob. After uploading it to storage and before returning it, a local ID to\n\t\t// storage ID mapping is created.\n\t\tconst localId = this.localBlobIdGenerator();\n\t\tconst pendingEntry: PendingBlob = {\n\t\t\tblob,\n\t\t\thandleP: new Deferred(),\n\t\t\tuploadP: this.uploadBlob(localId, blob),\n\t\t\tattached: false,\n\t\t\tacked: false,\n\t\t\tabortSignal: signal,\n\t\t\topsent: false,\n\t\t};\n\t\tthis.pendingBlobs.set(localId, pendingEntry);\n\n\t\tconst abortListener = (): void => {\n\t\t\tif (!pendingEntry.acked) {\n\t\t\t\tpendingEntry.handleP.reject(this.createAbortError(pendingEntry));\n\t\t\t}\n\t\t};\n\t\tsignal?.addEventListener(\"abort\", abortListener, { once: true });\n\n\t\treturn pendingEntry.handleP.promise.finally(() => {\n\t\t\tsignal?.removeEventListener(\"abort\", abortListener);\n\t\t});\n\t}\n\n\tprivate async uploadBlob(\n\t\tlocalId: string,\n\t\tblob: ArrayBufferLike,\n\t): Promise<ICreateBlobResponse | void> {\n\t\treturn runWithRetry(\n\t\t\tasync () => {\n\t\t\t\ttry {\n\t\t\t\t\treturn await this.getStorage().createBlob(blob);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst entry = this.pendingBlobs.get(localId);\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!entry,\n\t\t\t\t\t\t0x387 /* Must have pending blob entry for blob which failed to upload */,\n\t\t\t\t\t);\n\t\t\t\t\tif (entry.opsent && !canRetryOnError(error)) {\n\t\t\t\t\t\tthrow wrapError(\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t() => new LoggingError(`uploadBlob error`, { canRetry: true }),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"createBlob\",\n\t\t\tthis.mc.logger,\n\t\t\t{\n\t\t\t\tcancel: this.pendingBlobs.get(localId)?.abortSignal,\n\t\t\t},\n\t\t).then(\n\t\t\t(response) => this.onUploadResolve(localId, response),\n\t\t\t(error) => {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"UploadBlobReject\",\n\t\t\t\t\t// TODO: better typing\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\terror,\n\t\t\t\t\tlocalId,\n\t\t\t\t});\n\t\t\t\t// it will only reject if we haven't sent an op\n\t\t\t\t// and is a non-retriable error. It will only reject\n\t\t\t\t// the promise but not throw any error outside.\n\t\t\t\tthis.pendingBlobs.get(localId)?.handleP.reject(error);\n\t\t\t\tthis.deletePendingBlob(localId);\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Set up a mapping in the redirect table from fromId to toId. Also, notify the runtime that a reference is added\n\t * which is required for GC.\n\t */\n\tprivate setRedirection(fromId: string, toId: string | undefined): void {\n\t\tthis.redirectTable.set(fromId, toId);\n\t}\n\n\tprivate deletePendingBlobMaybe(id: string): void {\n\t\tif (this.pendingBlobs.has(id)) {\n\t\t\tconst entry = this.pendingBlobs.get(id);\n\t\t\tif (entry?.attached && entry?.acked) {\n\t\t\t\tthis.deletePendingBlob(id);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate deletePendingBlob(id: string): void {\n\t\tif (this.pendingBlobs.delete(id) && !this.hasPendingBlobs) {\n\t\t\tthis.emit(\"noPendingBlobs\");\n\t\t}\n\t}\n\n\tprivate onUploadResolve(\n\t\tlocalId: string,\n\t\tresponse: ICreateBlobResponseWithTTL,\n\t): ICreateBlobResponseWithTTL | undefined {\n\t\tconst entry = this.pendingBlobs.get(localId);\n\t\tif (entry === undefined && this.pendingStashedBlobs.has(localId)) {\n\t\t\t// The blob was already processed and deleted. This can happen if the blob was reuploaded by\n\t\t\t// the stashing process and the original upload was processed before the stashed upload.\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"StashedBlobAlreadyProcessed\",\n\t\t\t\tlocalId,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tassert(entry !== undefined, 0x6c8 /* pending blob entry not found for uploaded blob */);\n\t\tif ((entry.abortSignal?.aborted === true && !entry.opsent) || this.stopAttaching) {\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"BlobAborted\",\n\t\t\t\tlocalId,\n\t\t\t});\n\t\t\tthis.deletePendingBlob(localId);\n\t\t\treturn;\n\t\t}\n\t\tassert(\n\t\t\tentry.storageId === undefined,\n\t\t\t0x386 /* Must have pending blob entry for uploaded blob */,\n\t\t);\n\t\tentry.stashedUpload = undefined;\n\t\tentry.storageId = response.id;\n\t\tentry.uploadTime = Date.now();\n\t\tentry.minTTLInSeconds = response.minTTLInSeconds;\n\t\t// Send a blob attach op. This serves two purposes:\n\t\t// 1. If its a new blob, i.e., it isn't de-duped, the server will keep the blob alive if it sees this op\n\t\t// until its storage ID is added to the next summary.\n\t\t// 2. It will create a local ID to storage ID mapping in all clients which is needed to retrieve the\n\t\t// blob from the server via the storage ID.\n\t\tif (!entry.opsent) {\n\t\t\tthis.sendBlobAttachOp(localId, response.id);\n\t\t}\n\t\tconst storageIds = getStorageIds(this.redirectTable, this.runtime.attachState);\n\t\tif (storageIds.has(response.id)) {\n\t\t\t// The blob is de-duped. Set up a local ID to storage ID mapping and return the blob. Since this is\n\t\t\t// an existing blob, we don't have to wait for the op to be ack'd since this step has already\n\t\t\t// happened before and so, the server won't delete it.\n\t\t\tthis.setRedirection(localId, response.id);\n\t\t\tentry.handleP.resolve(this.getBlobHandle(localId));\n\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t} else {\n\t\t\t// If there is already an op for this storage ID, append the local ID to the list. Once any op for\n\t\t\t// this storage ID is ack'd, all pending blobs for it can be resolved since the op will keep the\n\t\t\t// blob alive in storage.\n\t\t\tthis.opsInFlight.set(response.id, [\n\t\t\t\t...(this.opsInFlight.get(response.id) ?? []),\n\t\t\t\tlocalId,\n\t\t\t]);\n\t\t}\n\t\treturn response;\n\t}\n\n\t/**\n\t * Resubmit a BlobAttach op. Used to add storage IDs to ops that were\n\t * submitted to runtime while disconnected.\n\t * @param metadata - op metadata containing storage and/or local IDs\n\t */\n\tpublic reSubmit(metadata: Record<string, unknown> | undefined): void {\n\t\tassert(!!metadata, 0x38b /* Resubmitted ops must have metadata */);\n\t\tconst { localId, blobId }: { localId?: string; blobId?: string } = metadata;\n\t\tassert(localId !== undefined, 0x50d /* local ID not available on reSubmit */);\n\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\n\t\tif (!blobId) {\n\t\t\t// We submitted this op while offline. The blob should have been uploaded by now.\n\t\t\tassert(\n\t\t\t\tpendingEntry?.opsent === true && !!pendingEntry?.storageId,\n\t\t\t\t0x38d /* blob must be uploaded before resubmitting BlobAttach op */,\n\t\t\t);\n\t\t\treturn this.sendBlobAttachOp(localId, pendingEntry?.storageId);\n\t\t}\n\t\treturn this.sendBlobAttachOp(localId, blobId);\n\t}\n\n\tpublic processBlobAttachMessage(message: ISequencedMessageEnvelope, local: boolean): void {\n\t\tconst localId = (message.metadata as IBlobMetadata | undefined)?.localId;\n\t\tconst blobId = (message.metadata as IBlobMetadata | undefined)?.blobId;\n\n\t\tif (localId) {\n\t\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\t\t\tif (pendingEntry?.abortSignal?.aborted) {\n\t\t\t\tthis.deletePendingBlob(localId);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tassert(blobId !== undefined, 0x12a /* \"Missing blob id on metadata\" */);\n\n\t\t// Set up a mapping from local ID to storage ID. This is crucial since without this the blob cannot be\n\t\t// requested from the server.\n\t\t// Note: The check for undefined is needed for back-compat when localId was not part of the BlobAttach op that\n\t\t// was sent when online.\n\t\tif (localId !== undefined) {\n\t\t\tthis.setRedirection(localId, blobId);\n\t\t}\n\t\t// set identity (id -> id) entry\n\t\tthis.setRedirection(blobId, blobId);\n\n\t\tif (local) {\n\t\t\tassert(localId !== undefined, 0x50e /* local ID not present in blob attach message */);\n\t\t\tconst waitingBlobs = this.opsInFlight.get(blobId);\n\t\t\tif (waitingBlobs !== undefined) {\n\t\t\t\t// For each op corresponding to this storage ID that we are waiting for, resolve the pending blob.\n\t\t\t\t// This is safe because the server will keep the blob alive and the op containing the local ID to\n\t\t\t\t// storage ID is already in flight and any op containing this local ID will be sequenced after that.\n\t\t\t\tfor (const pendingLocalId of waitingBlobs) {\n\t\t\t\t\tconst entry = this.pendingBlobs.get(pendingLocalId);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tentry !== undefined,\n\t\t\t\t\t\t0x38f /* local online BlobAttach op with no pending blob entry */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.setRedirection(pendingLocalId, blobId);\n\t\t\t\t\tentry.acked = true;\n\t\t\t\t\tentry.handleP.resolve(this.getBlobHandle(pendingLocalId));\n\t\t\t\t\tthis.deletePendingBlobMaybe(pendingLocalId);\n\t\t\t\t}\n\t\t\t\tthis.opsInFlight.delete(blobId);\n\t\t\t}\n\t\t\tconst localEntry = this.pendingBlobs.get(localId);\n\t\t\tif (localEntry) {\n\t\t\t\tlocalEntry.acked = true;\n\t\t\t\tlocalEntry.handleP.resolve(this.getBlobHandle(localId));\n\t\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic summarize(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\treturn summarizeBlobManagerState(this.redirectTable, this.runtime.attachState);\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. Each blob uploaded represents a node in the GC graph as it can be\n\t * individually referenced by storing its handle in a referenced DDS. Returns the list of blob ids as GC nodes.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data. BlobManager doesn't care\n\t * about this for now because the data is a simple list of blob ids.\n\t */\n\tpublic getGCData(fullGC: boolean = false): IGarbageCollectionData {\n\t\tconst gcData: IGarbageCollectionData = { gcNodes: {} };\n\t\tfor (const [localId, storageId] of this.redirectTable) {\n\t\t\tassert(!!storageId, 0x390 /* Must be attached to get GC data */);\n\t\t\t// Only return local ids as GC nodes because a blob can only be referenced via its local id. The storage\n\t\t\t// id entries have the same key and value, ignore them.\n\t\t\t// The outbound routes are empty because a blob node cannot reference other nodes. It can only be referenced\n\t\t\t// by adding its handle to a referenced DDS.\n\t\t\tif (localId !== storageId) {\n\t\t\t\tgcData.gcNodes[getGCNodePathFromBlobId(localId)] = [];\n\t\t\t}\n\t\t}\n\t\treturn gcData;\n\t}\n\n\t/**\n\t * Delete attachment blobs that are sweep ready.\n\t * @param sweepReadyBlobRoutes - The routes of blobs that are sweep ready and should be deleted. These routes will\n\t * be based off of local ids.\n\t * @returns The routes of blobs that were deleted.\n\t */\n\tpublic deleteSweepReadyNodes(sweepReadyBlobRoutes: readonly string[]): readonly string[] {\n\t\tthis.deleteBlobsFromRedirectTable(sweepReadyBlobRoutes);\n\t\treturn [...sweepReadyBlobRoutes];\n\t}\n\n\t/**\n\t * Delete blobs with the given routes from the redirect table.\n\t *\n\t * @remarks\n\t * The routes are GC nodes paths of format -`/<blobManagerBasePath>/<blobId>`. The blob ids are all local ids.\n\t * Deleting the blobs involves 2 steps:\n\t *\n\t * 1. The redirect table entry for the local ids are deleted.\n\t *\n\t * 2. If the storage ids corresponding to the deleted local ids are not in-use anymore, the redirect table entries\n\t * for the storage ids are deleted as well.\n\t *\n\t * Note that this does not delete the blobs from storage service immediately. Deleting the blobs from redirect table\n\t * will remove them the next summary. The service would them delete them some time in the future.\n\t */\n\tprivate deleteBlobsFromRedirectTable(blobRoutes: readonly string[]): void {\n\t\tif (blobRoutes.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// This tracks the storage ids of local ids that are deleted. After the local ids have been deleted, if any of\n\t\t// these storage ids are unused, they will be deleted as well.\n\t\tconst maybeUnusedStorageIds: Set<string> = new Set();\n\t\tfor (const route of blobRoutes) {\n\t\t\tconst blobId = getBlobIdFromGCNodePath(route);\n\t\t\t// If the blob hasn't already been deleted, log an error because this should never happen.\n\t\t\t// If the blob has already been deleted, log a telemetry event. This can happen because multiple GC\n\t\t\t// sweep ops can contain the same data store. It would be interesting to track how often this happens.\n\t\t\tconst alreadyDeleted = this.isBlobDeleted(route);\n\t\t\tif (!this.redirectTable.has(blobId)) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"DeletedAttachmentBlobNotFound\",\n\t\t\t\t\tcategory: alreadyDeleted ? \"generic\" : \"error\",\n\t\t\t\t\tblobId,\n\t\t\t\t\tdetails: { alreadyDeleted },\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst storageId = this.redirectTable.get(blobId);\n\t\t\tassert(!!storageId, 0x5bb /* Must be attached to run GC */);\n\t\t\tmaybeUnusedStorageIds.add(storageId);\n\t\t\tthis.redirectTable.delete(blobId);\n\t\t}\n\n\t\t// Find out storage ids that are in-use and remove them from maybeUnusedStorageIds. A storage id is in-use if\n\t\t// the redirect table has a local id -> storage id entry for it.\n\t\tfor (const [localId, storageId] of this.redirectTable.entries()) {\n\t\t\tassert(!!storageId, 0x5bc /* Must be attached to run GC */);\n\t\t\t// For every storage id, the redirect table has a id -> id entry. These do not make the storage id in-use.\n\t\t\tif (maybeUnusedStorageIds.has(storageId) && localId !== storageId) {\n\t\t\t\tmaybeUnusedStorageIds.delete(storageId);\n\t\t\t}\n\t\t}\n\n\t\t// For unused storage ids, delete their id -> id entries from the redirect table.\n\t\t// This way they'll be absent from the next summary, and the service is free to delete them from storage.\n\t\tfor (const storageId of maybeUnusedStorageIds) {\n\t\t\tthis.redirectTable.delete(storageId);\n\t\t}\n\t}\n\n\t/**\n\t * Verifies that the blob with given id is not deleted, i.e., it has not been garbage collected. If the blob is GC'd,\n\t * log an error and throw if necessary.\n\t */\n\tprivate verifyBlobNotDeleted(blobId: string): void {\n\t\tif (!this.isBlobDeleted(getGCNodePathFromBlobId(blobId))) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst request = { url: blobId };\n\t\tconst error = responseToException(\n\t\t\tcreateResponseError(404, `Blob was deleted`, request),\n\t\t\trequest,\n\t\t);\n\t\t// Only log deleted events. Tombstone events are logged by garbage collector.\n\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t{\n\t\t\t\teventName: \"GC_Deleted_Blob_Requested\",\n\t\t\t\tpkg: blobManagerBasePath,\n\t\t\t},\n\t\t\terror,\n\t\t);\n\t\tthrow error;\n\t}\n\n\tpublic setRedirectTable(table: Map<string, string>): void {\n\t\tassert(\n\t\t\tthis.runtime.attachState === AttachState.Detached,\n\t\t\t0x252 /* \"redirect table can only be set in detached container\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.redirectTable.size === table.size,\n\t\t\t0x391 /* Redirect table size must match BlobManager's local ID count */,\n\t\t);\n\t\tfor (const [localId, storageId] of table) {\n\t\t\tassert(this.redirectTable.has(localId), 0x254 /* \"unrecognized id in redirect table\" */);\n\t\t\tthis.setRedirection(localId, storageId);\n\t\t\t// set identity (id -> id) entry\n\t\t\tthis.setRedirection(storageId, storageId);\n\t\t}\n\t}\n\n\t/**\n\t * Part of container serialization when imminent closure is enabled (Currently when calling closeAndGetPendingLocalState).\n\t * This asynchronous function resolves all pending createBlob calls and waits for each blob\n\t * to be attached. It will also send BlobAttach ops for each pending blob that hasn't sent it\n\t * yet so that serialized container can resubmit them when rehydrated.\n\t *\n\t * @param stopBlobAttachingSignal - Optional signal to abort the blob attaching process.\n\t * @returns - A promise that resolves with the details of the attached blobs,\n\t * or undefined if no blobs were processed.\n\t */\n\tpublic async attachAndGetPendingBlobs(\n\t\tstopBlobAttachingSignal?: AbortSignal,\n\t): Promise<IPendingBlobs | undefined> {\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{ eventName: \"GetPendingBlobs\" },\n\t\t\tasync () => {\n\t\t\t\tif (this.pendingBlobs.size === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst blobs = {};\n\t\t\t\tconst localBlobs = new Set<PendingBlob>();\n\t\t\t\t// This while is used to stash blobs created while attaching and getting blobs\n\t\t\t\twhile (localBlobs.size < this.pendingBlobs.size) {\n\t\t\t\t\tconst attachBlobsP: Promise<void>[] = [];\n\t\t\t\t\tfor (const [id, entry] of this.pendingBlobs) {\n\t\t\t\t\t\tif (!localBlobs.has(entry)) {\n\t\t\t\t\t\t\tlocalBlobs.add(entry);\n\t\t\t\t\t\t\t// In order to follow natural blob creation flow we need to:\n\t\t\t\t\t\t\t// 1 send the blob attach op\n\t\t\t\t\t\t\t// 2 resolve the blob handle\n\t\t\t\t\t\t\t// 3 wait for op referencing the blob\n\t\t\t\t\t\t\tif (!entry.opsent) {\n\t\t\t\t\t\t\t\tthis.sendBlobAttachOp(id, entry.storageId);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Resolving the blob handle to let hosts continue with their operations (it will resolve\n\t\t\t\t\t\t\t// original createBlob call) and let them attach the blob. This is a lie we told since the upload\n\t\t\t\t\t\t\t// hasn't finished yet, but it's fine since we will retry on rehydration.\n\t\t\t\t\t\t\tentry.handleP.resolve(this.getBlobHandle(id));\n\t\t\t\t\t\t\t// Array of promises that will resolve when blobs get attached.\n\t\t\t\t\t\t\tattachBlobsP.push(\n\t\t\t\t\t\t\t\tnew Promise<void>((resolve, reject) => {\n\t\t\t\t\t\t\t\t\tstopBlobAttachingSignal?.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\"abort\",\n\t\t\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\t\t\tthis.stopAttaching = true;\n\t\t\t\t\t\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t{ once: true },\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tconst onBlobAttached = (attachedEntry): void => {\n\t\t\t\t\t\t\t\t\t\tif (attachedEntry === entry) {\n\t\t\t\t\t\t\t\t\t\t\tthis.off(\"blobAttached\", onBlobAttached);\n\t\t\t\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\tif (entry.attached) {\n\t\t\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tthis.on(\"blobAttached\", onBlobAttached);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Wait for all blobs to be attached. This is important, otherwise serialized container\n\t\t\t\t\t// could send the blobAttach op without any op that references the blob, making it useless.\n\t\t\t\t\tawait Promise.allSettled(attachBlobsP).catch(() => {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tfor (const [id, entry] of this.pendingBlobs) {\n\t\t\t\t\tif (stopBlobAttachingSignal?.aborted && !entry.attached) {\n\t\t\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\t\t\teventName: \"UnableToStashBlob\",\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tassert(entry.attached === true, 0x790 /* stashed blob should be attached */);\n\t\t\t\t\tblobs[id] = {\n\t\t\t\t\t\tblob: bufferToString(entry.blob, \"base64\"),\n\t\t\t\t\t\tstorageId: entry.storageId,\n\t\t\t\t\t\tacked: entry.acked,\n\t\t\t\t\t\tminTTLInSeconds: entry.minTTLInSeconds,\n\t\t\t\t\t\tuploadTime: entry.uploadTime,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn Object.keys(blobs).length > 0 ? blobs : undefined;\n\t\t\t},\n\t\t);\n\t}\n}\n\n/**\n * For a blobId, returns its path in GC's graph. The node path is of the format `/<blobManagerBasePath>/<blobId>`.\n * This path must match the path of the blob handle returned by the createBlob API because blobs are marked\n * referenced by storing these handles in a referenced DDS.\n */\nconst getGCNodePathFromBlobId = (blobId: string): string =>\n\t`/${blobManagerBasePath}/${blobId}`;\n\n/**\n * For a given GC node path, return the blobId. The node path is of the format `/<basePath>/<blobId>`.\n */\nconst getBlobIdFromGCNodePath = (nodePath: string): string => {\n\tconst pathParts = nodePath.split(\"/\");\n\tassert(areBlobPathParts(pathParts), 0x5bd /* Invalid blob node path */);\n\treturn pathParts[2];\n};\n\n/**\n * Returns whether a given path is for attachment blobs that are in the format - \"/blobManagerBasePath/...\".\n */\nexport const isBlobPath = (path: string): path is `/${typeof blobManagerBasePath}/${string}` =>\n\tareBlobPathParts(path.split(\"/\"));\n\nexport const areBlobPathParts = (\n\tpathParts: string[],\n): pathParts is [\"\", typeof blobManagerBasePath, string] =>\n\tpathParts.length === 3 && pathParts[1] === blobManagerBasePath;\n"]}
1
+ {"version":3,"file":"blobManager.js","sourceRoot":"","sources":["../../src/blobManager/blobManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,cAAc,GACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAWpE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAKvE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAOtF,OAAO,EACN,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,GACnB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,YAAY,EAEZ,gBAAgB,EAChB,4BAA4B,EAC5B,SAAS,GACT,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAIlC,OAAO,EACN,aAAa,EACb,yBAAyB,EACzB,eAAe,GAEf,MAAM,yBAAyB,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,OAAO,UAAW,SAAQ,eAAgC;IAG/D,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC;IACtD,CAAC;IAID,YACiB,IAAY,EACZ,YAAiC,EAC1C,GAAmC,EACzB,aAA0B;QAE3C,KAAK,EAAE,CAAC;QALQ,SAAI,GAAJ,IAAI,CAAQ;QACZ,iBAAY,GAAZ,YAAY,CAAqB;QAC1C,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CAAC,CAAC,SAAS,CAAC;QAC1D,CAAC,CACD,CAAC;IACH,CAAC;CACD;AAED;;;;GAIG;AACH,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAU,EAAE,CAC1D,IAAI,mBAAmB,IAAI,MAAM,EAAE,CAAC;AAErC;;GAEG;AACH,MAAM,uBAAuB,GAAG,CAAC,QAAgB,EAAU,EAAE;IAC5D,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACxE,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAsD,EAAE,CAC9F,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAEnC,MAAM,gBAAgB,GAAG,CACxB,SAAmB,EACqC,EAAE,CAC1D,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,mBAAmB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tTypedEventEmitter,\n\tbufferToString,\n\tstringToBuffer,\n} from \"@fluid-internal/client-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\tIContainerRuntime,\n\tIContainerRuntimeEvents,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport type {\n\tIEvent,\n\tIEventProvider,\n\tIFluidHandleContext,\n\tIFluidHandleInternal,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDocumentStorageService,\n\tICreateBlobResponse,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { canRetryOnError, runWithRetry } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\ttype ISequencedMessageEnvelope,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tFluidHandleBase,\n\tcreateResponseError,\n\tgenerateHandleContextPath,\n\tresponseToException,\n} from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tLoggingError,\n\tMonitoringContext,\n\tPerformanceEvent,\n\tcreateChildMonitoringContext,\n\twrapError,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { IBlobMetadata } from \"../metadata.js\";\n\nimport {\n\tgetStorageIds,\n\tsummarizeBlobManagerState,\n\ttoRedirectTable,\n\ttype IBlobManagerLoadInfo,\n} from \"./blobManagerSnapSum.js\";\n\n/**\n * This class represents blob (long string)\n * This object is used only when creating (writing) new blob and serialization purposes.\n * De-serialization process goes through FluidObjectHandle and request flow:\n * DataObject.request() recognizes requests in the form of `/blobs/<id>`\n * and loads blob.\n */\nexport class BlobHandle extends FluidHandleBase<ArrayBufferLike> {\n\tprivate attached: boolean = false;\n\n\tpublic get isAttached(): boolean {\n\t\treturn this.routeContext.isAttached && this.attached;\n\t}\n\n\tpublic readonly absolutePath: string;\n\n\tconstructor(\n\t\tpublic readonly path: string,\n\t\tpublic readonly routeContext: IFluidHandleContext,\n\t\tpublic get: () => Promise<ArrayBufferLike>,\n\t\tprivate readonly onAttachGraph?: () => void,\n\t) {\n\t\tsuper();\n\t\tthis.absolutePath = generateHandleContextPath(path, this.routeContext);\n\t}\n\n\tpublic attachGraph(): void {\n\t\tif (!this.attached) {\n\t\t\tthis.attached = true;\n\t\t\tthis.onAttachGraph?.();\n\t\t}\n\t}\n\n\tpublic bind(handle: IFluidHandleInternal): void {\n\t\tthrow new Error(\"Cannot bind to blob handle\");\n\t}\n}\n\n// Restrict the IContainerRuntime interface to the subset required by BlobManager. This helps to make\n// the contract explicit and reduces the amount of mocking required for tests.\nexport type IBlobManagerRuntime = Pick<\n\tIContainerRuntime,\n\t\"attachState\" | \"connected\" | \"baseLogger\" | \"clientDetails\" | \"disposed\"\n> &\n\tTypedEventEmitter<IContainerRuntimeEvents>;\n\ntype ICreateBlobResponseWithTTL = ICreateBlobResponse &\n\tPartial<Record<\"minTTLInSeconds\", number>>;\n\ninterface PendingBlob {\n\tblob: ArrayBufferLike;\n\topsent?: boolean;\n\tstorageId?: string;\n\thandleP: Deferred<BlobHandle>;\n\tuploadP?: Promise<ICreateBlobResponse | void>;\n\tuploadTime?: number;\n\tminTTLInSeconds?: number;\n\tattached?: boolean;\n\tacked?: boolean;\n\tabortSignal?: AbortSignal;\n\tstashedUpload?: boolean;\n}\n\nexport interface IPendingBlobs {\n\t[localId: string]: {\n\t\tblob: string;\n\t\tstorageId?: string;\n\t\tuploadTime?: number;\n\t\tminTTLInSeconds?: number;\n\t\tacked?: boolean;\n\t};\n}\n\nexport interface IBlobManagerEvents extends IEvent {\n\t(event: \"noPendingBlobs\", listener: () => void);\n}\n\ninterface IBlobManagerInternalEvents extends IEvent {\n\t(event: \"blobAttached\", listener: (pending: PendingBlob) => void);\n}\n\nconst stashedPendingBlobOverrides: Pick<\n\tPendingBlob,\n\t\"stashedUpload\" | \"storageId\" | \"minTTLInSeconds\" | \"uploadTime\"\n> = {\n\tstashedUpload: true,\n\tstorageId: undefined,\n\tminTTLInSeconds: undefined,\n\tuploadTime: undefined,\n} as const;\n\nexport const blobManagerBasePath = \"_blobs\" as const;\n\nexport class BlobManager {\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly publicEvents = new TypedEventEmitter<IBlobManagerEvents>();\n\tpublic get events(): IEventProvider<IBlobManagerEvents> {\n\t\treturn this.publicEvents;\n\t}\n\tprivate readonly internalEvents = new TypedEventEmitter<IBlobManagerInternalEvents>();\n\n\t/**\n\t * Map of local IDs to storage IDs. Contains identity entries (storageId → storageId) for storage IDs. All requested IDs should\n\t * be a key in this map. Blobs created while the container is detached are stored in IDetachedBlobStorage which\n\t * gives local IDs; the storage IDs are filled in at attach time.\n\t * Note: It contains mappings from all clients, i.e., from remote clients as well. local ID comes from the client\n\t * that uploaded the blob but its mapping to storage ID is needed in all clients in order to retrieve the blob.\n\t */\n\tprivate readonly redirectTable: Map<string, string | undefined>;\n\n\t/**\n\t * Blobs which we have not yet seen a BlobAttach op round-trip and not yet attached to a DDS.\n\t */\n\tprivate readonly pendingBlobs: Map<string, PendingBlob> = new Map();\n\n\t/**\n\t * Track ops in flight for online flow. This is used for optimizations where if we receive an ack for a storage ID,\n\t * we can resolve all pending blobs with the same storage ID even though they may have different local IDs. That's\n\t * because we know that the server will not delete the blob corresponding to that storage ID.\n\t */\n\tprivate readonly opsInFlight: Map<string, string[]> = new Map();\n\n\tprivate readonly sendBlobAttachOp: (localId: string, storageId?: string) => void;\n\tprivate stopAttaching: boolean = false;\n\n\tprivate readonly routeContext: IFluidHandleContext;\n\tprivate readonly storage: IDocumentStorageService;\n\t// Called when a blob node is requested. blobPath is the path of the blob's node in GC's graph.\n\t// blobPath's format - `/<basePath>/<blobId>`.\n\tprivate readonly blobRequested: (blobPath: string) => void;\n\t// Called to check if a blob has been deleted by GC.\n\t// blobPath's format - `/<basePath>/<blobId>`.\n\tprivate readonly isBlobDeleted: (blobPath: string) => boolean;\n\tprivate readonly runtime: IBlobManagerRuntime;\n\tprivate readonly localBlobIdGenerator: () => string;\n\tprivate readonly pendingStashedBlobs: Map<string, Promise<ICreateBlobResponse | void>> =\n\t\tnew Map();\n\tpublic readonly stashedBlobsUploadP: Promise<(void | ICreateBlobResponse)[]>;\n\n\tconstructor(props: {\n\t\treadonly routeContext: IFluidHandleContext;\n\n\t\tblobManagerLoadInfo: IBlobManagerLoadInfo;\n\t\treadonly storage: IDocumentStorageService;\n\t\t/**\n\t\t * Submit a BlobAttach op. When a blob is uploaded, there is a short grace period before which the blob is\n\t\t * deleted. The BlobAttach op notifies the server that blob is in use. The server will then not delete the\n\t\t * the blob as long as it is listed as referenced in future summaries. The summarizing client will know to\n\t\t * include the storage ID in the summary when it sees the op.\n\t\t *\n\t\t * The op will also include a local ID to inform all clients of the relation to the storage ID, without\n\t\t * knowledge of which they cannot request the blob from storage. It's important that this op is sequenced\n\t\t * before any ops that reference the local ID, otherwise, an invalid handle could be added to the document.\n\t\t */\n\t\tsendBlobAttachOp: (localId: string, storageId?: string) => void;\n\t\t// Called when a blob node is requested. blobPath is the path of the blob's node in GC's graph.\n\t\t// blobPath's format - `/<basePath>/<blobId>`.\n\t\treadonly blobRequested: (blobPath: string) => void;\n\t\t// Called to check if a blob has been deleted by GC.\n\t\t// blobPath's format - `/<basePath>/<blobId>`.\n\t\treadonly isBlobDeleted: (blobPath: string) => boolean;\n\t\treadonly runtime: IBlobManagerRuntime;\n\t\tstashedBlobs: IPendingBlobs | undefined;\n\t\treadonly localBlobIdGenerator?: (() => string) | undefined;\n\t}) {\n\t\tconst {\n\t\t\trouteContext,\n\t\t\tblobManagerLoadInfo,\n\t\t\tstorage,\n\t\t\tsendBlobAttachOp,\n\t\t\tblobRequested,\n\t\t\tisBlobDeleted,\n\t\t\truntime,\n\t\t\tstashedBlobs,\n\t\t\tlocalBlobIdGenerator,\n\t\t} = props;\n\t\tthis.routeContext = routeContext;\n\t\tthis.storage = storage;\n\t\tthis.blobRequested = blobRequested;\n\t\tthis.isBlobDeleted = isBlobDeleted;\n\t\tthis.runtime = runtime;\n\t\tthis.localBlobIdGenerator = localBlobIdGenerator ?? uuid;\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.runtime.baseLogger,\n\t\t\tnamespace: \"BlobManager\",\n\t\t});\n\n\t\tthis.redirectTable = toRedirectTable(\n\t\t\tblobManagerLoadInfo,\n\t\t\tthis.mc.logger,\n\t\t\tthis.runtime.attachState,\n\t\t);\n\n\t\t// Begin uploading stashed blobs from previous container instance\n\t\tfor (const [localId, entry] of Object.entries(stashedBlobs ?? {})) {\n\t\t\tconst { acked, storageId, minTTLInSeconds, uploadTime } = entry;\n\t\t\tconst blob = stringToBuffer(entry.blob, \"base64\");\n\t\t\tconst pendingEntry: PendingBlob = {\n\t\t\t\tblob,\n\t\t\t\topsent: true,\n\t\t\t\thandleP: new Deferred(),\n\t\t\t\tstorageId,\n\t\t\t\tuploadP: undefined,\n\t\t\t\tuploadTime,\n\t\t\t\tminTTLInSeconds,\n\t\t\t\tattached: true,\n\t\t\t\tacked,\n\t\t\t};\n\t\t\tthis.pendingBlobs.set(localId, pendingEntry);\n\n\t\t\tif (storageId !== undefined && minTTLInSeconds && uploadTime) {\n\t\t\t\tconst timeLapseSinceLocalUpload = (Date.now() - uploadTime) / 1000;\n\t\t\t\t// stashed entries with more than half-life in storage will not be reuploaded\n\t\t\t\tif (minTTLInSeconds - timeLapseSinceLocalUpload > minTTLInSeconds / 2) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.pendingStashedBlobs.set(localId, this.uploadBlob(localId, blob));\n\t\t\tthis.pendingBlobs.set(localId, {\n\t\t\t\t...pendingEntry,\n\t\t\t\t...stashedPendingBlobOverrides,\n\t\t\t\tuploadP: this.pendingStashedBlobs.get(localId),\n\t\t\t});\n\t\t}\n\n\t\tthis.stashedBlobsUploadP = PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{ eventName: \"BlobUploadProcessStashedChanges\", count: this.pendingStashedBlobs.size },\n\t\t\tasync () => Promise.all(this.pendingStashedBlobs.values()),\n\t\t\t{ start: true, end: true },\n\t\t).finally(() => {\n\t\t\tthis.pendingStashedBlobs.clear();\n\t\t});\n\n\t\tthis.sendBlobAttachOp = (localId: string, blobId?: string) => {\n\t\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\t\t\tassert(\n\t\t\t\tpendingEntry !== undefined,\n\t\t\t\t0x725 /* Must have pending blob entry for upcoming op */,\n\t\t\t);\n\t\t\tif (pendingEntry?.uploadTime && pendingEntry?.minTTLInSeconds) {\n\t\t\t\tconst secondsSinceUpload = (Date.now() - pendingEntry.uploadTime) / 1000;\n\t\t\t\tconst expired = pendingEntry.minTTLInSeconds - secondsSinceUpload < 0;\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"sendBlobAttach\",\n\t\t\t\t\tsecondsSinceUpload,\n\t\t\t\t\tminTTLInSeconds: pendingEntry.minTTLInSeconds,\n\t\t\t\t\texpired,\n\t\t\t\t});\n\t\t\t\tif (expired) {\n\t\t\t\t\t// reupload blob and reset previous fields\n\t\t\t\t\tthis.pendingBlobs.set(localId, {\n\t\t\t\t\t\t...pendingEntry,\n\t\t\t\t\t\tstorageId: undefined,\n\t\t\t\t\t\tuploadTime: undefined,\n\t\t\t\t\t\tminTTLInSeconds: undefined,\n\t\t\t\t\t\topsent: false,\n\t\t\t\t\t\tuploadP: this.uploadBlob(localId, pendingEntry.blob),\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tpendingEntry.opsent = true;\n\t\t\tsendBlobAttachOp(localId, blobId);\n\t\t};\n\t}\n\n\tpublic get allBlobsAttached(): boolean {\n\t\tfor (const entry of this.pendingBlobs.values()) {\n\t\t\tif (entry.attached === false) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic get hasPendingBlobs(): boolean {\n\t\treturn (\n\t\t\t(this.runtime.attachState !== AttachState.Attached && this.redirectTable.size > 0) ||\n\t\t\tthis.pendingBlobs.size > 0\n\t\t);\n\t}\n\n\tprivate createAbortError(pending?: PendingBlob): LoggingError {\n\t\treturn new LoggingError(\"uploadBlob aborted\", {\n\t\t\tacked: pending?.acked,\n\t\t\tuploadTime: pending?.uploadTime,\n\t\t});\n\t}\n\n\tpublic hasPendingStashedUploads(): boolean {\n\t\treturn [...this.pendingBlobs.values()].some((e) => e.stashedUpload === true);\n\t}\n\n\tpublic async getBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\t// Verify that the blob is not deleted, i.e., it has not been garbage collected. If it is, this will throw\n\t\t// an error, failing the call.\n\t\tthis.verifyBlobNotDeleted(blobId);\n\t\t// Let runtime know that the corresponding GC node was requested.\n\t\t// Note that this will throw if the blob is inactive or tombstoned and throwing on incorrect usage\n\t\t// is configured.\n\t\tthis.blobRequested(getGCNodePathFromBlobId(blobId));\n\n\t\tconst pending = this.pendingBlobs.get(blobId);\n\t\tif (pending) {\n\t\t\treturn pending.blob;\n\t\t}\n\n\t\tlet storageId: string;\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\tassert(this.redirectTable.has(blobId), 0x383 /* requesting unknown blobs */);\n\n\t\t\t// Blobs created while the container is detached are stored in IDetachedBlobStorage.\n\t\t\t// The 'IDocumentStorageService.readBlob()' call below will retrieve these via localId.\n\t\t\tstorageId = blobId;\n\t\t} else {\n\t\t\tconst attachedStorageId = this.redirectTable.get(blobId);\n\t\t\tassert(!!attachedStorageId, 0x11f /* \"requesting unknown blobs\" */);\n\t\t\tstorageId = attachedStorageId;\n\t\t}\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{ eventName: \"AttachmentReadBlob\", id: storageId },\n\t\t\tasync (event) => {\n\t\t\t\treturn this.storage.readBlob(storageId).catch((error) => {\n\t\t\t\t\tif (this.runtime.disposed) {\n\t\t\t\t\t\t// If the runtime is disposed, this is not an error we care to track, it's expected behavior.\n\t\t\t\t\t\tevent.cancel({ category: \"generic\" });\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t}\n\n\tprivate getBlobHandle(localId: string): BlobHandle {\n\t\tassert(\n\t\t\tthis.redirectTable.has(localId) || this.pendingBlobs.has(localId),\n\t\t\t0x384 /* requesting handle for unknown blob */,\n\t\t);\n\t\tconst pending = this.pendingBlobs.get(localId);\n\t\t// Create a callback function for once the blob has been attached\n\t\tconst callback = pending\n\t\t\t? () => {\n\t\t\t\t\tpending.attached = true;\n\t\t\t\t\t// Notify listeners (e.g. serialization process) that blob has been attached\n\t\t\t\t\tthis.internalEvents.emit(\"blobAttached\", pending);\n\t\t\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t\t\t}\n\t\t\t: undefined;\n\t\treturn new BlobHandle(\n\t\t\tgetGCNodePathFromBlobId(localId),\n\t\t\tthis.routeContext,\n\t\t\tasync () => this.getBlob(localId),\n\t\t\tcallback,\n\t\t);\n\t}\n\n\tprivate async createBlobDetached(\n\t\tblob: ArrayBufferLike,\n\t): Promise<IFluidHandleInternal<ArrayBufferLike>> {\n\t\t// Blobs created while the container is detached are stored in IDetachedBlobStorage.\n\t\t// The 'IDocumentStorageService.createBlob()' call below will respond with a localId.\n\t\tconst response = await this.storage.createBlob(blob);\n\t\tthis.setRedirection(response.id, undefined);\n\t\treturn this.getBlobHandle(response.id);\n\t}\n\n\tpublic async createBlob(\n\t\tblob: ArrayBufferLike,\n\t\tsignal?: AbortSignal,\n\t): Promise<IFluidHandleInternal<ArrayBufferLike>> {\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\treturn this.createBlobDetached(blob);\n\t\t}\n\t\tif (this.runtime.attachState === AttachState.Attaching) {\n\t\t\t// blob upload is not supported in \"Attaching\" state\n\t\t\tthis.mc.logger.sendTelemetryEvent({ eventName: \"CreateBlobWhileAttaching\" });\n\t\t\tawait new Promise<void>((resolve) => this.runtime.once(\"attached\", resolve));\n\t\t}\n\t\tassert(\n\t\t\tthis.runtime.attachState === AttachState.Attached,\n\t\t\t0x385 /* For clarity and paranoid defense against adding future attachment states */,\n\t\t);\n\n\t\tif (signal?.aborted) {\n\t\t\tthrow this.createAbortError();\n\t\t}\n\n\t\t// Create a local ID for the blob. After uploading it to storage and before returning it, a local ID to\n\t\t// storage ID mapping is created.\n\t\tconst localId = this.localBlobIdGenerator();\n\t\tconst pendingEntry: PendingBlob = {\n\t\t\tblob,\n\t\t\thandleP: new Deferred(),\n\t\t\tuploadP: this.uploadBlob(localId, blob),\n\t\t\tattached: false,\n\t\t\tacked: false,\n\t\t\tabortSignal: signal,\n\t\t\topsent: false,\n\t\t};\n\t\tthis.pendingBlobs.set(localId, pendingEntry);\n\n\t\tconst abortListener = (): void => {\n\t\t\tif (!pendingEntry.acked) {\n\t\t\t\tpendingEntry.handleP.reject(this.createAbortError(pendingEntry));\n\t\t\t}\n\t\t};\n\t\tsignal?.addEventListener(\"abort\", abortListener, { once: true });\n\n\t\treturn pendingEntry.handleP.promise.finally(() => {\n\t\t\tsignal?.removeEventListener(\"abort\", abortListener);\n\t\t});\n\t}\n\n\tprivate async uploadBlob(\n\t\tlocalId: string,\n\t\tblob: ArrayBufferLike,\n\t): Promise<ICreateBlobResponse | void> {\n\t\treturn runWithRetry(\n\t\t\tasync () => {\n\t\t\t\ttry {\n\t\t\t\t\treturn await this.storage.createBlob(blob);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst entry = this.pendingBlobs.get(localId);\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!entry,\n\t\t\t\t\t\t0x387 /* Must have pending blob entry for blob which failed to upload */,\n\t\t\t\t\t);\n\t\t\t\t\tif (entry.opsent && !canRetryOnError(error)) {\n\t\t\t\t\t\tthrow wrapError(\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t() => new LoggingError(`uploadBlob error`, { canRetry: true }),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"createBlob\",\n\t\t\tthis.mc.logger,\n\t\t\t{\n\t\t\t\tcancel: this.pendingBlobs.get(localId)?.abortSignal,\n\t\t\t},\n\t\t).then(\n\t\t\t(response) => this.onUploadResolve(localId, response),\n\t\t\t(error) => {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"UploadBlobReject\",\n\t\t\t\t\t// TODO: better typing\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\terror,\n\t\t\t\t\tlocalId,\n\t\t\t\t});\n\t\t\t\t// it will only reject if we haven't sent an op\n\t\t\t\t// and is a non-retriable error. It will only reject\n\t\t\t\t// the promise but not throw any error outside.\n\t\t\t\tthis.pendingBlobs.get(localId)?.handleP.reject(error);\n\t\t\t\tthis.deletePendingBlob(localId);\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Set up a mapping in the redirect table from fromId to toId. Also, notify the runtime that a reference is added\n\t * which is required for GC.\n\t */\n\tprivate setRedirection(fromId: string, toId: string | undefined): void {\n\t\tthis.redirectTable.set(fromId, toId);\n\t}\n\n\tprivate deletePendingBlobMaybe(localId: string): void {\n\t\tif (this.pendingBlobs.has(localId)) {\n\t\t\tconst entry = this.pendingBlobs.get(localId);\n\t\t\tif (entry?.attached && entry?.acked) {\n\t\t\t\tthis.deletePendingBlob(localId);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate deletePendingBlob(id: string): void {\n\t\tif (this.pendingBlobs.delete(id) && !this.hasPendingBlobs) {\n\t\t\tthis.publicEvents.emit(\"noPendingBlobs\");\n\t\t}\n\t}\n\n\tprivate onUploadResolve(\n\t\tlocalId: string,\n\t\tresponse: ICreateBlobResponseWithTTL,\n\t): ICreateBlobResponseWithTTL | undefined {\n\t\tconst entry = this.pendingBlobs.get(localId);\n\t\tif (entry === undefined && this.pendingStashedBlobs.has(localId)) {\n\t\t\t// The blob was already processed and deleted. This can happen if the blob was reuploaded by\n\t\t\t// the stashing process and the original upload was processed before the stashed upload.\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"StashedBlobAlreadyProcessed\",\n\t\t\t\tlocalId,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tassert(entry !== undefined, 0x6c8 /* pending blob entry not found for uploaded blob */);\n\t\tif ((entry.abortSignal?.aborted === true && !entry.opsent) || this.stopAttaching) {\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"BlobAborted\",\n\t\t\t\tlocalId,\n\t\t\t});\n\t\t\tthis.deletePendingBlob(localId);\n\t\t\treturn;\n\t\t}\n\t\tassert(\n\t\t\tentry.storageId === undefined,\n\t\t\t0x386 /* Must have pending blob entry for uploaded blob */,\n\t\t);\n\t\tentry.stashedUpload = undefined;\n\t\tentry.storageId = response.id;\n\t\tentry.uploadTime = Date.now();\n\t\tentry.minTTLInSeconds = response.minTTLInSeconds;\n\t\t// Send a blob attach op. This serves two purposes:\n\t\t// 1. If its a new blob, i.e., it isn't de-duped, the server will keep the blob alive if it sees this op\n\t\t// until its storage ID is added to the next summary.\n\t\t// 2. It will create a local ID to storage ID mapping in all clients which is needed to retrieve the\n\t\t// blob from the server via the storage ID.\n\t\tif (!entry.opsent) {\n\t\t\tthis.sendBlobAttachOp(localId, response.id);\n\t\t}\n\t\tconst storageIds = getStorageIds(this.redirectTable, this.runtime.attachState);\n\t\tif (storageIds.has(response.id)) {\n\t\t\t// The blob is de-duped. Set up a local ID to storage ID mapping and return the blob. Since this is\n\t\t\t// an existing blob, we don't have to wait for the op to be ack'd since this step has already\n\t\t\t// happened before and so, the server won't delete it.\n\t\t\tthis.setRedirection(localId, response.id);\n\t\t\tentry.handleP.resolve(this.getBlobHandle(localId));\n\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t} else {\n\t\t\t// If there is already an op for this storage ID, append the local ID to the list. Once any op for\n\t\t\t// this storage ID is ack'd, all pending blobs for it can be resolved since the op will keep the\n\t\t\t// blob alive in storage.\n\t\t\tthis.opsInFlight.set(response.id, [\n\t\t\t\t...(this.opsInFlight.get(response.id) ?? []),\n\t\t\t\tlocalId,\n\t\t\t]);\n\t\t}\n\t\treturn response;\n\t}\n\n\t/**\n\t * Resubmit a BlobAttach op. Used to add storage IDs to ops that were\n\t * submitted to runtime while disconnected.\n\t * @param metadata - op metadata containing storage and/or local IDs\n\t */\n\tpublic reSubmit(metadata: Record<string, unknown> | undefined): void {\n\t\tassert(!!metadata, 0x38b /* Resubmitted ops must have metadata */);\n\t\tconst { localId, blobId }: { localId?: string; blobId?: string } = metadata;\n\t\tassert(localId !== undefined, 0x50d /* local ID not available on reSubmit */);\n\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\n\t\tif (!blobId) {\n\t\t\t// We submitted this op while offline. The blob should have been uploaded by now.\n\t\t\tassert(\n\t\t\t\tpendingEntry?.opsent === true && !!pendingEntry?.storageId,\n\t\t\t\t0x38d /* blob must be uploaded before resubmitting BlobAttach op */,\n\t\t\t);\n\t\t\treturn this.sendBlobAttachOp(localId, pendingEntry?.storageId);\n\t\t}\n\t\treturn this.sendBlobAttachOp(localId, blobId);\n\t}\n\n\tpublic processBlobAttachMessage(message: ISequencedMessageEnvelope, local: boolean): void {\n\t\tconst localId = (message.metadata as IBlobMetadata | undefined)?.localId;\n\t\tconst blobId = (message.metadata as IBlobMetadata | undefined)?.blobId;\n\n\t\tif (localId) {\n\t\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\t\t\tif (pendingEntry?.abortSignal?.aborted) {\n\t\t\t\tthis.deletePendingBlob(localId);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tassert(blobId !== undefined, 0x12a /* \"Missing blob id on metadata\" */);\n\n\t\t// Set up a mapping from local ID to storage ID. This is crucial since without this the blob cannot be\n\t\t// requested from the server.\n\t\t// Note: The check for undefined is needed for back-compat when localId was not part of the BlobAttach op that\n\t\t// was sent when online.\n\t\tif (localId !== undefined) {\n\t\t\tthis.setRedirection(localId, blobId);\n\t\t}\n\t\t// set identity (id -> id) entry\n\t\tthis.setRedirection(blobId, blobId);\n\n\t\tif (local) {\n\t\t\tassert(localId !== undefined, 0x50e /* local ID not present in blob attach message */);\n\t\t\tconst waitingBlobs = this.opsInFlight.get(blobId);\n\t\t\tif (waitingBlobs !== undefined) {\n\t\t\t\t// For each op corresponding to this storage ID that we are waiting for, resolve the pending blob.\n\t\t\t\t// This is safe because the server will keep the blob alive and the op containing the local ID to\n\t\t\t\t// storage ID is already in flight and any op containing this local ID will be sequenced after that.\n\t\t\t\tfor (const pendingLocalId of waitingBlobs) {\n\t\t\t\t\tconst entry = this.pendingBlobs.get(pendingLocalId);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tentry !== undefined,\n\t\t\t\t\t\t0x38f /* local online BlobAttach op with no pending blob entry */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.setRedirection(pendingLocalId, blobId);\n\t\t\t\t\tentry.acked = true;\n\t\t\t\t\tentry.handleP.resolve(this.getBlobHandle(pendingLocalId));\n\t\t\t\t\tthis.deletePendingBlobMaybe(pendingLocalId);\n\t\t\t\t}\n\t\t\t\tthis.opsInFlight.delete(blobId);\n\t\t\t}\n\t\t\tconst localEntry = this.pendingBlobs.get(localId);\n\t\t\tif (localEntry) {\n\t\t\t\tlocalEntry.acked = true;\n\t\t\t\tlocalEntry.handleP.resolve(this.getBlobHandle(localId));\n\t\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic summarize(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\treturn summarizeBlobManagerState(this.redirectTable, this.runtime.attachState);\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. Each blob uploaded represents a node in the GC graph as it can be\n\t * individually referenced by storing its handle in a referenced DDS. Returns the list of blob ids as GC nodes.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data. BlobManager doesn't care\n\t * about this for now because the data is a simple list of blob ids.\n\t */\n\tpublic getGCData(fullGC: boolean = false): IGarbageCollectionData {\n\t\tconst gcData: IGarbageCollectionData = { gcNodes: {} };\n\t\tfor (const [localId, storageId] of this.redirectTable) {\n\t\t\tassert(!!storageId, 0x390 /* Must be attached to get GC data */);\n\t\t\t// Only return local ids as GC nodes because a blob can only be referenced via its local id. The storage\n\t\t\t// id entries have the same key and value, ignore them.\n\t\t\t// The outbound routes are empty because a blob node cannot reference other nodes. It can only be referenced\n\t\t\t// by adding its handle to a referenced DDS.\n\t\t\tif (localId !== storageId) {\n\t\t\t\tgcData.gcNodes[getGCNodePathFromBlobId(localId)] = [];\n\t\t\t}\n\t\t}\n\t\treturn gcData;\n\t}\n\n\t/**\n\t * Delete attachment blobs that are sweep ready.\n\t * @param sweepReadyBlobRoutes - The routes of blobs that are sweep ready and should be deleted. These routes will\n\t * be based off of local ids.\n\t * @returns The routes of blobs that were deleted.\n\t */\n\tpublic deleteSweepReadyNodes(sweepReadyBlobRoutes: readonly string[]): readonly string[] {\n\t\tthis.deleteBlobsFromRedirectTable(sweepReadyBlobRoutes);\n\t\treturn [...sweepReadyBlobRoutes];\n\t}\n\n\t/**\n\t * Delete blobs with the given routes from the redirect table.\n\t *\n\t * @remarks\n\t * The routes are GC nodes paths of format -`/<blobManagerBasePath>/<blobId>`. The blob ids are all local ids.\n\t * Deleting the blobs involves 2 steps:\n\t *\n\t * 1. The redirect table entry for the local ids are deleted.\n\t *\n\t * 2. If the storage ids corresponding to the deleted local ids are not in-use anymore, the redirect table entries\n\t * for the storage ids are deleted as well.\n\t *\n\t * Note that this does not delete the blobs from storage service immediately. Deleting the blobs from redirect table\n\t * will remove them the next summary. The service would them delete them some time in the future.\n\t */\n\tprivate deleteBlobsFromRedirectTable(blobRoutes: readonly string[]): void {\n\t\tif (blobRoutes.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// This tracks the storage ids of local ids that are deleted. After the local ids have been deleted, if any of\n\t\t// these storage ids are unused, they will be deleted as well.\n\t\tconst maybeUnusedStorageIds: Set<string> = new Set();\n\t\tfor (const route of blobRoutes) {\n\t\t\tconst blobId = getBlobIdFromGCNodePath(route);\n\t\t\t// If the blob hasn't already been deleted, log an error because this should never happen.\n\t\t\t// If the blob has already been deleted, log a telemetry event. This can happen because multiple GC\n\t\t\t// sweep ops can contain the same data store. It would be interesting to track how often this happens.\n\t\t\tconst alreadyDeleted = this.isBlobDeleted(route);\n\t\t\tif (!this.redirectTable.has(blobId)) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"DeletedAttachmentBlobNotFound\",\n\t\t\t\t\tcategory: alreadyDeleted ? \"generic\" : \"error\",\n\t\t\t\t\tblobId,\n\t\t\t\t\tdetails: { alreadyDeleted },\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst storageId = this.redirectTable.get(blobId);\n\t\t\tassert(!!storageId, 0x5bb /* Must be attached to run GC */);\n\t\t\tmaybeUnusedStorageIds.add(storageId);\n\t\t\tthis.redirectTable.delete(blobId);\n\t\t}\n\n\t\t// Find out storage ids that are in-use and remove them from maybeUnusedStorageIds. A storage id is in-use if\n\t\t// the redirect table has a local id -> storage id entry for it.\n\t\tfor (const [localId, storageId] of this.redirectTable.entries()) {\n\t\t\tassert(!!storageId, 0x5bc /* Must be attached to run GC */);\n\t\t\t// For every storage id, the redirect table has a id -> id entry. These do not make the storage id in-use.\n\t\t\tif (maybeUnusedStorageIds.has(storageId) && localId !== storageId) {\n\t\t\t\tmaybeUnusedStorageIds.delete(storageId);\n\t\t\t}\n\t\t}\n\n\t\t// For unused storage ids, delete their id -> id entries from the redirect table.\n\t\t// This way they'll be absent from the next summary, and the service is free to delete them from storage.\n\t\tfor (const storageId of maybeUnusedStorageIds) {\n\t\t\tthis.redirectTable.delete(storageId);\n\t\t}\n\t}\n\n\t/**\n\t * Verifies that the blob with given id is not deleted, i.e., it has not been garbage collected. If the blob is GC'd,\n\t * log an error and throw if necessary.\n\t */\n\tprivate verifyBlobNotDeleted(blobId: string): void {\n\t\tif (!this.isBlobDeleted(getGCNodePathFromBlobId(blobId))) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst request = { url: blobId };\n\t\tconst error = responseToException(\n\t\t\tcreateResponseError(404, `Blob was deleted`, request),\n\t\t\trequest,\n\t\t);\n\t\t// Only log deleted events. Tombstone events are logged by garbage collector.\n\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t{\n\t\t\t\teventName: \"GC_Deleted_Blob_Requested\",\n\t\t\t\tpkg: blobManagerBasePath,\n\t\t\t},\n\t\t\terror,\n\t\t);\n\t\tthrow error;\n\t}\n\n\tpublic setRedirectTable(table: Map<string, string>): void {\n\t\tassert(\n\t\t\tthis.runtime.attachState === AttachState.Detached,\n\t\t\t0x252 /* \"redirect table can only be set in detached container\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.redirectTable.size === table.size,\n\t\t\t0x391 /* Redirect table size must match BlobManager's local ID count */,\n\t\t);\n\t\tfor (const [localId, storageId] of table) {\n\t\t\tassert(this.redirectTable.has(localId), 0x254 /* \"unrecognized id in redirect table\" */);\n\t\t\tthis.setRedirection(localId, storageId);\n\t\t\t// set identity (id -> id) entry\n\t\t\tthis.setRedirection(storageId, storageId);\n\t\t}\n\t}\n\n\t/**\n\t * Part of container serialization when imminent closure is enabled (Currently when calling closeAndGetPendingLocalState).\n\t * This asynchronous function resolves all pending createBlob calls and waits for each blob\n\t * to be attached. It will also send BlobAttach ops for each pending blob that hasn't sent it\n\t * yet so that serialized container can resubmit them when rehydrated.\n\t *\n\t * @param stopBlobAttachingSignal - Optional signal to abort the blob attaching process.\n\t * @returns - A promise that resolves with the details of the attached blobs,\n\t * or undefined if no blobs were processed.\n\t */\n\tpublic async attachAndGetPendingBlobs(\n\t\tstopBlobAttachingSignal?: AbortSignal,\n\t): Promise<IPendingBlobs | undefined> {\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{ eventName: \"GetPendingBlobs\" },\n\t\t\tasync () => {\n\t\t\t\tif (this.pendingBlobs.size === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst blobs = {};\n\t\t\t\tconst localBlobs = new Set<PendingBlob>();\n\t\t\t\t// This while is used to stash blobs created while attaching and getting blobs\n\t\t\t\twhile (localBlobs.size < this.pendingBlobs.size) {\n\t\t\t\t\tconst attachBlobsP: Promise<void>[] = [];\n\t\t\t\t\tfor (const [localId, entry] of this.pendingBlobs) {\n\t\t\t\t\t\tif (!localBlobs.has(entry)) {\n\t\t\t\t\t\t\tlocalBlobs.add(entry);\n\t\t\t\t\t\t\t// In order to follow natural blob creation flow we need to:\n\t\t\t\t\t\t\t// 1 send the blob attach op\n\t\t\t\t\t\t\t// 2 resolve the blob handle\n\t\t\t\t\t\t\t// 3 wait for op referencing the blob\n\t\t\t\t\t\t\tif (!entry.opsent) {\n\t\t\t\t\t\t\t\tthis.sendBlobAttachOp(localId, entry.storageId);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Resolving the blob handle to let hosts continue with their operations (it will resolve\n\t\t\t\t\t\t\t// original createBlob call) and let them attach the blob. This is a lie we told since the upload\n\t\t\t\t\t\t\t// hasn't finished yet, but it's fine since we will retry on rehydration.\n\t\t\t\t\t\t\tentry.handleP.resolve(this.getBlobHandle(localId));\n\t\t\t\t\t\t\t// Array of promises that will resolve when blobs get attached.\n\t\t\t\t\t\t\tattachBlobsP.push(\n\t\t\t\t\t\t\t\tnew Promise<void>((resolve, reject) => {\n\t\t\t\t\t\t\t\t\tstopBlobAttachingSignal?.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\"abort\",\n\t\t\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\t\t\tthis.stopAttaching = true;\n\t\t\t\t\t\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t{ once: true },\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tconst onBlobAttached = (attachedEntry: PendingBlob): void => {\n\t\t\t\t\t\t\t\t\t\tif (attachedEntry === entry) {\n\t\t\t\t\t\t\t\t\t\t\tthis.internalEvents.off(\"blobAttached\", onBlobAttached);\n\t\t\t\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\tif (entry.attached) {\n\t\t\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tthis.internalEvents.on(\"blobAttached\", onBlobAttached);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Wait for all blobs to be attached. This is important, otherwise serialized container\n\t\t\t\t\t// could send the blobAttach op without any op that references the blob, making it useless.\n\t\t\t\t\tawait Promise.allSettled(attachBlobsP);\n\t\t\t\t}\n\n\t\t\t\tfor (const [localId, entry] of this.pendingBlobs) {\n\t\t\t\t\tif (stopBlobAttachingSignal?.aborted && !entry.attached) {\n\t\t\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\t\t\teventName: \"UnableToStashBlob\",\n\t\t\t\t\t\t\tid: localId,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tassert(entry.attached === true, 0x790 /* stashed blob should be attached */);\n\t\t\t\t\tblobs[localId] = {\n\t\t\t\t\t\tblob: bufferToString(entry.blob, \"base64\"),\n\t\t\t\t\t\tstorageId: entry.storageId,\n\t\t\t\t\t\tacked: entry.acked,\n\t\t\t\t\t\tminTTLInSeconds: entry.minTTLInSeconds,\n\t\t\t\t\t\tuploadTime: entry.uploadTime,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn Object.keys(blobs).length > 0 ? blobs : undefined;\n\t\t\t},\n\t\t);\n\t}\n}\n\n/**\n * For a blobId, returns its path in GC's graph. The node path is of the format `/<blobManagerBasePath>/<blobId>`.\n * This path must match the path of the blob handle returned by the createBlob API because blobs are marked\n * referenced by storing these handles in a referenced DDS.\n */\nconst getGCNodePathFromBlobId = (blobId: string): string =>\n\t`/${blobManagerBasePath}/${blobId}`;\n\n/**\n * For a given GC node path, return the blobId. The node path is of the format `/<basePath>/<blobId>`.\n */\nconst getBlobIdFromGCNodePath = (nodePath: string): string => {\n\tconst pathParts = nodePath.split(\"/\");\n\tassert(areBlobPathParts(pathParts), 0x5bd /* Invalid blob node path */);\n\treturn pathParts[2];\n};\n\n/**\n * Returns whether a given path is for attachment blobs that are in the format - \"/blobManagerBasePath/...\".\n */\nexport const isBlobPath = (path: string): path is `/${typeof blobManagerBasePath}/${string}` =>\n\tareBlobPathParts(path.split(\"/\"));\n\nconst areBlobPathParts = (\n\tpathParts: string[],\n): pathParts is [\"\", typeof blobManagerBasePath, string] =>\n\tpathParts.length === 3 && pathParts[1] === blobManagerBasePath;\n"]}
@@ -7,9 +7,7 @@ import type { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions/
7
7
  import type { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
8
8
  /**
9
9
  * Information from a snapshot needed to load BlobManager
10
- * @legacy
11
- * @alpha
12
- * @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
10
+ * @internal
13
11
  */
14
12
  export interface IBlobManagerLoadInfo {
15
13
  ids?: string[];
@@ -25,7 +23,7 @@ export declare const blobsTreeName = ".blobs";
25
23
  *
26
24
  */
27
25
  export declare const loadBlobManagerLoadInfo: (context: Pick<IContainerContext, "baseSnapshot" | "storage" | "attachState">) => Promise<IBlobManagerLoadInfo>;
28
- export declare const toRedirectTable: (snapshot: IBlobManagerLoadInfo, logger: ITelemetryLoggerExt, attachState: AttachState) => Map<string, string | undefined>;
26
+ export declare const toRedirectTable: (blobManagerLoadInfo: IBlobManagerLoadInfo, logger: ITelemetryLoggerExt, attachState: AttachState) => Map<string, string | undefined>;
29
27
  export declare const summarizeBlobManagerState: (redirectTable: Map<string, string | undefined>, attachState: AttachState) => ISummaryTreeWithStats;
30
28
  export declare const getStorageIds: (redirectTable: Map<string, string | undefined>, attachState: AttachState) => Set<string>;
31
29
  //# sourceMappingURL=blobManagerSnapSum.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"blobManagerSnapSum.d.ts","sourceRoot":"","sources":["../../src/blobManager/blobManagerSnapSum.ts"],"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AM,0CAA0C,CAAC;AAEpF;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;CACnC;AAED,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,aAAa,WAAW,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,uBAAuB,YAC1B,KAAK,iBAAiB,EAAE,cAAc,GAAG,SAAS,GAAG,aAAa,CAAC,KAC1E,QAAQ,oBAAoB,CAAoB,CAAC;AAsBpD,eAAO,MAAM,eAAe,wBACN,oBAAoB,UACjC,mBAAmB,eACd,WAAW,KACtB,IAAI,MAAM,EAAE,MAAM,GAAG,SAAS,CAgBhC,CAAC;AAEF,eAAO,MAAM,yBAAyB,kBACtB,IAAI,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,eACjC,WAAW,KACtB,qBAAgE,CAAC;AA6BpE,eAAO,MAAM,aAAa,kBACV,IAAI,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,eACjC,WAAW,KACtB,IAAI,MAAM,CAcZ,CAAC"}
@@ -31,18 +31,18 @@ const loadV1 = async (context) => {
31
31
  .map(([_, v]) => v);
32
32
  return { ids, redirectTable: redirectTableEntries };
33
33
  };
34
- export const toRedirectTable = (snapshot, logger, attachState) => {
34
+ export const toRedirectTable = (blobManagerLoadInfo, logger, attachState) => {
35
35
  logger.sendTelemetryEvent({
36
36
  eventName: "AttachmentBlobsLoaded",
37
- count: snapshot.ids?.length ?? 0,
38
- redirectTable: snapshot.redirectTable?.length,
37
+ count: blobManagerLoadInfo.ids?.length ?? 0,
38
+ redirectTable: blobManagerLoadInfo.redirectTable?.length,
39
39
  });
40
- const redirectTable = new Map(snapshot.redirectTable);
40
+ const redirectTable = new Map(blobManagerLoadInfo.redirectTable);
41
41
  const detached = attachState !== AttachState.Attached;
42
- if (snapshot.ids) {
42
+ if (blobManagerLoadInfo.ids) {
43
43
  // If we are detached, we don't have storage IDs yet, so set to undefined
44
44
  // Otherwise, set identity (id -> id) entries.
45
- for (const entry of snapshot.ids) {
45
+ for (const entry of blobManagerLoadInfo.ids) {
46
46
  redirectTable.set(entry, detached ? undefined : entry);
47
47
  }
48
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"blobManagerSnapSum.js","sourceRoot":"","sources":["../../src/blobManager/blobManagerSnapSum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,GAEX,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAc5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAEtD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,EAC3C,OAA4E,EAC5C,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAEpD,MAAM,MAAM,GAAG,KAAK,EACnB,OAA4E,EAC5C,EAAE;IAClC,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAE7D,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,OAAO,EAAE,CAAC;IACX,CAAC;IACD,IAAI,oBAAoB,GAAuB,EAAE,CAAC;IAClD,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACvD,IAAI,OAAO,EAAE,CAAC;QACb,oBAAoB,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;IACD,MAAM,GAAG,GAAG,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kB,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tAttachState,\n\ttype IContainerContext,\n} from \"@fluidframework/container-definitions/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport type { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\nimport type { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Information from a snapshot needed to load BlobManager\n * @legacy\n * @alpha\n * @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.\n */\nexport interface IBlobManagerLoadInfo {\n\tids?: string[];\n\tredirectTable?: [string, string][];\n}\n\nexport const redirectTableBlobName = \".redirectTable\";\n\n/**\n * @internal\n */\nexport const blobsTreeName = \".blobs\";\n\n/**\n * Reads blobs needed to load BlobManager from storage.\n *\n */\nexport const loadBlobManagerLoadInfo = async (\n\tcontext: Pick<IContainerContext, \"baseSnapshot\" | \"storage\" | \"attachState\">,\n): Promise<IBlobManagerLoadInfo> => loadV1(context);\n\nconst loadV1 = async (\n\tcontext: Pick<IContainerContext, \"baseSnapshot\" | \"storage\" | \"attachState\">,\n): Promise<IBlobManagerLoadInfo> => {\n\tconst blobsTree = context.baseSnapshot?.trees[blobsTreeName];\n\n\tif (!blobsTree) {\n\t\treturn {};\n\t}\n\tlet redirectTableEntries: [string, string][] = [];\n\tconst tableId = blobsTree.blobs[redirectTableBlobName];\n\tif (tableId) {\n\t\tredirectTableEntries = await readAndParse(context.storage, tableId);\n\t}\n\tconst ids = Object.entries(blobsTree.blobs)\n\t\t.filter(([k, _]) => k !== redirectTableBlobName)\n\t\t.map(([_, v]) => v);\n\n\treturn { ids, redirectTable: redirectTableEntries };\n};\n\nexport const toRedirectTable = (\n\tsnapshot: IBlobManagerLoadInfo,\n\tlogger: ITelemetryLoggerExt,\n\tattachState: AttachState,\n): Map<string, string | undefined> => {\n\tlogger.sendTelemetryEvent({\n\t\teventName: \"AttachmentBlobsLoaded\",\n\t\tcount: snapshot.ids?.length ?? 0,\n\t\tredirectTable: snapshot.redirectTable?.length,\n\t});\n\tconst redirectTable = new Map<string, string | undefined>(snapshot.redirectTable);\n\tconst detached = attachState !== AttachState.Attached;\n\tif (snapshot.ids) {\n\t\t// If we are detached, we don't have storage IDs yet, so set to undefined\n\t\t// Otherwise, set identity (id -> id) entries.\n\t\tfor (const entry of snapshot.ids) {\n\t\t\tredirectTable.set(entry, detached ? undefined : entry);\n\t\t}\n\t}\n\treturn redirectTable;\n};\n\nexport const summarizeBlobManagerState = (\n\tredirectTable: Map<string, string | undefined>,\n\tattachState: AttachState,\n): ISummaryTreeWithStats => summarizeV1(redirectTable, attachState);\n\nconst summarizeV1 = (\n\tredirectTable: Map<string, string | undefined>,\n\tattachState: AttachState,\n): ISummaryTreeWithStats => {\n\tconst storageIds = getStorageIds(redirectTable, attachState);\n\n\t// if storageIds is empty, it means we are detached and have only local IDs, or that there are no blobs attached\n\tconst blobIds = storageIds.size > 0 ? [...storageIds] : [...redirectTable.keys()];\n\tconst builder = new SummaryTreeBuilder();\n\tfor (const blobId of blobIds) {\n\t\tbuilder.addAttachment(blobId);\n\t}\n\n\t// Any non-identity entries in the table need to be saved in the summary\n\tif (redirectTable.size > blobIds.length) {\n\t\tbuilder.addBlob(\n\t\t\tredirectTableBlobName,\n\t\t\t// filter out identity entries\n\t\t\tJSON.stringify(\n\t\t\t\t[...redirectTable.entries()].filter(([localId, storageId]) => localId !== storageId),\n\t\t\t),\n\t\t);\n\t}\n\n\treturn builder.getSummaryTree();\n};\n\nexport const getStorageIds = (\n\tredirectTable: Map<string, string | undefined>,\n\tattachState: AttachState,\n): Set<string> => {\n\tconst ids = new Set<string | undefined>(redirectTable.values());\n\n\t// If we are detached, we will not have storage IDs, only undefined\n\tconst undefinedValueInTable = ids.delete(undefined);\n\n\t// For a detached container, entries are inserted into the redirect table with an undefined storage ID.\n\t// For an attached container, entries are inserted w/storage ID after the BlobAttach op round-trips.\n\tassert(\n\t\t!undefinedValueInTable || (attachState === AttachState.Detached && ids.size === 0),\n\t\t0x382 /* 'redirectTable' must contain only undefined while detached / defined values while attached */,\n\t);\n\n\treturn ids as Set<string>;\n};\n"]}
1
+ {"version":3,"file":"blobManagerSnapSum.js","sourceRoot":"","sources":["../../src/blobManager/blobManagerSnapSum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,GAEX,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAY5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAEtD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,EAC3C,OAA4E,EAC5C,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAEpD,MAAM,MAAM,GAAG,KAAK,EACnB,OAA4E,EAC5C,EAAE;IAClC,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAE7D,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,OAAO,EAAE,CAAC;IACX,CAAC;IACD,IAAI,oBAAoB,GAAuB,EAAE,CAAC;IAClD,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACvD,IAAI,OAAO,EAAE,CAAC;QACb,oBAAoB,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;IACD,MA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tG,CAAC;IAEF,OAAO,GAAkB,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tAttachState,\n\ttype IContainerContext,\n} from \"@fluidframework/container-definitions/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport type { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\nimport type { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Information from a snapshot needed to load BlobManager\n * @internal\n */\nexport interface IBlobManagerLoadInfo {\n\tids?: string[];\n\tredirectTable?: [string, string][];\n}\n\nexport const redirectTableBlobName = \".redirectTable\";\n\n/**\n * @internal\n */\nexport const blobsTreeName = \".blobs\";\n\n/**\n * Reads blobs needed to load BlobManager from storage.\n *\n */\nexport const loadBlobManagerLoadInfo = async (\n\tcontext: Pick<IContainerContext, \"baseSnapshot\" | \"storage\" | \"attachState\">,\n): Promise<IBlobManagerLoadInfo> => loadV1(context);\n\nconst loadV1 = async (\n\tcontext: Pick<IContainerContext, \"baseSnapshot\" | \"storage\" | \"attachState\">,\n): Promise<IBlobManagerLoadInfo> => {\n\tconst blobsTree = context.baseSnapshot?.trees[blobsTreeName];\n\n\tif (!blobsTree) {\n\t\treturn {};\n\t}\n\tlet redirectTableEntries: [string, string][] = [];\n\tconst tableId = blobsTree.blobs[redirectTableBlobName];\n\tif (tableId) {\n\t\tredirectTableEntries = await readAndParse(context.storage, tableId);\n\t}\n\tconst ids = Object.entries(blobsTree.blobs)\n\t\t.filter(([k, _]) => k !== redirectTableBlobName)\n\t\t.map(([_, v]) => v);\n\n\treturn { ids, redirectTable: redirectTableEntries };\n};\n\nexport const toRedirectTable = (\n\tblobManagerLoadInfo: IBlobManagerLoadInfo,\n\tlogger: ITelemetryLoggerExt,\n\tattachState: AttachState,\n): Map<string, string | undefined> => {\n\tlogger.sendTelemetryEvent({\n\t\teventName: \"AttachmentBlobsLoaded\",\n\t\tcount: blobManagerLoadInfo.ids?.length ?? 0,\n\t\tredirectTable: blobManagerLoadInfo.redirectTable?.length,\n\t});\n\tconst redirectTable = new Map<string, string | undefined>(blobManagerLoadInfo.redirectTable);\n\tconst detached = attachState !== AttachState.Attached;\n\tif (blobManagerLoadInfo.ids) {\n\t\t// If we are detached, we don't have storage IDs yet, so set to undefined\n\t\t// Otherwise, set identity (id -> id) entries.\n\t\tfor (const entry of blobManagerLoadInfo.ids) {\n\t\t\tredirectTable.set(entry, detached ? undefined : entry);\n\t\t}\n\t}\n\treturn redirectTable;\n};\n\nexport const summarizeBlobManagerState = (\n\tredirectTable: Map<string, string | undefined>,\n\tattachState: AttachState,\n): ISummaryTreeWithStats => summarizeV1(redirectTable, attachState);\n\nconst summarizeV1 = (\n\tredirectTable: Map<string, string | undefined>,\n\tattachState: AttachState,\n): ISummaryTreeWithStats => {\n\tconst storageIds = getStorageIds(redirectTable, attachState);\n\n\t// if storageIds is empty, it means we are detached and have only local IDs, or that there are no blobs attached\n\tconst blobIds = storageIds.size > 0 ? [...storageIds] : [...redirectTable.keys()];\n\tconst builder = new SummaryTreeBuilder();\n\tfor (const blobId of blobIds) {\n\t\tbuilder.addAttachment(blobId);\n\t}\n\n\t// Any non-identity entries in the table need to be saved in the summary\n\tif (redirectTable.size > blobIds.length) {\n\t\tbuilder.addBlob(\n\t\t\tredirectTableBlobName,\n\t\t\t// filter out identity entries\n\t\t\tJSON.stringify(\n\t\t\t\t[...redirectTable.entries()].filter(([localId, storageId]) => localId !== storageId),\n\t\t\t),\n\t\t);\n\t}\n\n\treturn builder.getSummaryTree();\n};\n\nexport const getStorageIds = (\n\tredirectTable: Map<string, string | undefined>,\n\tattachState: AttachState,\n): Set<string> => {\n\tconst ids = new Set<string | undefined>(redirectTable.values());\n\n\t// If we are detached, we will not have storage IDs, only undefined\n\tconst undefinedValueInTable = ids.delete(undefined);\n\n\t// For a detached container, entries are inserted into the redirect table with an undefined storage ID.\n\t// For an attached container, entries are inserted w/storage ID after the BlobAttach op round-trips.\n\tassert(\n\t\t!undefinedValueInTable || (attachState === AttachState.Detached && ids.size === 0),\n\t\t0x382 /* 'redirectTable' must contain only undefined while detached / defined values while attached */,\n\t);\n\n\treturn ids as Set<string>;\n};\n"]}
@@ -6,7 +6,7 @@ import { AttachState } from "@fluidframework/container-definitions";
6
6
  import { FluidObject, IDisposable, IRequest, IResponse, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
7
7
  import type { IFluidHandleInternal } from "@fluidframework/core-interfaces/internal";
8
8
  import type { ISnapshot } from "@fluidframework/driver-definitions/internal";
9
- import { ISnapshotTree, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
9
+ import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
10
10
  import { ISummaryTreeWithStats, ITelemetryContext, IGarbageCollectionData, AliasResult, IEnvelope, IFluidDataStoreChannel, IFluidDataStoreContext, IFluidDataStoreContextDetached, IFluidDataStoreFactory, IFluidDataStoreRegistry, IFluidParentContext, NamedFluidDataStoreRegistryEntries, IInboundSignalMessage, type IRuntimeMessageCollection } from "@fluidframework/runtime-definitions/internal";
11
11
  import { MonitoringContext } from "@fluidframework/telemetry-utils/internal";
12
12
  import { RuntimeHeaderData } from "./containerRuntime.js";
@@ -128,12 +128,6 @@ export declare class ChannelCollection implements IFluidDataStoreChannel, IDispo
128
128
  * @param messageCollection - The collection of messages to process.
129
129
  */
130
130
  processMessages(messageCollection: IRuntimeMessageCollection): void;
131
- /**
132
- * This is still here for back-compat purposes because channel collection implements
133
- * IFluidDataStoreChannel. Once it is removed from the interface, this method can be removed.
134
- * Container runtime calls `processMessages` instead.
135
- */
136
- process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
137
131
  /**
138
132
  * Process channel messages. The messages here are contiguous channel type messages in a batch. Bunch
139
133
  * of contiguous messages for a data store should be sent to it together.