@fluidframework/container-runtime 2.0.0-internal.2.2.1 → 2.0.0-internal.2.3.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 (195) hide show
  1. package/.eslintrc.js +19 -8
  2. package/dist/batchTracker.d.ts +1 -2
  3. package/dist/batchTracker.d.ts.map +1 -1
  4. package/dist/batchTracker.js.map +1 -1
  5. package/dist/blobManager.d.ts +45 -34
  6. package/dist/blobManager.d.ts.map +1 -1
  7. package/dist/blobManager.js +135 -102
  8. package/dist/blobManager.js.map +1 -1
  9. package/dist/containerRuntime.d.ts +54 -8
  10. package/dist/containerRuntime.d.ts.map +1 -1
  11. package/dist/containerRuntime.js +143 -72
  12. package/dist/containerRuntime.js.map +1 -1
  13. package/dist/dataStoreContext.d.ts +1 -1
  14. package/dist/dataStoreContext.d.ts.map +1 -1
  15. package/dist/dataStoreContext.js +6 -8
  16. package/dist/dataStoreContext.js.map +1 -1
  17. package/dist/dataStores.d.ts +12 -9
  18. package/dist/dataStores.d.ts.map +1 -1
  19. package/dist/dataStores.js +41 -35
  20. package/dist/dataStores.js.map +1 -1
  21. package/dist/garbageCollection.d.ts +41 -20
  22. package/dist/garbageCollection.d.ts.map +1 -1
  23. package/dist/garbageCollection.js +205 -150
  24. package/dist/garbageCollection.js.map +1 -1
  25. package/dist/garbageCollectionConstants.d.ts +7 -3
  26. package/dist/garbageCollectionConstants.d.ts.map +1 -1
  27. package/dist/garbageCollectionConstants.js +10 -8
  28. package/dist/garbageCollectionConstants.js.map +1 -1
  29. package/dist/garbageCollectionTombstoneUtils.d.ts +14 -0
  30. package/dist/garbageCollectionTombstoneUtils.d.ts.map +1 -0
  31. package/dist/garbageCollectionTombstoneUtils.js +23 -0
  32. package/dist/garbageCollectionTombstoneUtils.js.map +1 -0
  33. package/dist/index.d.ts +1 -2
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +3 -5
  36. package/dist/index.js.map +1 -1
  37. package/dist/opLifecycle/batchManager.d.ts +13 -1
  38. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  39. package/dist/opLifecycle/batchManager.js +35 -1
  40. package/dist/opLifecycle/batchManager.js.map +1 -1
  41. package/dist/opLifecycle/definitions.d.ts +25 -1
  42. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  43. package/dist/opLifecycle/definitions.js.map +1 -1
  44. package/dist/opLifecycle/index.d.ts +2 -2
  45. package/dist/opLifecycle/index.d.ts.map +1 -1
  46. package/dist/opLifecycle/index.js +2 -1
  47. package/dist/opLifecycle/index.js.map +1 -1
  48. package/dist/opLifecycle/opCompressor.d.ts +1 -1
  49. package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
  50. package/dist/opLifecycle/opCompressor.js +24 -10
  51. package/dist/opLifecycle/opCompressor.js.map +1 -1
  52. package/dist/opLifecycle/opDecompressor.d.ts +2 -1
  53. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
  54. package/dist/opLifecycle/opDecompressor.js +30 -17
  55. package/dist/opLifecycle/opDecompressor.js.map +1 -1
  56. package/dist/opLifecycle/opSplitter.d.ts +34 -2
  57. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  58. package/dist/opLifecycle/opSplitter.js +114 -5
  59. package/dist/opLifecycle/opSplitter.js.map +1 -1
  60. package/dist/opLifecycle/outbox.d.ts +5 -0
  61. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  62. package/dist/opLifecycle/outbox.js +24 -14
  63. package/dist/opLifecycle/outbox.js.map +1 -1
  64. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  65. package/dist/opLifecycle/remoteMessageProcessor.js +17 -2
  66. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  67. package/dist/packageVersion.d.ts +1 -1
  68. package/dist/packageVersion.js +1 -1
  69. package/dist/packageVersion.js.map +1 -1
  70. package/dist/runningSummarizer.d.ts.map +1 -1
  71. package/dist/runningSummarizer.js +0 -1
  72. package/dist/runningSummarizer.js.map +1 -1
  73. package/dist/scheduleManager.d.ts +0 -1
  74. package/dist/scheduleManager.d.ts.map +1 -1
  75. package/dist/scheduleManager.js +9 -20
  76. package/dist/scheduleManager.js.map +1 -1
  77. package/dist/summarizer.d.ts +0 -1
  78. package/dist/summarizer.d.ts.map +1 -1
  79. package/dist/summarizer.js +2 -1
  80. package/dist/summarizer.js.map +1 -1
  81. package/dist/summarizerTypes.d.ts +1 -0
  82. package/dist/summarizerTypes.d.ts.map +1 -1
  83. package/dist/summarizerTypes.js.map +1 -1
  84. package/dist/summaryFormat.d.ts.map +1 -1
  85. package/dist/summaryFormat.js +1 -2
  86. package/dist/summaryFormat.js.map +1 -1
  87. package/lib/batchTracker.d.ts +1 -2
  88. package/lib/batchTracker.d.ts.map +1 -1
  89. package/lib/batchTracker.js.map +1 -1
  90. package/lib/blobManager.d.ts +45 -34
  91. package/lib/blobManager.d.ts.map +1 -1
  92. package/lib/blobManager.js +137 -104
  93. package/lib/blobManager.js.map +1 -1
  94. package/lib/containerRuntime.d.ts +54 -8
  95. package/lib/containerRuntime.d.ts.map +1 -1
  96. package/lib/containerRuntime.js +140 -69
  97. package/lib/containerRuntime.js.map +1 -1
  98. package/lib/dataStoreContext.d.ts +1 -1
  99. package/lib/dataStoreContext.d.ts.map +1 -1
  100. package/lib/dataStoreContext.js +7 -9
  101. package/lib/dataStoreContext.js.map +1 -1
  102. package/lib/dataStores.d.ts +12 -9
  103. package/lib/dataStores.d.ts.map +1 -1
  104. package/lib/dataStores.js +44 -38
  105. package/lib/dataStores.js.map +1 -1
  106. package/lib/garbageCollection.d.ts +41 -20
  107. package/lib/garbageCollection.d.ts.map +1 -1
  108. package/lib/garbageCollection.js +201 -146
  109. package/lib/garbageCollection.js.map +1 -1
  110. package/lib/garbageCollectionConstants.d.ts +7 -3
  111. package/lib/garbageCollectionConstants.d.ts.map +1 -1
  112. package/lib/garbageCollectionConstants.js +9 -7
  113. package/lib/garbageCollectionConstants.js.map +1 -1
  114. package/lib/garbageCollectionTombstoneUtils.d.ts +14 -0
  115. package/lib/garbageCollectionTombstoneUtils.d.ts.map +1 -0
  116. package/lib/garbageCollectionTombstoneUtils.js +19 -0
  117. package/lib/garbageCollectionTombstoneUtils.js.map +1 -0
  118. package/lib/index.d.ts +1 -2
  119. package/lib/index.d.ts.map +1 -1
  120. package/lib/index.js +1 -2
  121. package/lib/index.js.map +1 -1
  122. package/lib/opLifecycle/batchManager.d.ts +13 -1
  123. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  124. package/lib/opLifecycle/batchManager.js +35 -1
  125. package/lib/opLifecycle/batchManager.js.map +1 -1
  126. package/lib/opLifecycle/definitions.d.ts +25 -1
  127. package/lib/opLifecycle/definitions.d.ts.map +1 -1
  128. package/lib/opLifecycle/definitions.js.map +1 -1
  129. package/lib/opLifecycle/index.d.ts +2 -2
  130. package/lib/opLifecycle/index.d.ts.map +1 -1
  131. package/lib/opLifecycle/index.js +1 -1
  132. package/lib/opLifecycle/index.js.map +1 -1
  133. package/lib/opLifecycle/opCompressor.d.ts +1 -1
  134. package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
  135. package/lib/opLifecycle/opCompressor.js +24 -10
  136. package/lib/opLifecycle/opCompressor.js.map +1 -1
  137. package/lib/opLifecycle/opDecompressor.d.ts +2 -1
  138. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
  139. package/lib/opLifecycle/opDecompressor.js +30 -17
  140. package/lib/opLifecycle/opDecompressor.js.map +1 -1
  141. package/lib/opLifecycle/opSplitter.d.ts +34 -2
  142. package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
  143. package/lib/opLifecycle/opSplitter.js +112 -4
  144. package/lib/opLifecycle/opSplitter.js.map +1 -1
  145. package/lib/opLifecycle/outbox.d.ts +5 -0
  146. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  147. package/lib/opLifecycle/outbox.js +24 -14
  148. package/lib/opLifecycle/outbox.js.map +1 -1
  149. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  150. package/lib/opLifecycle/remoteMessageProcessor.js +17 -2
  151. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  152. package/lib/packageVersion.d.ts +1 -1
  153. package/lib/packageVersion.js +1 -1
  154. package/lib/packageVersion.js.map +1 -1
  155. package/lib/runningSummarizer.d.ts.map +1 -1
  156. package/lib/runningSummarizer.js +0 -1
  157. package/lib/runningSummarizer.js.map +1 -1
  158. package/lib/scheduleManager.d.ts +0 -1
  159. package/lib/scheduleManager.d.ts.map +1 -1
  160. package/lib/scheduleManager.js +9 -20
  161. package/lib/scheduleManager.js.map +1 -1
  162. package/lib/summarizer.d.ts +0 -1
  163. package/lib/summarizer.d.ts.map +1 -1
  164. package/lib/summarizer.js +2 -1
  165. package/lib/summarizer.js.map +1 -1
  166. package/lib/summarizerTypes.d.ts +1 -0
  167. package/lib/summarizerTypes.d.ts.map +1 -1
  168. package/lib/summarizerTypes.js.map +1 -1
  169. package/lib/summaryFormat.d.ts.map +1 -1
  170. package/lib/summaryFormat.js +1 -2
  171. package/lib/summaryFormat.js.map +1 -1
  172. package/package.json +20 -19
  173. package/src/batchTracker.ts +1 -1
  174. package/src/blobManager.ts +159 -111
  175. package/src/containerRuntime.ts +202 -73
  176. package/src/dataStoreContext.ts +15 -16
  177. package/src/dataStores.ts +61 -45
  178. package/src/garbageCollection.ts +258 -183
  179. package/src/garbageCollectionConstants.ts +10 -7
  180. package/src/garbageCollectionTombstoneUtils.ts +28 -0
  181. package/src/index.ts +2 -5
  182. package/src/opLifecycle/batchManager.ts +59 -1
  183. package/src/opLifecycle/definitions.ts +27 -1
  184. package/src/opLifecycle/index.ts +2 -1
  185. package/src/opLifecycle/opCompressor.ts +29 -12
  186. package/src/opLifecycle/opDecompressor.ts +39 -18
  187. package/src/opLifecycle/opSplitter.ts +141 -7
  188. package/src/opLifecycle/outbox.ts +32 -16
  189. package/src/opLifecycle/remoteMessageProcessor.ts +19 -3
  190. package/src/packageVersion.ts +1 -1
  191. package/src/runningSummarizer.ts +0 -1
  192. package/src/scheduleManager.ts +19 -30
  193. package/src/summarizer.ts +1 -1
  194. package/src/summarizerTypes.ts +1 -0
  195. package/src/summaryFormat.ts +1 -2
