@fluidframework/container-runtime 2.0.0-internal.2.1.2 → 2.0.0-internal.2.2.1

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/.eslintrc.js +1 -1
  2. package/dist/blobManager.d.ts +20 -5
  3. package/dist/blobManager.d.ts.map +1 -1
  4. package/dist/blobManager.js +57 -15
  5. package/dist/blobManager.js.map +1 -1
  6. package/dist/containerRuntime.d.ts +39 -40
  7. package/dist/containerRuntime.d.ts.map +1 -1
  8. package/dist/containerRuntime.js +115 -278
  9. package/dist/containerRuntime.js.map +1 -1
  10. package/dist/dataStoreContext.d.ts +3 -1
  11. package/dist/dataStoreContext.d.ts.map +1 -1
  12. package/dist/dataStoreContext.js +21 -3
  13. package/dist/dataStoreContext.js.map +1 -1
  14. package/dist/dataStores.d.ts +8 -5
  15. package/dist/dataStores.d.ts.map +1 -1
  16. package/dist/dataStores.js +26 -13
  17. package/dist/dataStores.js.map +1 -1
  18. package/dist/garbageCollection.d.ts +15 -17
  19. package/dist/garbageCollection.d.ts.map +1 -1
  20. package/dist/garbageCollection.js +92 -106
  21. package/dist/garbageCollection.js.map +1 -1
  22. package/dist/garbageCollectionConstants.d.ts +19 -0
  23. package/dist/garbageCollectionConstants.d.ts.map +1 -0
  24. package/dist/garbageCollectionConstants.js +34 -0
  25. package/dist/garbageCollectionConstants.js.map +1 -0
  26. package/dist/gcSweepReadyUsageDetection.js +2 -2
  27. package/dist/gcSweepReadyUsageDetection.js.map +1 -1
  28. package/dist/index.d.ts +4 -2
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +8 -6
  31. package/dist/index.js.map +1 -1
  32. package/dist/opLifecycle/batchManager.d.ts +30 -0
  33. package/dist/opLifecycle/batchManager.d.ts.map +1 -0
  34. package/dist/{batchManager.js → opLifecycle/batchManager.js} +25 -10
  35. package/dist/opLifecycle/batchManager.js.map +1 -0
  36. package/dist/opLifecycle/definitions.d.ts +40 -0
  37. package/dist/opLifecycle/definitions.d.ts.map +1 -0
  38. package/dist/opLifecycle/definitions.js +7 -0
  39. package/dist/opLifecycle/definitions.js.map +1 -0
  40. package/dist/opLifecycle/index.d.ts +12 -0
  41. package/dist/opLifecycle/index.d.ts.map +1 -0
  42. package/dist/opLifecycle/index.js +21 -0
  43. package/dist/opLifecycle/index.js.map +1 -0
  44. package/dist/opLifecycle/opCompressor.d.ts +18 -0
  45. package/dist/opLifecycle/opCompressor.d.ts.map +1 -0
  46. package/dist/opLifecycle/opCompressor.js +53 -0
  47. package/dist/opLifecycle/opCompressor.js.map +1 -0
  48. package/dist/opLifecycle/opDecompressor.d.ts +20 -0
  49. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -0
  50. package/dist/opLifecycle/opDecompressor.js +72 -0
  51. package/dist/opLifecycle/opDecompressor.js.map +1 -0
  52. package/dist/opLifecycle/opSplitter.d.ts +17 -0
  53. package/dist/opLifecycle/opSplitter.d.ts.map +1 -0
  54. package/dist/opLifecycle/opSplitter.js +61 -0
  55. package/dist/opLifecycle/opSplitter.js.map +1 -0
  56. package/dist/opLifecycle/outbox.d.ts +47 -0
  57. package/dist/opLifecycle/outbox.d.ts.map +1 -0
  58. package/dist/opLifecycle/outbox.js +153 -0
  59. package/dist/opLifecycle/outbox.js.map +1 -0
  60. package/dist/opLifecycle/remoteMessageProcessor.d.ts +26 -0
  61. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -0
  62. package/dist/opLifecycle/remoteMessageProcessor.js +81 -0
  63. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -0
  64. package/dist/packageVersion.d.ts +1 -1
  65. package/dist/packageVersion.js +1 -1
  66. package/dist/packageVersion.js.map +1 -1
  67. package/dist/summaryFormat.js +2 -2
  68. package/dist/summaryFormat.js.map +1 -1
  69. package/lib/blobManager.d.ts +20 -5
  70. package/lib/blobManager.d.ts.map +1 -1
  71. package/lib/blobManager.js +59 -17
  72. package/lib/blobManager.js.map +1 -1
  73. package/lib/containerRuntime.d.ts +39 -40
  74. package/lib/containerRuntime.d.ts.map +1 -1
  75. package/lib/containerRuntime.js +113 -275
  76. package/lib/containerRuntime.js.map +1 -1
  77. package/lib/dataStoreContext.d.ts +3 -1
  78. package/lib/dataStoreContext.d.ts.map +1 -1
  79. package/lib/dataStoreContext.js +23 -5
  80. package/lib/dataStoreContext.js.map +1 -1
  81. package/lib/dataStores.d.ts +8 -5
  82. package/lib/dataStores.d.ts.map +1 -1
  83. package/lib/dataStores.js +28 -15
  84. package/lib/dataStores.js.map +1 -1
  85. package/lib/garbageCollection.d.ts +15 -17
  86. package/lib/garbageCollection.d.ts.map +1 -1
  87. package/lib/garbageCollection.js +72 -86
  88. package/lib/garbageCollection.js.map +1 -1
  89. package/lib/garbageCollectionConstants.d.ts +19 -0
  90. package/lib/garbageCollectionConstants.d.ts.map +1 -0
  91. package/lib/garbageCollectionConstants.js +31 -0
  92. package/lib/garbageCollectionConstants.js.map +1 -0
  93. package/lib/gcSweepReadyUsageDetection.js +1 -1
  94. package/lib/gcSweepReadyUsageDetection.js.map +1 -1
  95. package/lib/index.d.ts +4 -2
  96. package/lib/index.d.ts.map +1 -1
  97. package/lib/index.js +3 -2
  98. package/lib/index.js.map +1 -1
  99. package/lib/opLifecycle/batchManager.d.ts +30 -0
  100. package/lib/opLifecycle/batchManager.d.ts.map +1 -0
  101. package/lib/{batchManager.js → opLifecycle/batchManager.js} +25 -10
  102. package/lib/opLifecycle/batchManager.js.map +1 -0
  103. package/lib/opLifecycle/definitions.d.ts +40 -0
  104. package/lib/opLifecycle/definitions.d.ts.map +1 -0
  105. package/lib/opLifecycle/definitions.js +6 -0
  106. package/lib/opLifecycle/definitions.js.map +1 -0
  107. package/lib/opLifecycle/index.d.ts +12 -0
  108. package/lib/opLifecycle/index.d.ts.map +1 -0
  109. package/lib/opLifecycle/index.js +11 -0
  110. package/lib/opLifecycle/index.js.map +1 -0
  111. package/lib/opLifecycle/opCompressor.d.ts +18 -0
  112. package/lib/opLifecycle/opCompressor.d.ts.map +1 -0
  113. package/lib/opLifecycle/opCompressor.js +49 -0
  114. package/lib/opLifecycle/opCompressor.js.map +1 -0
  115. package/lib/opLifecycle/opDecompressor.d.ts +20 -0
  116. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -0
  117. package/lib/opLifecycle/opDecompressor.js +68 -0
  118. package/lib/opLifecycle/opDecompressor.js.map +1 -0
  119. package/lib/opLifecycle/opSplitter.d.ts +17 -0
  120. package/lib/opLifecycle/opSplitter.d.ts.map +1 -0
  121. package/lib/opLifecycle/opSplitter.js +57 -0
  122. package/lib/opLifecycle/opSplitter.js.map +1 -0
  123. package/lib/opLifecycle/outbox.d.ts +47 -0
  124. package/lib/opLifecycle/outbox.d.ts.map +1 -0
  125. package/lib/opLifecycle/outbox.js +149 -0
  126. package/lib/opLifecycle/outbox.js.map +1 -0
  127. package/lib/opLifecycle/remoteMessageProcessor.d.ts +26 -0
  128. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -0
  129. package/lib/opLifecycle/remoteMessageProcessor.js +76 -0
  130. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -0
  131. package/lib/packageVersion.d.ts +1 -1
  132. package/lib/packageVersion.js +1 -1
  133. package/lib/packageVersion.js.map +1 -1
  134. package/lib/summaryFormat.js +1 -1
  135. package/lib/summaryFormat.js.map +1 -1
  136. package/package.json +22 -19
  137. package/prettier.config.cjs +8 -0
  138. package/src/blobManager.ts +74 -19
  139. package/src/containerRuntime.ts +144 -341
  140. package/src/dataStoreContext.ts +33 -5
  141. package/src/dataStores.ts +32 -16
  142. package/src/garbageCollection.ts +106 -82
  143. package/src/garbageCollectionConstants.ts +35 -0
  144. package/src/gcSweepReadyUsageDetection.ts +1 -1
  145. package/src/index.ts +6 -4
  146. package/src/{batchManager.ts → opLifecycle/batchManager.ts} +41 -23
  147. package/src/opLifecycle/definitions.ts +44 -0
  148. package/src/opLifecycle/index.ts +17 -0
  149. package/src/opLifecycle/opCompressor.ts +64 -0
  150. package/src/opLifecycle/opDecompressor.ts +84 -0
  151. package/src/opLifecycle/opSplitter.ts +78 -0
  152. package/src/opLifecycle/outbox.ts +204 -0
  153. package/src/opLifecycle/remoteMessageProcessor.ts +90 -0
  154. package/src/packageVersion.ts +1 -1
  155. package/src/summaryFormat.ts +1 -1
  156. package/dist/batchManager.d.ts +0 -36
  157. package/dist/batchManager.d.ts.map +0 -1
  158. package/dist/batchManager.js.map +0 -1
  159. package/lib/batchManager.d.ts +0 -36
  160. package/lib/batchManager.d.ts.map +0 -1
  161. package/lib/batchManager.js.map +0 -1
