@fluidframework/container-runtime 2.0.0-dev.2.2.0.111723 → 2.0.0-dev.2.3.0.115467

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 (161) hide show
  1. package/dist/blobManager.d.ts +20 -5
  2. package/dist/blobManager.d.ts.map +1 -1
  3. package/dist/blobManager.js +57 -15
  4. package/dist/blobManager.js.map +1 -1
  5. package/dist/containerRuntime.d.ts +16 -33
  6. package/dist/containerRuntime.d.ts.map +1 -1
  7. package/dist/containerRuntime.js +71 -219
  8. package/dist/containerRuntime.js.map +1 -1
  9. package/dist/dataStoreContext.js +2 -2
  10. package/dist/dataStoreContext.js.map +1 -1
  11. package/dist/dataStores.d.ts.map +1 -1
  12. package/dist/dataStores.js +2 -1
  13. package/dist/dataStores.js.map +1 -1
  14. package/dist/garbageCollection.d.ts +7 -16
  15. package/dist/garbageCollection.d.ts.map +1 -1
  16. package/dist/garbageCollection.js +41 -61
  17. package/dist/garbageCollection.js.map +1 -1
  18. package/dist/garbageCollectionConstants.d.ts +19 -0
  19. package/dist/garbageCollectionConstants.d.ts.map +1 -0
  20. package/dist/garbageCollectionConstants.js +34 -0
  21. package/dist/garbageCollectionConstants.js.map +1 -0
  22. package/dist/gcSweepReadyUsageDetection.js +2 -2
  23. package/dist/gcSweepReadyUsageDetection.js.map +1 -1
  24. package/dist/index.d.ts +4 -2
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +7 -6
  27. package/dist/index.js.map +1 -1
  28. package/dist/opLifecycle/batchManager.d.ts +30 -0
  29. package/dist/opLifecycle/batchManager.d.ts.map +1 -0
  30. package/dist/{batchManager.js → opLifecycle/batchManager.js} +17 -17
  31. package/dist/opLifecycle/batchManager.js.map +1 -0
  32. package/dist/opLifecycle/definitions.d.ts +40 -0
  33. package/dist/opLifecycle/definitions.d.ts.map +1 -0
  34. package/dist/opLifecycle/definitions.js +7 -0
  35. package/dist/opLifecycle/definitions.js.map +1 -0
  36. package/dist/opLifecycle/index.d.ts +12 -0
  37. package/dist/opLifecycle/index.d.ts.map +1 -0
  38. package/dist/opLifecycle/index.js +21 -0
  39. package/dist/opLifecycle/index.js.map +1 -0
  40. package/dist/{opCompressor.d.ts → opLifecycle/opCompressor.d.ts} +2 -2
  41. package/dist/opLifecycle/opCompressor.d.ts.map +1 -0
  42. package/dist/{opCompressor.js → opLifecycle/opCompressor.js} +16 -13
  43. package/dist/opLifecycle/opCompressor.js.map +1 -0
  44. package/dist/{opDecompressor.d.ts → opLifecycle/opDecompressor.d.ts} +0 -0
  45. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -0
  46. package/dist/{opDecompressor.js → opLifecycle/opDecompressor.js} +5 -5
  47. package/dist/opLifecycle/opDecompressor.js.map +1 -0
  48. package/dist/opLifecycle/opSplitter.d.ts +17 -0
  49. package/dist/opLifecycle/opSplitter.d.ts.map +1 -0
  50. package/dist/opLifecycle/opSplitter.js +61 -0
  51. package/dist/opLifecycle/opSplitter.js.map +1 -0
  52. package/dist/opLifecycle/outbox.d.ts +47 -0
  53. package/dist/opLifecycle/outbox.d.ts.map +1 -0
  54. package/dist/opLifecycle/outbox.js +153 -0
  55. package/dist/opLifecycle/outbox.js.map +1 -0
  56. package/dist/opLifecycle/remoteMessageProcessor.d.ts +26 -0
  57. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -0
  58. package/dist/opLifecycle/remoteMessageProcessor.js +81 -0
  59. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -0
  60. package/dist/packageVersion.d.ts +1 -1
  61. package/dist/packageVersion.js +1 -1
  62. package/dist/packageVersion.js.map +1 -1
  63. package/dist/summaryFormat.js +2 -2
  64. package/dist/summaryFormat.js.map +1 -1
  65. package/lib/blobManager.d.ts +20 -5
  66. package/lib/blobManager.d.ts.map +1 -1
  67. package/lib/blobManager.js +59 -17
  68. package/lib/blobManager.js.map +1 -1
  69. package/lib/containerRuntime.d.ts +16 -33
  70. package/lib/containerRuntime.d.ts.map +1 -1
  71. package/lib/containerRuntime.js +68 -215
  72. package/lib/containerRuntime.js.map +1 -1
  73. package/lib/dataStoreContext.js +1 -1
  74. package/lib/dataStoreContext.js.map +1 -1
  75. package/lib/dataStores.d.ts.map +1 -1
  76. package/lib/dataStores.js +2 -1
  77. package/lib/dataStores.js.map +1 -1
  78. package/lib/garbageCollection.d.ts +7 -16
  79. package/lib/garbageCollection.d.ts.map +1 -1
  80. package/lib/garbageCollection.js +19 -39
  81. package/lib/garbageCollection.js.map +1 -1
  82. package/lib/garbageCollectionConstants.d.ts +19 -0
  83. package/lib/garbageCollectionConstants.d.ts.map +1 -0
  84. package/lib/garbageCollectionConstants.js +31 -0
  85. package/lib/garbageCollectionConstants.js.map +1 -0
  86. package/lib/gcSweepReadyUsageDetection.js +1 -1
  87. package/lib/gcSweepReadyUsageDetection.js.map +1 -1
  88. package/lib/index.d.ts +4 -2
  89. package/lib/index.d.ts.map +1 -1
  90. package/lib/index.js +3 -2
  91. package/lib/index.js.map +1 -1
  92. package/lib/opLifecycle/batchManager.d.ts +30 -0
  93. package/lib/opLifecycle/batchManager.d.ts.map +1 -0
  94. package/lib/{batchManager.js → opLifecycle/batchManager.js} +17 -17
  95. package/lib/opLifecycle/batchManager.js.map +1 -0
  96. package/lib/opLifecycle/definitions.d.ts +40 -0
  97. package/lib/opLifecycle/definitions.d.ts.map +1 -0
  98. package/lib/opLifecycle/definitions.js +6 -0
  99. package/lib/opLifecycle/definitions.js.map +1 -0
  100. package/lib/opLifecycle/index.d.ts +12 -0
  101. package/lib/opLifecycle/index.d.ts.map +1 -0
  102. package/lib/opLifecycle/index.js +11 -0
  103. package/lib/opLifecycle/index.js.map +1 -0
  104. package/lib/{opCompressor.d.ts → opLifecycle/opCompressor.d.ts} +2 -2
  105. package/lib/opLifecycle/opCompressor.d.ts.map +1 -0
  106. package/lib/{opCompressor.js → opLifecycle/opCompressor.js} +16 -13
  107. package/lib/opLifecycle/opCompressor.js.map +1 -0
  108. package/lib/{opDecompressor.d.ts → opLifecycle/opDecompressor.d.ts} +0 -0
  109. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -0
  110. package/lib/{opDecompressor.js → opLifecycle/opDecompressor.js} +4 -4
  111. package/lib/opLifecycle/opDecompressor.js.map +1 -0
  112. package/lib/opLifecycle/opSplitter.d.ts +17 -0
  113. package/lib/opLifecycle/opSplitter.d.ts.map +1 -0
  114. package/lib/opLifecycle/opSplitter.js +57 -0
  115. package/lib/opLifecycle/opSplitter.js.map +1 -0
  116. package/lib/opLifecycle/outbox.d.ts +47 -0
  117. package/lib/opLifecycle/outbox.d.ts.map +1 -0
  118. package/lib/opLifecycle/outbox.js +149 -0
  119. package/lib/opLifecycle/outbox.js.map +1 -0
  120. package/lib/opLifecycle/remoteMessageProcessor.d.ts +26 -0
  121. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -0
  122. package/lib/opLifecycle/remoteMessageProcessor.js +76 -0
  123. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -0
  124. package/lib/packageVersion.d.ts +1 -1
  125. package/lib/packageVersion.js +1 -1
  126. package/lib/packageVersion.js.map +1 -1
  127. package/lib/summaryFormat.js +1 -1
  128. package/lib/summaryFormat.js.map +1 -1
  129. package/package.json +21 -34
  130. package/src/blobManager.ts +74 -19
  131. package/src/containerRuntime.ts +91 -278
  132. package/src/dataStoreContext.ts +1 -1
  133. package/src/dataStores.ts +2 -1
  134. package/src/garbageCollection.ts +33 -43
  135. package/src/garbageCollectionConstants.ts +35 -0
  136. package/src/gcSweepReadyUsageDetection.ts +1 -1
  137. package/src/index.ts +5 -4
  138. package/src/{batchManager.ts → opLifecycle/batchManager.ts} +30 -33
  139. package/src/opLifecycle/definitions.ts +44 -0
  140. package/src/opLifecycle/index.ts +17 -0
  141. package/src/{opCompressor.ts → opLifecycle/opCompressor.ts} +21 -16
  142. package/src/{opDecompressor.ts → opLifecycle/opDecompressor.ts} +8 -6
  143. package/src/opLifecycle/opSplitter.ts +78 -0
  144. package/src/opLifecycle/outbox.ts +204 -0
  145. package/src/opLifecycle/remoteMessageProcessor.ts +90 -0
  146. package/src/packageVersion.ts +1 -1
  147. package/src/summaryFormat.ts +1 -1
  148. package/dist/batchManager.d.ts +0 -42
  149. package/dist/batchManager.d.ts.map +0 -1
  150. package/dist/batchManager.js.map +0 -1
  151. package/dist/opCompressor.d.ts.map +0 -1
  152. package/dist/opCompressor.js.map +0 -1
  153. package/dist/opDecompressor.d.ts.map +0 -1
  154. package/dist/opDecompressor.js.map +0 -1
  155. package/lib/batchManager.d.ts +0 -42
  156. package/lib/batchManager.d.ts.map +0 -1
  157. package/lib/batchManager.js.map +0 -1
  158. package/lib/opCompressor.d.ts.map +0 -1
  159. package/lib/opCompressor.js.map +0 -1
  160. package/lib/opDecompressor.d.ts.map +0 -1
  161. package/lib/opDecompressor.js.map +0 -1
@@ -34,7 +34,7 @@ export interface IBlobManagerLoadInfo {
34
34
  ids?: string[];
35
35
  redirectTable?: [string, string][];
36
36
  }
