@fluidframework/container-runtime 2.0.0-internal.1.1.3 → 2.0.0-internal.1.2.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 (137) hide show
  1. package/dist/batchManager.d.ts +37 -0
  2. package/dist/batchManager.d.ts.map +1 -0
  3. package/dist/batchManager.js +73 -0
  4. package/dist/batchManager.js.map +1 -0
  5. package/dist/batchTracker.d.ts +1 -2
  6. package/dist/batchTracker.d.ts.map +1 -1
  7. package/dist/batchTracker.js +1 -2
  8. package/dist/batchTracker.js.map +1 -1
  9. package/dist/containerRuntime.d.ts +52 -20
  10. package/dist/containerRuntime.d.ts.map +1 -1
  11. package/dist/containerRuntime.js +240 -119
  12. package/dist/containerRuntime.js.map +1 -1
  13. package/dist/dataStoreContext.d.ts +12 -6
  14. package/dist/dataStoreContext.d.ts.map +1 -1
  15. package/dist/dataStoreContext.js +16 -13
  16. package/dist/dataStoreContext.js.map +1 -1
  17. package/dist/dataStores.d.ts +6 -2
  18. package/dist/dataStores.d.ts.map +1 -1
  19. package/dist/dataStores.js +7 -9
  20. package/dist/dataStores.js.map +1 -1
  21. package/dist/deltaScheduler.d.ts +6 -4
  22. package/dist/deltaScheduler.d.ts.map +1 -1
  23. package/dist/deltaScheduler.js +6 -4
  24. package/dist/deltaScheduler.js.map +1 -1
  25. package/dist/garbageCollection.d.ts +41 -12
  26. package/dist/garbageCollection.d.ts.map +1 -1
  27. package/dist/garbageCollection.js +176 -98
  28. package/dist/garbageCollection.js.map +1 -1
  29. package/dist/gcSweepReadyUsageDetection.d.ts +53 -0
  30. package/dist/gcSweepReadyUsageDetection.d.ts.map +1 -0
  31. package/dist/gcSweepReadyUsageDetection.js +135 -0
  32. package/dist/gcSweepReadyUsageDetection.js.map +1 -0
  33. package/dist/orderedClientElection.d.ts +28 -10
  34. package/dist/orderedClientElection.d.ts.map +1 -1
  35. package/dist/orderedClientElection.js +14 -4
  36. package/dist/orderedClientElection.js.map +1 -1
  37. package/dist/packageVersion.d.ts +1 -1
  38. package/dist/packageVersion.js +1 -1
  39. package/dist/packageVersion.js.map +1 -1
  40. package/dist/pendingStateManager.d.ts +0 -11
  41. package/dist/pendingStateManager.d.ts.map +1 -1
  42. package/dist/pendingStateManager.js +9 -44
  43. package/dist/pendingStateManager.js.map +1 -1
  44. package/dist/runningSummarizer.js +1 -1
  45. package/dist/runningSummarizer.js.map +1 -1
  46. package/dist/scheduleManager.d.ts +6 -3
  47. package/dist/scheduleManager.d.ts.map +1 -1
  48. package/dist/scheduleManager.js +22 -14
  49. package/dist/scheduleManager.js.map +1 -1
  50. package/dist/summarizerTypes.d.ts +16 -9
  51. package/dist/summarizerTypes.d.ts.map +1 -1
  52. package/dist/summarizerTypes.js +1 -1
  53. package/dist/summarizerTypes.js.map +1 -1
  54. package/dist/summaryCollection.d.ts +1 -0
  55. package/dist/summaryCollection.d.ts.map +1 -1
  56. package/dist/summaryCollection.js +29 -13
  57. package/dist/summaryCollection.js.map +1 -1
  58. package/dist/summaryManager.d.ts +2 -2
  59. package/dist/summaryManager.js +2 -2
  60. package/dist/summaryManager.js.map +1 -1
  61. package/lib/batchManager.d.ts +37 -0
  62. package/lib/batchManager.d.ts.map +1 -0
  63. package/lib/batchManager.js +69 -0
  64. package/lib/batchManager.js.map +1 -0
  65. package/lib/batchTracker.d.ts +1 -2
  66. package/lib/batchTracker.d.ts.map +1 -1
  67. package/lib/batchTracker.js +1 -2
  68. package/lib/batchTracker.js.map +1 -1
  69. package/lib/containerRuntime.d.ts +52 -20
  70. package/lib/containerRuntime.d.ts.map +1 -1
  71. package/lib/containerRuntime.js +243 -122
  72. package/lib/containerRuntime.js.map +1 -1
  73. package/lib/dataStoreContext.d.ts +12 -6
  74. package/lib/dataStoreContext.d.ts.map +1 -1
  75. package/lib/dataStoreContext.js +16 -13
  76. package/lib/dataStoreContext.js.map +1 -1
  77. package/lib/dataStores.d.ts +6 -2
  78. package/lib/dataStores.d.ts.map +1 -1
  79. package/lib/dataStores.js +7 -9
  80. package/lib/dataStores.js.map +1 -1
  81. package/lib/deltaScheduler.d.ts +6 -4
  82. package/lib/deltaScheduler.d.ts.map +1 -1
  83. package/lib/deltaScheduler.js +6 -4
  84. package/lib/deltaScheduler.js.map +1 -1
  85. package/lib/garbageCollection.d.ts +41 -12
  86. package/lib/garbageCollection.d.ts.map +1 -1
  87. package/lib/garbageCollection.js +175 -97
  88. package/lib/garbageCollection.js.map +1 -1
  89. package/lib/gcSweepReadyUsageDetection.d.ts +53 -0
  90. package/lib/gcSweepReadyUsageDetection.d.ts.map +1 -0
  91. package/lib/gcSweepReadyUsageDetection.js +130 -0
  92. package/lib/gcSweepReadyUsageDetection.js.map +1 -0
  93. package/lib/orderedClientElection.d.ts +28 -10
  94. package/lib/orderedClientElection.d.ts.map +1 -1
  95. package/lib/orderedClientElection.js +14 -4
  96. package/lib/orderedClientElection.js.map +1 -1
  97. package/lib/packageVersion.d.ts +1 -1
  98. package/lib/packageVersion.js +1 -1
  99. package/lib/packageVersion.js.map +1 -1
  100. package/lib/pendingStateManager.d.ts +0 -11
  101. package/lib/pendingStateManager.d.ts.map +1 -1
  102. package/lib/pendingStateManager.js +9 -44
  103. package/lib/pendingStateManager.js.map +1 -1
  104. package/lib/runningSummarizer.js +1 -1
  105. package/lib/runningSummarizer.js.map +1 -1
  106. package/lib/scheduleManager.d.ts +6 -3
  107. package/lib/scheduleManager.d.ts.map +1 -1
  108. package/lib/scheduleManager.js +24 -16
  109. package/lib/scheduleManager.js.map +1 -1
  110. package/lib/summarizerTypes.d.ts +16 -9
  111. package/lib/summarizerTypes.d.ts.map +1 -1
  112. package/lib/summarizerTypes.js +1 -1
  113. package/lib/summarizerTypes.js.map +1 -1
  114. package/lib/summaryCollection.d.ts +1 -0
  115. package/lib/summaryCollection.d.ts.map +1 -1
  116. package/lib/summaryCollection.js +29 -13
  117. package/lib/summaryCollection.js.map +1 -1
  118. package/lib/summaryManager.d.ts +2 -2
  119. package/lib/summaryManager.js +2 -2
  120. package/lib/summaryManager.js.map +1 -1
  121. package/package.json +21 -18
  122. package/src/batchManager.ts +91 -0
  123. package/src/batchTracker.ts +1 -2
  124. package/src/containerRuntime.ts +336 -185
  125. package/src/dataStoreContext.ts +18 -14
  126. package/src/dataStores.ts +7 -8
  127. package/src/deltaScheduler.ts +6 -4
  128. package/src/garbageCollection.ts +224 -134
  129. package/src/gcSweepReadyUsageDetection.ts +147 -0
  130. package/src/orderedClientElection.ts +31 -10
  131. package/src/packageVersion.ts +1 -1
  132. package/src/pendingStateManager.ts +9 -57
  133. package/src/runningSummarizer.ts +1 -1
  134. package/src/scheduleManager.ts +32 -12
  135. package/src/summarizerTypes.ts +17 -9
  136. package/src/summaryCollection.ts +31 -16
  137. package/src/summaryManager.ts +2 -2