@@ -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,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AAG3G,OAAO,EACH,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACpB,MAAM,qCAAqC,CAAC;AAG7C;;;;;;GAMG;AACH,qBAAa,UAAW,YAAW,YAAY,CAAC,eAAe,CAAC;aAYxC,IAAI,EAAE,MAAM;aACZ,YAAY,EAAE,mBAAmB;IAC1C,GAAG,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC;IAblC,OAAO,CAAC,QAAQ,CAAkB;IAElC,IAAW,YAAY,IAAI,YAAY,CAAiB;IAExD,IAAW,UAAU,IAAI,OAAO,CAE/B;IAED,SAAgB,YAAY,EAAE,MAAM,CAAC;gBAGjB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,mBAAmB,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AAE,iBAAiB,GAAG,qBAAqB;IAqBtE,gBAAgB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAa3C,eAAe,IAAI,aAAa;CAO1C"}
@@ -3,11 +3,13 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { v4 as uuid } from "uuid";
6
- import { generateHandleContextPath, SummaryTreeBuilder } from "@fluidframework/runtime-utils";
6
+ import { createResponseError, generateHandleContextPath, responseToException, SummaryTreeBuilder, } from "@fluidframework/runtime-utils";
7
7
  import { assert, bufferToString, Deferred, stringToBuffer } from "@fluidframework/common-utils";