@@ -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;AAOrH,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;AAK7C;;;;;;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,EAC1C,GAAG,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC;IAK3B,WAAW;IAIX,IAAI,CAAC,MAAM,EAAE,YAAY;CAGnC;AAmBD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,C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,CAAC,GAC1D,OAAO,CAAC,oBAAoB,CAAC;IAchC;;OAEG;IACH,OAAO,CAAC,IAAI;IAgBZ;;;;;OAKG;IACI,SAAS,CAAC,MAAM,GAAE,OAAe,GAAG,sBAAsB;IASjE;;;OAGG;IACI,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI;IAcvD;;;;OAIG;IACI,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,EAAE;IA0BjD,SAAS,CAAC,gBAAgB,CAAC,EAAE,iBAAiB,GAAG,qBAAqB;IAqBtE,gBAAgB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAa3C,eAAe,IAAI,aAAa;CAO1C"}
@@ -4,12 +4,13 @@
4
4
  */
5
5
  import { v4 as uuid } from "uuid";
6
6
  import { createResponseError, generateHandleContextPath, responseToException, SummaryTreeBuilder, } from "@fluidframework/runtime-utils";
7
- import { assert, bufferToString, Deferred, stringToBuffer } from "@fluidframework/common-utils";
7
+ import { assert, bufferToString, Deferred, stringToBuffer, TypedEventEmitter } from "@fluidframework/common-utils";
8
8
  import { AttachState } from "@fluidframework/container-definitions";