@@ -519,12 +519,18 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidData
519
519
 
520
520
  /**
521
521
  * After GC has run, called to notify the data store of routes used in it. These are used for the following:
522
+ *
522
523
  * 1. To identify if this data store is being referenced in the document or not.
524
+ *
523
525
  * 2. To determine if it needs to re-summarize in case used routes changed since last summary.
526
+ *
524
527
  * 3. These are added to the summary generated by the data store.
525
- * 4. To notify child contexts of their used routes. This is done immediately if the data store is loaded. Else,
526
- * it is done when realizing the data store.
528
+ *
529
+ * 4. To notify child contexts of their used routes. This is done immediately if the data store is loaded.
530
+ * Else, it is done when realizing the data store.
531
+ *
527
532
  * 5. To update the timestamp when this data store or any children are marked as unreferenced.
533
+ *
528
534
  * @param usedRoutes - The routes that are used in this data store.
529
535
  * @param gcTimestamp - The time when GC was run that generated these used routes. If any node becomes unreferenced
530
536
  * as part of this GC run, this should be used to update the time when it happens.
@@ -704,7 +710,7 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidData
704
710
  public abstract getInitialSnapshotDetails(): Promise<ISnapshotDetails>;
705
711
 
706
712
  /**
707
- * @deprecated - Sets the datastore as root, for aliasing purposes: #7948
713
+ * @deprecated Sets the datastore as root, for aliasing purposes: #7948
708
714
  * This method should not be used outside of the aliasing context.
709
715
  * It will be removed, as the source of truth for this flag will be the aliasing blob.
710
716
  */