8
8
  import { AttachState } from "@fluidframework/container-definitions";
9
- import { ChildLogger, PerformanceEvent } from "@fluidframework/telemetry-utils";
9
+ import { ChildLogger, loggerToMonitoringContext, PerformanceEvent } from "@fluidframework/telemetry-utils";
10
10
  import { Throttler, formExponentialFn } from "./throttler";
11
+ import { summarizerClientType } from "./summarizerClientElection";
12
+ import { throwOnTombstoneUsageKey } from "./garbageCollectionConstants";
11
13
  /**
12
14
  * This class represents blob (long string)
13
15
  * This object is used only when creating (writing) new blob and serialization purposes.
@@ -95,7 +97,16 @@ export class BlobManager {
95
97
  30 * 1000, // 30 sec max delay
96
98
  // throttling function increases exponentially (0ms, 40ms, 80ms, 160ms, etc)
97
99
  formExponentialFn({ coefficient: 20, initialDelay: 0 })));
98
- this.logger = ChildLogger.create(this.runtime.logger, "BlobManager");
100
+ /**
101
+ * This stores ides of tombstoned blobs.
102
+ * Tombstone is a temporary feature that imitates a blob getting swept by garbage collection.
103
+ */
104
+ this.tombstonedBlobs = new Set();
105
+ this.mc = loggerToMonitoringContext(ChildLogger.create(this.runtime.logger, "BlobManager"));
106
+ // Read the feature flag that tells whether to throw when a tombstone blob is requested.
107
+ this.throwOnTombstoneUsage =
108
+ this.mc.config.getBoolean(throwOnTombstoneUsageKey) === true &&
109
+ this.runtime.clientDetails.type !== summarizerClientType;
99
110
  this.runtime.on("disconnected", () => this.onDisconnected());