37
- export declare type IBlobManagerRuntime = Pick<IContainerRuntime, "attachState" | "connected" | "logger"> & TypedEventEmitter<IContainerRuntimeEvents>;
37
+ export declare type IBlobManagerRuntime = Pick<IContainerRuntime, "attachState" | "connected" | "logger" | "clientDetails"> & TypedEventEmitter<IContainerRuntimeEvents>;
38
38
  export interface IPendingBlobs {
39
39
  [id: string]: {
40
40
  blob: string;
@@ -58,7 +58,7 @@ export declare class BlobManager {
58
58
  private readonly runtime;
59
59
  static readonly basePath = "_blobs";
60
60
  private static readonly redirectTableBlobName;
61
- private readonly logger;
61
+ private readonly mc;
62
62
  /**
63
63
  * Map of local (offline/detached) IDs to storage IDs. Contains identity entries
64
64
  * (id → id) for storage IDs, so all requested IDs should be a key in this map.
@@ -78,6 +78,13 @@ export declare class BlobManager {
78
78
  */
79
79
  private readonly opsInFlight;
80
80
  private readonly retryThrottler;
81
+ /** If true, throw an error when a tombstone attachment blob is retrieved. */
82
+ private readonly throwOnTombstoneUsage;
83
+ /**
84
+ * This stores ides of tombstoned blobs.
85
+ * Tombstone is a temporary feature that imitates a blob getting swept by garbage collection.
86
+ */
87
+ private readonly tombstonedBlobs;
81
88
  constructor(routeContext: IFluidHandleContext, snapshot: IBlobManagerLoadInfo, getStorage: () => IDocumentStorageService,
82
89
  /**
83
90
  * Submit a BlobAttach op. When a blob is uploaded, there is a short grace period before which
@@ -146,10 +153,18 @@ export declare class BlobManager {
146
153
  */
147
154
  getGCData(fullGC?: boolean): IGarbageCollectionData;
148
155
  /**
149
- * When running GC in test mode, this is called to delete blobs that are unused.
150
- * @param unusedRoutes - These are the blob node ids that are unused and should be deleted.
156
+ * This is called to update blobs whose routes are used. The used blobs are removed from the tombstone list.
157
+ * @param usedRoutes - The routes of the blob nodes that are used.
158
+ */
159
+ updateUsedRoutes(usedRoutes: string[]): void;
160
+ /**
161
+ * This is called to update blobs whose routes are unused. The unused blobs are either deleted or marked as
162
+ * tombstones.
163
+ * @param unusedRoutes - The routes of the blob nodes that are unused.
164
+ * @param tombstone - if true, the objects corresponding to unused routes are marked tombstones. Otherwise, they
165
+ * are deleted.
151
166
  */
152
- deleteUnusedRoutes(unusedRoutes: string[]): void;
167
+ updateUnusedRoutes(unusedRoutes: string[], tombstone: boolean): void;
153
168
  summarize(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
154
169
  setRedirectTable(table: Map<string, string>): void;
155
170
  getPendingBlobs(): IPendingBlobs;
@@ -1 +1 @@
1
- {"version":3,"file":"blobManager.d.ts","sourceRoot":"","sources":["../src/blobManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAuB,yBAAyB,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAGrH,OAAO,EAAoD,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACnH,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AAO;IAmC7E;;;;;OAKG;WACiB,IAAI,CACpB,SAAS,EAAE,aAAa,GAAG,SAAS,EACpC,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,GAC1D,OAAO,CAAC,oBAAoB,CAAC;IAchC;;OAEG;IACH,OAAO,CAAC,IAAI;IAgBZ;;;;;OAKG;IACI,SAAS,CAAC,MAAM,GAAE,OAAe,GAAG,sBAAsB;IAyBjE;;;OAGG;IACI,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE;IAe5C;;;;;;OAMG;IACI,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI;IAsBpE,SAAS,CAAC,gBAAgB,CAAC,EAAE,iBAAiB,GAAG,qBAAqB;IAqBtE,gBAAgB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAa3C,eAAe,IAAI,aAAa;CAO1C"}
@@ -11,6 +11,8 @@ const common_utils_1 = require("@fluidframework/common-utils");
11
11
  const container_definitions_1 = require("@fluidframework/container-definitions");
12
12
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
13
13
  const throttler_1 = require("./throttler");
14
+ const summarizerClientElection_1 = require("./summarizerClientElection");
15
+ const garbageCollectionConstants_1 = require("./garbageCollectionConstants");
14
16
  /**
15
17
  * This class represents blob (long string)
16
18
  * This object is used only when creating (writing) new blob and serialization purposes.
@@ -99,7 +101,16 @@ class BlobManager {
99
101
  30 * 1000, // 30 sec max delay
100
102
  // throttling function increases exponentially (0ms, 40ms, 80ms, 160ms, etc)
101
103
  (0, throttler_1.formExponentialFn)({ coefficient: 20, initialDelay: 0 })));
102
- this.logger = telemetry_utils_1.ChildLogger.create(this.runtime.logger, "BlobManager");
104
+ /**
105
+ * This stores ides of tombstoned blobs.
106
+ * Tombstone is a temporary feature that imitates a blob getting swept by garbage collection.
107
+ */
108
+ this.tombstonedBlobs = new Set();
109
+ this.mc = (0, telemetry_utils_1.loggerToMonitoringContext)(telemetry_utils_1.ChildLogger.create(this.runtime.logger, "BlobManager"));
110
+ // Read the feature flag that tells whether to throw when a tombstone blob is requested.
111
+ this.throwOnTombstoneUsage =
112
+ this.mc.config.getBoolean(garbageCollectionConstants_1.throwOnTombstoneUsageKey) === true &&
113
+ this.runtime.clientDetails.type !== summarizerClientElection_1.summarizerClientType;
103
114
  this.runtime.on("disconnected", () => this.onDisconnected());
104
115
  this.redirectTable = this.load(snapshot);
105
116
  // Begin uploading stashed blobs from previous container instance
@@ -126,7 +137,7 @@ class BlobManager {
126
137
  async onConnected() {
127
138
  this.retryThrottler.cancel();
128
139
  const pendingUploads = this.pendingOfflineUploads.map(async (e) => e.uploadP);
129
- await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.logger, {
140
+ await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.mc.logger, {
130
141
  eventName: "BlobUploadOnConnected",
131
142
  count: pendingUploads.length,
132
143
  }, async () => Promise.all(pendingUploads), { start: true, end: true });
@@ -166,6 +177,17 @@ class BlobManager {
166
177
  return ids;
167
178
  }
168
179
  async getBlob(blobId) {
180
+ const request = { url: blobId };
181
+ if (this.tombstonedBlobs.has(blobId)) {
182
+ const error = (0, runtime_utils_1.responseToException)((0, runtime_utils_1.createResponseError)(404, "Blob removed by gc", request), request);
183
+ this.mc.logger.sendErrorEvent({
184
+ eventName: "GC_Tombstone_Blob_Requested",
185
+ url: request.url,
186
+ }, error);
187
+ if (this.throwOnTombstoneUsage) {
188
+ throw error;
189
+ }
190
+ }
169
191
  const pending = this.pendingBlobs.get(blobId);
170
192
  if (pending) {
171
193
  return pending.blob;
@@ -183,7 +205,7 @@ class BlobManager {
183
205
  }
184
206
  // When a GC-able (not pending) blob is retrieved, let runtime know that the corresponding GC node got updated.
185
207
  this.gcNodeUpdated(this.getBlobGCNodePath(blobId));
186
- return telemetry_utils_1.PerformanceEvent.timedExecAsync(this.logger, { eventName: "AttachmentReadBlob", id: storageId }, async () => {
208
+ return telemetry_utils_1.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "AttachmentReadBlob", id: storageId }, async () => {
187
209
  return this.getStorage().readBlob(storageId);
188
210
  }, { end: true, cancel: "error" });
189
211
  }
@@ -204,7 +226,7 @@ class BlobManager {
204
226
  }
205
227
  if (this.runtime.attachState === container_definitions_1.AttachState.Attaching) {
206
228
  // blob upload is not supported in "Attaching" state
207
- this.logger.sendTelemetryEvent({ eventName: "CreateBlobWhileAttaching" });
229
+ this.mc.logger.sendTelemetryEvent({ eventName: "CreateBlobWhileAttaching" });
208
230
  await new Promise((resolve) => this.runtime.once("attached", resolve));
209
231
  }
210
232
  (0, common_utils_1.assert)(this.runtime.attachState === container_definitions_1.AttachState.Attached, 0x385 /* For clarity and paranoid defense against adding future attachment states */);
@@ -221,7 +243,7 @@ class BlobManager {
221
243
  return pendingEntry.handleP.promise;
222
244
  }
223
245
  async uploadBlob(localId, blob) {
224
- return telemetry_utils_1.PerformanceEvent.timedExecAsync(this.logger, { eventName: "createBlob" }, async () => this.getStorage().createBlob(blob), { end: true, cancel: this.runtime.connected ? "error" : "generic" }).then((response) => this.onUploadResolve(localId, response), async (err) => this.onUploadReject(localId, err));
246
+ return telemetry_utils_1.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "createBlob" }, async () => this.getStorage().createBlob(blob), { end: true, cancel: this.runtime.connected ? "error" : "generic" }).then((response) => this.onUploadResolve(localId, response), async (err) => this.onUploadReject(localId, err));
225
247
  }
226
248
  onUploadResolve(localId, response) {
227
249
  var _a;
@@ -253,7 +275,7 @@ class BlobManager {
253
275
  }
254
276
  else {
255
277
  // connected to storage but not ordering service?
256
- this.logger.sendTelemetryEvent({ eventName: "BlobUploadSuccessWhileDisconnected" });
278
+ this.mc.logger.sendTelemetryEvent({ eventName: "BlobUploadSuccessWhileDisconnected" });
257
279
  if (entry.status === PendingBlobStatus.OnlinePendingUpload) {
258
280
  this.transitionToOffline(localId);
259
281
  }
@@ -365,7 +387,7 @@ class BlobManager {
365
387
  */
366
388
  load(snapshot) {
367
389
  var _a, _b, _c;
368
- this.logger.sendTelemetryEvent({
390
+ this.mc.logger.sendTelemetryEvent({
369
391
  eventName: "AttachmentBlobsLoaded",
370
392
  count: (_b = (_a = snapshot.ids) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
371
393
  redirectTable: (_c = snapshot.redirectTable) === null || _c === void 0 ? void 0 : _c.length,
@@ -408,22 +430,42 @@ class BlobManager {
408
430
  return gcData;
409
431
  }
410
432
  /**
411
- * When running GC in test mode, this is called to delete blobs that are unused.
412
- * @param unusedRoutes - These are the blob node ids that are unused and should be deleted.
433
+ * This is called to update blobs whose routes are used. The used blobs are removed from the tombstone list.
434
+ * @param usedRoutes - The routes of the blob nodes that are used.
413
435
  */
414
- deleteUnusedRoutes(unusedRoutes) {
415
- var _a;
436
+ updateUsedRoutes(usedRoutes) {
437
+ // The routes or blob node paths are in the same format as returned in getGCData -
438
+ // `/<BlobManager.basePath>/<blobId>`.
439
+ for (const route of usedRoutes) {
440
+ const pathParts = route.split("/");
441
+ (0, common_utils_1.assert)(pathParts.length === 3 && pathParts[1] === BlobManager.basePath, 0x4bc /* Invalid blob node id in used routes. */);
442
+ const blobId = pathParts[2];
443
+ // Un-tombstone the blob if it was marked tombstone.
444
+ this.tombstonedBlobs.delete(blobId);
445
+ }
446
+ }
447
+ /**
448
+ * This is called to update blobs whose routes are unused. The unused blobs are either deleted or marked as
449
+ * tombstones.
450
+ * @param unusedRoutes - The routes of the blob nodes that are unused.
451
+ * @param tombstone - if true, the objects corresponding to unused routes are marked tombstones. Otherwise, they
452
+ * are deleted.
453
+ */
454
+ updateUnusedRoutes(unusedRoutes, tombstone) {
416
455
  // The routes or blob node paths are in the same format as returned in getGCData -
417
456
  // `/<BlobManager.basePath>/<blobId>`.
418
457
  for (const route of unusedRoutes) {
419
458
  const pathParts = route.split("/");
420
459
  (0, common_utils_1.assert)(pathParts.length === 3 && pathParts[1] === BlobManager.basePath, 0x2d5 /* "Invalid blob node id in unused routes." */);
421
460
  const blobId = pathParts[2];
422
- // The unused blobId could be a localId. If so, remove it from the redirect table and continue. The
423
- // corresponding storageId may still be used either directly or via other localIds.
424
- if ((_a = this.redirectTable) === null || _a === void 0 ? void 0 : _a.has(blobId)) {
461
+ if (tombstone) {
462
+ // If tombstone is set, add this blob to the tombstone list.
463
+ this.tombstonedBlobs.add(blobId);
464
+ }
465
+ else {
466
+ // The unused blobId could be a localId. If so, remove it from the redirect table and continue. The
467
+ // corresponding storageId may still be used either directly or via other localIds.
425
468
  this.redirectTable.delete(blobId);
426
- continue;
427
469
  }
428
470
  }
429
471
  }
@@ -1 +1 @@
1
- {"version":3,"file":"blobManager.js","sourceRoot":"","sources":["../src/blobManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAkC;AAIlC,iEAA8F;AAE9F,+DAAmH;AAEnH,iFAAoE;AACpE,qEAAgF;AAMhF,2CAAuE;AAEvE;;;;;;GAMG;AACH,MAAa,UAAU;IAWnB,YACoB,IAAY,EACZ,YAAiC,EAC1C,GAAuB;QAFd,SAAI,GAAJ,IAAI,CAAQ;QACZ,iBAAY,GAAZ,YAAY,CAAqB;QAC1C,QAAG,GAAH,GAAG,CAAoB;QAb1B,aAAQ,GAAY,KAAK,CAAC;QAe9B,IAAI,CAAC,YAAY,GAAG,IAAA,yCAAyB,EAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3E,CAAC;IAdD,IAAW,YAAY,KAAmB,OAAO,IAAI,CAAC,CAAC,CAAC;IAExD,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAYM,WAAW;QACd,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACzB,CAAC;IAEM,IAAI,CAAC,MAAoB;QAC5B,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAA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G,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE;YAC1C,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAA,6BAAc,EAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;SAC/D;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;;AAneL,kCAoeC;AAne0B,oBAAQ,GAAG,QAAQ,CAAC;AACnB,iCAAqB,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { IFluidHandle, IFluidHandleContext } from \"@fluidframework/core-interfaces\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ICreateBlobResponse, ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { generateHandleContextPath, SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, bufferToString, Deferred, stringToBuffer, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IContainerRuntime, IContainerRuntimeEvents } from \"@fluidframework/container-runtime-definitions\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { ChildLogger, PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport {\n IGarbageCollectionData,\n ISummaryTreeWithStats,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { Throttler, formExponentialFn, IThrottler } from \"./throttler\";\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 implements IFluidHandle<ArrayBufferLike> {\n private attached: boolean = false;\n\n public get IFluidHandle(): IFluidHandle { return this; }\n\n public get isAttached(): boolean {\n return this.attached;\n }\n\n public readonly absolutePath: string;\n\n constructor(\n public readonly path: string,\n public readonly routeContext: IFluidHandleContext,\n public get: () => Promise<any>,\n ) {\n this.absolutePath = generateHandleContextPath(path, this.routeContext);\n }\n\n public attachGraph() {\n this.attached = true;\n }\n\n public bind(handle: IFluidHandle) {\n throw new Error(\"Cannot bind to blob handle\");\n }\n}\n\nclass CancellableThrottler {\n constructor(private readonly throttler: IThrottler) { }\n private cancelP = new Deferred<void>();\n\n public async getDelay(): Promise<void> {\n return Promise.race([\n this.cancelP.promise,\n new Promise<void>((resolve) => setTimeout(resolve, this.throttler.getDelay())),\n ]);\n }\n\n public cancel() {\n this.cancelP.resolve();\n this.cancelP = new Deferred<void>();\n }\n}\n\n/**\n * Information from a snapshot needed to load BlobManager\n */\nexport interface IBlobManagerLoadInfo {\n ids?: string[];\n redirectTable?: [string, string][];\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 =\n Pick<IContainerRuntime, \"attachState\" | \"connected\" | \"logger\"> & TypedEventEmitter<IContainerRuntimeEvents>;\n\n// Note that while offline we \"submit\" an op before uploading the blob, but we always\n// expect blobs to be uploaded before we actually see the op round-trip\nenum PendingBlobStatus {\n OnlinePendingUpload,\n OnlinePendingOp,\n OfflinePendingUpload,\n OfflinePendingOp,\n}\n\ninterface PendingBlob {\n blob: ArrayBufferLike;\n status: PendingBlobStatus;\n storageId?: string;\n handleP: Deferred<IFluidHandle<ArrayBufferLike>>;\n uploadP: Promise<ICreateBlobResponse>;\n}\n\nexport interface IPendingBlobs { [id: string]: { blob: string; }; }\n\nexport class BlobManager {\n public static readonly basePath = \"_blobs\";\n private static readonly redirectTableBlobName = \".redirectTable\";\n private readonly logger: ITelemetryLogger;\n\n /**\n * Map of local (offline/detached) IDs to storage IDs. Contains identity entries\n * (id → id) for storage IDs, so all requested IDs should be a key in this map.\n * Blobs created while the container is detached are stored in IDetachedBlobStorage\n * which gives local IDs; the storage IDs are filled in at attach time.\n */\n private readonly redirectTable: Map<string, string | undefined>;\n\n /**\n * Blobs which have not been uploaded or for which we have not yet seen a BlobAttach op round-trip.\n * Until we see the op round-trip, there is a possibility we may need to re-upload the blob, so\n * we must save it. This is true for both the online and offline flow.\n */\n private readonly pendingBlobs: Map<string, PendingBlob> = new Map();\n\n /**\n * Track ops in flight for online flow. Used to avoid searching pendingBlobs since BlobAttach ops\n * don't include local ID in online flow.\n */\n private readonly opsInFlight: Map<string, string[]> = new Map();\n\n private readonly retryThrottler = new CancellableThrottler(new Throttler(\n 60 * 1000, // 60 sec delay window\n 30 * 1000, // 30 sec max delay\n // throttling function increases exponentially (0ms, 40ms, 80ms, 160ms, etc)\n formExponentialFn({ coefficient: 20, initialDelay: 0 }),\n ));\n\n constructor(\n private readonly routeContext: IFluidHandleContext,\n snapshot: IBlobManagerLoadInfo,\n private readonly getStorage: () => IDocumentStorageService,\n /**\n * Submit a BlobAttach op. When a blob is uploaded, there is a short grace period before which\n * the blob is deleted. The BlobAttach op notifies the server that blob is in use. The server\n * will then not delete the blob as long as it is listed as referenced in future summaries.\n * The summarizing client will know to include the storage ID in the summary when it sees the op.\n *\n * The op may also include a local ID to inform all clients of the relation to the storage\n * ID, without knowledge of which they cannot request the blob from storage. This is also\n * included in the redirect table in the summary.\n */\n private readonly sendBlobAttachOp: (storageId?: string, localId?: string) => void,\n // To be called when a blob node is requested. blobPath is the path of the blob's node in GC's graph. It's\n // of the format `/<BlobManager.basePath>/<blobId>`.\n private readonly gcNodeUpdated: (blobPath: string) => void,\n private readonly runtime: IBlobManagerRuntime,\n stashedBlobs: IPendingBlobs = {},\n ) {\n this.logger = ChildLogger.create(this.runtime.logger, \"BlobManager\");\n this.runtime.on(\"disconnected\", () => this.onDisconnected());\n this.redirectTable = this.load(snapshot);\n\n // Begin uploading stashed blobs from previous container instance\n Object.entries(stashedBlobs).forEach(([localId, entry]) => {\n const blob = stringToBuffer(entry.blob, \"base64\");\n this.pendingBlobs.set(localId, {\n blob,\n status: PendingBlobStatus.OfflinePendingUpload,\n handleP: new Deferred(),\n uploadP: this.uploadBlob(localId, blob),\n });\n });\n }\n\n private get pendingOfflineUploads() {\n return Array.from(this.pendingBlobs.values())\n .filter((e) => e.status === PendingBlobStatus.OfflinePendingUpload);\n }\n\n public get hasPendingOfflineUploads(): boolean {\n return this.pendingOfflineUploads.length > 0;\n }\n\n /**\n * Upload blobs added while offline. This must be completed before connecting and resubmitting ops.\n */\n public async onConnected() {\n this.retryThrottler.cancel();\n const pendingUploads = this.pendingOfflineUploads.map(async (e) => e.uploadP);\n await PerformanceEvent.timedExecAsync(this.logger, {\n eventName: \"BlobUploadOnConnected\",\n count: pendingUploads.length,\n }, async () => Promise.all(pendingUploads),\n { start: true, end: true },\n );\n }\n\n /**\n * Transition online blobs waiting for BlobAttach op round-trip since we will not see the op until we are connected\n * again\n */\n private onDisconnected() {\n for (const [localId, entry] of this.pendingBlobs) {\n if (entry.status === PendingBlobStatus.OnlinePendingOp) {\n // This will submit another BlobAttach op for this blob. This is necessary because the one we sent\n // already didn't have the local ID.\n this.transitionToOffline(localId);\n }\n }\n }\n\n /**\n * For a blobId, returns its path in GC's graph. The node path is of the format `/<BlobManager.basePath>/<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 */\n private getBlobGCNodePath(blobId: string) {\n return `/${BlobManager.basePath}/${blobId}`;\n }\n\n /**\n * Set of actual storage IDs (i.e., IDs that can be requested from storage). This will be empty if the container is\n * detached or there are no (non-pending) attachment blobs in the document\n */\n private get storageIds(): Set<string> {\n const ids = new Set<string | undefined>(this.redirectTable.values());\n\n // If we are detached, we will not have storage IDs, only undefined\n const undefinedValueInTable = ids.delete(undefined);\n\n // For a detached container, entries are inserted into the redirect table with an undefined storage ID.\n // For an attached container, entries are inserted w/storage ID after the BlobAttach op round-trips.\n assert(!undefinedValueInTable || this.runtime.attachState === AttachState.Detached && ids.size === 0,\n 0x382 /* 'redirectTable' must contain only undefined while detached / defined values while attached */);\n\n return ids as Set<string>;\n }\n\n public async getBlob(blobId: string): Promise<ArrayBufferLike> {\n const pending = this.pendingBlobs.get(blobId);\n if (pending) {\n return pending.blob;\n }\n let storageId;\n if (this.runtime.attachState === AttachState.Detached) {\n assert(this.redirectTable.has(blobId), 0x383 /* requesting unknown blobs */);\n\n // Blobs created while the container is detached are stored in IDetachedBlobStorage.\n // The 'IDocumentStorageService.readBlob()' call below will retrieve these via localId.\n storageId = blobId;\n } else {\n storageId = this.redirectTable.get(blobId);\n assert(!!storageId, 0x11f /* \"requesting unknown blobs\" */);\n }\n\n // When a GC-able (not pending) blob is retrieved, let runtime know that the corresponding GC node got updated.\n this.gcNodeUpdated(this.getBlobGCNodePath(blobId));\n\n return PerformanceEvent.timedExecAsync(\n this.logger,\n { eventName: \"AttachmentReadBlob\", id: storageId },\n async () => {\n return this.getStorage().readBlob(storageId);\n },\n { end: true, cancel: \"error\" },\n );\n }\n\n private getBlobHandle(id: string): IFluidHandle<ArrayBufferLike> {\n assert(this.redirectTable.has(id) || this.pendingBlobs.has(id),\n 0x384 /* requesting handle for unknown blob */);\n return new BlobHandle(\n `${BlobManager.basePath}/${id}`,\n this.routeContext,\n async () => this.getBlob(id),\n );\n }\n\n private async createBlobDetached(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n // Blobs created while the container is detached are stored in IDetachedBlobStorage.\n // The 'IDocumentStorageService.createBlob()' call below will respond with a localId.\n const response = await this.getStorage().createBlob(blob);\n this.redirectTable.set(response.id, undefined);\n return this.getBlobHandle(response.id);\n }\n\n public async createBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n if (this.runtime.attachState === AttachState.Detached) {\n return this.createBlobDetached(blob);\n }\n if (this.runtime.attachState === AttachState.Attaching) {\n // blob upload is not supported in \"Attaching\" state\n this.logger.sendTelemetryEvent({ eventName: \"CreateBlobWhileAttaching\" });\n await new Promise<void>((resolve) => this.runtime.once(\"attached\", resolve));\n }\n assert(this.runtime.attachState === AttachState.Attached,\n 0x385 /* For clarity and paranoid defense against adding future attachment states */);\n\n // Create a local ID for each blob. This is used to support blobs if/when the client goes\n // offline since we don't have the ID from storage yet. If online flow succeeds this won't be used.\n const localId = uuid();\n const pendingEntry: PendingBlob = {\n blob,\n status: PendingBlobStatus.OnlinePendingUpload,\n handleP: new Deferred(),\n uploadP: this.uploadBlob(localId, blob),\n };\n this.pendingBlobs.set(localId, pendingEntry);\n\n return pendingEntry.handleP.promise;\n }\n\n private async uploadBlob(localId: string, blob: ArrayBufferLike): Promise<ICreateBlobResponse> {\n return PerformanceEvent.timedExecAsync(\n this.logger,\n { eventName: \"createBlob\" },\n async () => this.getStorage().createBlob(blob),\n { end: true, cancel: this.runtime.connected ? \"error\" : \"generic\" },\n ).then(\n (response) => this.onUploadResolve(localId, response),\n async (err) => this.onUploadReject(localId, err),\n );\n }\n\n private onUploadResolve(localId: string, response: ICreateBlobResponse) {\n const entry = this.pendingBlobs.get(localId);\n assert(entry?.status === PendingBlobStatus.OnlinePendingUpload ||\n entry?.status === PendingBlobStatus.OfflinePendingUpload,\n 0x386 /* Must have pending blob entry for uploaded blob */);\n entry.storageId = response.id;\n if (this.runtime.connected) {\n if (entry.status === PendingBlobStatus.OnlinePendingUpload) {\n if (this.storageIds.has(response.id)) {\n // Storage may dedupe blobs and give us an ID we already know\n // no need to submit BlobAttach op in this case\n entry.handleP.resolve(this.getBlobHandle(response.id));\n this.pendingBlobs.delete(localId);\n } else {\n // Check for still-pending duplicates too; if an op is already in flight we can wait for that one\n if (!this.opsInFlight.has(response.id)) {\n this.sendBlobAttachOp(response.id);\n }\n this.opsInFlight.set(response.id, (this.opsInFlight.get(response.id) ?? []).concat(localId));\n entry.status = PendingBlobStatus.OnlinePendingOp;\n }\n } else if (entry.status === PendingBlobStatus.OfflinePendingUpload) {\n // We already submitted a BlobAttach op for this blob when it was transitioned to offline flow\n entry.status = PendingBlobStatus.OfflinePendingOp;\n }\n } else {\n // connected to storage but not ordering service?\n this.logger.sendTelemetryEvent({ eventName: \"BlobUploadSuccessWhileDisconnected\" });\n if (entry.status === PendingBlobStatus.OnlinePendingUpload) {\n this.transitionToOffline(localId);\n }\n entry.status = PendingBlobStatus.OfflinePendingOp;\n }\n return response;\n }\n\n private async onUploadReject(localId: string, error) {\n const entry = this.pendingBlobs.get(localId);\n assert(!!entry, 0x387 /* Must have pending blob entry for blob which failed to upload */);\n if (!this.runtime.connected) {\n if (entry.status === PendingBlobStatus.OnlinePendingUpload) {\n this.transitionToOffline(localId);\n }\n // we are probably not connected to storage but start another upload request in case we are\n entry.uploadP = this.retryThrottler.getDelay().then(async () => this.uploadBlob(localId, entry.blob));\n return entry.uploadP;\n } else {\n entry.handleP.reject(error);\n throw error;\n }\n }\n\n private transitionToOffline(localId: string) {\n assert(!this.runtime.connected, 0x388 /* Must only transition to offline flow while runtime is disconnected */);\n const entry = this.pendingBlobs.get(localId);\n assert(!!entry, 0x389 /* No pending blob entry */);\n assert([PendingBlobStatus.OnlinePendingUpload, PendingBlobStatus.OnlinePendingOp].includes(entry.status),\n 0x38a /* Blob must be in online flow to transition to offline flow */);\n\n entry.status = entry.status === PendingBlobStatus.OnlinePendingUpload\n ? PendingBlobStatus.OfflinePendingUpload\n : PendingBlobStatus.OfflinePendingOp;\n\n // Submit a BlobAttach op. It's important we submit this op now before returning the blob handle so the\n // BlobAttach op is sequenced prior to any ops referencing the handle. Otherwise an invalid handle could be\n // added to the document if the ops are not all successfully submitted upon reconnection.\n // storageId may be undefined but since we are not connected we will have a chance to add it when reSubmit()\n // is called\n this.sendBlobAttachOp(entry.storageId, localId);\n entry.handleP.resolve(this.getBlobHandle(localId));\n }\n\n /**\n * Resubmit a BlobAttach op. Used to add storage IDs to ops that were\n * submitted to runtime while disconnected.\n * @param metadata - op metadata containing storage and/or local IDs\n */\n public reSubmit(metadata: Record<string, unknown> | undefined) {\n assert(!!metadata, 0x38b /* Resubmitted ops must have metadata */);\n const { blobId, localId }: { blobId?: string; localId?: string; } = metadata;\n if (!blobId) {\n assert(!!localId, 0x38c /* Submitted BlobAttach ops must have a blobId or localId */);\n // We submitted this op while offline. The blob should have been uploaded by now.\n const pendingEntry = this.pendingBlobs.get(localId);\n assert(pendingEntry?.status === PendingBlobStatus.OfflinePendingOp &&\n !!pendingEntry?.storageId, 0x38d /* blob must be uploaded before resubmitting BlobAttach op */);\n return this.sendBlobAttachOp(pendingEntry.storageId, localId);\n }\n return this.sendBlobAttachOp(blobId, localId);\n }\n\n public processBlobAttachOp(message: ISequencedDocumentMessage, local: boolean) {\n assert(message?.metadata?.blobId, 0x12a /* \"Missing blob id on metadata\" */);\n if (message.metadata.localId !== undefined) {\n this.redirectTable.set(message.metadata.localId, message.metadata.blobId);\n }\n // set identity (id -> id) entry\n this.redirectTable.set(message.metadata.blobId, message.metadata.blobId);\n\n if (local) {\n if (message.metadata.localId === undefined) {\n // Since there is no local ID, we know this op was submitted while online.\n const waitingBlobs = this.opsInFlight.get(message.metadata.blobId);\n assert(!!waitingBlobs, 0x38e /* local online BlobAttach op with no pending blob */);\n waitingBlobs.forEach((localId) => {\n const pendingBlobEntry = this.pendingBlobs.get(localId);\n assert(\n pendingBlobEntry !== undefined,\n 0x38f, /* local online BlobAttach op with no pending blob entry */\n );\n\n // It's possible we transitioned to offline flow while waiting for this op.\n if (pendingBlobEntry.status === PendingBlobStatus.OnlinePendingOp) {\n pendingBlobEntry.handleP.resolve(this.getBlobHandle(message.metadata.blobId));\n this.pendingBlobs.delete(localId);\n }\n });\n } else {\n // Each local ID is unique; get the pending blob entry and delete it\n assert(this.pendingBlobs.get(message.metadata.localId)?.status === PendingBlobStatus.OfflinePendingOp,\n 0x1f8 /* \"local BlobAttach op with no pending blob\" */);\n this.pendingBlobs.delete(message.metadata.localId);\n }\n }\n }\n\n /**\n * Reads blobs needed to load BlobManager from storage.\n * @param blobsTree - Tree containing IDs of previously attached blobs. We\n * look for the IDs in the blob entries of the tree since the both the r11s\n * and SPO drivers replace the attachment types returned in snapshot() with blobs.\n */\n public static async load(\n blobsTree: ISnapshotTree | undefined,\n tryFetchBlob: (id: string) => Promise<[string, string][]>,\n ): Promise<IBlobManagerLoadInfo> {\n if (!blobsTree) {\n return {};\n }\n let redirectTable;\n const tableId = blobsTree.blobs[this.redirectTableBlobName];\n if (tableId) {\n redirectTable = await tryFetchBlob(tableId);\n }\n const ids = Object.entries(blobsTree.blobs)\n .filter(([k, _]) => k !== this.redirectTableBlobName).map(([_, v]) => v);\n return { ids, redirectTable };\n }\n\n /**\n * Load a set of previously attached blob IDs and redirect table from a previous snapshot.\n */\n private load(snapshot: IBlobManagerLoadInfo): Map<string, string | undefined> {\n this.logger.sendTelemetryEvent({\n eventName: \"AttachmentBlobsLoaded\",\n count: snapshot.ids?.length ?? 0,\n redirectTable: snapshot.redirectTable?.length,\n });\n const table = new Map<string, string | undefined>(snapshot.redirectTable);\n if (snapshot.ids) {\n const detached = this.runtime.attachState === AttachState.Detached;\n // If we are detached, we don't have storage IDs yet, so set to undefined\n // Otherwise, set identity (id -> id) entries\n snapshot.ids.forEach((entry) => table.set(entry, detached ? undefined : entry));\n }\n return table;\n }\n\n /**\n * Generates data used for garbage collection. Each blob uploaded represents a node in the GC graph as it can be\n * individually referenced by storing its handle in a referenced DDS. Returns the list of blob ids as GC nodes.\n * @param fullGC - true to bypass optimizations and force full generation of GC data. BlobManager doesn't care\n * about this for now because the data is a simple list of blob ids.\n */\n public getGCData(fullGC: boolean = false): IGarbageCollectionData {\n const gcData: IGarbageCollectionData = { gcNodes: {} };\n /**\n * The node path is of the format `/_blobs/blobId`. This path must match the path of the blob handle returned\n * by the createBlob API because blobs are marked referenced by storing these handles in a referenced DDS.\n */\n this.storageIds.forEach((blobId: string) => {\n gcData.gcNodes[this.getBlobGCNodePath(blobId)] = [];\n });\n\n // For some blobs, the handle returned on creation is based off of the localId. So, these\n // nodes can be referenced by storing the localId handle. When that happens, the corresponding storageId node\n // must also be marked referenced. So, we add a route from the localId node to the storageId node.\n // Note that because of de-duping, there can be multiple localIds that all redirect to the same storageId or\n // a blob may be referenced via its storageId handle.\n for (const [localId, storageId] of this.redirectTable) {\n assert(!!storageId, 0x390 /* Must be attached to get GC data */);\n // Add node for the localId and add a route to the storageId node. The storageId node will have been\n // added above when adding nodes for this.blobIds.\n gcData.gcNodes[this.getBlobGCNodePath(localId)] = [this.getBlobGCNodePath(storageId)];\n }\n\n return gcData;\n }\n\n /**\n * When running GC in test mode, this is called to delete blobs that are unused.\n * @param unusedRoutes - These are the blob node ids that are unused and should be deleted.\n */\n public deleteUnusedRoutes(unusedRoutes: string[]): void {\n // The routes or blob node paths are in the same format as returned in getGCData -\n // `/<BlobManager.basePath>/<blobId>`.\n for (const route of unusedRoutes) {\n const pathParts = route.split(\"/\");\n assert(\n pathParts.length === 3 && pathParts[1] === BlobManager.basePath,\n 0x2d5 /* \"Invalid blob node id in unused routes.\" */,\n );\n const blobId = pathParts[2];\n\n // The unused blobId could be a localId. If so, remove it from the redirect table and continue. The\n // corresponding storageId may still be used either directly or via other localIds.\n if (this.redirectTable?.has(blobId)) {\n this.redirectTable.delete(blobId);\n continue;\n }\n }\n }\n\n public summarize(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n // if storageIds is empty, it means we are detached and have only local IDs, or that there are no blobs attached\n const blobIds = this.storageIds.size > 0 ? Array.from(this.storageIds) : Array.from(this.redirectTable.keys());\n const builder = new SummaryTreeBuilder();\n blobIds.forEach((blobId) => {\n builder.addAttachment(blobId);\n });\n\n // Any non-identity entries in the table need to be saved in the summary\n if (this.redirectTable.size > blobIds.length) {\n builder.addBlob(\n BlobManager.redirectTableBlobName,\n // filter out identity entries\n JSON.stringify(Array.from(this.redirectTable.entries())\n .filter(([localId, storageId]) => localId !== storageId)),\n );\n }\n\n return builder.getSummaryTree();\n }\n\n public setRedirectTable(table: Map<string, string>) {\n assert(this.runtime.attachState === AttachState.Detached,\n 0x252 /* \"redirect table can only be set in detached container\" */);\n assert(this.redirectTable.size === table.size,\n 0x391 /* Redirect table size must match BlobManager's local ID count */);\n for (const [localId, storageId] of table) {\n assert(this.redirectTable.has(localId), 0x254 /* \"unrecognized id in redirect table\" */);\n this.redirectTable.set(localId, storageId);\n // set identity (id -> id) entry\n this.redirectTable.set(storageId, storageId);\n }\n }\n\n public getPendingBlobs(): IPendingBlobs {\n const blobs = {};\n for (const [key, entry] of this.pendingBlobs) {\n blobs[key] = { blob: bufferToString(entry.blob, \"base64\") };\n }\n return blobs;\n }\n}\n"]}
1
+ {"version":3,"file":"blobManager.js","sourceRoot":"","sources":["../src/blobManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAkC;AAIlC,iEAKuC;AACvC,+DAAmH;AAEnH,iFAAoE;AACpE,qEAA8H;AAM9H,2CAAuE;AACvE,yEAAkE;AAClE,6EAAwE;AAExE;;;;;;GAMG;AACH,MAAa,UAAU;IAWnB,YACoB,IAAY,EACZ,YAAiC,EAC1C,GAAuB;QAFd,SAAI,GAAJ,IAAI,CAAQ;QACZ,iBAAY,GAAZ,YAAY,CAAqB;QAC1C,QAAG,GAAH,GAAG,CAAoB;QAb1B,aAAQ,GAAY,KAAK,CAAC;QAe9B,IAAI,CAAC,YAAY,GAAG,IAAA,yCAAyB,EAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3E,CAAC;IAdD,IAAW,YAAY,KAAmB,OAAO,IAAI,CAAC,CAAC,CAAC;IAExD,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAYM,WAAW;QACd,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACzB,CAAC;IAEM,IAAI,CAAC,MAAoB;QAC5B,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAClD,CAAC;CACJ;AA1BD,gCA0BC;AAED,MAAM,oBAAoB;IACtB,YAA6B,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;QAC1C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AAE,KAAK,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE;YAC1C,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAA,6BAAc,EAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;SAC/D;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;;AAphBL,kCAqhBC;AAphB0B,oBAAQ,GAAG,QAAQ,CAAC;AACnB,iCAAqB,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { IFluidHandle, IFluidHandleContext } from \"@fluidframework/core-interfaces\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ICreateBlobResponse, ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n createResponseError,\n generateHandleContextPath,\n responseToException,\n SummaryTreeBuilder,\n} from \"@fluidframework/runtime-utils\";\nimport { assert, bufferToString, Deferred, stringToBuffer, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IContainerRuntime, IContainerRuntimeEvents } from \"@fluidframework/container-runtime-definitions\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { ChildLogger, loggerToMonitoringContext, MonitoringContext, PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport {\n IGarbageCollectionData,\n ISummaryTreeWithStats,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { Throttler, formExponentialFn, IThrottler } from \"./throttler\";\nimport { summarizerClientType } from \"./summarizerClientElection\";\nimport { throwOnTombstoneUsageKey } from \"./garbageCollectionConstants\";\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 implements IFluidHandle<ArrayBufferLike> {\n private attached: boolean = false;\n\n public get IFluidHandle(): IFluidHandle { return this; }\n\n public get isAttached(): boolean {\n return this.attached;\n }\n\n public readonly absolutePath: string;\n\n constructor(\n public readonly path: string,\n public readonly routeContext: IFluidHandleContext,\n public get: () => Promise<any>,\n ) {\n this.absolutePath = generateHandleContextPath(path, this.routeContext);\n }\n\n public attachGraph() {\n this.attached = true;\n }\n\n public bind(handle: IFluidHandle) {\n throw new Error(\"Cannot bind to blob handle\");\n }\n}\n\nclass CancellableThrottler {\n constructor(private readonly throttler: IThrottler) { }\n private cancelP = new Deferred<void>();\n\n public async getDelay(): Promise<void> {\n return Promise.race([\n this.cancelP.promise,\n new Promise<void>((resolve) => setTimeout(resolve, this.throttler.getDelay())),\n ]);\n }\n\n public cancel() {\n this.cancelP.resolve();\n this.cancelP = new Deferred<void>();\n }\n}\n\n/**\n * Information from a snapshot needed to load BlobManager\n */\nexport interface IBlobManagerLoadInfo {\n ids?: string[];\n redirectTable?: [string, string][];\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 =\n Pick<IContainerRuntime, \"attachState\" | \"connected\" | \"logger\" | \"clientDetails\"> & TypedEventEmitter<IContainerRuntimeEvents>;\n\n// Note that while offline we \"submit\" an op before uploading the blob, but we always\n// expect blobs to be uploaded before we actually see the op round-trip\nenum PendingBlobStatus {\n OnlinePendingUpload,\n OnlinePendingOp,\n OfflinePendingUpload,\n OfflinePendingOp,\n}\n\ninterface PendingBlob {\n blob: ArrayBufferLike;\n status: PendingBlobStatus;\n storageId?: string;\n handleP: Deferred<IFluidHandle<ArrayBufferLike>>;\n uploadP: Promise<ICreateBlobResponse>;\n}\n\nexport interface IPendingBlobs { [id: string]: { blob: string; }; }\n\nexport class BlobManager {\n public static readonly basePath = \"_blobs\";\n private static readonly redirectTableBlobName = \".redirectTable\";\n private readonly mc: MonitoringContext;\n\n /**\n * Map of local (offline/detached) IDs to storage IDs. Contains identity entries\n * (id → id) for storage IDs, so all requested IDs should be a key in this map.\n * Blobs created while the container is detached are stored in IDetachedBlobStorage\n * which gives local IDs; the storage IDs are filled in at attach time.\n */\n private readonly redirectTable: Map<string, string | undefined>;\n\n /**\n * Blobs which have not been uploaded or for which we have not yet seen a BlobAttach op round-trip.\n * Until we see the op round-trip, there is a possibility we may need to re-upload the blob, so\n * we must save it. This is true for both the online and offline flow.\n */\n private readonly pendingBlobs: Map<string, PendingBlob> = new Map();\n\n /**\n * Track ops in flight for online flow. Used to avoid searching pendingBlobs since BlobAttach ops\n * don't include local ID in online flow.\n */\n private readonly opsInFlight: Map<string, string[]> = new Map();\n\n private readonly retryThrottler = new CancellableThrottler(new Throttler(\n 60 * 1000, // 60 sec delay window\n 30 * 1000, // 30 sec max delay\n // throttling function increases exponentially (0ms, 40ms, 80ms, 160ms, etc)\n formExponentialFn({ coefficient: 20, initialDelay: 0 }),\n ));\n\n /** If true, throw an error when a tombstone attachment blob is retrieved. */\n private readonly throwOnTombstoneUsage: boolean;\n /**\n * This stores ides of tombstoned blobs.\n * Tombstone is a temporary feature that imitates a blob getting swept by garbage collection.\n */\n private readonly tombstonedBlobs: Set<string> = new Set();\n\n constructor(\n private readonly routeContext: IFluidHandleContext,\n snapshot: IBlobManagerLoadInfo,\n private readonly getStorage: () => IDocumentStorageService,\n /**\n * Submit a BlobAttach op. When a blob is uploaded, there is a short grace period before which\n * the blob is deleted. The BlobAttach op notifies the server that blob is in use. The server\n * will then not delete the blob as long as it is listed as referenced in future summaries.\n * The summarizing client will know to include the storage ID in the summary when it sees the op.\n *\n * The op may also include a local ID to inform all clients of the relation to the storage\n * ID, without knowledge of which they cannot request the blob from storage. This is also\n * included in the redirect table in the summary.\n */\n private readonly sendBlobAttachOp: (storageId?: string, localId?: string) => void,\n // To be called when a blob node is requested. blobPath is the path of the blob's node in GC's graph. It's\n // of the format `/<BlobManager.basePath>/<blobId>`.\n private readonly gcNodeUpdated: (blobPath: string) => void,\n private readonly runtime: IBlobManagerRuntime,\n stashedBlobs: IPendingBlobs = {},\n ) {\n this.mc = loggerToMonitoringContext(ChildLogger.create(this.runtime.logger, \"BlobManager\"));\n // Read the feature flag that tells whether to throw when a tombstone blob is requested.\n this.throwOnTombstoneUsage =\n this.mc.config.getBoolean(throwOnTombstoneUsageKey) === true &&\n this.runtime.clientDetails.type !== summarizerClientType;\n\n this.runtime.on(\"disconnected\", () => this.onDisconnected());\n this.redirectTable = this.load(snapshot);\n\n // Begin uploading stashed blobs from previous container instance\n Object.entries(stashedBlobs).forEach(([localId, entry]) => {\n const blob = stringToBuffer(entry.blob, \"base64\");\n this.pendingBlobs.set(localId, {\n blob,\n status: PendingBlobStatus.OfflinePendingUpload,\n handleP: new Deferred(),\n uploadP: this.uploadBlob(localId, blob),\n });\n });\n }\n\n private get pendingOfflineUploads() {\n return Array.from(this.pendingBlobs.values())\n .filter((e) => e.status === PendingBlobStatus.OfflinePendingUpload);\n }\n\n public get hasPendingOfflineUploads(): boolean {\n return this.pendingOfflineUploads.length > 0;\n }\n\n /**\n * Upload blobs added while offline. This must be completed before connecting and resubmitting ops.\n */\n public async onConnected() {\n this.retryThrottler.cancel();\n const pendingUploads = this.pendingOfflineUploads.map(async (e) => e.uploadP);\n await PerformanceEvent.timedExecAsync(this.mc.logger, {\n eventName: \"BlobUploadOnConnected\",\n count: pendingUploads.length,\n }, async () => Promise.all(pendingUploads),\n { start: true, end: true },\n );\n }\n\n /**\n * Transition online blobs waiting for BlobAttach op round-trip since we will not see the op until we are connected\n * again\n */\n private onDisconnected() {\n for (const [localId, entry] of this.pendingBlobs) {\n if (entry.status === PendingBlobStatus.OnlinePendingOp) {\n // This will submit another BlobAttach op for this blob. This is necessary because the one we sent\n // already didn't have the local ID.\n this.transitionToOffline(localId);\n }\n }\n }\n\n /**\n * For a blobId, returns its path in GC's graph. The node path is of the format `/<BlobManager.basePath>/<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 */\n private getBlobGCNodePath(blobId: string) {\n return `/${BlobManager.basePath}/${blobId}`;\n }\n\n /**\n * Set of actual storage IDs (i.e., IDs that can be requested from storage). This will be empty if the container is\n * detached or there are no (non-pending) attachment blobs in the document\n */\n private get storageIds(): Set<string> {\n const ids = new Set<string | undefined>(this.redirectTable.values());\n\n // If we are detached, we will not have storage IDs, only undefined\n const undefinedValueInTable = ids.delete(undefined);\n\n // For a detached container, entries are inserted into the redirect table with an undefined storage ID.\n // For an attached container, entries are inserted w/storage ID after the BlobAttach op round-trips.\n assert(!undefinedValueInTable || this.runtime.attachState === AttachState.Detached && ids.size === 0,\n 0x382 /* 'redirectTable' must contain only undefined while detached / defined values while attached */);\n\n return ids as Set<string>;\n }\n\n public async getBlob(blobId: string): Promise<ArrayBufferLike> {\n const request = { url: blobId };\n if (this.tombstonedBlobs.has(blobId) ) {\n const error = responseToException(createResponseError(404, \"Blob removed by gc\", request), request);\n this.mc.logger.sendErrorEvent({\n eventName: \"GC_Tombstone_Blob_Requested\",\n url: request.url,\n }, error);\n if (this.throwOnTombstoneUsage) {\n throw error;\n }\n }\n\n const pending = this.pendingBlobs.get(blobId);\n if (pending) {\n return pending.blob;\n }\n let storageId;\n if (this.runtime.attachState === AttachState.Detached) {\n assert(this.redirectTable.has(blobId), 0x383 /* requesting unknown blobs */);\n\n // Blobs created while the container is detached are stored in IDetachedBlobStorage.\n // The 'IDocumentStorageService.readBlob()' call below will retrieve these via localId.\n storageId = blobId;\n } else {\n storageId = this.redirectTable.get(blobId);\n assert(!!storageId, 0x11f /* \"requesting unknown blobs\" */);\n }\n\n // When a GC-able (not pending) blob is retrieved, let runtime know that the corresponding GC node got updated.\n this.gcNodeUpdated(this.getBlobGCNodePath(blobId));\n\n return PerformanceEvent.timedExecAsync(\n this.mc.logger,\n { eventName: \"AttachmentReadBlob\", id: storageId },\n async () => {\n return this.getStorage().readBlob(storageId);\n },\n { end: true, cancel: \"error\" },\n );\n }\n\n private getBlobHandle(id: string): IFluidHandle<ArrayBufferLike> {\n assert(this.redirectTable.has(id) || this.pendingBlobs.has(id),\n 0x384 /* requesting handle for unknown blob */);\n return new BlobHandle(\n `${BlobManager.basePath}/${id}`,\n this.routeContext,\n async () => this.getBlob(id),\n );\n }\n\n private async createBlobDetached(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n // Blobs created while the container is detached are stored in IDetachedBlobStorage.\n // The 'IDocumentStorageService.createBlob()' call below will respond with a localId.\n const response = await this.getStorage().createBlob(blob);\n this.redirectTable.set(response.id, undefined);\n return this.getBlobHandle(response.id);\n }\n\n public async createBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n if (this.runtime.attachState === AttachState.Detached) {\n return this.createBlobDetached(blob);\n }\n if (this.runtime.attachState === AttachState.Attaching) {\n // blob upload is not supported in \"Attaching\" state\n this.mc.logger.sendTelemetryEvent({ eventName: \"CreateBlobWhileAttaching\" });\n await new Promise<void>((resolve) => this.runtime.once(\"attached\", resolve));\n }\n assert(this.runtime.attachState === AttachState.Attached,\n 0x385 /* For clarity and paranoid defense against adding future attachment states */);\n\n // Create a local ID for each blob. This is used to support blobs if/when the client goes\n // offline since we don't have the ID from storage yet. If online flow succeeds this won't be used.\n const localId = uuid();\n const pendingEntry: PendingBlob = {\n blob,\n status: PendingBlobStatus.OnlinePendingUpload,\n handleP: new Deferred(),\n uploadP: this.uploadBlob(localId, blob),\n };\n this.pendingBlobs.set(localId, pendingEntry);\n\n return pendingEntry.handleP.promise;\n }\n\n private async uploadBlob(localId: string, blob: ArrayBufferLike): Promise<ICreateBlobResponse> {\n return PerformanceEvent.timedExecAsync(\n this.mc.logger,\n { eventName: \"createBlob\" },\n async () => this.getStorage().createBlob(blob),\n { end: true, cancel: this.runtime.connected ? \"error\" : \"generic\" },\n ).then(\n (response) => this.onUploadResolve(localId, response),\n async (err) => this.onUploadReject(localId, err),\n );\n }\n\n private onUploadResolve(localId: string, response: ICreateBlobResponse) {\n const entry = this.pendingBlobs.get(localId);\n assert(entry?.status === PendingBlobStatus.OnlinePendingUpload ||\n entry?.status === PendingBlobStatus.OfflinePendingUpload,\n 0x386 /* Must have pending blob entry for uploaded blob */);\n entry.storageId = response.id;\n if (this.runtime.connected) {\n if (entry.status === PendingBlobStatus.OnlinePendingUpload) {\n if (this.storageIds.has(response.id)) {\n // Storage may dedupe blobs and give us an ID we already know\n // no need to submit BlobAttach op in this case\n entry.handleP.resolve(this.getBlobHandle(response.id));\n this.pendingBlobs.delete(localId);\n } else {\n // Check for still-pending duplicates too; if an op is already in flight we can wait for that one\n if (!this.opsInFlight.has(response.id)) {\n this.sendBlobAttachOp(response.id);\n }\n this.opsInFlight.set(response.id, (this.opsInFlight.get(response.id) ?? []).concat(localId));\n entry.status = PendingBlobStatus.OnlinePendingOp;\n }\n } else if (entry.status === PendingBlobStatus.OfflinePendingUpload) {\n // We already submitted a BlobAttach op for this blob when it was transitioned to offline flow\n entry.status = PendingBlobStatus.OfflinePendingOp;\n }\n } else {\n // connected to storage but not ordering service?\n this.mc.logger.sendTelemetryEvent({ eventName: \"BlobUploadSuccessWhileDisconnected\" });\n if (entry.status === PendingBlobStatus.OnlinePendingUpload) {\n this.transitionToOffline(localId);\n }\n entry.status = PendingBlobStatus.OfflinePendingOp;\n }\n return response;\n }\n\n private async onUploadReject(localId: string, error) {\n const entry = this.pendingBlobs.get(localId);\n assert(!!entry, 0x387 /* Must have pending blob entry for blob which failed to upload */);\n if (!this.runtime.connected) {\n if (entry.status === PendingBlobStatus.OnlinePendingUpload) {\n this.transitionToOffline(localId);\n }\n // we are probably not connected to storage but start another upload request in case we are\n entry.uploadP = this.retryThrottler.getDelay().then(async () => this.uploadBlob(localId, entry.blob));\n return entry.uploadP;\n } else {\n entry.handleP.reject(error);\n throw error;\n }\n }\n\n private transitionToOffline(localId: string) {\n assert(!this.runtime.connected, 0x388 /* Must only transition to offline flow while runtime is disconnected */);\n const entry = this.pendingBlobs.get(localId);\n assert(!!entry, 0x389 /* No pending blob entry */);\n assert([PendingBlobStatus.OnlinePendingUpload, PendingBlobStatus.OnlinePendingOp].includes(entry.status),\n 0x38a /* Blob must be in online flow to transition to offline flow */);\n\n entry.status = entry.status === PendingBlobStatus.OnlinePendingUpload\n ? PendingBlobStatus.OfflinePendingUpload\n : PendingBlobStatus.OfflinePendingOp;\n\n // Submit a BlobAttach op. It's important we submit this op now before returning the blob handle so the\n // BlobAttach op is sequenced prior to any ops referencing the handle. Otherwise an invalid handle could be\n // added to the document if the ops are not all successfully submitted upon reconnection.\n // storageId may be undefined but since we are not connected we will have a chance to add it when reSubmit()\n // is called\n this.sendBlobAttachOp(entry.storageId, localId);\n entry.handleP.resolve(this.getBlobHandle(localId));\n }\n\n /**\n * Resubmit a BlobAttach op. Used to add storage IDs to ops that were\n * submitted to runtime while disconnected.\n * @param metadata - op metadata containing storage and/or local IDs\n */\n public reSubmit(metadata: Record<string, unknown> | undefined) {\n assert(!!metadata, 0x38b /* Resubmitted ops must have metadata */);\n const { blobId, localId }: { blobId?: string; localId?: string; } = metadata;\n if (!blobId) {\n assert(!!localId, 0x38c /* Submitted BlobAttach ops must have a blobId or localId */);\n // We submitted this op while offline. The blob should have been uploaded by now.\n const pendingEntry = this.pendingBlobs.get(localId);\n assert(pendingEntry?.status === PendingBlobStatus.OfflinePendingOp &&\n !!pendingEntry?.storageId, 0x38d /* blob must be uploaded before resubmitting BlobAttach op */);\n return this.sendBlobAttachOp(pendingEntry.storageId, localId);\n }\n return this.sendBlobAttachOp(blobId, localId);\n }\n\n public processBlobAttachOp(message: ISequencedDocumentMessage, local: boolean) {\n assert(message?.metadata?.blobId, 0x12a /* \"Missing blob id on metadata\" */);\n if (message.metadata.localId !== undefined) {\n this.redirectTable.set(message.metadata.localId, message.metadata.blobId);\n }\n // set identity (id -> id) entry\n this.redirectTable.set(message.metadata.blobId, message.metadata.blobId);\n\n if (local) {\n if (message.metadata.localId === undefined) {\n // Since there is no local ID, we know this op was submitted while online.\n const waitingBlobs = this.opsInFlight.get(message.metadata.blobId);\n assert(!!waitingBlobs, 0x38e /* local online BlobAttach op with no pending blob */);\n waitingBlobs.forEach((localId) => {\n const pendingBlobEntry = this.pendingBlobs.get(localId);\n assert(\n pendingBlobEntry !== undefined,\n 0x38f, /* local online BlobAttach op with no pending blob entry */\n );\n\n // It's possible we transitioned to offline flow while waiting for this op.\n if (pendingBlobEntry.status === PendingBlobStatus.OnlinePendingOp) {\n pendingBlobEntry.handleP.resolve(this.getBlobHandle(message.metadata.blobId));\n this.pendingBlobs.delete(localId);\n }\n });\n } else {\n // Each local ID is unique; get the pending blob entry and delete it\n assert(this.pendingBlobs.get(message.metadata.localId)?.status === PendingBlobStatus.OfflinePendingOp,\n 0x1f8 /* \"local BlobAttach op with no pending blob\" */);\n this.pendingBlobs.delete(message.metadata.localId);\n }\n }\n }\n\n /**\n * Reads blobs needed to load BlobManager from storage.\n * @param blobsTree - Tree containing IDs of previously attached blobs. We\n * look for the IDs in the blob entries of the tree since the both the r11s\n * and SPO drivers replace the attachment types returned in snapshot() with blobs.\n */\n public static async load(\n blobsTree: ISnapshotTree | undefined,\n tryFetchBlob: (id: string) => Promise<[string, string][]>,\n ): Promise<IBlobManagerLoadInfo> {\n if (!blobsTree) {\n return {};\n }\n let redirectTable;\n const tableId = blobsTree.blobs[this.redirectTableBlobName];\n if (tableId) {\n redirectTable = await tryFetchBlob(tableId);\n }\n const ids = Object.entries(blobsTree.blobs)\n .filter(([k, _]) => k !== this.redirectTableBlobName).map(([_, v]) => v);\n return { ids, redirectTable };\n }\n\n /**\n * Load a set of previously attached blob IDs and redirect table from a previous snapshot.\n */\n private load(snapshot: IBlobManagerLoadInfo): Map<string, string | undefined> {\n this.mc.logger.sendTelemetryEvent({\n eventName: \"AttachmentBlobsLoaded\",\n count: snapshot.ids?.length ?? 0,\n redirectTable: snapshot.redirectTable?.length,\n });\n const table = new Map<string, string | undefined>(snapshot.redirectTable);\n if (snapshot.ids) {\n const detached = this.runtime.attachState === AttachState.Detached;\n // If we are detached, we don't have storage IDs yet, so set to undefined\n // Otherwise, set identity (id -> id) entries\n snapshot.ids.forEach((entry) => table.set(entry, detached ? undefined : entry));\n }\n return table;\n }\n\n /**\n * Generates data used for garbage collection. Each blob uploaded represents a node in the GC graph as it can be\n * individually referenced by storing its handle in a referenced DDS. Returns the list of blob ids as GC nodes.\n * @param fullGC - true to bypass optimizations and force full generation of GC data. BlobManager doesn't care\n * about this for now because the data is a simple list of blob ids.\n */\n public getGCData(fullGC: boolean = false): IGarbageCollectionData {\n const gcData: IGarbageCollectionData = { gcNodes: {} };\n /**\n * The node path is of the format `/_blobs/blobId`. This path must match the path of the blob handle returned\n * by the createBlob API because blobs are marked referenced by storing these handles in a referenced DDS.\n */\n this.storageIds.forEach((blobId: string) => {\n gcData.gcNodes[this.getBlobGCNodePath(blobId)] = [];\n });\n\n // For some blobs, the handle returned on creation is based off of the localId. So, these\n // nodes can be referenced by storing the localId handle. When that happens, the corresponding storageId node\n // must also be marked referenced. So, we add a route from the localId node to the storageId node.\n // Note that because of de-duping, there can be multiple localIds that all redirect to the same storageId or\n // a blob may be referenced via its storageId handle.\n for (const [localId, storageId] of this.redirectTable) {\n assert(!!storageId, 0x390 /* Must be attached to get GC data */);\n // Add node for the localId and add a route to the storageId node. The storageId node will have been\n // added above when adding nodes for this.blobIds.\n gcData.gcNodes[this.getBlobGCNodePath(localId)] = [this.getBlobGCNodePath(storageId)];\n }\n\n return gcData;\n }\n\n /**\n * This is called to update blobs whose routes are used. The used blobs are removed from the tombstone list.\n * @param usedRoutes - The routes of the blob nodes that are used.\n */\n public updateUsedRoutes(usedRoutes: string[]) {\n // The routes or blob node paths are in the same format as returned in getGCData -\n // `/<BlobManager.basePath>/<blobId>`.\n for (const route of usedRoutes) {\n const pathParts = route.split(\"/\");\n assert(\n pathParts.length === 3 && pathParts[1] === BlobManager.basePath,\n 0x4bc /* Invalid blob node id in used routes. */,\n );\n const blobId = pathParts[2];\n // Un-tombstone the blob if it was marked tombstone.\n this.tombstonedBlobs.delete(blobId);\n }\n }\n\n /**\n * This is called to update blobs whose routes are unused. The unused blobs are either deleted or marked as\n * tombstones.\n * @param unusedRoutes - The routes of the blob nodes that are unused.\n * @param tombstone - if true, the objects corresponding to unused routes are marked tombstones. Otherwise, they\n * are deleted.\n */\n public updateUnusedRoutes(unusedRoutes: string[], tombstone: boolean): void {\n // The routes or blob node paths are in the same format as returned in getGCData -\n // `/<BlobManager.basePath>/<blobId>`.\n for (const route of unusedRoutes) {\n const pathParts = route.split(\"/\");\n assert(\n pathParts.length === 3 && pathParts[1] === BlobManager.basePath,\n 0x2d5 /* \"Invalid blob node id in unused routes.\" */,\n );\n const blobId = pathParts[2];\n\n if (tombstone) {\n // If tombstone is set, add this blob to the tombstone list.\n this.tombstonedBlobs.add(blobId);\n } else {\n // The unused blobId could be a localId. If so, remove it from the redirect table and continue. The\n // corresponding storageId may still be used either directly or via other localIds.\n this.redirectTable.delete(blobId);\n }\n }\n }\n\n public summarize(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n // if storageIds is empty, it means we are detached and have only local IDs, or that there are no blobs attached\n const blobIds = this.storageIds.size > 0 ? Array.from(this.storageIds) : Array.from(this.redirectTable.keys());\n const builder = new SummaryTreeBuilder();\n blobIds.forEach((blobId) => {\n builder.addAttachment(blobId);\n });\n\n // Any non-identity entries in the table need to be saved in the summary\n if (this.redirectTable.size > blobIds.length) {\n builder.addBlob(\n BlobManager.redirectTableBlobName,\n // filter out identity entries\n JSON.stringify(Array.from(this.redirectTable.entries())\n .filter(([localId, storageId]) => localId !== storageId)),\n );\n }\n\n return builder.getSummaryTree();\n }\n\n public setRedirectTable(table: Map<string, string>) {\n assert(this.runtime.attachState === AttachState.Detached,\n 0x252 /* \"redirect table can only be set in detached container\" */);\n assert(this.redirectTable.size === table.size,\n 0x391 /* Redirect table size must match BlobManager's local ID count */);\n for (const [localId, storageId] of table) {\n assert(this.redirectTable.has(localId), 0x254 /* \"unrecognized id in redirect table\" */);\n this.redirectTable.set(localId, storageId);\n // set identity (id -> id) entry\n this.redirectTable.set(storageId, storageId);\n }\n }\n\n public getPendingBlobs(): IPendingBlobs {\n const blobs = {};\n for (const [key, entry] of this.pendingBlobs) {\n blobs[key] = { blob: bufferToString(entry.blob, \"base64\") };\n }\n return blobs;\n }\n}\n"]}
@@ -8,9 +8,11 @@ import { IAudience, IFluidTokenProvider, IContainerContext, IDeltaManager, IRunt
8
8
  import { IContainerRuntime, IContainerRuntimeEvents } from "@fluidframework/container-runtime-definitions";
9
9
  import { TypedEventEmitter } from "@fluidframework/common-utils";
10
10
  import { IDocumentStorageService } from "@fluidframework/driver-definitions";
11
- import { IClientDetails, IDocumentMessage, IQuorumClients, ISequencedDocumentMessage, ISignalMessage, ISummaryTree, MessageType } from "@fluidframework/protocol-definitions";
11
+ import { IClientDetails, IDocumentMessage, IQuorumClients, ISequencedDocumentMessage, ISignalMessage, ISummaryTree } from "@fluidframework/protocol-definitions";
12
12
  import { FlushMode, IFluidDataStoreContextDetached, IFluidDataStoreRegistry, IGarbageCollectionData, NamedFluidDataStoreRegistryEntries, ISummaryTreeWithStats, IDataStore, ITelemetryContext } from "@fluidframework/runtime-definitions";
13
- import { BatchMessage } from "./batchManager";
13
+ import { IBlobManagerLoadInfo } from "./blobManager";
14
+ import { IContainerRuntimeMetadata } from "./summaryFormat";
15
+ import { ISerializedElection } from "./orderedClientElection";
14
16
  import { SubmitSummaryResult, ISubmitSummaryOptions, ISummarizer, ISummarizerInternalsProvider, ISummarizerOptions, ISummarizerRuntime, IRefreshSummaryAckOptions } from "./summarizerTypes";
15
17
  import { GCNodeType, IGarbageCollectionRuntime, IGCStats } from "./garbageCollection";
16
18
  export declare enum ContainerMessageType {
@@ -21,12 +23,6 @@ export declare enum ContainerMessageType {
21
23
  Rejoin = "rejoin",
22
24
  Alias = "alias"
23
25
  }
24
- export interface IChunkedOp {
25
- chunkId: number;
26
- totalChunks: number;
27
- contents: string;
28
- originalType: MessageType | ContainerMessageType;
29
- }
30
26
  export interface ContainerRuntimeMessage {
31
27
  contents: any;
32
28
  type: ContainerMessageType;
@@ -303,16 +299,6 @@ export declare enum RuntimeMessage {
303
299
  * @deprecated - please use version in driver-utils
304
300
  */
305
301
  export declare function isRuntimeMessage(message: ISequencedDocumentMessage): boolean;
306
- /**
307
- * Unpacks runtime messages
308
- *
309
- * @remarks This API makes no promises regarding backward-compatibility. This is internal API.
310
- * @param message - message (as it observed in storage / service)
311
- * @returns unpacked runtime message
312
- *
313
- * @internal
314
- */
315
- export declare function unpackRuntimeMessage(message: ISequencedDocumentMessage): boolean;
316
302
  /**
317
303
  * Legacy ID for the built-in AgentScheduler. To minimize disruption while removing it, retaining this as a
318
304
  * special-case for document dirty state. Ultimately we should have no special-cases from the
@@ -348,8 +334,10 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
348
334
  * @param requestHandler - Request handlers for the container runtime
349
335
  * @param runtimeOptions - Additional options to be passed to the runtime
350
336
  * @param existing - (optional) When loading from an existing snapshot. Precedes context.existing if provided
337
+ * @param containerRuntimeCtor - (optional) Constructor to use to create the ContainerRuntime instance. This
338
+ * allows mixin classes to leverage this method to define their own async initializer.
351
339
  */
352
- static load(context: IContainerContext, registryEntries: NamedFluidDataStoreRegistryEntries, requestHandler?: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>, runtimeOptions?: IContainerRuntimeOptions, containerScope?: FluidObject, existing?: boolean): Promise<ContainerRuntime>;
340
+ static load(context: IContainerContext, registryEntries: NamedFluidDataStoreRegistryEntries, requestHandler?: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>, runtimeOptions?: IContainerRuntimeOptions, containerScope?: FluidObject, existing?: boolean, containerRuntimeCtor?: typeof ContainerRuntime): Promise<ContainerRuntime>;
353
341
  get options(): ILoaderOptions;
354
342
  get clientId(): string | undefined;
355
343
  get clientDetails(): IClientDetails;
@@ -364,7 +352,6 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
364
352
  get IFluidHandleContext(): IFluidHandleContext;
365
353
  private readonly handleContext;
366
354
  private readonly mc;
367
- private readonly opDecompressor;
368
355
  private readonly summarizerClientElection?;
369
356
  /**
370
357
  * summaryManager will only be created if this client is permitted to spawn a summarizing client
@@ -403,18 +390,15 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
403
390
  * It is created only by summarizing container (i.e. one with clientType === "summarizer")
404
391
  */
405
392
  private readonly _summarizer?;
406
- private readonly deltaSender;
407
393
  private readonly scheduleManager;
408
394
  private readonly blobManager;
409
395
  private readonly pendingStateManager;
410
- private readonly pendingAttachBatch;
411
- private readonly pendingBatch;
396
+ private readonly outbox;
412
397
  private readonly garbageCollector;
413
- private readonly chunkMap;
414
398
  private readonly dataStores;
399
+ private readonly remoteMessageProcessor;
415
400
  /** The last message processed at the time of the last summary. */
416
401
  private messageAtLastSummary;
417
- private get emptyBatch();
418
402
  private get summarizer();
419
403
  private readonly summariesDisabled;
420
404
  private isSummariesDisabled;
@@ -432,7 +416,10 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
432
416
  * a summary is generated.
433
417
  */
434
418
  private nextSummaryNumber;
435
- private constructor();
419
+ /**
420
+ * @internal
421
+ */
422
+ protected constructor(context: IContainerContext, registry: IFluidDataStoreRegistry, metadata: IContainerRuntimeMetadata | undefined, electedSummarizerData: ISerializedElection | undefined, chunks: [string, string[]][], dataStoreAliasMap: [string, string][], runtimeOptions: Readonly<Required<IContainerRuntimeOptions>>, containerScope: FluidObject, logger: ITelemetryLogger, existing: boolean, blobManagerSnapshot: IBlobManagerLoadInfo, _storage: IDocumentStorageService, requestHandler?: ((request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>) | undefined, summaryConfiguration?: ISummaryConfiguration);
436
423
  /**
437
424
  * Initializes the state from the base snapshot this container runtime loaded from.
438
425
  */
@@ -453,7 +440,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
453
440
  private getDataStoreFromRequest;
454
441
  /** Adds the container's metadata to the given summary tree. */
455
442
  private addMetadataToSummary;
456
- private addContainerStateToSummary;
443
+ protected addContainerStateToSummary(summaryTree: ISummaryTreeWithStats, fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext): void;
457
444
  private shouldContinueReconnecting;
458
445
  private resetReconnectCount;
459
446
  private replayPendingStates;
@@ -475,8 +462,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
475
462
  * This method is expected to be called at the end of a batch.
476
463
  */
477
464
  private flush;
478
- protected flushBatch(batch: BatchMessage[]): void;
479
- orderSequentially(callback: () => void): void;
465
+ orderSequentially<T>(callback: () => T): T;
480
466
  createDataStore(pkg: string | string[]): Promise<IDataStore>;
481
467
  createDetachedRootDataStore(pkg: Readonly<string[]>, rootDataStoreId: string): IFluidDataStoreContextDetached;
482
468
  createDetachedDataStore(pkg: Readonly<string[]>): IFluidDataStoreContextDetached;
@@ -554,7 +540,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
554
540
  /**
555
541
  * This is called to update objects whose routes are unused. The unused objects are either deleted or marked as
556
542
  * tombstones.
557
- * @param unusedRoutes - The routes that are unused in all data stores in this Container.
543
+ * @param unusedRoutes - The routes that are unused in all data stores and attachment blobs in this Container.
558
544
  * @param tombstone - if true, the objects corresponding to unused routes are marked tombstones. Otherwise, they
559
545
  * are deleted.
560
546
  */
@@ -605,9 +591,6 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
605
591
  * @param options - options controlling how the summary is generated or submitted
606
592
  */
607
593
  submitSummary(options: ISubmitSummaryOptions): Promise<SubmitSummaryResult>;
608
- private processRemoteChunkedMessage;
609
- private addChunk;
610
- private clearPartialChunks;
611
594
  private hasPendingMessages;
612
595
  private updateDocumentDirtyState;
613
596
  submitDataStoreOp(id: string, contents: any, localOpMetadata?: unknown): void;