@fluidframework/container-runtime 2.43.0 → 2.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/container-runtime.test-files.tar +0 -0
  3. package/dist/blobManager/blobManager.d.ts +1 -5
  4. package/dist/blobManager/blobManager.d.ts.map +1 -1
  5. package/dist/blobManager/blobManager.js +0 -7
  6. package/dist/blobManager/blobManager.js.map +1 -1
  7. package/dist/channelCollection.d.ts +1 -1
  8. package/dist/channelCollection.js.map +1 -1
  9. package/dist/containerRuntime.d.ts.map +1 -1
  10. package/dist/containerRuntime.js +3 -3
  11. package/dist/containerRuntime.js.map +1 -1
  12. package/dist/dataStoreContext.d.ts +45 -9
  13. package/dist/dataStoreContext.d.ts.map +1 -1
  14. package/dist/dataStoreContext.js +26 -12
  15. package/dist/dataStoreContext.js.map +1 -1
  16. package/dist/gc/gcTelemetry.d.ts +3 -1
  17. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  18. package/dist/gc/gcTelemetry.js.map +1 -1
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +7 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  24. package/dist/opLifecycle/outbox.js +1 -4
  25. package/dist/opLifecycle/outbox.js.map +1 -1
  26. package/dist/packageVersion.d.ts +1 -1
  27. package/dist/packageVersion.js +1 -1
  28. package/dist/packageVersion.js.map +1 -1
  29. package/dist/runtimeLayerCompatState.d.ts +3 -3
  30. package/dist/runtimeLayerCompatState.d.ts.map +1 -1
  31. package/dist/runtimeLayerCompatState.js +10 -10
  32. package/dist/runtimeLayerCompatState.js.map +1 -1
  33. package/lib/blobManager/blobManager.d.ts +1 -5
  34. package/lib/blobManager/blobManager.d.ts.map +1 -1
  35. package/lib/blobManager/blobManager.js +0 -7
  36. package/lib/blobManager/blobManager.js.map +1 -1
  37. package/lib/channelCollection.d.ts +1 -1
  38. package/lib/channelCollection.js.map +1 -1
  39. package/lib/containerRuntime.d.ts.map +1 -1
  40. package/lib/containerRuntime.js +3 -3
  41. package/lib/containerRuntime.js.map +1 -1
  42. package/lib/dataStoreContext.d.ts +45 -9
  43. package/lib/dataStoreContext.d.ts.map +1 -1
  44. package/lib/dataStoreContext.js +26 -12
  45. package/lib/dataStoreContext.js.map +1 -1
  46. package/lib/gc/gcTelemetry.d.ts +3 -1
  47. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  48. package/lib/gc/gcTelemetry.js.map +1 -1
  49. package/lib/index.d.ts +1 -0
  50. package/lib/index.d.ts.map +1 -1
  51. package/lib/index.js +1 -0
  52. package/lib/index.js.map +1 -1
  53. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  54. package/lib/opLifecycle/outbox.js +1 -4
  55. package/lib/opLifecycle/outbox.js.map +1 -1
  56. package/lib/packageVersion.d.ts +1 -1
  57. package/lib/packageVersion.js +1 -1
  58. package/lib/packageVersion.js.map +1 -1
  59. package/lib/runtimeLayerCompatState.d.ts +3 -3
  60. package/lib/runtimeLayerCompatState.d.ts.map +1 -1
  61. package/lib/runtimeLayerCompatState.js +9 -9
  62. package/lib/runtimeLayerCompatState.js.map +1 -1
  63. package/package.json +18 -18
  64. package/src/blobManager/blobManager.ts +0 -9
  65. package/src/channelCollection.ts +1 -1
  66. package/src/containerRuntime.ts +3 -5
  67. package/src/dataStoreContext.ts +61 -25
  68. package/src/gc/gcTelemetry.ts +3 -1
  69. package/src/index.ts +7 -0
  70. package/src/opLifecycle/outbox.ts +1 -4
  71. package/src/packageVersion.ts +1 -1
  72. package/src/runtimeLayerCompatState.ts +10 -10
@@ -62,7 +62,7 @@ import {
62
62
  type IPendingMessagesState,
63
63
  type IRuntimeMessageCollection,
64
64
  type IFluidDataStoreFactory,
65
- type IFluidParentContext,
65
+ type PackagePath,
66
66
  } from "@fluidframework/runtime-definitions/internal";
