@fluidframework/container-runtime 2.0.0-internal.1.0.0.83139 → 2.0.0-internal.1.0.1
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/batchTracker.js +1 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +16 -16
- package/dist/blobManager.js.map +1 -1
- package/dist/containerRuntime.d.ts +1 -38
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +60 -109
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +2 -3
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStores.d.ts +1 -1
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +2 -2
- package/dist/dataStores.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.js +1 -1
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +20 -1
- package/dist/summarizer.js.map +1 -1
- package/dist/summaryGenerator.js +1 -1
- package/dist/summaryGenerator.js.map +1 -1
- package/lib/batchTracker.js +1 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +16 -16
- package/lib/blobManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +1 -38
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +60 -109
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +2 -3
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStores.d.ts +1 -1
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +2 -2
- package/lib/dataStores.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.js +1 -1
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +22 -3
- package/lib/summarizer.js.map +1 -1
- package/lib/summaryGenerator.js +1 -1
- package/lib/summaryGenerator.js.map +1 -1
- package/package.json +27 -18
- package/src/batchTracker.ts +1 -1
- package/src/blobManager.ts +20 -16
- package/src/containerRuntime.ts +84 -164
- package/src/dataStore.ts +1 -4
- package/src/dataStores.ts +13 -13
- package/src/packageVersion.ts +1 -1
- package/src/runningSummarizer.ts +1 -1
- package/src/summarizer.ts +28 -3
- package/src/summaryGenerator.ts +1 -1
package/dist/containerRuntime.js
CHANGED
|
@@ -77,7 +77,6 @@ var RuntimeHeaders;
|
|
|
77
77
|
/** True if the request is coming from an IFluidHandle. */
|
|
78
78
|
RuntimeHeaders["viaHandle"] = "viaHandle";
|
|
79
79
|
})(RuntimeHeaders = exports.RuntimeHeaders || (exports.RuntimeHeaders = {}));
|
|
80
|
-
const useDataStoreAliasingKey = "Fluid.ContainerRuntime.UseDataStoreAliasing";
|
|
81
80
|
const maxConsecutiveReconnectsKey = "Fluid.ContainerRuntime.MaxConsecutiveReconnects";
|
|
82
81
|
// Feature gate for the max op size. If the value is negative, chunking is enabled
|
|
83
82
|
// and all ops over 16k would be chunked. If the value is positive, all ops with
|
|
@@ -379,7 +378,7 @@ exports.getDeviceSpec = getDeviceSpec;
|
|
|
379
378
|
*/
|
|
380
379
|
class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
381
380
|
constructor(context, registry, metadata, electedSummarizerData, chunks, dataStoreAliasMap, runtimeOptions, containerScope, logger, existing, blobManagerSnapshot, _storage, requestHandler, summaryConfiguration) {
|
|
382
|
-
var _a, _b, _c, _d, _e, _f
|
|
381
|
+
var _a, _b, _c, _d, _e, _f;
|
|
383
382
|
if (summaryConfiguration === void 0) { summaryConfiguration = Object.assign(Object.assign({}, exports.DefaultSummaryConfiguration), (_a = runtimeOptions.summaryOptions) === null || _a === void 0 ? void 0 : _a.summaryConfigOverrides); }
|
|
384
383
|
super();
|
|
385
384
|
this.context = context;
|
|
@@ -448,15 +447,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
448
447
|
this.summarizerClientElectionEnabled = this.isSummarizerClientElectionEnabled();
|
|
449
448
|
this.maxOpsSinceLastSummary = this.getMaxOpsSinceLastSummary();
|
|
450
449
|
this.initialSummarizerDelayMs = this.getInitialSummarizerDelayMs();
|
|
451
|
-
this.
|
|
452
|
-
((_c = this.mc.config.getBoolean(useDataStoreAliasingKey)) !== null && _c !== void 0 ? _c : false) ||
|
|
453
|
-
((_d = runtimeOptions.useDataStoreAliasing) !== null && _d !== void 0 ? _d : false);
|
|
454
|
-
this._maxOpSizeInBytes = ((_e = this.mc.config.getNumber(maxOpSizeInBytesKey)) !== null && _e !== void 0 ? _e : defaultMaxOpSizeInBytes);
|
|
450
|
+
this._maxOpSizeInBytes = ((_c = this.mc.config.getNumber(maxOpSizeInBytesKey)) !== null && _c !== void 0 ? _c : defaultMaxOpSizeInBytes);
|
|
455
451
|
this.maxConsecutiveReconnects =
|
|
456
|
-
(
|
|
452
|
+
(_d = this.mc.config.getNumber(maxConsecutiveReconnectsKey)) !== null && _d !== void 0 ? _d : this.defaultMaxConsecutiveReconnects;
|
|
457
453
|
this._flushMode = runtimeOptions.flushMode;
|
|
458
454
|
const pendingRuntimeState = context.pendingLocalState;
|
|
459
|
-
const baseSnapshot = (
|
|
455
|
+
const baseSnapshot = (_e = pendingRuntimeState === null || pendingRuntimeState === void 0 ? void 0 : pendingRuntimeState.baseSnapshot) !== null && _e !== void 0 ? _e : context.baseSnapshot;
|
|
460
456
|
this.garbageCollector = garbageCollection_1.GarbageCollector.create({
|
|
461
457
|
runtime: this,
|
|
462
458
|
gcOptions: this.runtimeOptions.gcOptions,
|
|
@@ -583,7 +579,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
583
579
|
};
|
|
584
580
|
// summaryNumber was renamed from summaryCount. For older docs that haven't been opened for a long time,
|
|
585
581
|
// the count is reset to 0.
|
|
586
|
-
loadSummaryNumber = (
|
|
582
|
+
loadSummaryNumber = (_f = metadata === null || metadata === void 0 ? void 0 : metadata.summaryNumber) !== null && _f !== void 0 ? _f : 0;
|
|
587
583
|
}
|
|
588
584
|
else {
|
|
589
585
|
this.createContainerMetadata = {
|
|
@@ -618,7 +614,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
618
614
|
runtimeVersion: packageVersion_1.pkgVersion,
|
|
619
615
|
},
|
|
620
616
|
});
|
|
621
|
-
const { summaryOptions = {}, gcOptions = {}, loadSequenceNumberVerification = "close",
|
|
617
|
+
const { summaryOptions = {}, gcOptions = {}, loadSequenceNumberVerification = "close", flushMode = defaultFlushMode, enableOfflineLoad = false, } = runtimeOptions;
|
|
622
618
|
const pendingRuntimeState = context.pendingLocalState;
|
|
623
619
|
const baseSnapshot = (_b = pendingRuntimeState === null || pendingRuntimeState === void 0 ? void 0 : pendingRuntimeState.baseSnapshot) !== null && _b !== void 0 ? _b : context.baseSnapshot;
|
|
624
620
|
const storage = !pendingRuntimeState ?
|
|
@@ -671,7 +667,6 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
671
667
|
summaryOptions,
|
|
672
668
|
gcOptions,
|
|
673
669
|
loadSequenceNumberVerification,
|
|
674
|
-
useDataStoreAliasing,
|
|
675
670
|
flushMode,
|
|
676
671
|
enableOfflineLoad,
|
|
677
672
|
}, containerScope, logger, loadExisting, blobManagerSnapshot, storage, requestHandler);
|
|
@@ -1053,8 +1048,8 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1053
1048
|
// ensure we don't submit ops referencing a blob that has not been uploaded
|
|
1054
1049
|
const connecting = connected && !this._connected && !this.deltaManager.readOnlyInfo.readonly;
|
|
1055
1050
|
if (connecting && this.blobManager.hasPendingOfflineUploads) {
|
|
1056
|
-
(0, common_utils_1.assert)(!this.delayConnectClientId,
|
|
1057
|
-
(0, common_utils_1.assert)(!!clientId,
|
|
1051
|
+
(0, common_utils_1.assert)(!this.delayConnectClientId, 0x392 /* Connect event delay must be canceled before subsequent connect event */);
|
|
1052
|
+
(0, common_utils_1.assert)(!!clientId, 0x393 /* Must have clientId when connecting */);
|
|
1058
1053
|
this.delayConnectClientId = clientId;
|
|
1059
1054
|
this.blobManager.onConnected().then(() => {
|
|
1060
1055
|
// make sure we didn't reconnect before the promise resolved
|
|
@@ -1068,7 +1063,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1068
1063
|
this.setConnectionStateCore(connected, clientId);
|
|
1069
1064
|
}
|
|
1070
1065
|
setConnectionStateCore(connected, clientId) {
|
|
1071
|
-
(0, common_utils_1.assert)(!this.delayConnectClientId,
|
|
1066
|
+
(0, common_utils_1.assert)(!this.delayConnectClientId, 0x394 /* connect event delay must be cleared before propagating connect event */);
|
|
1072
1067
|
this.verifyNotClosed();
|
|
1073
1068
|
// There might be no change of state due to Container calling this API after loading runtime.
|
|
1074
1069
|
const changeOfState = this._connected !== connected;
|
|
@@ -1310,59 +1305,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1310
1305
|
}
|
|
1311
1306
|
async createDataStore(pkg) {
|
|
1312
1307
|
const internalId = (0, uuid_1.v4)();
|
|
1313
|
-
return (0, dataStore_1.channelToDataStore)(await this._createDataStore(pkg,
|
|
1314
|
-
}
|
|
1315
|
-
/**
|
|
1316
|
-
* Creates a root datastore directly with a user generated id and attaches it to storage.
|
|
1317
|
-
* It is vulnerable to name collisions and should not be used.
|
|
1318
|
-
*
|
|
1319
|
-
* This method will be removed. See #6465.
|
|
1320
|
-
*/
|
|
1321
|
-
async createRootDataStoreLegacy(pkg, rootDataStoreId) {
|
|
1322
|
-
const fluidDataStore = await this._createDataStore(pkg, true /* isRoot */, rootDataStoreId);
|
|
1323
|
-
fluidDataStore.makeVisibleAndAttachGraph();
|
|
1324
|
-
return fluidDataStore;
|
|
1325
|
-
}
|
|
1326
|
-
/**
|
|
1327
|
-
* @deprecated - will be removed in an upcoming release. See #9660.
|
|
1328
|
-
*/
|
|
1329
|
-
async createRootDataStore(pkg, rootDataStoreId) {
|
|
1330
|
-
if (rootDataStoreId.includes("/")) {
|
|
1331
|
-
throw new container_utils_1.UsageError(`Id cannot contain slashes: '${rootDataStoreId}'`);
|
|
1332
|
-
}
|
|
1333
|
-
return this._aliasingEnabled === true ?
|
|
1334
|
-
this.createAndAliasDataStore(pkg, rootDataStoreId) :
|
|
1335
|
-
this.createRootDataStoreLegacy(pkg, rootDataStoreId);
|
|
1336
|
-
}
|
|
1337
|
-
/**
|
|
1338
|
-
* Creates a data store then attempts to alias it.
|
|
1339
|
-
* If aliasing fails, it will raise an exception.
|
|
1340
|
-
*
|
|
1341
|
-
* This method will be removed. See #6465.
|
|
1342
|
-
*
|
|
1343
|
-
* @param pkg - Package name of the data store
|
|
1344
|
-
* @param alias - Alias to be assigned to the data store
|
|
1345
|
-
* @param props - Properties for the data store
|
|
1346
|
-
* @returns - An aliased data store which can can be found / loaded by alias.
|
|
1347
|
-
*/
|
|
1348
|
-
async createAndAliasDataStore(pkg, alias, props) {
|
|
1349
|
-
const internalId = (0, uuid_1.v4)();
|
|
1350
|
-
try {
|
|
1351
|
-
// A similar call may have been initiated by the same client, so we should try to get
|
|
1352
|
-
// a possible existing aliased datastore first.
|
|
1353
|
-
const existingDataStore = await this.getRootDataStoreChannel(alias, /* wait */ false);
|
|
1354
|
-
return (0, dataStore_1.channelToDataStore)(existingDataStore, internalId, this, this.dataStores, this.mc.logger, true);
|
|
1355
|
-
}
|
|
1356
|
-
catch (err) {
|
|
1357
|
-
const newChannel = await this._createDataStore(pkg, false /* isRoot */, internalId, props);
|
|
1358
|
-
const newDataStore = (0, dataStore_1.channelToDataStore)(newChannel, internalId, this, this.dataStores, this.mc.logger);
|
|
1359
|
-
const aliasResult = await newDataStore.trySetAlias(alias);
|
|
1360
|
-
if (aliasResult === "Success") {
|
|
1361
|
-
return newDataStore;
|
|
1362
|
-
}
|
|
1363
|
-
const existingDataStore = await this.getRootDataStoreChannel(alias, /* wait */ false);
|
|
1364
|
-
return (0, dataStore_1.channelToDataStore)(existingDataStore, internalId, this, this.dataStores, this.mc.logger, true);
|
|
1365
|
-
}
|
|
1308
|
+
return (0, dataStore_1.channelToDataStore)(await this._createDataStore(pkg, internalId), internalId, this, this.dataStores, this.mc.logger);
|
|
1366
1309
|
}
|
|
1367
1310
|
createDetachedRootDataStore(pkg, rootDataStoreId) {
|
|
1368
1311
|
if (rootDataStoreId.includes("/")) {
|
|
@@ -1373,31 +1316,13 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1373
1316
|
createDetachedDataStore(pkg) {
|
|
1374
1317
|
return this.dataStores.createDetachedDataStoreCore(pkg, false);
|
|
1375
1318
|
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
* It is vulnerable to name collisions if both aforementioned conditions are true, and should not be used.
|
|
1379
|
-
*
|
|
1380
|
-
* This method will be removed. See #6465.
|
|
1381
|
-
*/
|
|
1382
|
-
async _createDataStoreWithPropsLegacy(pkg, props, id = (0, uuid_1.v4)(), isRoot = false) {
|
|
1383
|
-
const fluidDataStore = await this.dataStores._createFluidDataStoreContext(Array.isArray(pkg) ? pkg : [pkg], id, isRoot, props).realize();
|
|
1384
|
-
if (isRoot) {
|
|
1385
|
-
fluidDataStore.makeVisibleAndAttachGraph();
|
|
1386
|
-
this.logger.sendTelemetryEvent({
|
|
1387
|
-
eventName: "Root datastore with props",
|
|
1388
|
-
hasProps: props !== undefined,
|
|
1389
|
-
});
|
|
1390
|
-
}
|
|
1319
|
+
async _createDataStoreWithProps(pkg, props, id = (0, uuid_1.v4)()) {
|
|
1320
|
+
const fluidDataStore = await this.dataStores._createFluidDataStoreContext(Array.isArray(pkg) ? pkg : [pkg], id, props).realize();
|
|
1391
1321
|
return (0, dataStore_1.channelToDataStore)(fluidDataStore, id, this, this.dataStores, this.mc.logger);
|
|
1392
1322
|
}
|
|
1393
|
-
async
|
|
1394
|
-
return this._aliasingEnabled === true && isRoot ?
|
|
1395
|
-
this.createAndAliasDataStore(pkg, id, props) :
|
|
1396
|
-
this._createDataStoreWithPropsLegacy(pkg, props, id, isRoot);
|
|
1397
|
-
}
|
|
1398
|
-
async _createDataStore(pkg, isRoot, id = (0, uuid_1.v4)(), props) {
|
|
1323
|
+
async _createDataStore(pkg, id = (0, uuid_1.v4)(), props) {
|
|
1399
1324
|
return this.dataStores
|
|
1400
|
-
._createFluidDataStoreContext(Array.isArray(pkg) ? pkg : [pkg], id,
|
|
1325
|
+
._createFluidDataStoreContext(Array.isArray(pkg) ? pkg : [pkg], id, props)
|
|
1401
1326
|
.realize();
|
|
1402
1327
|
}
|
|
1403
1328
|
canSendOps() {
|
|
@@ -1671,16 +1596,19 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1671
1596
|
const summaryNumberLogger = telemetry_utils_1.ChildLogger.create(summaryLogger, undefined, {
|
|
1672
1597
|
all: { summaryNumber },
|
|
1673
1598
|
});
|
|
1599
|
+
let latestSnapshotVersionId;
|
|
1674
1600
|
if (refreshLatestAck) {
|
|
1675
|
-
const
|
|
1676
|
-
|
|
1601
|
+
const latestSnapshotInfo = await this.refreshLatestSummaryAckFromServer(telemetry_utils_1.ChildLogger.create(summaryNumberLogger, undefined, { all: { safeSummary: true } }));
|
|
1602
|
+
const latestSnapshotRefSeq = latestSnapshotInfo.latestSnapshotRefSeq;
|
|
1603
|
+
latestSnapshotVersionId = latestSnapshotInfo.latestSnapshotVersionId;
|
|
1604
|
+
if (latestSnapshotRefSeq > this.deltaManager.lastSequenceNumber) {
|
|
1677
1605
|
// We need to catch up to the latest summary's reference sequence number before pausing.
|
|
1678
1606
|
await telemetry_utils_1.PerformanceEvent.timedExecAsync(summaryNumberLogger, {
|
|
1679
1607
|
eventName: "WaitingForSeq",
|
|
1680
1608
|
lastSequenceNumber: this.deltaManager.lastSequenceNumber,
|
|
1681
|
-
targetSequenceNumber:
|
|
1609
|
+
targetSequenceNumber: latestSnapshotRefSeq,
|
|
1682
1610
|
lastKnownSeqNumber: this.deltaManager.lastKnownSeqNumber,
|
|
1683
|
-
}, async () => waitForSeq(this.deltaManager,
|
|
1611
|
+
}, async () => waitForSeq(this.deltaManager, latestSnapshotRefSeq), { start: true, end: true, cancel: "error" });
|
|
1684
1612
|
}
|
|
1685
1613
|
}
|
|
1686
1614
|
try {
|
|
@@ -1716,7 +1644,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1716
1644
|
error: `lastSequenceNumber changed before uploading to storage. ${this.deltaManager.lastSequenceNumber} !== ${summaryRefSeqNum}`,
|
|
1717
1645
|
};
|
|
1718
1646
|
}
|
|
1719
|
-
(0, common_utils_1.assert)(summaryRefSeqNum === ((_a = this.deltaManager.lastMessage) === null || _a === void 0 ? void 0 : _a.sequenceNumber),
|
|
1647
|
+
(0, common_utils_1.assert)(summaryRefSeqNum === ((_a = this.deltaManager.lastMessage) === null || _a === void 0 ? void 0 : _a.sequenceNumber), 0x395 /* it's one and the same thing */);
|
|
1720
1648
|
if (lastAck !== this.summaryCollection.latestAck) {
|
|
1721
1649
|
return {
|
|
1722
1650
|
continue: false,
|
|
@@ -1781,17 +1709,34 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1781
1709
|
if (!continueResult.continue) {
|
|
1782
1710
|
return Object.assign(Object.assign({ stage: "generate" }, generateSummaryData), { error: continueResult.error });
|
|
1783
1711
|
}
|
|
1784
|
-
|
|
1785
|
-
|
|
1712
|
+
// It may happen that the lastAck it not correct due to missing summaryAck in case of single commit
|
|
1713
|
+
// summary. So if the previous summarizer closes just after submitting the summary and before
|
|
1714
|
+
// submitting the summaryOp then we can't rely on summaryAck. So in case we have
|
|
1715
|
+
// latestSnapshotVersionId from storage and it does not match with the lastAck ackHandle, then use
|
|
1716
|
+
// the one fetched from storage as parent as that is the latest.
|
|
1717
|
+
let summaryContext;
|
|
1718
|
+
if ((lastAck === null || lastAck === void 0 ? void 0 : lastAck.summaryAck.contents.handle) !== latestSnapshotVersionId
|
|
1719
|
+
&& latestSnapshotVersionId !== undefined) {
|
|
1720
|
+
summaryContext = {
|
|
1721
|
+
proposalHandle: undefined,
|
|
1722
|
+
ackHandle: latestSnapshotVersionId,
|
|
1723
|
+
referenceSequenceNumber: summaryRefSeqNum,
|
|
1724
|
+
};
|
|
1725
|
+
}
|
|
1726
|
+
else if (lastAck === undefined) {
|
|
1727
|
+
summaryContext = {
|
|
1786
1728
|
proposalHandle: undefined,
|
|
1787
1729
|
ackHandle: (_b = this.context.getLoadedFromVersion()) === null || _b === void 0 ? void 0 : _b.id,
|
|
1788
1730
|
referenceSequenceNumber: summaryRefSeqNum,
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
else {
|
|
1734
|
+
summaryContext = {
|
|
1791
1735
|
proposalHandle: lastAck.summaryOp.contents.handle,
|
|
1792
1736
|
ackHandle: lastAck.summaryAck.contents.handle,
|
|
1793
1737
|
referenceSequenceNumber: summaryRefSeqNum,
|
|
1794
1738
|
};
|
|
1739
|
+
}
|
|
1795
1740
|
let handle;
|
|
1796
1741
|
try {
|
|
1797
1742
|
handle = await this.storage.uploadSummaryWithContext(summarizeResult.summary, summaryContext);
|
|
@@ -2030,12 +1975,18 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
2030
1975
|
/** Implementation of ISummarizerInternalsProvider.refreshLatestSummaryAck */
|
|
2031
1976
|
async refreshLatestSummaryAck(proposalHandle, ackHandle, summaryRefSeq, summaryLogger) {
|
|
2032
1977
|
const readAndParseBlob = async (id) => (0, driver_utils_1.readAndParse)(this.storage, id);
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
1978
|
+
// The call to fetch the snapshot is very expensive and not always needed.
|
|
1979
|
+
// It should only be done by the summarizerNode, if required.
|
|
1980
|
+
const snapshotTreeFetcher = async () => {
|
|
1981
|
+
const fetchResult = await this.fetchSnapshotFromStorage(ackHandle, summaryLogger, {
|
|
1982
|
+
eventName: "RefreshLatestSummaryGetSnapshot",
|
|
1983
|
+
ackHandle,
|
|
1984
|
+
summaryRefSeq,
|
|
1985
|
+
fetchLatest: false,
|
|
1986
|
+
});
|
|
1987
|
+
return fetchResult.snapshotTree;
|
|
1988
|
+
};
|
|
1989
|
+
const result = await this.summarizerNode.refreshLatestSummary(proposalHandle, summaryRefSeq, snapshotTreeFetcher, readAndParseBlob, summaryLogger);
|
|
2039
1990
|
// Notify the garbage collector so it can update its latest summary state.
|
|
2040
1991
|
await this.garbageCollector.latestSummaryStateRefreshed(result, readAndParseBlob);
|
|
2041
1992
|
}
|
|
@@ -2046,16 +1997,16 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
2046
1997
|
* @returns downloaded snapshot's reference sequence number
|
|
2047
1998
|
*/
|
|
2048
1999
|
async refreshLatestSummaryAckFromServer(summaryLogger) {
|
|
2049
|
-
const
|
|
2000
|
+
const { snapshotTree, versionId } = await this.fetchSnapshotFromStorage(null, summaryLogger, {
|
|
2050
2001
|
eventName: "RefreshLatestSummaryGetSnapshot",
|
|
2051
2002
|
fetchLatest: true,
|
|
2052
2003
|
}, driver_definitions_1.FetchSource.noCache);
|
|
2053
2004
|
const readAndParseBlob = async (id) => (0, driver_utils_1.readAndParse)(this.storage, id);
|
|
2054
|
-
const
|
|
2055
|
-
const result = await this.summarizerNode.refreshLatestSummary(undefined,
|
|
2005
|
+
const latestSnapshotRefSeq = await (0, runtime_utils_1.seqFromTree)(snapshotTree, readAndParseBlob);
|
|
2006
|
+
const result = await this.summarizerNode.refreshLatestSummary(undefined, latestSnapshotRefSeq, async () => snapshotTree, readAndParseBlob, summaryLogger);
|
|
2056
2007
|
// Notify the garbage collector so it can update its latest summary state.
|
|
2057
2008
|
await this.garbageCollector.latestSummaryStateRefreshed(result, readAndParseBlob);
|
|
2058
|
-
return
|
|
2009
|
+
return { latestSnapshotRefSeq, latestSnapshotVersionId: versionId };
|
|
2059
2010
|
}
|
|
2060
2011
|
async fetchSnapshotFromStorage(versionId, logger, event, fetchSource) {
|
|
2061
2012
|
return telemetry_utils_1.PerformanceEvent.timedExecAsync(logger, event, async (perfEvent) => {
|
|
@@ -2068,7 +2019,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
2068
2019
|
(0, common_utils_1.assert)(!!maybeSnapshot, 0x138 /* "Failed to get snapshot from storage" */);
|
|
2069
2020
|
stats.getSnapshotDuration = trace.trace().duration;
|
|
2070
2021
|
perfEvent.end(stats);
|
|
2071
|
-
return maybeSnapshot;
|
|
2022
|
+
return { snapshotTree: maybeSnapshot, versionId: versions[0].id };
|
|
2072
2023
|
});
|
|
2073
2024
|
}
|
|
2074
2025
|
notifyAttaching(snapshot) {
|