9
9
  import { ChildLogger, loggerToMonitoringContext, PerformanceEvent } from "@fluidframework/telemetry-utils";
10
10
  import { Throttler, formExponentialFn } from "./throttler";
11
11
  import { summarizerClientType } from "./summarizerClientElection";
12
- import { throwOnTombstoneUsageKey } from "./garbageCollectionConstants";
12
+ import { throwOnTombstoneLoadKey } from "./garbageCollectionConstants";
13
+ import { sendGCTombstoneEvent } from "./garbageCollectionTombstoneUtils";
13
14
  /**
14
15
  * This class represents blob (long string)
15
16
  * This object is used only when creating (writing) new blob and serialization purposes.
@@ -61,26 +62,28 @@ var PendingBlobStatus;
61
62
  PendingBlobStatus[PendingBlobStatus["OfflinePendingUpload"] = 2] = "OfflinePendingUpload";
62
63
  PendingBlobStatus[PendingBlobStatus["OfflinePendingOp"] = 3] = "OfflinePendingOp";
63
64
  })(PendingBlobStatus || (PendingBlobStatus = {}));
64
- export class BlobManager {
65
+ export class BlobManager extends TypedEventEmitter {
65
66
  constructor(routeContext, snapshot, getStorage,
66
67
  /**
67
- * Submit a BlobAttach op. When a blob is uploaded, there is a short grace period before which
68
- * the blob is deleted. The BlobAttach op notifies the server that blob is in use. The server
69
- * will then not delete the blob as long as it is listed as referenced in future summaries.
70
- * The summarizing client will know to include the storage ID in the summary when it sees the op.
68
+ * Submit a BlobAttach op. When a blob is uploaded, there is a short grace period before which the blob is
69
+ * deleted. The BlobAttach op notifies the server that blob is in use. The server will then not delete the
70
+ * the blob as long as it is listed as referenced in future summaries. The summarizing client will know to
71
+ * include the storage ID in the summary when it sees the op.
71
72
  *
72
- * The op may also include a local ID to inform all clients of the relation to the storage
73
- * ID, without knowledge of which they cannot request the blob from storage. This is also
74
- * included in the redirect table in the summary.
73
+ * The op will also include a local ID to inform all clients of the relation to the storage ID, without
74
+ * knowledge of which they cannot request the blob from storage. It's important that this op is sequenced
75
+ * before any ops that reference the local ID, otherwise, an invalid handle could be added to the document.
75
76
  */
