@fluidframework/container-runtime 2.10.0-306579 → 2.10.0-307399

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 (39) hide show
  1. package/container-runtime.test-files.tar +0 -0
  2. package/dist/blobManager/blobManager.d.ts +1 -6
  3. package/dist/blobManager/blobManager.d.ts.map +1 -1
  4. package/dist/blobManager/blobManager.js +10 -29
  5. package/dist/blobManager/blobManager.js.map +1 -1
  6. package/dist/channelCollection.d.ts.map +1 -1
  7. package/dist/channelCollection.js +0 -4
  8. package/dist/channelCollection.js.map +1 -1
  9. package/dist/containerRuntime.js +1 -1
  10. package/dist/containerRuntime.js.map +1 -1
  11. package/dist/dataStoreContext.d.ts +0 -1
  12. package/dist/dataStoreContext.d.ts.map +1 -1
  13. package/dist/dataStoreContext.js +0 -4
  14. package/dist/dataStoreContext.js.map +1 -1
  15. package/dist/packageVersion.d.ts +1 -1
  16. package/dist/packageVersion.js +1 -1
  17. package/dist/packageVersion.js.map +1 -1
  18. package/lib/blobManager/blobManager.d.ts +1 -6
  19. package/lib/blobManager/blobManager.d.ts.map +1 -1
  20. package/lib/blobManager/blobManager.js +11 -30
  21. package/lib/blobManager/blobManager.js.map +1 -1
  22. package/lib/channelCollection.d.ts.map +1 -1
  23. package/lib/channelCollection.js +0 -4
  24. package/lib/channelCollection.js.map +1 -1
  25. package/lib/containerRuntime.js +1 -1
  26. package/lib/containerRuntime.js.map +1 -1
  27. package/lib/dataStoreContext.d.ts +0 -1
  28. package/lib/dataStoreContext.d.ts.map +1 -1
  29. package/lib/dataStoreContext.js +0 -4
  30. package/lib/dataStoreContext.js.map +1 -1
  31. package/lib/packageVersion.d.ts +1 -1
  32. package/lib/packageVersion.js +1 -1
  33. package/lib/packageVersion.js.map +1 -1
  34. package/package.json +19 -19
  35. package/src/blobManager/blobManager.ts +24 -39
  36. package/src/channelCollection.ts +0 -4
  37. package/src/containerRuntime.ts +1 -1
  38. package/src/dataStoreContext.ts +0 -6
  39. package/src/packageVersion.ts +1 -1
@@ -17,7 +17,7 @@ import {
17
17
  IFluidHandleContext,
18
18
  type IFluidHandleInternal,
19
19
  } from "@fluidframework/core-interfaces/internal";
20
- import { assert, Deferred } from "@fluidframework/core-utils/internal";
20
+ import { assert, Deferred, LazyPromise } from "@fluidframework/core-utils/internal";
21
21
  import {
22
22
  IDocumentStorageService,
23
23
  ICreateBlobResponse,
@@ -181,10 +181,9 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
181
181
  private readonly runtime: IBlobManagerRuntime;
182
182
  private readonly closeContainer: (error?: ICriticalContainerError) => void;
183
183
  private readonly localBlobIdGenerator: () => string;
184
- // TODO: consider to replace with a lazy promise
185
184
  private readonly pendingStashedBlobs: Map<string, Promise<ICreateBlobResponse | void>> =
186
185
  new Map();
187
- private stashedBlobsUploadP: Promise<(void | ICreateBlobResponse)[]> | undefined = undefined;
186
+ public readonly stashedBlobsUploadP: Promise<(void | ICreateBlobResponse)[]>;
188
187
 
189
188
  constructor(props: {
190
189
  readonly routeContext: IFluidHandleContext;
@@ -271,11 +270,18 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
271
270
  uploadP: this.pendingStashedBlobs.get(localId),
272
271
  });
273
272
  });
274
- this.waitForStashedBlobs()
275
- .catch(() => {})
276
- .finally(() => {
277
- this.pendingStashedBlobs.clear();
278
- });
273
+
274
+ this.stashedBlobsUploadP = new LazyPromise(async () =>
275
+ PerformanceEvent.timedExecAsync(
276
+ this.mc.logger,
277
+ { eventName: "BlobUploadProcessStashedChanges", count: this.pendingStashedBlobs.size },
278
+ async () => Promise.all(this.pendingStashedBlobs.values()),
279
+ { start: true, end: true },
280
+ ),
281
+ ).finally(() => {
282
+ this.pendingStashedBlobs.clear();
283
+ });
284
+
279
285
  this.sendBlobAttachOp = (localId: string, blobId?: string) => {
280
286
  const pendingEntry = this.pendingBlobs.get(localId);
281
287
  assert(
@@ -307,17 +313,6 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
307
313
  };
308
314
  }