67
67
  import {
68
68
  addBlobToSummary,
@@ -149,7 +149,13 @@ export interface IFluidDataStoreContextProps {
149
149
  readonly storage: IDocumentStorageService;
150
150
  readonly scope: FluidObject;
151
151
  readonly createSummarizerNodeFn: CreateChildSummarizerNodeFn;
152
- readonly pkg?: Readonly<string[]>;
152
+ /**
153
+ * See {@link FluidDataStoreContext.pkg}.
154
+ */
155
+ readonly pkg?: PackagePath;
156
+ /**
157
+ * See {@link FluidDataStoreContext.loadingGroupId}.
158
+ */
153
159
  readonly loadingGroupId?: string;
154
160
  }
155
161
 
@@ -179,8 +185,6 @@ export interface IRemoteFluidDataStoreContextProps extends IFluidDataStoreContex
179
185
 
180
186
  // back-compat: To be removed in the future.
181
187
  // Added in "2.0.0-rc.2.0.0" timeframe (to support older builds).
182
- /**
183
- */
184
188
  export interface IFluidDataStoreContextEvents extends IEvent {
185
189
  (event: "attaching" | "attached", listener: () => void);
186
190
  }
@@ -235,13 +239,13 @@ class ContextDeltaManagerProxy extends BaseDeltaManagerProxy {
235
239
  }
236
240
 
237
241
  /**
238
- * Represents the context for the store. This context is passed to the store runtime.
242
+ * {@link IFluidDataStoreContext} for the implementations of {@link IFluidDataStoreChannel} which powers the {@link IDataStore}s.
239
243
  */
240
244
  export abstract class FluidDataStoreContext
241
245
  extends TypedEventEmitter<IFluidDataStoreContextEvents>
242
- implements IFluidDataStoreContextInternal, IFluidParentContext, IDisposable
246
+ implements IFluidDataStoreContextInternal, IFluidDataStoreContext, IDisposable
243
247
  {
244
- public get packagePath(): readonly string[] {
248
+ public get packagePath(): PackagePath {
245
249
  assert(this.pkg !== undefined, 0x139 /* "Undefined package path" */);
246
250
  return this.pkg;
247
251
  }
@@ -413,14 +417,32 @@ export abstract class FluidDataStoreContext
413
417
 
414
418
  public readonly id: string;
415
419
  private readonly _containerRuntime: IContainerRuntimeBase;
420
+ /**
421
+ * Information for this data store from its parent.
422
+ *
423
+ * @remarks
424
+ * The parent which provided this information currently can be the container runtime or a datastore (if the datastore this context is for is nested under another one).
425
+ */
416
426
  private readonly parentContext: IFluidParentContextPrivate;
417
427
  public readonly storage: IDocumentStorageService;
418
428
  public readonly scope: FluidObject;
419
- // Represents the group to which the data store belongs too.
429
+ /**
430
+ * The loading group to which the data store belongs to.
431
+ */
420
432
  public readonly loadingGroupId: string | undefined;
421
- protected pkg?: readonly string[];
433
+ /**
434
+ * {@link PackagePath} of this data store.
435
+ *
436
+ * This can be undefined when a data store is delay loaded, i.e., the attributes of this data store in the snapshot are not fetched until this data store is actually used.
437
+ * At that time, the attributes blob is fetched and the pkg is updated from it.
438
+ *
439
+ * @see {@link PackagePath}.
440
+ * @see {@link IFluidDataStoreContext.packagePath}.
441
+ * @see {@link factoryFromPackagePath}.
442
+ */
443
+ protected pkg?: PackagePath;
422
444
 
423
- constructor(
445
+ public constructor(
424
446
  props: IFluidDataStoreContextProps,
425
447
  private readonly existing: boolean,
426
448
  public readonly isLocalDataStore: boolean,
@@ -522,10 +544,13 @@ export abstract class FluidDataStoreContext
522
544
  attachState: AttachState.Attaching | AttachState.Attached,
523
545
  ): void;
524
546
 
525
- private rejectDeferredRealize(
547
+ /**
548
+ * Throw a {@link LoggingError} indicating that {@link factoryFromPackagePath} failed.
549
+ */
550
+ private factoryFromPackagePathError(
526
551
  reason: string,
527
552
  failedPkgPath?: string,
528
- fullPackageName?: readonly string[],
553
+ fullPackageName?: PackagePath,
529
554
  ): never {
530
555
  throw new LoggingError(
531
556
  reason,
@@ -560,34 +585,45 @@ export abstract class FluidDataStoreContext
560
585
  return this.channelP;
561
586
  }
562
587
 
588
+ /**
589
+ * Gets the factory that would be used to instantiate this data store by calling `instantiateDataStore` based on {@link pkg}.
590
+ * @remarks
591
+ * Also populates {@link registry}.
592
+ *
593
+ * Must be called after {@link pkg} is set, and only called once.
594
+ *
595
+ * @see {@link @fluidframework/container-runtime-definitions#IContainerRuntimeBase.createDataStore}.
596
+ * @see {@link FluidDataStoreContext.pkg}.
597
+ */
563
598
  protected async factoryFromPackagePath(): Promise<IFluidDataStoreFactory> {
564
- const packages = this.pkg;
565
- if (packages === undefined) {
566
- this.rejectDeferredRealize("packages is undefined");
599
+ const path = this.pkg;
600
+ if (path === undefined) {
601
+ this.factoryFromPackagePathError("packages is undefined");
567
602
  }
568
603
 
569
604
  let entry: FluidDataStoreRegistryEntry | undefined;
570
605
  let registry: IFluidDataStoreRegistry | undefined =
571
606
  this.parentContext.IFluidDataStoreRegistry;
572
- let lastPkg: string | undefined;
573
- for (const pkg of packages) {
607
+ let lastIdentifier: string | undefined;
608
+ // Follow the path, looking up each identifier in the registry along the way:
609
+ for (const identifier of path) {
574
610
  if (!registry) {
575
- this.rejectDeferredRealize("No registry for package", lastPkg, packages);
611
+ this.factoryFromPackagePathError("No registry for package", lastIdentifier, path);
576
612
  }
577
- lastPkg = pkg;
578
- entry = registry.getSync?.(pkg) ?? (await registry.get(pkg));
613
+ lastIdentifier = identifier;
614
+ entry = registry.getSync?.(identifier) ?? (await registry.get(identifier));
579
615
  if (!entry) {
580
- this.rejectDeferredRealize(
616
+ this.factoryFromPackagePathError(
581
617
  "Registry does not contain entry for the package",
582
- pkg,
583
- packages,
618
+ identifier,
619
+ path,
584
620
  );
585
621
  }
586
622
  registry = entry.IFluidDataStoreRegistry;
587
623
  }
588
624
  const factory = entry?.IFluidDataStoreFactory;
589
625
  if (factory === undefined) {
590
- this.rejectDeferredRealize("Can't find factory for package", lastPkg, packages);
626
+ this.factoryFromPackagePathError("Can't find factory for package", lastIdentifier, path);
591
627
  }
592
628
 
593
629
  assert(this.registry === undefined, 0x157 /* "datastore registry already attached" */);
@@ -596,7 +632,7 @@ export abstract class FluidDataStoreContext
596
632
  return factory;
597
633
  }
598
634
 
599
- createChildDataStore<T extends IFluidDataStoreFactory>(
635
+ public createChildDataStore<T extends IFluidDataStoreFactory>(
600
636
  childFactory: T,
601
637
  ): ReturnType<Exclude<T["createDataStore"], undefined>> {
602
638
  const maybe = this.registry?.getSync?.(childFactory.type);
@@ -77,7 +77,9 @@ interface INodeUsageProps extends ICommonProps {
77
77
  */
78
78
  currentReferenceTimestampMs: number;
79
79
  /**
80
- * The package path of the node. This may not be available if the node hasn't been loaded yet
80
+ * The package path of the node. This may not be available if the node hasn't been loaded yet.
81
+ *
82
+ * @see {@link @fluidframework/runtime-definitions#IFluidDataStoreContext.packagePath} for more details.
81
83
  */
82
84
  packagePath: readonly string[] | undefined;
83
85
  /**
package/src/index.ts CHANGED
@@ -112,3 +112,10 @@ export {
112
112
  DefaultSummaryConfiguration,
113
113
  } from "./summary/index.js";
114
114
  export { IChunkedOp, unpackRuntimeMessage } from "./opLifecycle/index.js";
115
+ export {
116
+ runtimeCoreCompatDetails,
117
+ runtimeCompatDetailsForLoader,
118
+ runtimeCompatDetailsForDataStore,
119
+ loaderSupportRequirementsForRuntime,
120
+ dataStoreSupportRequirementsForRuntime,
121
+ } from "./runtimeLayerCompatState.js";
@@ -455,10 +455,7 @@ export class Outbox {
455
455
  if (
456
456
  batchManager.options.canRebase &&
457
457
  rawBatch.hasReentrantOps === true &&
458
- // NOTE: This is too restrictive. We should rebase for any reentrant op, not just if it's going to be a grouped batch
459
- // However there is some test that is depending on this behavior so we haven't removed these conditions yet. See AB#33427
460
- groupingEnabled &&
461
- rawBatch.messages.length > 1
458
+ groupingEnabled
462
459
  ) {
463
460
  assert(!this.rebasing, 0x6fa /* A rebased batch should never have reentrant ops */);
464
461
  // If a batch contains reentrant ops (ops created as a result from processing another op)
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-runtime";
9
- export const pkgVersion = "2.43.0";
9
+ export const pkgVersion = "2.50.0";
@@ -48,7 +48,7 @@ export const runtimeCompatDetailsForLoader: ILayerCompatDetails = {
48
48
  * The requirements that the Loader layer must meet to be compatible with this Runtime.
49
49
  * @internal
50
50
  */
51
- export const loaderSupportRequirements: ILayerCompatSupportRequirements = {
51
+ export const loaderSupportRequirementsForRuntime: ILayerCompatSupportRequirements = {
52
52
  /**
53
53
  * Minimum generation that Loader must be at to be compatible with Runtime. Note that 0 is used here so
54
54
  * that Loader layers before the introduction of the layer compatibility enforcement are compatible.
@@ -76,7 +76,7 @@ export const runtimeCompatDetailsForDataStore: ILayerCompatDetails = {
76
76
  * The requirements that the DataStore layer must meet to be compatible with this Runtime.
77
77
  * @internal
78
78
  */
79
- export const dataStoreSupportRequirements: ILayerCompatSupportRequirements = {
79
+ export const dataStoreSupportRequirementsForRuntime: ILayerCompatSupportRequirements = {
80
80
  /**
81
81
  * Minimum generation that DataStore must be at to be compatible with Runtime. Note that 0 is used here so
82
82
  * that DataStore layers before the introduction of the layer compatibility enforcement are compatible.
@@ -93,21 +93,21 @@ export const dataStoreSupportRequirements: ILayerCompatSupportRequirements = {
93
93
  * @internal
94
94
  */
95
95
  export function validateLoaderCompatibility(
96
- maybeloaderCompatDetailsForRuntime: ILayerCompatDetails | undefined,
96
+ maybeLoaderCompatDetailsForRuntime: ILayerCompatDetails | undefined,
97
97
  disposeFn: (error?: ICriticalContainerError) => void,
98
98
  ): void {
99
99
  const layerCheckResult = checkLayerCompatibility(
100
- loaderSupportRequirements,
101
- maybeloaderCompatDetailsForRuntime,
100
+ loaderSupportRequirementsForRuntime,
101
+ maybeLoaderCompatDetailsForRuntime,
102
102
  );
103
103
  if (!layerCheckResult.isCompatible) {
104
104
  const error = new UsageError("Runtime is not compatible with Loader", {
105
105
  errorDetails: JSON.stringify({
106
106
  runtimeVersion: runtimeCoreCompatDetails.pkgVersion,
107
- loaderVersion: maybeloaderCompatDetailsForRuntime?.pkgVersion,
107
+ loaderVersion: maybeLoaderCompatDetailsForRuntime?.pkgVersion,
108
108
  runtimeGeneration: runtimeCoreCompatDetails.generation,
109
- loaderGeneration: maybeloaderCompatDetailsForRuntime?.generation,
110
- minSupportedGeneration: loaderSupportRequirements.minSupportedGeneration,
109
+ loaderGeneration: maybeLoaderCompatDetailsForRuntime?.generation,
110
+ minSupportedGeneration: loaderSupportRequirementsForRuntime.minSupportedGeneration,
111
111
  isGenerationCompatible: layerCheckResult.isGenerationCompatible,
112
112
  unsupportedFeatures: layerCheckResult.unsupportedFeatures,
113
113
  }),
@@ -126,7 +126,7 @@ export function validateDatastoreCompatibility(
126
126
  disposeFn: () => void,
127
127
  ): void {
128
128
  const layerCheckResult = checkLayerCompatibility(
129
- dataStoreSupportRequirements,
129
+ dataStoreSupportRequirementsForRuntime,
130
130
  maybeDataStoreCompatDetails,
131
131
  );
132
132
  if (!layerCheckResult.isCompatible) {
@@ -136,7 +136,7 @@ export function validateDatastoreCompatibility(
136
136
  dataStoreVersion: maybeDataStoreCompatDetails?.pkgVersion,
137
137
  runtimeGeneration: runtimeCoreCompatDetails.generation,
138
138
  dataStoreGeneration: maybeDataStoreCompatDetails?.generation,
139
- minSupportedGeneration: dataStoreSupportRequirements.minSupportedGeneration,
139
+ minSupportedGeneration: dataStoreSupportRequirementsForRuntime.minSupportedGeneration,
140
140
  isGenerationCompatible: layerCheckResult.isGenerationCompatible,
141
141
  unsupportedFeatures: layerCheckResult.unsupportedFeatures,
142
142
  }),