76
77
  sendBlobAttachOp,
77
78
  // To be called when a blob node is requested. blobPath is the path of the blob's node in GC's graph. It's
78
79
  // of the format `/<BlobManager.basePath>/<blobId>`.
79
- gcNodeUpdated, runtime, stashedBlobs = {}) {
80
+ blobRequested, addedBlobReference, runtime, stashedBlobs = {}) {
81
+ super();
80
82
  this.routeContext = routeContext;
81
83
  this.getStorage = getStorage;
82
84
  this.sendBlobAttachOp = sendBlobAttachOp;
83
- this.gcNodeUpdated = gcNodeUpdated;
85
+ this.blobRequested = blobRequested;
86
+ this.addedBlobReference = addedBlobReference;
84
87
  this.runtime = runtime;
85
88
  /**
86
89
  * Blobs which have not been uploaded or for which we have not yet seen a BlobAttach op round-trip.
@@ -89,8 +92,9 @@ export class BlobManager {
89
92
  */
90
93
  this.pendingBlobs = new Map();
91
94
  /**
92
- * Track ops in flight for online flow. Used to avoid searching pendingBlobs since BlobAttach ops
93
- * don't include local ID in online flow.
95
+ * Track ops in flight for online flow. This is used for optimizations where if we receive an ack for a storage ID,
96
+ * we can resolve all pending blobs with the same storage ID even though they may have different local IDs. That's
97
+ * because we know that the server will not delete the blob corresponding to that storage ID.
94
98
  */
95
99
  this.opsInFlight = new Map();
96
100
  this.retryThrottler = new CancellableThrottler(new Throttler(60 * 1000, // 60 sec delay window
@@ -98,14 +102,14 @@ export class BlobManager {
98
102
  // throttling function increases exponentially (0ms, 40ms, 80ms, 160ms, etc)
99
103
  formExponentialFn({ coefficient: 20, initialDelay: 0 })));
100
104
  /**
101
- * This stores ides of tombstoned blobs.
105
+ * This stores IDs of tombstoned blobs.
102
106
  * Tombstone is a temporary feature that imitates a blob getting swept by garbage collection.
103
107
  */
104
108
  this.tombstonedBlobs = new Set();
105
109
  this.mc = loggerToMonitoringContext(ChildLogger.create(this.runtime.logger, "BlobManager"));
106
110
  // 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 &&
111
+ this.throwOnTombstoneLoad =
112
+ this.mc.config.getBoolean(throwOnTombstoneLoadKey) === true &&
109
113
  this.runtime.clientDetails.type !== summarizerClientType;
110
114
  this.runtime.on("disconnected", () => this.onDisconnected());
111
115
  this.redirectTable = this.load(snapshot);
@@ -127,6 +131,10 @@ export class BlobManager {
127
131
  get hasPendingOfflineUploads() {
128
132
  return this.pendingOfflineUploads.length > 0;
129
133
  }
134
+ get hasPendingBlobs() {
135
+ return (this.runtime.attachState !== AttachState.Attached && this.redirectTable.size > 0)
136
+ || this.pendingBlobs.size > 0;
137
+ }
130
138
  /**
131
139
  * Upload blobs added while offline. This must be completed before connecting and resubmitting ops.
132
140
  */
@@ -175,12 +183,13 @@ export class BlobManager {
175
183
  async getBlob(blobId) {
176
184
  const request = { url: blobId };
177
185
  if (this.tombstonedBlobs.has(blobId)) {
178
- const error = responseToException(createResponseError(404, "Blob removed by gc", request), request);
179
- this.mc.logger.sendErrorEvent({
186
+ const error = responseToException(createResponseError(404, "Blob was deleted", request), request);
187
+ sendGCTombstoneEvent(this.mc, {
180
188
  eventName: "GC_Tombstone_Blob_Requested",
181
- url: request.url,
182
- }, error);
183
- if (this.throwOnTombstoneUsage) {
189
+ category: this.throwOnTombstoneLoad ? "error" : "generic",
190
+ isSummarizerClient: this.runtime.clientDetails.type === summarizerClientType,
191
+ }, [BlobManager.basePath], error);
192
+ if (this.throwOnTombstoneLoad) {
184
193
  throw error;
185
194
  }
186
195
  }
@@ -196,11 +205,12 @@ export class BlobManager {
196
205
  storageId = blobId;
197
206
  }
198
207
  else {
199
- storageId = this.redirectTable.get(blobId);
200
- assert(!!storageId, 0x11f /* "requesting unknown blobs" */);
208
+ const attachedStorageId = this.redirectTable.get(blobId);
209
+ assert(!!attachedStorageId, 0x11f /* "requesting unknown blobs" */);
210
+ storageId = attachedStorageId;
201
211
  }
202
- // When a GC-able (not pending) blob is retrieved, let runtime know that the corresponding GC node got updated.
203
- this.gcNodeUpdated(this.getBlobGCNodePath(blobId));
212
+ // Let runtime know that the corresponding GC node was requested.
213
+ this.blobRequested(this.getBlobGCNodePath(blobId));
204
214
  return PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "AttachmentReadBlob", id: storageId }, async () => {
205
215
  return this.getStorage().readBlob(storageId);
206
216
  }, { end: true, cancel: "error" });
@@ -213,7 +223,7 @@ export class BlobManager {
213
223
  // Blobs created while the container is detached are stored in IDetachedBlobStorage.
214
224
  // The 'IDocumentStorageService.createBlob()' call below will respond with a localId.
215
225
  const response = await this.getStorage().createBlob(blob);
216
- this.redirectTable.set(response.id, undefined);
226
+ this.setRedirection(response.id, undefined);
217
227
  return this.getBlobHandle(response.id);
218
228
  }
219
229
  async createBlob(blob) {
@@ -226,8 +236,8 @@ export class BlobManager {
226
236
  await new Promise((resolve) => this.runtime.once("attached", resolve));
227
237
  }
228
238
  assert(this.runtime.attachState === AttachState.Attached, 0x385 /* For clarity and paranoid defense against adding future attachment states */);
229
- // Create a local ID for each blob. This is used to support blobs if/when the client goes
230
- // offline since we don't have the ID from storage yet. If online flow succeeds this won't be used.
239
+ // Create a local ID for the blob. After uploading it to storage and before returning it, a local ID to
240
+ // storage ID mapping is created.
231
241
  const localId = uuid();
232
242
  const pendingEntry = {
233
243
  blob,
@@ -241,6 +251,26 @@ export class BlobManager {
241
251
  async uploadBlob(localId, blob) {
242
252
  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));
243
253
  }
254
+ /**
255
+ * Set up a mapping in the redirect table from fromId to toId. Also, notify the runtime that a reference is added
256
+ * which is required for GC.
257
+ */
258
+ setRedirection(fromId, toId) {
259
+ this.redirectTable.set(fromId, toId);
260
+ // Notify runtime of a reference added if toId is not undefined. It can be undefined when a blob is uploaded in
261
+ // detached mode. In this case, the entry will be updated when the blob is updated.
262
+ if (toId !== undefined) {
263
+ this.addedBlobReference(this.getBlobGCNodePath(fromId), this.getBlobGCNodePath(toId));
264
+ }
265
+ }
266
+ deleteAndEmitsIfEmpty(id) {
267
+ if (this.pendingBlobs.has(id)) {
268
+ this.pendingBlobs.delete(id);
269
+ if (!this.hasPendingBlobs) {
270
+ this.emit("noPendingBlobs");
271
+ }
272
+ }
273
+ }
244
274
  onUploadResolve(localId, response) {
245
275
  var _a;
246
276
  const entry = this.pendingBlobs.get(localId);
@@ -249,17 +279,24 @@ export class BlobManager {
249
279
  entry.storageId = response.id;
250
280
  if (this.runtime.connected) {
251
281
  if (entry.status === PendingBlobStatus.OnlinePendingUpload) {
282
+ // Send a blob attach op. This serves two purposes:
283
+ // 1. If its a new blob, i.e., it isn't de-duped, the server will keep the blob alive if it sees this op
284
+ // until its storage ID is added to the next summary.
285
+ // 2. It will create a local ID to storage ID mapping in all clients which is needed to retrieve the
286
+ // blob from the server via the storage ID.
287
+ this.sendBlobAttachOp(localId, response.id);
252
288
  if (this.storageIds.has(response.id)) {
253
- // Storage may dedupe blobs and give us an ID we already know
254
- // no need to submit BlobAttach op in this case
255
- entry.handleP.resolve(this.getBlobHandle(response.id));
256
- this.pendingBlobs.delete(localId);
289
+ // The blob is de-duped. Set up a local ID to storage ID mapping and return the blob. Since this is
290
+ // an existing blob, we don't have to wait for the op to be ack'd since this step has already
291
+ // happened before and so, the server won't delete it.
292
+ this.setRedirection(localId, response.id);
293
+ entry.handleP.resolve(this.getBlobHandle(localId));
294
+ this.deleteAndEmitsIfEmpty(localId);
257
295
  }
258
296
  else {
259
- // Check for still-pending duplicates too; if an op is already in flight we can wait for that one
260
- if (!this.opsInFlight.has(response.id)) {
261
- this.sendBlobAttachOp(response.id);
262
- }
297
+ // If there is already an op for this storage ID, append the local ID to the list. Once any op for
298
+ // this storage ID is ack'd, all pending blobs for it can be resolved since the op will keep the
299
+ // blob alive in storage.
263
300
  this.opsInFlight.set(response.id, ((_a = this.opsInFlight.get(response.id)) !== null && _a !== void 0 ? _a : []).concat(localId));
264
301
  entry.status = PendingBlobStatus.OnlinePendingOp;
265
302
  }
@@ -300,15 +337,19 @@ export class BlobManager {
300
337
  const entry = this.pendingBlobs.get(localId);
301
338
  assert(!!entry, 0x389 /* No pending blob entry */);
302
339
  assert([PendingBlobStatus.OnlinePendingUpload, PendingBlobStatus.OnlinePendingOp].includes(entry.status), 0x38a /* Blob must be in online flow to transition to offline flow */);
340
+ /**
341
+ * If we haven't already submitted a BlobAttach op for this entry, send it before returning the blob handle.
342
+ * This will make sure that the BlobAttach op is sequenced prior to any ops referencing the handle. Otherwise,
343
+ * an invalid handle could be added to the document.
344
+ * storageId may be undefined but since we are not connected we will have a chance to add it when reSubmit()
345
+ * is called on reconnection.
346
+ */
347
+ if (entry.status !== PendingBlobStatus.OnlinePendingOp) {
348
+ this.sendBlobAttachOp(localId, entry.storageId);
349
+ }
303
350
  entry.status = entry.status === PendingBlobStatus.OnlinePendingUpload
304
351
  ? PendingBlobStatus.OfflinePendingUpload
305
352
  : PendingBlobStatus.OfflinePendingOp;
306
- // Submit a BlobAttach op. It's important we submit this op now before returning the blob handle so the
307
- // BlobAttach op is sequenced prior to any ops referencing the handle. Otherwise an invalid handle could be
308
- // added to the document if the ops are not all successfully submitted upon reconnection.
309
- // storageId may be undefined but since we are not connected we will have a chance to add it when reSubmit()
310
- // is called
311
- this.sendBlobAttachOp(entry.storageId, localId);
312
353
  entry.handleP.resolve(this.getBlobHandle(localId));
313
354
  }
314
355
  /**
@@ -318,45 +359,52 @@ export class BlobManager {
318
359
  */
319
360
  reSubmit(metadata) {
320
361
  assert(!!metadata, 0x38b /* Resubmitted ops must have metadata */);
321
- const { blobId, localId } = metadata;
362
+ const { localId, blobId } = metadata;
363
+ assert(localId !== undefined, 0x50d /* local ID not available on reSubmit */);
322
364
  if (!blobId) {
323
- assert(!!localId, 0x38c /* Submitted BlobAttach ops must have a blobId or localId */);
324
365
  // We submitted this op while offline. The blob should have been uploaded by now.
325
366
  const pendingEntry = this.pendingBlobs.get(localId);
326
367
  assert((pendingEntry === null || pendingEntry === void 0 ? void 0 : pendingEntry.status) === PendingBlobStatus.OfflinePendingOp &&
327
368
  !!(pendingEntry === null || pendingEntry === void 0 ? void 0 : pendingEntry.storageId), 0x38d /* blob must be uploaded before resubmitting BlobAttach op */);
328
- return this.sendBlobAttachOp(pendingEntry.storageId, localId);
369
+ return this.sendBlobAttachOp(localId, pendingEntry.storageId);
329
370
  }
330
- return this.sendBlobAttachOp(blobId, localId);
371
+ return this.sendBlobAttachOp(localId, blobId);
331
372
  }
332
373
  processBlobAttachOp(message, local) {
333
374
  var _a, _b;
334
- assert((_a = message === null || message === void 0 ? void 0 : message.metadata) === null || _a === void 0 ? void 0 : _a.blobId, 0x12a /* "Missing blob id on metadata" */);
335
- if (message.metadata.localId !== undefined) {
336
- this.redirectTable.set(message.metadata.localId, message.metadata.blobId);
375
+ const localId = (_a = message.metadata) === null || _a === void 0 ? void 0 : _a.localId;
376
+ const blobId = (_b = message.metadata) === null || _b === void 0 ? void 0 : _b.blobId;
377
+ assert(blobId !== undefined, 0x12a /* "Missing blob id on metadata" */);
378
+ // Set up a mapping from local ID to storage ID. This is crucial since without this the blob cannot be
379
+ // requested from the server.
380
+ // Note: The check for undefined is needed for back-compat when localId was not part of the BlobAttach op that
381
+ // was sent when online.
382
+ if (localId !== undefined) {
383
+ this.setRedirection(localId, blobId);
337
384
  }
338
385
  // set identity (id -> id) entry
339
- this.redirectTable.set(message.metadata.blobId, message.metadata.blobId);
386
+ this.setRedirection(blobId, blobId);
340
387
  if (local) {
341
- if (message.metadata.localId === undefined) {
342
- // Since there is no local ID, we know this op was submitted while online.
343
- const waitingBlobs = this.opsInFlight.get(message.metadata.blobId);
344
- assert(!!waitingBlobs, 0x38e /* local online BlobAttach op with no pending blob */);
345
- waitingBlobs.forEach((localId) => {
346
- const pendingBlobEntry = this.pendingBlobs.get(localId);
388
+ assert(localId !== undefined, 0x50e /* local ID not present in blob attach message */);
389
+ const waitingBlobs = this.opsInFlight.get(blobId);
390
+ if (waitingBlobs !== undefined) {
391
+ // For each op corresponding to this storage ID that we are waiting for, resolve the pending blob.
392
+ // This is safe because the server will keep the blob alive and the op containing the local ID to
393
+ // storage ID is already in flight and any op containing this local ID will be sequenced after that.
394
+ waitingBlobs.forEach((pendingLocalId) => {
395
+ const pendingBlobEntry = this.pendingBlobs.get(pendingLocalId);
347
396
  assert(pendingBlobEntry !== undefined, 0x38f);
348
397
  // It's possible we transitioned to offline flow while waiting for this op.
349
398
  if (pendingBlobEntry.status === PendingBlobStatus.OnlinePendingOp) {
350
- pendingBlobEntry.handleP.resolve(this.getBlobHandle(message.metadata.blobId));
351
- this.pendingBlobs.delete(localId);
399
+ this.setRedirection(pendingLocalId, blobId);
400
+ pendingBlobEntry.handleP.resolve(this.getBlobHandle(pendingLocalId));
401
+ this.deleteAndEmitsIfEmpty(pendingLocalId);
352
402
  }
353
403
  });
404
+ this.opsInFlight.delete(blobId);
354
405
  }
355
- else {
356
- // Each local ID is unique; get the pending blob entry and delete it
357
- assert(((_b = this.pendingBlobs.get(message.metadata.localId)) === null || _b === void 0 ? void 0 : _b.status) === PendingBlobStatus.OfflinePendingOp, 0x1f8 /* "local BlobAttach op with no pending blob" */);
358
- this.pendingBlobs.delete(message.metadata.localId);
359
- }
406
+ // For blobs that were transitioned to offline flow while waiting for this op, the entry should be deleted.
407
+ this.deleteAndEmitsIfEmpty(localId);
360
408
  }
361
409
  }
362
410
  /**
@@ -405,65 +453,50 @@ export class BlobManager {
405
453
  */
406
454
  getGCData(fullGC = false) {
407
455
  const gcData = { gcNodes: {} };
408
- /**
409
- * The node path is of the format `/_blobs/blobId`. This path must match the path of the blob handle returned
410
- * by the createBlob API because blobs are marked referenced by storing these handles in a referenced DDS.
411
- */
412
- this.storageIds.forEach((blobId) => {
413
- gcData.gcNodes[this.getBlobGCNodePath(blobId)] = [];
414
- });
415
- // For some blobs, the handle returned on creation is based off of the localId. So, these
416
- // nodes can be referenced by storing the localId handle. When that happens, the corresponding storageId node
417
- // must also be marked referenced. So, we add a route from the localId node to the storageId node.
418
- // Note that because of de-duping, there can be multiple localIds that all redirect to the same storageId or
419
- // a blob may be referenced via its storageId handle.
420
456
  for (const [localId, storageId] of this.redirectTable) {
421
457
  assert(!!storageId, 0x390 /* Must be attached to get GC data */);
422
- // Add node for the localId and add a route to the storageId node. The storageId node will have been
423
- // added above when adding nodes for this.blobIds.
424
458
  gcData.gcNodes[this.getBlobGCNodePath(localId)] = [this.getBlobGCNodePath(storageId)];
425
459
  }
426
460
  return gcData;
427
461
  }
428
462
  /**
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.
463
+ * This is called to update blobs whose routes are unused. The unused blobs are deleted.
464
+ * @param unusedRoutes - The routes of the blob nodes that are unused.
431
465
  */
432
- updateUsedRoutes(usedRoutes) {
466
+ updateUnusedRoutes(unusedRoutes) {
433
467
  // The routes or blob node paths are in the same format as returned in getGCData -
434
468
  // `/<BlobManager.basePath>/<blobId>`.
435
- for (const route of usedRoutes) {
469
+ for (const route of unusedRoutes) {
436
470
  const pathParts = route.split("/");
437
- assert(pathParts.length === 3 && pathParts[1] === BlobManager.basePath, 0x4bc /* Invalid blob node id in used routes. */);
471
+ assert(pathParts.length === 3 && pathParts[1] === BlobManager.basePath, 0x2d5 /* "Invalid blob node id in unused routes." */);
438
472
  const blobId = pathParts[2];
439
- // Un-tombstone the blob if it was marked tombstone.
440
- this.tombstonedBlobs.delete(blobId);
473
+ this.redirectTable.delete(blobId);
441
474
  }
442
475
  }
443
476
  /**
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.
477
+ * This is called to update blobs whose routes are tombstones. Tombstoned blobs enable testing scenarios with
478
+ * accessing deleted content without actually deleting content from summaries.
479
+ * @param tombstonedRoutes - The routes of blob nodes that are tombstones.
449
480
  */
450
- updateUnusedRoutes(unusedRoutes, tombstone) {
481
+ updateTombstonedRoutes(tombstonedRoutes) {
482
+ const tombstonedBlobsSet = new Set();
451
483
  // The routes or blob node paths are in the same format as returned in getGCData -
452
484
  // `/<BlobManager.basePath>/<blobId>`.
453
- for (const route of unusedRoutes) {
485
+ for (const route of tombstonedRoutes) {
454
486
  const pathParts = route.split("/");
455
- assert(pathParts.length === 3 && pathParts[1] === BlobManager.basePath, 0x2d5 /* "Invalid blob node id in unused routes." */);
456
- const blobId = pathParts[2];
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.
464
- this.redirectTable.delete(blobId);
487
+ assert(pathParts.length === 3 && pathParts[1] === BlobManager.basePath, 0x50f /* Invalid blob node id in tombstoned routes. */);
488
+ tombstonedBlobsSet.add(pathParts[2]);
489
+ }
490
+ // Remove blobs from the tombstone list that were tombstoned but aren't anymore as per the tombstoneRoutes.
491
+ for (const blobId of this.tombstonedBlobs) {
492
+ if (!tombstonedBlobsSet.has(blobId)) {
493
+ this.tombstonedBlobs.delete(blobId);
465
494
  }
466
495
  }
496
+ // Mark blobs that are now tombstoned by adding them to the tombstone list.
497
+ for (const blobId of tombstonedBlobsSet) {
498
+ this.tombstonedBlobs.add(blobId);
499
+ }
467
500
  }
468
501
  summarize(telemetryContext) {
469
502
  // if storageIds is empty, it means we are detached and have only local IDs, or that there are no blobs attached
@@ -486,9 +519,9 @@ export class BlobManager {
486
519
  assert(this.redirectTable.size === table.size, 0x391 /* Redirect table size must match BlobManager's local ID count */);
487
520
  for (const [localId, storageId] of table) {
488
521
  assert(this.redirectTable.has(localId), 0x254 /* "unrecognized id in redirect table" */);
489
- this.redirectTable.set(localId, storageId);
522
+ this.setRedirection(localId, storageId);
490
523
  // set identity (id -> id) entry
491
- this.redirectTable.set(storageId, storageId);
524
+ this.setRedirection(storageId, storageId);
492
525
  }
493
526
  }
494
527
  getPendingBlobs() {