@fluidframework/container-runtime 0.54.2 → 0.56.0-49831
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/.eslintrc.js +1 -1
- package/dist/blobManager.js +1 -1
- package/dist/blobManager.js.map +1 -1
- package/dist/containerRuntime.d.ts +20 -14
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +51 -58
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +57 -33
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +44 -54
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStores.d.ts +12 -2
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +106 -32
- package/dist/dataStores.js.map +1 -1
- package/dist/garbageCollection.d.ts +49 -14
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +122 -26
- package/dist/garbageCollection.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -17
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +2 -9
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/summaryFormat.d.ts +2 -0
- package/dist/summaryFormat.d.ts.map +1 -1
- package/dist/summaryFormat.js +2 -4
- package/dist/summaryFormat.js.map +1 -1
- package/dist/summaryGenerator.d.ts +0 -5
- package/dist/summaryGenerator.d.ts.map +1 -1
- package/dist/summaryGenerator.js.map +1 -1
- package/dist/summaryManager.d.ts +1 -0
- package/dist/summaryManager.d.ts.map +1 -1
- package/dist/summaryManager.js +7 -2
- package/dist/summaryManager.js.map +1 -1
- package/garbageCollection.md +33 -0
- package/lib/blobManager.js +1 -1
- package/lib/blobManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +20 -14
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +51 -58
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts +57 -33
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +42 -52
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStores.d.ts +12 -2
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +107 -33
- package/lib/dataStores.js.map +1 -1
- package/lib/garbageCollection.d.ts +49 -14
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +122 -26
- package/lib/garbageCollection.js.map +1 -1
- package/lib/index.d.ts +7 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -7
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +2 -9
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/summaryFormat.d.ts +2 -0
- package/lib/summaryFormat.d.ts.map +1 -1
- package/lib/summaryFormat.js +2 -4
- package/lib/summaryFormat.js.map +1 -1
- package/lib/summaryGenerator.d.ts +0 -5
- package/lib/summaryGenerator.d.ts.map +1 -1
- package/lib/summaryGenerator.js.map +1 -1
- package/lib/summaryManager.d.ts +1 -0
- package/lib/summaryManager.d.ts.map +1 -1
- package/lib/summaryManager.js +7 -2
- package/lib/summaryManager.js.map +1 -1
- package/package.json +24 -23
- package/src/blobManager.ts +1 -1
- package/src/containerRuntime.ts +69 -65
- package/src/dataStoreContext.ts +105 -129
- package/src/dataStores.ts +118 -68
- package/src/garbageCollection.ts +156 -31
- package/src/index.ts +52 -6
- package/src/packageVersion.ts +1 -1
- package/src/runningSummarizer.ts +2 -7
- package/src/summaryFormat.ts +4 -4
- package/src/summaryGenerator.ts +0 -5
- package/src/summaryManager.ts +9 -3
package/lib/containerRuntime.js
CHANGED
|
@@ -7,7 +7,7 @@ import { assert, Trace, TypedEventEmitter, unreachableCase, performance, } from
|
|
|
7
7
|
import { ChildLogger, raiseConnectedEvent, PerformanceEvent, normalizeError, TaggedLoggerAdapter, loggerToMonitoringContext, } from "@fluidframework/telemetry-utils";
|
|
8
8
|
import { DriverHeader } from "@fluidframework/driver-definitions";
|
|
9
9
|
import { readAndParse, BlobAggregationStorage } from "@fluidframework/driver-utils";
|
|
10
|
-
import {
|
|
10
|
+
import { DataCorruptionError, GenericError, UsageError, extractSafePropertiesFromMessage, } from "@fluidframework/container-utils";
|
|
11
11
|
import { MessageType, SummaryType, } from "@fluidframework/protocol-definitions";
|
|
12
12
|
import { FlushMode, channelsTreeName, } from "@fluidframework/runtime-definitions";
|
|
13
13
|
import { addBlobToSummary, addTreeToSummary, convertToSummaryTree, createRootSummarizerNodeWithGC, RequestParser, create404Response, exceptionToResponse, requestFluidObject, responseToException, seqFromTree, convertSummaryTreeToITree, } from "@fluidframework/runtime-utils";
|
|
@@ -56,21 +56,24 @@ const DefaultSummaryConfiguration = {
|
|
|
56
56
|
// the min of the two will be chosen
|
|
57
57
|
maxAckWaitTime: 120000,
|
|
58
58
|
};
|
|
59
|
+
;
|
|
59
60
|
// Local storage key to set the default flush mode to TurnBased
|
|
60
61
|
const turnBasedFlushModeKey = "Fluid.ContainerRuntime.FlushModeTurnBased";
|
|
62
|
+
export var RuntimeMessage;
|
|
63
|
+
(function (RuntimeMessage) {
|
|
64
|
+
RuntimeMessage["FluidDataStoreOp"] = "component";
|
|
65
|
+
RuntimeMessage["Attach"] = "attach";
|
|
66
|
+
RuntimeMessage["ChunkedOp"] = "chunkedOp";
|
|
67
|
+
RuntimeMessage["BlobAttach"] = "blobAttach";
|
|
68
|
+
RuntimeMessage["Rejoin"] = "rejoin";
|
|
69
|
+
RuntimeMessage["Alias"] = "alias";
|
|
70
|
+
RuntimeMessage["Operation"] = "op";
|
|
71
|
+
})(RuntimeMessage || (RuntimeMessage = {}));
|
|
61
72
|
export function isRuntimeMessage(message) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
case ContainerMessageType.ChunkedOp:
|
|
65
|
-
case ContainerMessageType.Attach:
|
|
66
|
-
case ContainerMessageType.Alias:
|
|
67
|
-
case ContainerMessageType.BlobAttach:
|
|
68
|
-
case ContainerMessageType.Rejoin:
|
|
69
|
-
case MessageType.Operation:
|
|
70
|
-
return true;
|
|
71
|
-
default:
|
|
72
|
-
return false;
|
|
73
|
+
if (Object.values(RuntimeMessage).includes(message.type)) {
|
|
74
|
+
return true;
|
|
73
75
|
}
|
|
76
|
+
return false;
|
|
74
77
|
}
|
|
75
78
|
export function unpackRuntimeMessage(message) {
|
|
76
79
|
if (message.type === MessageType.Operation) {
|
|
@@ -344,6 +347,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
344
347
|
this._disposed = false;
|
|
345
348
|
this.dirtyContainer = false;
|
|
346
349
|
this.emitDirtyDocumentEvent = true;
|
|
350
|
+
this.summarizerWarning = (warning) => this.mc.logger.sendTelemetryEvent({ eventName: "summarizerWarning" }, warning);
|
|
347
351
|
/**
|
|
348
352
|
* Used to apply stashed ops at their reference sequence number.
|
|
349
353
|
* Normal op processing is synchronous, but applying stashed ops is async since the
|
|
@@ -365,10 +369,6 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
365
369
|
this.closeFn(normalizeError(error));
|
|
366
370
|
});
|
|
367
371
|
};
|
|
368
|
-
// @deprecated Needs to become private
|
|
369
|
-
this.raiseContainerWarning = (warning) => {
|
|
370
|
-
this.context.raiseContainerWarning(warning);
|
|
371
|
-
};
|
|
372
372
|
this.summarizeOnDemand = (...args) => {
|
|
373
373
|
if (this.clientDetails.type === summarizerClientType) {
|
|
374
374
|
return this.summarizer.summarizeOnDemand(...args);
|
|
@@ -434,7 +434,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
434
434
|
const timestamp = client === null || client === void 0 ? void 0 : client.timestamp;
|
|
435
435
|
return (_c = (_b = (_a = this.deltaManager.lastMessage) === null || _a === void 0 ? void 0 : _a.timestamp) !== null && _b !== void 0 ? _b : timestamp) !== null && _c !== void 0 ? _c : Date.now();
|
|
436
436
|
};
|
|
437
|
-
this.garbageCollector = GarbageCollector.create(this, this.runtimeOptions.gcOptions, (unusedRoutes) => this.dataStores.deleteUnusedRoutes(unusedRoutes), getCurrentTimestamp, context.baseSnapshot, async (id) => readAndParse(this.storage, id), this.mc.logger, existing, metadata);
|
|
437
|
+
this.garbageCollector = GarbageCollector.create(this, this.runtimeOptions.gcOptions, (unusedRoutes) => this.dataStores.deleteUnusedRoutes(unusedRoutes), getCurrentTimestamp, this.closeFn, context.baseSnapshot, async (id) => readAndParse(this.storage, id), this.mc.logger, existing, metadata);
|
|
438
438
|
const loadedFromSequenceNumber = this.deltaManager.initialSequenceNumber;
|
|
439
439
|
this.summarizerNode = createRootSummarizerNodeWithGC(ChildLogger.create(this.logger, "SummarizerNode"),
|
|
440
440
|
// Summarize function to call when summarize is called. Summarizer node always tracks summary state.
|
|
@@ -455,7 +455,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
455
455
|
if (this.context.baseSnapshot) {
|
|
456
456
|
this.summarizerNode.loadBaseSummaryWithoutDifferential(this.context.baseSnapshot);
|
|
457
457
|
}
|
|
458
|
-
this.dataStores = new DataStores(getSummaryForDatastores(context.baseSnapshot, metadata), this, (attachMsg) => this.submit(ContainerMessageType.Attach, attachMsg), (id, createParam) => (summarizeInternal, getGCDataFn,
|
|
458
|
+
this.dataStores = new DataStores(getSummaryForDatastores(context.baseSnapshot, metadata), this, (attachMsg) => this.submit(ContainerMessageType.Attach, attachMsg), (id, createParam) => (summarizeInternal, getGCDataFn, getBaseGCDetailsFn) => this.summarizerNode.createChild(summarizeInternal, id, createParam, undefined, getGCDataFn, getBaseGCDetailsFn), (id) => this.summarizerNode.deleteChild(id), this.mc.logger, async () => this.garbageCollector.getDataStoreBaseGCDetails(), (id) => this.garbageCollector.nodeChanged(id), new Map(dataStoreAliasMap), this.garbageCollector.writeDataAtRoot);
|
|
459
459
|
this.blobManager = new BlobManager(this.handleContext, blobManagerSnapshot, () => this.storage, (blobId) => this.submit(ContainerMessageType.BlobAttach, undefined, undefined, { blobId }), this, this.logger);
|
|
460
460
|
this.scheduleManager = new ScheduleManager(context.deltaManager, this, ChildLogger.create(this.logger, "ScheduleManager"));
|
|
461
461
|
this.deltaSender = this.deltaManager;
|
|
@@ -508,7 +508,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
508
508
|
formExponentialFn({ coefficient: 20, initialDelay: 0 })), {
|
|
509
509
|
initialDelayMs: this.runtimeOptions.summaryOptions.initialSummarizerDelayMs,
|
|
510
510
|
}, this.runtimeOptions.summaryOptions.summarizerOptions);
|
|
511
|
-
this.summaryManager.on("summarizerWarning", this.
|
|
511
|
+
this.summaryManager.on("summarizerWarning", this.summarizerWarning);
|
|
512
512
|
this.summaryManager.start();
|
|
513
513
|
}
|
|
514
514
|
}
|
|
@@ -553,6 +553,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
553
553
|
static async load(context, registryEntries, requestHandler, runtimeOptions = {}, containerScope = context.scope, existing) {
|
|
554
554
|
var _a, _b, _c;
|
|
555
555
|
// If taggedLogger exists, use it. Otherwise, wrap the vanilla logger:
|
|
556
|
+
// back-compat: Remove the TaggedLoggerAdapter fallback once all the host are using loader > 0.45
|
|
556
557
|
const passLogger = (_a = context.taggedLogger) !== null && _a !== void 0 ? _a : new TaggedLoggerAdapter(context.logger);
|
|
557
558
|
const logger = ChildLogger.create(passLogger, undefined, {
|
|
558
559
|
all: {
|
|
@@ -630,12 +631,6 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
630
631
|
}, containerScope, logger, loadExisting, blobManagerSnapshot, requestHandler, storage);
|
|
631
632
|
return runtime;
|
|
632
633
|
}
|
|
633
|
-
/**
|
|
634
|
-
* @deprecated This will be removed in a later release. Deprecated in 0.53
|
|
635
|
-
*/
|
|
636
|
-
get id() {
|
|
637
|
-
return this.context.id;
|
|
638
|
-
}
|
|
639
634
|
get options() {
|
|
640
635
|
return this.context.options;
|
|
641
636
|
}
|
|
@@ -699,13 +694,6 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
699
694
|
return Object.assign(Object.assign(Object.assign({}, DefaultSummaryConfiguration), (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.serviceConfiguration) === null || _b === void 0 ? void 0 : _b.summary), (_c = this.runtimeOptions.summaryOptions) === null || _c === void 0 ? void 0 : _c.summaryConfigOverrides);
|
|
700
695
|
}
|
|
701
696
|
get disposed() { return this._disposed; }
|
|
702
|
-
/**
|
|
703
|
-
* True, if GC data should be written at root of the summary tree.
|
|
704
|
-
* False, if data stores should write GC blobs in their summary tree.
|
|
705
|
-
*/
|
|
706
|
-
get writeGCDataAtRoot() {
|
|
707
|
-
return this.garbageCollector.writeDataAtRoot;
|
|
708
|
-
}
|
|
709
697
|
get summarizer() {
|
|
710
698
|
assert(this._summarizer !== undefined, 0x257 /* "This is not summarizing container" */);
|
|
711
699
|
return this._summarizer;
|
|
@@ -728,9 +716,10 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
728
716
|
attachState: this.attachState,
|
|
729
717
|
}, error);
|
|
730
718
|
if (this.summaryManager !== undefined) {
|
|
731
|
-
this.summaryManager.off("summarizerWarning", this.
|
|
719
|
+
this.summaryManager.off("summarizerWarning", this.summarizerWarning);
|
|
732
720
|
this.summaryManager.dispose();
|
|
733
721
|
}
|
|
722
|
+
this.garbageCollector.dispose();
|
|
734
723
|
(_a = this._summarizer) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
735
724
|
this.dataStores.dispose();
|
|
736
725
|
this.pendingStateManager.dispose();
|
|
@@ -746,9 +735,6 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
746
735
|
}
|
|
747
736
|
return undefined;
|
|
748
737
|
}
|
|
749
|
-
get IFluidConfiguration() {
|
|
750
|
-
return this.context.configuration;
|
|
751
|
-
}
|
|
752
738
|
/**
|
|
753
739
|
* Notifies this object about the request made to the container.
|
|
754
740
|
* @param request - Request made to the handler.
|
|
@@ -831,7 +817,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
831
817
|
return Object.assign(Object.assign({}, this.createContainerMetadata), { summaryCount: this.summaryCount, summaryFormatVersion: 1, disableIsolatedChannels: this.disableIsolatedChannels || undefined, gcFeature: this.garbageCollector.gcSummaryFeatureVersion,
|
|
832
818
|
// The last message processed at the time of summary. If there are no messages, nothing has changed from
|
|
833
819
|
// the base summary we loaded from. So, use the message from its metadata blob.
|
|
834
|
-
message: (_a = extractSummaryMetadataMessage(this.deltaManager.lastMessage)) !== null && _a !== void 0 ? _a : this.baseSummaryMessage });
|
|
820
|
+
message: (_a = extractSummaryMetadataMessage(this.deltaManager.lastMessage)) !== null && _a !== void 0 ? _a : this.baseSummaryMessage, sessionExpiryTimeoutMs: this.garbageCollector.sessionExpiryTimeoutMs });
|
|
835
821
|
}
|
|
836
822
|
/**
|
|
837
823
|
* Retrieves the runtime for a data store if it's referenced as per the initially summary that it is loaded with.
|
|
@@ -845,7 +831,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
845
831
|
const dataStoreContext = await this.dataStores.getDataStore(id, wait);
|
|
846
832
|
// The data store is referenced if used routes in the initial summary has a route to self.
|
|
847
833
|
// Older documents may not have used routes in the summary. They are considered referenced.
|
|
848
|
-
const usedRoutes = (await dataStoreContext.
|
|
834
|
+
const usedRoutes = (await dataStoreContext.getBaseGCDetails()).usedRoutes;
|
|
849
835
|
if (usedRoutes === undefined || usedRoutes.includes("") || usedRoutes.includes("/")) {
|
|
850
836
|
return dataStoreContext.realize();
|
|
851
837
|
}
|
|
@@ -867,7 +853,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
867
853
|
});
|
|
868
854
|
return convertSummaryTreeToITree(summaryResult.summary);
|
|
869
855
|
}
|
|
870
|
-
|
|
856
|
+
addContainerStateToSummary(summaryTree) {
|
|
871
857
|
var _a;
|
|
872
858
|
addBlobToSummary(summaryTree, metadataBlobName, JSON.stringify(this.formMetadata()));
|
|
873
859
|
if (this.chunkMap.size > 0) {
|
|
@@ -889,7 +875,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
889
875
|
const blobsTree = convertToSummaryTree(snapshot, false);
|
|
890
876
|
addTreeToSummary(summaryTree, blobsTreeName, blobsTree);
|
|
891
877
|
}
|
|
892
|
-
if (this.
|
|
878
|
+
if (this.garbageCollector.writeDataAtRoot) {
|
|
893
879
|
const gcSummary = this.garbageCollector.summarize();
|
|
894
880
|
if (gcSummary !== undefined) {
|
|
895
881
|
addTreeToSummary(summaryTree, gcTreeKey, gcSummary);
|
|
@@ -1077,21 +1063,19 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1077
1063
|
}
|
|
1078
1064
|
const savedFlushMode = this.flushMode;
|
|
1079
1065
|
this.setFlushMode(FlushMode.TurnBased);
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
this.setFlushMode(savedFlushMode);
|
|
1084
|
-
}
|
|
1085
|
-
catch (error) {
|
|
1086
|
-
this.closeFn(CreateProcessingError(error, "orderSequentially"));
|
|
1087
|
-
throw error; // throw the original error for the consumer of the runtime
|
|
1088
|
-
}
|
|
1066
|
+
this.trackOrderSequentiallyCalls(callback);
|
|
1067
|
+
this.flush();
|
|
1068
|
+
this.setFlushMode(savedFlushMode);
|
|
1089
1069
|
}
|
|
1090
1070
|
trackOrderSequentiallyCalls(callback) {
|
|
1091
1071
|
try {
|
|
1092
1072
|
this._orderSequentiallyCalls++;
|
|
1093
1073
|
callback();
|
|
1094
1074
|
}
|
|
1075
|
+
catch (error) {
|
|
1076
|
+
this.closeFn(new GenericError("orderSequentiallyCallbackException", error));
|
|
1077
|
+
throw error; // throw the original error for the consumer of the runtime
|
|
1078
|
+
}
|
|
1095
1079
|
finally {
|
|
1096
1080
|
this._orderSequentiallyCalls--;
|
|
1097
1081
|
}
|
|
@@ -1121,7 +1105,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1121
1105
|
return this.dataStores._createFluidDataStoreContext(Array.isArray(pkg) ? pkg : [pkg], id, isRoot).realize();
|
|
1122
1106
|
}
|
|
1123
1107
|
canSendOps() {
|
|
1124
|
-
return this.connected && !this.deltaManager.readonly;
|
|
1108
|
+
return this.connected && !this.deltaManager.readOnlyInfo.readonly;
|
|
1125
1109
|
}
|
|
1126
1110
|
getQuorum() {
|
|
1127
1111
|
return this.context.quorum;
|
|
@@ -1194,7 +1178,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1194
1178
|
// Wrap data store summaries in .channels subtree.
|
|
1195
1179
|
wrapSummaryInChannelsTree(summarizeResult);
|
|
1196
1180
|
}
|
|
1197
|
-
this.
|
|
1181
|
+
this.addContainerStateToSummary(summarizeResult);
|
|
1198
1182
|
return summarizeResult.summary;
|
|
1199
1183
|
}
|
|
1200
1184
|
async getAbsoluteUrl(relativeUrl) {
|
|
@@ -1214,13 +1198,14 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1214
1198
|
wrapSummaryInChannelsTree(summarizeResult);
|
|
1215
1199
|
pathPartsForChildren = [channelsTreeName];
|
|
1216
1200
|
}
|
|
1217
|
-
this.
|
|
1201
|
+
this.addContainerStateToSummary(summarizeResult);
|
|
1218
1202
|
return Object.assign(Object.assign({}, summarizeResult), { id: "", pathPartsForChildren });
|
|
1219
1203
|
}
|
|
1220
1204
|
/**
|
|
1221
1205
|
* Returns a summary of the runtime at the current sequence number.
|
|
1222
1206
|
*/
|
|
1223
1207
|
async summarize(options) {
|
|
1208
|
+
this.verifyNotClosed();
|
|
1224
1209
|
const { summaryLogger, fullTree = false, trackState = true, runGC = true, runSweep, fullGC } = options;
|
|
1225
1210
|
if (runGC) {
|
|
1226
1211
|
await this.collectGarbage({ logger: summaryLogger, runSweep, fullGC });
|
|
@@ -1229,6 +1214,15 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1229
1214
|
assert(summarizeResult.summary.type === SummaryType.Tree, 0x12f /* "Container Runtime's summarize should always return a tree" */);
|
|
1230
1215
|
return summarizeResult;
|
|
1231
1216
|
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Implementation of IGarbageCollectionRuntime::updateStateBeforeGC.
|
|
1219
|
+
* Before GC runs, called by the garbage collector to update any pending GC state. This is mainly used to notify
|
|
1220
|
+
* the garbage collector of references detected since the last GC run. Most references are notified immediately
|
|
1221
|
+
* but there can be some for which async operation is required (such as detecting new root data stores).
|
|
1222
|
+
*/
|
|
1223
|
+
async updateStateBeforeGC() {
|
|
1224
|
+
return this.dataStores.updateStateBeforeGC();
|
|
1225
|
+
}
|
|
1232
1226
|
/**
|
|
1233
1227
|
* Implementation of IGarbageCollectionRuntime::getGCData.
|
|
1234
1228
|
* Generates and returns the GC data for this container.
|
|
@@ -1339,10 +1333,9 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1339
1333
|
try {
|
|
1340
1334
|
summarizeResult = await this.summarize({
|
|
1341
1335
|
summaryLogger,
|
|
1342
|
-
// If the GC
|
|
1343
|
-
//
|
|
1344
|
-
|
|
1345
|
-
fullTree: fullTree || this.garbageCollector.hasGCVersionChanged,
|
|
1336
|
+
// If the GC state needs to be reset, we need to regenerate the summary and update the unreferenced
|
|
1337
|
+
// state of all the nodes.
|
|
1338
|
+
fullTree: fullTree || this.garbageCollector.summaryStateNeedsReset,
|
|
1346
1339
|
trackState: true,
|
|
1347
1340
|
runGC: this.garbageCollector.shouldRunGC,
|
|
1348
1341
|
});
|
|
@@ -1662,12 +1655,12 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1662
1655
|
* Wait for a specific sequence number. Promise should resolve when we reach that number,
|
|
1663
1656
|
* or reject if closed.
|
|
1664
1657
|
*/
|
|
1665
|
-
const waitForSeq = async (deltaManager, targetSeq) => new Promise((
|
|
1658
|
+
const waitForSeq = async (deltaManager, targetSeq) => new Promise((resolve, reject) => {
|
|
1666
1659
|
// TODO: remove cast to any when actual event is determined
|
|
1667
1660
|
deltaManager.on("closed", reject);
|
|
1668
1661
|
const handleOp = (message) => {
|
|
1669
1662
|
if (message.sequenceNumber >= targetSeq) {
|
|
1670
|
-
|
|
1663
|
+
resolve();
|
|
1671
1664
|
deltaManager.off("op", handleOp);
|
|
1672
1665
|
}
|
|
1673
1666
|
};
|