@@ -713,7 +719,7 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidData
713
719
  }
714
720
 
715
721
  /**
716
- * @deprecated - Renamed to getBaseGCDetails().
722
+ * @deprecated Renamed to `{@link FluidDataStoreContext.getBaseGCDetails}()`.
717
723
  */
718
724
  public abstract getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails>;
719
725
 
@@ -819,11 +825,9 @@ export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
819
825
  // For snapshotFormatVersion = "0.1" (1) or above, pkg is jsonified, otherwise it is just a string.
820
826
  const formatVersion = getAttributesFormatVersion(attributes);
821
827
  if (formatVersion < 1) {
822
- if (attributes.pkg.startsWith("[\"") && attributes.pkg.endsWith("\"]")) {
823
- pkgFromSnapshot = JSON.parse(attributes.pkg) as string[];
824
- } else {
825
- pkgFromSnapshot = [attributes.pkg];
826
- }
828
+ pkgFromSnapshot = attributes.pkg.startsWith("[\"") && attributes.pkg.endsWith("\"]")
829
+ ? JSON.parse(attributes.pkg) as string[]
830
+ : [attributes.pkg];
827
831
  } else {
828
832
  pkgFromSnapshot = JSON.parse(attributes.pkg) as string[];
829
833
  }
@@ -856,7 +860,7 @@ export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
856
860
  }
857
861
 
858
862
  /**
859
- * @deprecated - Renamed to getBaseGCDetails.
863
+ * @deprecated Renamed to {@link RemoteFluidDataStoreContext.getBaseGCDetails}.
860
864
  */
861
865
  public async getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails> {
862
866
  return this.getBaseGCDetails();
@@ -971,7 +975,7 @@ export class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
971
975
  }
972
976
 
