@fluidframework/container-runtime 2.0.0-internal.7.1.0 → 2.0.0-internal.7.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/CHANGELOG.md +4 -0
- package/api-extractor.json +1 -13
- package/api-report/container-runtime.api.md +75 -10
- package/dist/blobManager.d.ts +4 -6
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +42 -56
- package/dist/blobManager.js.map +1 -1
- package/dist/containerRuntime.d.ts +71 -23
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +72 -32
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.js +2 -2
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +8 -2
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +15 -8
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreRegistry.d.ts +3 -0
- package/dist/dataStoreRegistry.d.ts.map +1 -1
- package/dist/dataStoreRegistry.js +3 -0
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/dataStores.d.ts +0 -2
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +2 -7
- package/dist/dataStores.js.map +1 -1
- package/dist/deltaManagerProxyBase.d.ts +1 -1
- package/dist/deltaManagerProxyBase.d.ts.map +1 -1
- package/dist/deltaManagerProxyBase.js +2 -2
- package/dist/deltaManagerProxyBase.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +6 -0
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +16 -3
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts +1 -0
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +12 -2
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +40 -9
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +4 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcSummaryDefinitions.d.ts +1 -1
- package/dist/gc/gcSummaryDefinitions.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +2 -3
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +7 -8
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/index.d.ts +2 -2
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +1 -5
- package/dist/gc/index.js.map +1 -1
- package/dist/id-compressor/utilities.d.ts +3 -0
- package/dist/id-compressor/utilities.d.ts.map +1 -1
- package/dist/id-compressor/utilities.js +3 -0
- package/dist/id-compressor/utilities.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/messageTypes.d.ts +4 -1
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js +3 -0
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +3 -0
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.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/summary/orderedClientElection.d.ts +4 -1
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.d.ts +5 -0
- package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js +1 -0
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/summarizer.d.ts +1 -0
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +1 -0
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +94 -10
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +16 -0
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js +1 -0
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +10 -1
- package/dist/summary/summaryFormat.d.ts.map +1 -1
- package/dist/summary/summaryFormat.js.map +1 -1
- package/lib/blobManager.d.ts +4 -6
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +44 -58
- package/lib/blobManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +71 -23
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +73 -33
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.js +2 -2
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +8 -2
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +16 -9
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreRegistry.d.ts +3 -0
- package/lib/dataStoreRegistry.d.ts.map +1 -1
- package/lib/dataStoreRegistry.js +3 -0
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/dataStores.d.ts +0 -2
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +3 -8
- package/lib/dataStores.js.map +1 -1
- package/lib/deltaManagerProxyBase.d.ts +1 -1
- package/lib/deltaManagerProxyBase.d.ts.map +1 -1
- package/lib/deltaManagerProxyBase.js +2 -2
- package/lib/deltaManagerProxyBase.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +6 -0
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +16 -3
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts +1 -0
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js +14 -4
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +40 -9
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js +4 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcSummaryDefinitions.d.ts +1 -1
- package/lib/gc/gcSummaryDefinitions.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +2 -3
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +7 -8
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/gc/index.d.ts +2 -2
- package/lib/gc/index.d.ts.map +1 -1
- package/lib/gc/index.js +2 -2
- package/lib/gc/index.js.map +1 -1
- package/lib/id-compressor/utilities.d.ts +3 -0
- package/lib/id-compressor/utilities.d.ts.map +1 -1
- package/lib/id-compressor/utilities.js +3 -0
- package/lib/id-compressor/utilities.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/messageTypes.d.ts +4 -1
- package/lib/messageTypes.d.ts.map +1 -1
- package/lib/messageTypes.js +3 -0
- package/lib/messageTypes.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +3 -0
- package/lib/opLifecycle/definitions.d.ts.map +1 -1
- package/lib/opLifecycle/definitions.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/summary/orderedClientElection.d.ts +4 -1
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.d.ts +5 -0
- package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js +1 -0
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/summary/summarizer.d.ts +1 -0
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +1 -0
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +94 -10
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +16 -0
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js +1 -0
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts +10 -1
- package/lib/summary/summaryFormat.d.ts.map +1 -1
- package/lib/summary/summaryFormat.js.map +1 -1
- package/package.json +25 -22
- package/src/blobManager.ts +61 -74
- package/src/containerRuntime.ts +103 -50
- package/src/dataStore.ts +2 -2
- package/src/dataStoreContext.ts +16 -9
- package/src/dataStoreRegistry.ts +3 -0
- package/src/dataStores.ts +4 -16
- package/src/deltaManagerProxyBase.ts +2 -2
- package/src/gc/garbageCollection.ts +18 -3
- package/src/gc/gcConfigs.ts +22 -4
- package/src/gc/gcDefinitions.ts +41 -9
- package/src/gc/gcSummaryDefinitions.ts +1 -1
- package/src/gc/gcTelemetry.ts +8 -8
- package/src/gc/index.ts +0 -4
- package/src/id-compressor/utilities.ts +3 -0
- package/src/index.ts +13 -1
- package/src/messageTypes.ts +4 -1
- package/src/opLifecycle/definitions.ts +3 -0
- package/src/packageVersion.ts +1 -1
- package/src/summary/orderedClientElection.ts +4 -1
- package/src/summary/runWhileConnectedCoordinator.ts +5 -1
- package/src/summary/summarizer.ts +1 -0
- package/src/summary/summarizerTypes.ts +95 -11
- package/src/summary/summaryCollection.ts +18 -1
- package/src/summary/summaryFormat.ts +11 -1
- package/dist/container-runtime-alpha.d.ts +0 -1554
- package/dist/container-runtime-beta.d.ts +0 -1554
- package/dist/container-runtime-public.d.ts +0 -1554
- package/dist/container-runtime.d.ts +0 -1611
- package/src/gc/gcEarlyAdoption.md +0 -145
package/dist/containerRuntime.js
CHANGED
|
@@ -68,6 +68,9 @@ function prepareLocalContainerRuntimeIdAllocationMessageForTransit(message) {
|
|
|
68
68
|
delete message.contents.stashedState;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
71
74
|
exports.DefaultSummaryConfiguration = {
|
|
72
75
|
state: "enabled",
|
|
73
76
|
minIdleTime: 0,
|
|
@@ -84,6 +87,7 @@ exports.DefaultSummaryConfiguration = {
|
|
|
84
87
|
};
|
|
85
88
|
/**
|
|
86
89
|
* Accepted header keys for requests coming to the runtime.
|
|
90
|
+
* @public
|
|
87
91
|
*/
|
|
88
92
|
var RuntimeHeaders;
|
|
89
93
|
(function (RuntimeHeaders) {
|
|
@@ -92,13 +96,24 @@ var RuntimeHeaders;
|
|
|
92
96
|
/** True if the request is coming from an IFluidHandle. */
|
|
93
97
|
RuntimeHeaders["viaHandle"] = "viaHandle";
|
|
94
98
|
})(RuntimeHeaders || (exports.RuntimeHeaders = RuntimeHeaders = {}));
|
|
95
|
-
/** True if a tombstoned object should be returned without erroring
|
|
99
|
+
/** True if a tombstoned object should be returned without erroring
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
96
102
|
exports.AllowTombstoneRequestHeaderKey = "allowTombstone"; // Belongs in the enum above, but avoiding the breaking change
|
|
97
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* [IRRELEVANT IF throwOnInactiveLoad OPTION NOT SET] True if an inactive object should be returned without erroring
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
98
107
|
exports.AllowInactiveRequestHeaderKey = "allowInactive"; // Belongs in the enum above, but avoiding the breaking change
|
|
99
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Tombstone error responses will have this header set to true
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
100
112
|
exports.TombstoneResponseHeaderKey = "isTombstoned";
|
|
101
|
-
/**
|
|
113
|
+
/**
|
|
114
|
+
* Inactive error responses will have this header set to true
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
102
117
|
exports.InactiveResponseHeaderKey = "isInactive";
|
|
103
118
|
/** Default values for Runtime Headers */
|
|
104
119
|
exports.defaultRuntimeHeaderData = {
|
|
@@ -108,6 +123,7 @@ exports.defaultRuntimeHeaderData = {
|
|
|
108
123
|
};
|
|
109
124
|
/**
|
|
110
125
|
* Available compression algorithms for op compression.
|
|
126
|
+
* @public
|
|
111
127
|
*/
|
|
112
128
|
var CompressionAlgorithms;
|
|
113
129
|
(function (CompressionAlgorithms) {
|
|
@@ -137,7 +153,8 @@ exports.defaultPendingOpsRetryDelayMs = 1000;
|
|
|
137
153
|
*/
|
|
138
154
|
const defaultCloseSummarizerDelayMs = 5000; // 5 seconds
|
|
139
155
|
/**
|
|
140
|
-
* @deprecated
|
|
156
|
+
* @deprecated use ContainerRuntimeMessageType instead
|
|
157
|
+
* @public
|
|
141
158
|
*/
|
|
142
159
|
var RuntimeMessage;
|
|
143
160
|
(function (RuntimeMessage) {
|
|
@@ -150,7 +167,8 @@ var RuntimeMessage;
|
|
|
150
167
|
RuntimeMessage["Operation"] = "op";
|
|
151
168
|
})(RuntimeMessage || (exports.RuntimeMessage = RuntimeMessage = {}));
|
|
152
169
|
/**
|
|
153
|
-
* @deprecated
|
|
170
|
+
* @deprecated please use version in driver-utils
|
|
171
|
+
* @public
|
|
154
172
|
*/
|
|
155
173
|
function isRuntimeMessage(message) {
|
|
156
174
|
return Object.values(RuntimeMessage).includes(message.type);
|
|
@@ -160,6 +178,7 @@ exports.isRuntimeMessage = isRuntimeMessage;
|
|
|
160
178
|
* Legacy ID for the built-in AgentScheduler. To minimize disruption while removing it, retaining this as a
|
|
161
179
|
* special-case for document dirty state. Ultimately we should have no special-cases from the
|
|
162
180
|
* ContainerRuntime's perspective.
|
|
181
|
+
* @public
|
|
163
182
|
*/
|
|
164
183
|
exports.agentSchedulerId = "_scheduler";
|
|
165
184
|
// safely check navigator and get the hardware spec value
|
|
@@ -229,6 +248,7 @@ async function createSummarizer(loader, url) {
|
|
|
229
248
|
}
|
|
230
249
|
/**
|
|
231
250
|
* This function is not supported publicly and exists for e2e testing
|
|
251
|
+
* @internal
|
|
232
252
|
*/
|
|
233
253
|
async function TEST_requestSummarizer(loader, url) {
|
|
234
254
|
return createSummarizer(loader, url);
|
|
@@ -237,16 +257,17 @@ exports.TEST_requestSummarizer = TEST_requestSummarizer;
|
|
|
237
257
|
/**
|
|
238
258
|
* Represents the runtime of the container. Contains helper functions/state of the container.
|
|
239
259
|
* It will define the store level mappings.
|
|
260
|
+
* @public
|
|
240
261
|
*/
|
|
241
262
|
class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
242
263
|
/**
|
|
243
|
-
* @deprecated
|
|
264
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
244
265
|
*/
|
|
245
266
|
get IFluidRouter() {
|
|
246
267
|
return this;
|
|
247
268
|
}
|
|
248
269
|
/**
|
|
249
|
-
* @deprecated
|
|
270
|
+
* @deprecated use loadRuntime instead.
|
|
250
271
|
* Load the stores from a snapshot and returns the runtime.
|
|
251
272
|
* @param context - Context of the container.
|
|
252
273
|
* @param registryEntries - Mapping to the stores.
|
|
@@ -451,6 +472,18 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
451
472
|
? this.summaryConfiguration.initialSummarizerDelayMs
|
|
452
473
|
: 0;
|
|
453
474
|
}
|
|
475
|
+
/** If false, loading or using a Tombstoned object should merely log, not fail */
|
|
476
|
+
get gcTombstoneEnforcementAllowed() {
|
|
477
|
+
return this.garbageCollector.tombstoneEnforcementAllowed;
|
|
478
|
+
}
|
|
479
|
+
/** If true, throw an error when a tombstone data store is retrieved */
|
|
480
|
+
get gcThrowOnTombstoneLoad() {
|
|
481
|
+
return this.garbageCollector.throwOnTombstoneLoad;
|
|
482
|
+
}
|
|
483
|
+
/** If true, throw an error when a tombstone data store is used. */
|
|
484
|
+
get gcThrowOnTombstoneUsage() {
|
|
485
|
+
return this.garbageCollector.throwOnTombstoneUsage;
|
|
486
|
+
}
|
|
454
487
|
/**
|
|
455
488
|
* @internal
|
|
456
489
|
*/
|
|
@@ -555,7 +588,6 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
555
588
|
// Note that we only need to pull the *initial* connected state from the context.
|
|
556
589
|
// Later updates come through calls to setConnectionState.
|
|
557
590
|
this._connected = connected;
|
|
558
|
-
this.gcTombstoneEnforcementAllowed = (0, gc_1.shouldAllowGcTombstoneEnforcement)(metadata?.gcFeatureMatrix?.tombstoneGeneration /* persisted */, this.runtimeOptions.gcOptions[gc_1.gcTombstoneGenerationOptionName] /* current */);
|
|
559
591
|
this.mc.logger.sendTelemetryEvent({
|
|
560
592
|
eventName: "GCFeatureMatrix",
|
|
561
593
|
metadataValue: JSON.stringify(metadata?.gcFeatureMatrix),
|
|
@@ -829,7 +861,7 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
829
861
|
/**
|
|
830
862
|
* Notifies this object about the request made to the container.
|
|
831
863
|
* @param request - Request made to the handler.
|
|
832
|
-
* @deprecated
|
|
864
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
833
865
|
*/
|
|
834
866
|
async request(request) {
|
|
835
867
|
try {
|
|
@@ -878,7 +910,9 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
878
910
|
: (0, runtime_utils_1.create404Response)(request);
|
|
879
911
|
}
|
|
880
912
|
else if (requestParser.pathParts.length > 0) {
|
|
881
|
-
|
|
913
|
+
// Differentiate between requesting the dataStore directly, or one of its children
|
|
914
|
+
const requestForChild = !requestParser.isLeaf(1);
|
|
915
|
+
const dataStore = await this.getDataStoreFromRequest(id, request, requestForChild);
|
|
882
916
|
const subRequest = requestParser.createSubRequest(1);
|
|
883
917
|
// We always expect createSubRequest to include a leading slash, but asserting here to protect against
|
|
884
918
|
// unintentionally modifying the url if that changes.
|
|
@@ -901,7 +935,7 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
901
935
|
internalId(maybeAlias) {
|
|
902
936
|
return this.dataStores.aliases.get(maybeAlias) ?? maybeAlias;
|
|
903
937
|
}
|
|
904
|
-
async getDataStoreFromRequest(id, request) {
|
|
938
|
+
async getDataStoreFromRequest(id, request, requestForChild) {
|
|
905
939
|
const headerData = {};
|
|
906
940
|
if (typeof request.headers?.[RuntimeHeaders.wait] === "boolean") {
|
|
907
941
|
headerData.wait = request.headers[RuntimeHeaders.wait];
|
|
@@ -912,6 +946,10 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
912
946
|
if (typeof request.headers?.[exports.AllowTombstoneRequestHeaderKey] === "boolean") {
|
|
913
947
|
headerData.allowTombstone = request.headers[exports.AllowTombstoneRequestHeaderKey];
|
|
914
948
|
}
|
|
949
|
+
// We allow Tombstone requests for sub-DataStore objects
|
|
950
|
+
if (requestForChild) {
|
|
951
|
+
headerData.allowTombstone = true;
|
|
952
|
+
}
|
|
915
953
|
await this.dataStores.waitIfPendingAlias(id);
|
|
916
954
|
const internalId = this.internalId(id);
|
|
917
955
|
const dataStoreContext = await this.dataStores.getDataStore(internalId, headerData);
|
|
@@ -1342,7 +1380,7 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
1342
1380
|
* Returns the runtime of the data store.
|
|
1343
1381
|
* @param id - Id supplied during creating the data store.
|
|
1344
1382
|
* @param wait - True if you want to wait for it.
|
|
1345
|
-
* @deprecated
|
|
1383
|
+
* @deprecated Use getAliasedDataStoreEntryPoint instead to get an aliased data store's entry point.
|
|
1346
1384
|
*/
|
|
1347
1385
|
// eslint-disable-next-line import/no-deprecated
|
|
1348
1386
|
async getRootDataStore(id, wait = true) {
|
|
@@ -1510,15 +1548,22 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
1510
1548
|
* Submits the signal to be sent to other clients.
|
|
1511
1549
|
* @param type - Type of the signal.
|
|
1512
1550
|
* @param content - Content of the signal.
|
|
1551
|
+
* @param targetClientId - When specified, the signal is only sent to the provided client id.
|
|
1513
1552
|
*/
|
|
1514
|
-
submitSignal(type, content) {
|
|
1553
|
+
submitSignal(type, content, targetClientId) {
|
|
1515
1554
|
this.verifyNotClosed();
|
|
1516
1555
|
const envelope = this.createNewSignalEnvelope(undefined /* address */, type, content);
|
|
1517
|
-
return this.submitSignalFn(envelope);
|
|
1556
|
+
return this.submitSignalFn(envelope, targetClientId);
|
|
1518
1557
|
}
|
|
1519
|
-
|
|
1558
|
+
/**
|
|
1559
|
+
* Submits the signal to be sent to other clients.
|
|
1560
|
+
* @param type - Type of the signal.
|
|
1561
|
+
* @param content - Content of the signal.
|
|
1562
|
+
* @param targetClientId - When specified, the signal is only sent to the provided client id.
|
|
1563
|
+
*/
|
|
1564
|
+
submitDataStoreSignal(address, type, content, targetClientId) {
|
|
1520
1565
|
const envelope = this.createNewSignalEnvelope(address, type, content);
|
|
1521
|
-
return this.submitSignalFn(envelope);
|
|
1566
|
+
return this.submitSignalFn(envelope, targetClientId);
|
|
1522
1567
|
}
|
|
1523
1568
|
setAttachState(attachState) {
|
|
1524
1569
|
if (attachState === container_definitions_1.AttachState.Attaching) {
|
|
@@ -1641,7 +1686,7 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
1641
1686
|
this.dataStores.updateUnusedRoutes(dataStoreRoutes);
|
|
1642
1687
|
}
|
|
1643
1688
|
/**
|
|
1644
|
-
* @deprecated
|
|
1689
|
+
* @deprecated Replaced by deleteSweepReadyNodes.
|
|
1645
1690
|
*/
|
|
1646
1691
|
deleteUnusedNodes(unusedRoutes) {
|
|
1647
1692
|
throw new Error("deleteUnusedRoutes should not be called");
|
|
@@ -2377,11 +2422,11 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
2377
2422
|
* and then close as the current main client is likely to be re-elected as the parent summarizer again.
|
|
2378
2423
|
*/
|
|
2379
2424
|
if (!result.isSummaryTracked && result.isSummaryNewer) {
|
|
2380
|
-
const fetchResult = await this.
|
|
2425
|
+
const fetchResult = await this.fetchLatestSnapshotFromStorage(summaryLogger, {
|
|
2381
2426
|
eventName: "RefreshLatestSummaryAckFetch",
|
|
2382
2427
|
ackHandle,
|
|
2383
2428
|
targetSequenceNumber: summaryRefSeq,
|
|
2384
|
-
}, readAndParseBlob
|
|
2429
|
+
}, readAndParseBlob);
|
|
2385
2430
|
/**
|
|
2386
2431
|
* If the fetched snapshot is older than the one for which the ack was received, close the container.
|
|
2387
2432
|
* This should never happen because an ack should be sent after the latest summary is updated in the server.
|
|
@@ -2417,9 +2462,9 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
2417
2462
|
const readAndParseBlob = async (id) => (0, driver_utils_1.readAndParse)(this.storage, id);
|
|
2418
2463
|
// This is a performance optimization as the same parent is likely to be elected again, and would use its
|
|
2419
2464
|
// cache to fetch the snapshot instead of the network.
|
|
2420
|
-
await this.
|
|
2465
|
+
await this.fetchLatestSnapshotFromStorage(summaryLogger, {
|
|
2421
2466
|
eventName: "RefreshLatestSummaryFromServerFetch",
|
|
2422
|
-
}, readAndParseBlob
|
|
2467
|
+
}, readAndParseBlob);
|
|
2423
2468
|
await this.closeStaleSummarizer("RefreshLatestSummaryFromServerFetch");
|
|
2424
2469
|
return {
|
|
2425
2470
|
stage: "base",
|
|
@@ -2429,27 +2474,21 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
2429
2474
|
};
|
|
2430
2475
|
}
|
|
2431
2476
|
async closeStaleSummarizer(codePath) {
|
|
2432
|
-
this.mc.logger.sendTelemetryEvent({
|
|
2433
|
-
eventName: "ClosingSummarizerOnSummaryStale",
|
|
2434
|
-
codePath,
|
|
2435
|
-
message: "Stopping fetch from storage",
|
|
2436
|
-
closeSummarizerDelayMs: this.closeSummarizerDelayMs,
|
|
2437
|
-
}, new telemetry_utils_1.GenericError("Restarting summarizer instead of refreshing"));
|
|
2438
2477
|
// Delay before restarting summarizer to prevent the summarizer from restarting too frequently.
|
|
2439
2478
|
await (0, core_utils_1.delay)(this.closeSummarizerDelayMs);
|
|
2440
2479
|
this._summarizer?.stop("latestSummaryStateStale");
|
|
2441
2480
|
this.disposeFn();
|
|
2442
2481
|
}
|
|
2443
2482
|
/**
|
|
2444
|
-
* Downloads
|
|
2483
|
+
* Downloads the latest snapshot from storage.
|
|
2445
2484
|
* By default, it also closes the container after downloading the snapshot. However, this may be
|
|
2446
2485
|
* overridden via options.
|
|
2447
2486
|
*/
|
|
2448
|
-
async
|
|
2487
|
+
async fetchLatestSnapshotFromStorage(logger, event, readAndParseBlob) {
|
|
2449
2488
|
return telemetry_utils_1.PerformanceEvent.timedExecAsync(logger, event, async (perfEvent) => {
|
|
2450
2489
|
const stats = {};
|
|
2451
2490
|
const trace = client_utils_1.Trace.start();
|
|
2452
|
-
const versions = await this.storage.getVersions(
|
|
2491
|
+
const versions = await this.storage.getVersions(null, 1, "prefetchLatestSummaryBeforeClose", driver_definitions_1.FetchSource.noCache);
|
|
2453
2492
|
(0, core_utils_1.assert)(!!versions && !!versions[0], 0x137 /* "Failed to get version from storage" */);
|
|
2454
2493
|
stats.getVersionDuration = trace.trace().duration;
|
|
2455
2494
|
const maybeSnapshot = await this.storage.getSnapshotTree(versions[0]);
|
|
@@ -2474,6 +2513,7 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
2474
2513
|
}, async (event) => {
|
|
2475
2514
|
this.verifyNotClosed();
|
|
2476
2515
|
const waitBlobsToAttach = props?.notifyImminentClosure;
|
|
2516
|
+
const stopBlobAttachingSignal = props?.stopBlobAttachingSignal;
|
|
2477
2517
|
if (this._orderSequentiallyCalls !== 0) {
|
|
2478
2518
|
throw new telemetry_utils_1.UsageError("can't get state during orderSequentially");
|
|
2479
2519
|
}
|
|
@@ -2482,7 +2522,7 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
2482
2522
|
// to close current batch.
|
|
2483
2523
|
this.flush();
|
|
2484
2524
|
const pendingAttachmentBlobs = waitBlobsToAttach
|
|
2485
|
-
? await this.blobManager.attachAndGetPendingBlobs()
|
|
2525
|
+
? await this.blobManager.attachAndGetPendingBlobs(stopBlobAttachingSignal)
|
|
2486
2526
|
: undefined;
|
|
2487
2527
|
const pending = this.pendingStateManager.getLocalState();
|
|
2488
2528
|
if (!pendingAttachmentBlobs && !this.hasPendingMessages()) {
|