100
111
  this.redirectTable = this.load(snapshot);
101
112
  // Begin uploading stashed blobs from previous container instance
@@ -122,7 +133,7 @@ export class BlobManager {
122
133
  async onConnected() {
123
134
  this.retryThrottler.cancel();
124
135
  const pendingUploads = this.pendingOfflineUploads.map(async (e) => e.uploadP);
125
- await PerformanceEvent.timedExecAsync(this.logger, {
136
+ await PerformanceEvent.timedExecAsync(this.mc.logger, {
126
137
  eventName: "BlobUploadOnConnected",
127
138
  count: pendingUploads.length,
128
139
  }, async () => Promise.all(pendingUploads), { start: true, end: true });
@@ -162,6 +173,17 @@ export class BlobManager {
162
173
  return ids;
163
174
  }
164
175
  async getBlob(blobId) {
176
+ const request = { url: blobId };
177
+ if (this.tombstonedBlobs.has(blobId)) {
178
+ const error = responseToException(createResponseError(404, "Blob removed by gc", request), request);
179
+ this.mc.logger.sendErrorEvent({
180
+ eventName: "GC_Tombstone_Blob_Requested",
181
+ url: request.url,
182
+ }, error);
183
+ if (this.throwOnTombstoneUsage) {
184
+ throw error;
185
+ }
186
+ }
165
187
  const pending = this.pendingBlobs.get(blobId);
166
188
  if (pending) {
167
189
  return pending.blob;
@@ -179,7 +201,7 @@ export class BlobManager {
179
201
  }
180
202
  // When a GC-able (not pending) blob is retrieved, let runtime know that the corresponding GC node got updated.
181
203
  this.gcNodeUpdated(this.getBlobGCNodePath(blobId));
182
- return PerformanceEvent.timedExecAsync(this.logger, { eventName: "AttachmentReadBlob", id: storageId }, async () => {
204
+ return PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "AttachmentReadBlob", id: storageId }, async () => {
183
205
  return this.getStorage().readBlob(storageId);
184
206
  }, { end: true, cancel: "error" });
185
207
  }
@@ -200,7 +222,7 @@ export class BlobManager {
200
222
  }
201
223
  if (this.runtime.attachState === AttachState.Attaching) {
202
224
  // blob upload is not supported in "Attaching" state
203
- this.logger.sendTelemetryEvent({ eventName: "CreateBlobWhileAttaching" });
225
+ this.mc.logger.sendTelemetryEvent({ eventName: "CreateBlobWhileAttaching" });
204
226
  await new Promise((resolve) => this.runtime.once("attached", resolve));
205
227
  }
206
228
  assert(this.runtime.attachState === AttachState.Attached, 0x385 /* For clarity and paranoid defense against adding future attachment states */);
@@ -217,7 +239,7 @@ export class BlobManager {
217
239
  return pendingEntry.handleP.promise;
218
240
  }
219
241
  async uploadBlob(localId, blob) {
220
- return 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));
242
+ return 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));
221
243
  }
222
244
  onUploadResolve(localId, response) {
223
245
  var _a;
@@ -249,7 +271,7 @@ export class BlobManager {
249
271
  }
250
272
  else {
251
273
  // connected to storage but not ordering service?
252
- this.logger.sendTelemetryEvent({ eventName: "BlobUploadSuccessWhileDisconnected" });
274
+ this.mc.logger.sendTelemetryEvent({ eventName: "BlobUploadSuccessWhileDisconnected" });
253
275
  if (entry.status === PendingBlobStatus.OnlinePendingUpload) {
254
276
  this.transitionToOffline(localId);
255
277
  }
@@ -361,7 +383,7 @@ export class BlobManager {
361
383
  */
362
384
  load(snapshot) {
363
385
  var _a, _b, _c;
364
- this.logger.sendTelemetryEvent({
386
+ this.mc.logger.sendTelemetryEvent({
365
387
  eventName: "AttachmentBlobsLoaded",
366
388
  count: (_b = (_a = snapshot.ids) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
367
389
  redirectTable: (_c = snapshot.redirectTable) === null || _c === void 0 ? void 0 : _c.length,
@@ -404,22 +426,42 @@ export class BlobManager {
404
426
  return gcData;
405
427
  }
406
428
  /**
407
- * When running GC in test mode, this is called to delete blobs that are unused.
408
- * @param unusedRoutes - These are the blob node ids that are unused and should be deleted.
429
+ * This is called to update blobs whose routes are used. The used blobs are removed from the tombstone list.
430
+ * @param usedRoutes - The routes of the blob nodes that are used.
409
431
  */
410
- deleteUnusedRoutes(unusedRoutes) {
411
- var _a;
432
+ updateUsedRoutes(usedRoutes) {
433
+ // The routes or blob node paths are in the same format as returned in getGCData -
434
+ // `/<BlobManager.basePath>/<blobId>`.
435
+ for (const route of usedRoutes) {
436
+ const pathParts = route.split("/");
437
+ assert(pathParts.length === 3 && pathParts[1] === BlobManager.basePath, 0x4bc /* Invalid blob node id in used routes. */);
438
+ const blobId = pathParts[2];
439
+ // Un-tombstone the blob if it was marked tombstone.
440
+ this.tombstonedBlobs.delete(blobId);
441
+ }
442
+ }
443
+ /**
444
+ * This is called to update blobs whose routes are unused. The unused blobs are either deleted or marked as
445
+ * tombstones.
446
+ * @param unusedRoutes - The routes of the blob nodes that are unused.
447
+ * @param tombstone - if true, the objects corresponding to unused routes are marked tombstones. Otherwise, they
448
+ * are deleted.
449
+ */
450
+ updateUnusedRoutes(unusedRoutes, tombstone) {
412
451
  // The routes or blob node paths are in the same format as returned in getGCData -
413
452
  // `/<BlobManager.basePath>/<blobId>`.
414
453
  for (const route of unusedRoutes) {
415
454
  const pathParts = route.split("/");
416
455
  assert(pathParts.length === 3 && pathParts[1] === BlobManager.basePath, 0x2d5 /* "Invalid blob node id in unused routes." */);
417
456
  const blobId = pathParts[2];
418
- // The unused blobId could be a localId. If so, remove it from the redirect table and continue. The
419
- // corresponding storageId may still be used either directly or via other localIds.
420
- if ((_a = this.redirectTable) === null || _a === void 0 ? void 0 : _a.has(blobId)) {
457
+ if (tombstone) {
458
+ // If tombstone is set, add this blob to the tombstone list.
459
+ this.tombstonedBlobs.add(blobId);
460
+ }
461
+ else {
462
+ // The unused blobId could be a localId. If so, remove it from the redirect table and continue. The
463
+ // corresponding storageId may still be used either directly or via other localIds.
421
464
  this.redirectTable.delete(blobId);
422
- continue;
423
465
  }
424
466
  }
425
467
  }
@@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OAAO,EAAE,CAAC;iBAClD,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAChE,CAAC;SACL;QAED,OAAO,OAAO,CAAC,cAAc,EAAE,CAAC;IACpC,CAAC;IAEM,gBAAgB,CAAC,KAA0B;QAC9C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,EACpD,KAAK,CAAC,4DAA4D,CAAC,CAAC;QACxE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,EACzC,KAAK,CAAC,iEAAiE,CAAC,CAAC;QAC7E,KAAK,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,KAAK,EAAE;YACtC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;YACzF,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YAC3C,gCAAgC;YAChC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;SAChD;IACL,CAAC;IAEM,eAAe;QAClB,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE;YAC1C,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;SAC/D;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;;AAlesB,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"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AAC;IACjB,CAAC;;AAnhBsB,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;
@@ -37,6 +33,7 @@ export interface ISummaryBaseConfiguration {
37
33
  */
38
34
  initialSummarizerDelayMs: number;
39
35
  /**
36
+ * @deprecated
40
37
  * Flag that will enable changing elected summarizer client after maxOpsSinceLastSummary.
41
38
  * This defaults to false (disabled) and must be explicitly set to true to enable.
42
39
  */
@@ -208,10 +205,13 @@ export interface ISummaryRuntimeOptions {
208
205
  */
209
206
  export interface ICompressionRuntimeOptions {
210
207
  /**
211
- * The minimum size the content payload must exceed before it is compressed.
212
- * Compression is disabled if undefined.
208
+ * The minimum size the batch's payload must exceed before the batch's contents will be compressed.
209
+ */
210
+ readonly minimumBatchSizeInBytes: number;
211
+ /**
212
+ * The compression algorithm that will be used to compress the op.
213
213
  */
214
- readonly minimumSize?: number;
214
+ readonly compressionAlgorithm: CompressionAlgorithms;
215
215
  }
216
216
  /**
217
217
  * Options for container runtime.
@@ -240,7 +240,7 @@ export interface IContainerRuntimeOptions {
240
240
  */
241
241
  readonly enableOfflineLoad?: boolean;
242
242
  /**
243
- * Enables the runtime to compress ops.
243
+ * Enables the runtime to compress ops. Compression is disabled when undefined.
244
244
  * @experimental Not ready for use.
245
245
  */
246
246
  readonly compressionOptions?: ICompressionRuntimeOptions;
@@ -277,6 +277,12 @@ export declare enum RuntimeHeaders {
277
277
  /** True if the request is coming from an IFluidHandle. */
278
278
  viaHandle = "viaHandle"
279
279
  }
280
+ /**
281
+ * Available compression algorithms for op compression.
282
+ */
283
+ export declare enum CompressionAlgorithms {
284
+ lz4 = "lz4"
285
+ }
280
286
  /**
281
287
  * @deprecated - use ContainerRuntimeMessage instead
282
288
  */
@@ -293,16 +299,6 @@ export declare enum RuntimeMessage {
293
299
  * @deprecated - please use version in driver-utils
294
300
  */
295
301
  export declare function isRuntimeMessage(message: ISequencedDocumentMessage): boolean;
296
- /**
297
- * Unpacks runtime messages
298
- *
299
- * @remarks This API makes no promises regarding backward-compatibility. This is internal API.
300
- * @param message - message (as it observed in storage / service)
301
- * @returns unpacked runtime message
302
- *
303
- * @internal
304
- */
305
- export declare function unpackRuntimeMessage(message: ISequencedDocumentMessage): boolean;
306
302
  /**
307
303
  * Legacy ID for the built-in AgentScheduler. To minimize disruption while removing it, retaining this as a
308
304
  * special-case for document dirty state. Ultimately we should have no special-cases from the
@@ -338,8 +334,10 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
338
334
  * @param requestHandler - Request handlers for the container runtime
339
335
  * @param runtimeOptions - Additional options to be passed to the runtime
340
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.
341
339
  */
342
- 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>;
343
341
  get options(): ILoaderOptions;
344
342
  get clientId(): string | undefined;
345
343
  get clientDetails(): IClientDetails;
@@ -372,7 +370,6 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
372
370
  private readonly savedOps;
373
371
  private baseSnapshotBlobs?;
374
372
  private consecutiveReconnects;
375
- private compressedOpCount;
376
373
  /**
377
374
  * Used to delay transition to "connected" state while we upload
378
375
  * attachment blobs that were added while disconnected
@@ -393,18 +390,15 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
393
390
  * It is created only by summarizing container (i.e. one with clientType === "summarizer")
394
391
  */
395
392
  private readonly _summarizer?;
396
- private readonly deltaSender;
397
393
  private readonly scheduleManager;
398
394
  private readonly blobManager;
399
395
  private readonly pendingStateManager;
400
- private readonly pendingAttachBatch;
401
- private readonly pendingBatch;
396
+ private readonly outbox;
402
397
  private readonly garbageCollector;
403
- private readonly chunkMap;
404
398
  private readonly dataStores;
399
+ private readonly remoteMessageProcessor;
405
400
  /** The last message processed at the time of the last summary. */
406
401
  private messageAtLastSummary;
407
- private get emptyBatch();
408
402
  private get summarizer();
409
403
  private readonly summariesDisabled;
410
404
  private isSummariesDisabled;
@@ -422,7 +416,14 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
422
416
  * a summary is generated.
423
417
  */
424
418
  private nextSummaryNumber;
425
- 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);
423
+ /**
424
+ * Initializes the state from the base snapshot this container runtime loaded from.
425
+ */
426
+ private initializeBaseState;
426
427
  dispose(error?: Error): void;
427
428
  get IFluidTokenProvider(): IFluidTokenProvider | undefined;
428
429
  /**
@@ -439,7 +440,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
439
440
  private getDataStoreFromRequest;
440
441
  /** Adds the container's metadata to the given summary tree. */
441
442
  private addMetadataToSummary;
442
- private addContainerStateToSummary;
443
+ protected addContainerStateToSummary(summaryTree: ISummaryTreeWithStats, fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext): void;
443
444
  private shouldContinueReconnecting;
444
445
  private resetReconnectCount;
445
446
  private replayPendingStates;
@@ -461,7 +462,6 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
461
462
  * This method is expected to be called at the end of a batch.
462
463
  */
463
464
  private flush;
464
- protected flushBatch(batch: BatchMessage[]): void;
465
465
  orderSequentially(callback: () => void): void;
466
466
  createDataStore(pkg: string | string[]): Promise<IDataStore>;
467
467
  createDetachedRootDataStore(pkg: Readonly<string[]>, rootDataStoreId: string): IFluidDataStoreContextDetached;
@@ -538,11 +538,13 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
538
538
  */
539
539
  updateUsedRoutes(usedRoutes: string[]): void;
540
540
  /**
541
- * When running GC in test mode, this is called to delete objects whose routes are unused. This enables testing
542
- * scenarios with accessing deleted content.
543
- * @param unusedRoutes - The routes that are unused in all data stores and blobs in this Container.
541
+ * This is called to update objects whose routes are unused. The unused objects are either deleted or marked as
542
+ * tombstones.
543
+ * @param unusedRoutes - The routes that are unused in all data stores and attachment blobs in this Container.
544
+ * @param tombstone - if true, the objects corresponding to unused routes are marked tombstones. Otherwise, they
545
+ * are deleted.
544
546
  */
545
- deleteUnusedRoutes(unusedRoutes: string[]): void;
547
+ updateUnusedRoutes(unusedRoutes: string[], tombstone: boolean): void;
546
548
  /**
547
549
  * Returns a server generated referenced timestamp to be used to track unreferenced nodes by GC.
548
550
  */
@@ -589,9 +591,6 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
589
591
  * @param options - options controlling how the summary is generated or submitted
590
592
  */
591
593
  submitSummary(options: ISubmitSummaryOptions): Promise<SubmitSummaryResult>;
592
- private processRemoteChunkedMessage;
593
- private addChunk;
594
- private clearPartialChunks;
595
594
  private hasPendingMessages;
596
595
  private updateDocumentDirtyState;
597
596
  submitDataStoreOp(id: string, contents: any, localOpMetadata?: unknown): void;
@@ -624,7 +623,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
624
623
  private refreshLatestSummaryAckFromServer;
625
624
  private fetchSnapshotFromStorage;
626
625
  notifyAttaching(snapshot: ISnapshotTreeWithBlobContents): void;
627
- getSnapshotBlobs(): Promise<void>;
626
+ private initializeBaseSnapshotBlobs;
628
627
  getPendingLocalState(): unknown;
629
628
  readonly summarizeOnDemand: ISummarizer["summarizeOnDemand"];
630
629
  readonly enqueueSummarize: ISummarizer["enqueueSummarize"];