@fluidframework/container-runtime 2.0.0-internal.1.1.2 → 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.
- package/dist/batchManager.d.ts +37 -0
- package/dist/batchManager.d.ts.map +1 -0
- package/dist/batchManager.js +73 -0
- package/dist/batchManager.js.map +1 -0
- package/dist/batchTracker.d.ts +1 -2
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +1 -2
- package/dist/batchTracker.js.map +1 -1
- package/dist/containerRuntime.d.ts +52 -20
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +252 -126
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +18 -9
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +24 -16
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStores.d.ts +6 -2
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +7 -9
- package/dist/dataStores.js.map +1 -1
- package/dist/deltaScheduler.d.ts +6 -4
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +6 -4
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/garbageCollection.d.ts +41 -12
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +176 -98
- package/dist/garbageCollection.js.map +1 -1
- package/dist/gcSweepReadyUsageDetection.d.ts +53 -0
- package/dist/gcSweepReadyUsageDetection.d.ts.map +1 -0
- package/dist/gcSweepReadyUsageDetection.js +135 -0
- package/dist/gcSweepReadyUsageDetection.js.map +1 -0
- package/dist/orderedClientElection.d.ts +28 -10
- package/dist/orderedClientElection.d.ts.map +1 -1
- package/dist/orderedClientElection.js +14 -4
- package/dist/orderedClientElection.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +0 -11
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +9 -44
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/runningSummarizer.js +1 -1
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/scheduleManager.d.ts +6 -3
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +22 -14
- package/dist/scheduleManager.js.map +1 -1
- package/dist/summarizerTypes.d.ts +16 -9
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryCollection.d.ts +1 -0
- package/dist/summaryCollection.d.ts.map +1 -1
- package/dist/summaryCollection.js +29 -13
- package/dist/summaryCollection.js.map +1 -1
- package/dist/summaryManager.d.ts +2 -2
- package/dist/summaryManager.js +2 -2
- package/dist/summaryManager.js.map +1 -1
- package/lib/batchManager.d.ts +37 -0
- package/lib/batchManager.d.ts.map +1 -0
- package/lib/batchManager.js +69 -0
- package/lib/batchManager.js.map +1 -0
- package/lib/batchTracker.d.ts +1 -2
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +1 -2
- package/lib/batchTracker.js.map +1 -1
- package/lib/containerRuntime.d.ts +52 -20
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +255 -129
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts +18 -9
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +25 -17
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStores.d.ts +6 -2
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +7 -9
- package/lib/dataStores.js.map +1 -1
- package/lib/deltaScheduler.d.ts +6 -4
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +6 -4
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/garbageCollection.d.ts +41 -12
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +175 -97
- package/lib/garbageCollection.js.map +1 -1
- package/lib/gcSweepReadyUsageDetection.d.ts +53 -0
- package/lib/gcSweepReadyUsageDetection.d.ts.map +1 -0
- package/lib/gcSweepReadyUsageDetection.js +130 -0
- package/lib/gcSweepReadyUsageDetection.js.map +1 -0
- package/lib/orderedClientElection.d.ts +28 -10
- package/lib/orderedClientElection.d.ts.map +1 -1
- package/lib/orderedClientElection.js +14 -4
- package/lib/orderedClientElection.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts +0 -11
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +9 -44
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/runningSummarizer.js +1 -1
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/scheduleManager.d.ts +6 -3
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +24 -16
- package/lib/scheduleManager.js.map +1 -1
- package/lib/summarizerTypes.d.ts +16 -9
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryCollection.d.ts +1 -0
- package/lib/summaryCollection.d.ts.map +1 -1
- package/lib/summaryCollection.js +29 -13
- package/lib/summaryCollection.js.map +1 -1
- package/lib/summaryManager.d.ts +2 -2
- package/lib/summaryManager.js +2 -2
- package/lib/summaryManager.js.map +1 -1
- package/package.json +21 -18
- package/src/batchManager.ts +91 -0
- package/src/batchTracker.ts +1 -2
- package/src/containerRuntime.ts +331 -176
- package/src/dataStoreContext.ts +27 -17
- package/src/dataStores.ts +7 -8
- package/src/deltaScheduler.ts +6 -4
- package/src/garbageCollection.ts +224 -134
- package/src/gcSweepReadyUsageDetection.ts +147 -0
- package/src/orderedClientElection.ts +31 -10
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +9 -57
- package/src/runningSummarizer.ts +1 -1
- package/src/scheduleManager.ts +32 -12
- package/src/summarizerTypes.ts +17 -9
- package/src/summaryCollection.ts +31 -16
- package/src/summaryManager.ts +2 -2
package/src/dataStoreContext.ts
CHANGED
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
IContainerRuntime,
|
|
38
38
|
} from "@fluidframework/container-runtime-definitions";
|
|
39
39
|
import {
|
|
40
|
+
BindState,
|
|
40
41
|
channelsTreeName,
|
|
41
42
|
CreateChildSummarizerNodeFn,
|
|
42
43
|
CreateChildSummarizerNodeParam,
|
|
@@ -224,9 +225,8 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidData
|
|
|
224
225
|
protected registry: IFluidDataStoreRegistry | undefined;
|
|
225
226
|
|
|
226
227
|
protected detachedRuntimeCreation = false;
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
private readonly bindToContext: () => void;
|
|
228
|
+
/** @deprecated - To be replaced by calling makeLocallyVisible directly */
|
|
229
|
+
public readonly bindToContext: () => void;
|
|
230
230
|
protected channel: IFluidDataStoreChannel | undefined;
|
|
231
231
|
private loaded = false;
|
|
232
232
|
protected pending: ISequencedDocumentMessage[] | undefined = [];
|
|
@@ -253,6 +253,7 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidData
|
|
|
253
253
|
constructor(
|
|
254
254
|
props: IFluidDataStoreContextProps,
|
|
255
255
|
private readonly existing: boolean,
|
|
256
|
+
private bindState: BindState, // Used to assert for state tracking purposes
|
|
256
257
|
public readonly isLocalDataStore: boolean,
|
|
257
258
|
private readonly makeLocallyVisibleFn: () => void,
|
|
258
259
|
) {
|
|
@@ -273,8 +274,11 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidData
|
|
|
273
274
|
this.containerRuntime.attachState : AttachState.Detached;
|
|
274
275
|
|
|
275
276
|
this.bindToContext = () => {
|
|
277
|
+
assert(this.bindState === BindState.NotBound, 0x13b /* "datastore context is already in bound state" */);
|
|
278
|
+
this.bindState = BindState.Binding;
|
|
276
279
|
assert(this.channel !== undefined, 0x13c /* "undefined channel on datastore context" */);
|
|
277
280
|
this.makeLocallyVisible();
|
|
281
|
+
this.bindState = BindState.Bound;
|
|
278
282
|
};
|
|
279
283
|
|
|
280
284
|
const thisSummarizeInternal =
|
|
@@ -515,12 +519,18 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidData
|
|
|
515
519
|
|
|
516
520
|
/**
|
|
517
521
|
* After GC has run, called to notify the data store of routes used in it. These are used for the following:
|
|
522
|
+
*
|
|
518
523
|
* 1. To identify if this data store is being referenced in the document or not.
|
|
524
|
+
*
|
|
519
525
|
* 2. To determine if it needs to re-summarize in case used routes changed since last summary.
|
|
526
|
+
*
|
|
520
527
|
* 3. These are added to the summary generated by the data store.
|
|
521
|
-
*
|
|
522
|
-
*
|
|
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
|
+
*
|
|
523
532
|
* 5. To update the timestamp when this data store or any children are marked as unreferenced.
|
|
533
|
+
*
|
|
524
534
|
* @param usedRoutes - The routes that are used in this data store.
|
|
525
535
|
* @param gcTimestamp - The time when GC was run that generated these used routes. If any node becomes unreferenced
|
|
526
536
|
* as part of this GC run, this should be used to update the time when it happens.
|
|
@@ -700,7 +710,7 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidData
|
|
|
700
710
|
public abstract getInitialSnapshotDetails(): Promise<ISnapshotDetails>;
|
|
701
711
|
|
|
702
712
|
/**
|
|
703
|
-
* @deprecated
|
|
713
|
+
* @deprecated Sets the datastore as root, for aliasing purposes: #7948
|
|
704
714
|
* This method should not be used outside of the aliasing context.
|
|
705
715
|
* It will be removed, as the source of truth for this flag will be the aliasing blob.
|
|
706
716
|
*/
|
|
@@ -709,7 +719,7 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidData
|
|
|
709
719
|
}
|
|
710
720
|
|
|
711
721
|
/**
|
|
712
|
-
* @deprecated
|
|
722
|
+
* @deprecated Renamed to `{@link FluidDataStoreContext.getBaseGCDetails}()`.
|
|
713
723
|
*/
|
|
714
724
|
public abstract getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails>;
|
|
715
725
|
|
|
@@ -776,6 +786,7 @@ export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
|
776
786
|
super(
|
|
777
787
|
props,
|
|
778
788
|
true /* existing */,
|
|
789
|
+
BindState.Bound,
|
|
779
790
|
false /* isLocalDataStore */,
|
|
780
791
|
() => {
|
|
781
792
|
throw new Error("Already attached");
|
|
@@ -814,11 +825,9 @@ export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
|
814
825
|
// For snapshotFormatVersion = "0.1" (1) or above, pkg is jsonified, otherwise it is just a string.
|
|
815
826
|
const formatVersion = getAttributesFormatVersion(attributes);
|
|
816
827
|
if (formatVersion < 1) {
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
pkgFromSnapshot = [attributes.pkg];
|
|
821
|
-
}
|
|
828
|
+
pkgFromSnapshot = attributes.pkg.startsWith("[\"") && attributes.pkg.endsWith("\"]")
|
|
829
|
+
? JSON.parse(attributes.pkg) as string[]
|
|
830
|
+
: [attributes.pkg];
|
|
822
831
|
} else {
|
|
823
832
|
pkgFromSnapshot = JSON.parse(attributes.pkg) as string[];
|
|
824
833
|
}
|
|
@@ -851,7 +860,7 @@ export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
|
851
860
|
}
|
|
852
861
|
|
|
853
862
|
/**
|
|
854
|
-
* @deprecated
|
|
863
|
+
* @deprecated Renamed to {@link RemoteFluidDataStoreContext.getBaseGCDetails}.
|
|
855
864
|
*/
|
|
856
865
|
public async getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails> {
|
|
857
866
|
return this.getBaseGCDetails();
|
|
@@ -880,6 +889,7 @@ export class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
|
880
889
|
super(
|
|
881
890
|
props,
|
|
882
891
|
props.snapshotTree !== undefined ? true : false /* existing */,
|
|
892
|
+
props.snapshotTree ? BindState.Bound : BindState.NotBound,
|
|
883
893
|
true /* isLocalDataStore */,
|
|
884
894
|
props.makeLocallyVisibleFn,
|
|
885
895
|
);
|
|
@@ -965,7 +975,7 @@ export class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
|
965
975
|
}
|
|
966
976
|
|
|
967
977
|
/**
|
|
968
|
-
* @deprecated
|
|
978
|
+
* @deprecated Renamed to {@link LocalFluidDataStoreContextBase.getBaseGCDetails}.
|
|
969
979
|
*/
|
|
970
980
|
public async getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails> {
|
|
971
981
|
// Local data store does not have initial summary.
|
|
@@ -1008,7 +1018,10 @@ export class LocalDetachedFluidDataStoreContext
|
|
|
1008
1018
|
registry: IProvideFluidDataStoreFactory,
|
|
1009
1019
|
dataStoreChannel: IFluidDataStoreChannel) {
|
|
1010
1020
|
assert(this.detachedRuntimeCreation, 0x154 /* "runtime creation is already attached" */);
|
|
1021
|
+
this.detachedRuntimeCreation = false;
|
|
1022
|
+
|
|
1011
1023
|
assert(this.channelDeferred === undefined, 0x155 /* "channel deferral is already set" */);
|
|
1024
|
+
this.channelDeferred = new Deferred<IFluidDataStoreChannel>();
|
|
1012
1025
|
|
|
1013
1026
|
const factory = registry.IFluidDataStoreFactory;
|
|
1014
1027
|
|
|
@@ -1018,9 +1031,6 @@ export class LocalDetachedFluidDataStoreContext
|
|
|
1018
1031
|
assert(this.registry === undefined, 0x157 /* "datastore registry already attached" */);
|
|
1019
1032
|
this.registry = entry.registry;
|
|
1020
1033
|
|
|
1021
|
-
this.detachedRuntimeCreation = false;
|
|
1022
|
-
this.channelDeferred = new Deferred<IFluidDataStoreChannel>();
|
|
1023
|
-
|
|
1024
1034
|
super.bindRuntime(dataStoreChannel);
|
|
1025
1035
|
|
|
1026
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
|
-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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> {
|
package/src/deltaScheduler.ts
CHANGED
|
@@ -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
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
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
|
-
*
|
|
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>;
|