309
315
 
310
- public async waitForStashedBlobs(): Promise<(void | ICreateBlobResponse)[]> {
311
- if (!this.stashedBlobsUploadP) {
312
- this.stashedBlobsUploadP = Promise.all(this.pendingStashedBlobs.values()).finally(() => {
313
- this.stashedBlobsUploadP = undefined;
314
- return;
315
- });
316
- }
317
-
318
- return this.stashedBlobsUploadP;
319
- }
320
-
321
316
  public get allBlobsAttached(): boolean {
322
317
  for (const [, entry] of this.pendingBlobs) {
323
318
  if (entry.attached === false) {
@@ -344,26 +339,6 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
344
339
  public hasPendingStashedUploads(): boolean {
345
340
  return Array.from(this.pendingBlobs.values()).some((e) => e.stashedUpload === true);
346
341
  }
347
- /**
348
- * Upload blobs added while offline. This must be completed before connecting and resubmitting ops.
349
- */
350
- public async trackPendingStashedUploads(): Promise<void> {
351
- const pendingUploads = Array.from(this.pendingBlobs.values())
352
- .filter((e) => e.stashedUpload === true)
353
- .map(async (e) => e.uploadP);
354
- if (pendingUploads.length === 0) {
355
- return;
356
- }
357
- await PerformanceEvent.timedExecAsync(
358
- this.mc.logger,
359
- {
360
- eventName: "BlobUploadProcessStashedChanges",
361
- count: pendingUploads.length,
362
- },
363
- async () => Promise.all(pendingUploads),
364
- { start: true, end: true },
365
- );
366
- }
367
342
 
368
343
  public async getBlob(blobId: string): Promise<ArrayBufferLike> {
369
344
  // Verify that the blob is not deleted, i.e., it has not been garbage collected. If it is, this will throw
@@ -552,6 +527,16 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
552
527
 
553
528
  private onUploadResolve(localId: string, response: ICreateBlobResponseWithTTL) {
554
529
  const entry = this.pendingBlobs.get(localId);
530
+ if (entry === undefined && this.pendingStashedBlobs.has(localId)) {
531
+ // The blob was already processed and deleted. This can happen if the blob was reuploaded by
532
+ // the stashing process and the original upload was processed before the stashed upload.
533
+ this.mc.logger.sendTelemetryEvent({
534
+ eventName: "StashedBlobAlreadyProcessed",
535
+ localId,
536
+ });
537
+ return;
538
+ }
539
+
555
540
  assert(entry !== undefined, 0x6c8 /* pending blob entry not found for uploaded blob */);
556
541
  if ((entry.abortSignal?.aborted === true && !entry.opsent) || this.stopAttaching) {
557
542
  this.mc.logger.sendTelemetryEvent({
@@ -171,10 +171,6 @@ export function wrapContext(context: IFluidParentContext): IFluidParentContext {
171
171
  getAudience: (...args) => {
172
172
  return context.getAudience(...args);
173
173
  },
174
- // back-compat, to be removed in 2.0
175
- ensureNoDataModelChanges: (...args) => {
176
- return context.ensureNoDataModelChanges(...args);
177
- },
178
174
  submitMessage: (...args) => {
179
175
  return context.submitMessage(...args);
180
176
  },
@@ -1116,7 +1116,7 @@ export class ContainerRuntime
1116
1116
  undefined, // summaryConfiguration
1117
1117
  );
1118
1118
 
1119
- runtime.blobManager.trackPendingStashedUploads().then(
1119
+ runtime.blobManager.stashedBlobsUploadP.then(
1120
1120
  () => {
1121
1121
  // make sure we didn't reconnect before the promise resolved
1122
1122
  if (runtime.delayConnectClientId !== undefined && !runtime.disposed) {
@@ -224,12 +224,6 @@ export abstract class FluidDataStoreContext
224
224
  public get containerRuntime(): IContainerRuntimeBase {
225
225
  return this._containerRuntime;
226
226
  }
227
-
228
- // back-compat, to be removed in 2.0
229
- public ensureNoDataModelChanges<T>(callback: () => T): T {
230
- return this.parentContext.ensureNoDataModelChanges(callback);
231
- }
232
-
233
227
  public get isLoaded(): boolean {
234
228
  return this.loaded;
235
229
  }
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-runtime";
9
- export const pkgVersion = "2.10.0-306579";
9
+ export const pkgVersion = "2.10.0-307399";