973
977
  /**
974
- * @deprecated - Renamed to getBaseGCDetails.
978
+ * @deprecated Renamed to {@link LocalFluidDataStoreContextBase.getBaseGCDetails}.
975
979
  */
976
980
  public async getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails> {
977
981
  // Local data store does not have initial summary.
@@ -1014,7 +1018,10 @@ export class LocalDetachedFluidDataStoreContext
1014
1018
  registry: IProvideFluidDataStoreFactory,
1015
1019
  dataStoreChannel: IFluidDataStoreChannel) {
1016
1020
  assert(this.detachedRuntimeCreation, 0x154 /* "runtime creation is already attached" */);
1021
+ this.detachedRuntimeCreation = false;
1022
+
1017
1023
  assert(this.channelDeferred === undefined, 0x155 /* "channel deferral is already set" */);
1024
+ this.channelDeferred = new Deferred<IFluidDataStoreChannel>();
1018
1025
 
1019
1026
  const factory = registry.IFluidDataStoreFactory;
1020
1027
 
@@ -1024,9 +1031,6 @@ export class LocalDetachedFluidDataStoreContext
1024
1031
  assert(this.registry === undefined, 0x157 /* "datastore registry already attached" */);
1025
1032
  this.registry = entry.registry;
1026
1033
 
1027
- this.detachedRuntimeCreation = false;
1028
- this.channelDeferred = new Deferred<IFluidDataStoreChannel>();
1029
-
1030
1034
  super.bindRuntime(dataStoreChannel);
1031
1035
 
1032
1036
  if (await this.isRoot()) {
package/src/dataStores.ts CHANGED
@@ -469,12 +469,7 @@ export class DataStores implements IDisposable {
469
469
  }
470
470
 
471
471
  public setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void {
472
- let eventName: "attaching" | "attached";
473
- if (attachState === AttachState.Attaching) {
474
- eventName = "attaching";
475
- } else {
476
- eventName = "attached";
477
- }
472
+ const eventName = attachState === AttachState.Attaching ? "attaching" : "attached";
478
473
  for (const [, context] of this.contexts) {
479
474
  // Fire only for bounded stores.
480
475
  if (!this.contexts.isNotBound(context.id)) {
@@ -566,11 +561,15 @@ export class DataStores implements IDisposable {
566
561
 
567
562
  /**
568
563
  * Generates data used for garbage collection. It does the following:
564
+ *
569
565
  * 1. Calls into each child data store context to get its GC data.
566
+ *
570
567
  * 2. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be
571
- * identified as belonging to the child.
568
+ * identified as belonging to the child.
569
+ *
572
570
  * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent
573
- * the GC data of this channel.
571
+ * the GC data of this channel.
572
+ *
574
573
  * @param fullGC - true to bypass optimizations and force full generation of GC data.
575
574
  */
576
575
  public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {
@@ -18,12 +18,14 @@ import {
18
18
  * DeltaScheduler is responsible for the scheduling of inbound delta queue in cases where there
19
19
  * is more than one op a particular run of the queue. It does not schedule if there is just one
20
20
  * op or just one batch in the run. It does the following two things:
21
+ *
21
22
  * 1. If the ops have been processed for more than a specific amount of time, it pauses the queue
22
- * and calls setTimeout to schedule a resume of the queue. This ensures that we don't block
23
- * the JS thread for a long time processing ops synchronously (for example, when catching up
24
- * ops right after boot or catching up ops / delayed realizing data stores by summarizer).
23
+ * and calls setTimeout to schedule a resume of the queue. This ensures that we don't block
24
+ * the JS thread for a long time processing ops synchronously (for example, when catching up
25
+ * ops right after boot or catching up ops / delayed realizing data stores by summarizer).
26
+ *
25
27
  * 2. If we scheduled a particular run of the queue, it logs telemetry for the number of ops
26
- * processed, the time and number of turns it took to process the ops.
28
+ * processed, the time and number of turns it took to process the ops.
27
29
  */
28
30
  export class DeltaScheduler {
29
31
  private readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;