@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/lib/containerRuntime.js
CHANGED
|
@@ -19,7 +19,7 @@ import { BlobManager } from "./blobManager";
|
|
|
19
19
|
import { DataStores, getSummaryForDatastores } from "./dataStores";
|
|
20
20
|
import { aliasBlobName, blobsTreeName, chunksBlobName, createRootSummarizerNodeWithGC, electedSummarizerBlobName, extractSummaryMetadataMessage, idCompressorBlobName, metadataBlobName, Summarizer, SummaryManager, wrapSummaryInChannelsTree, SummaryCollection, OrderedClientCollection, OrderedClientElection, SummarizerClientElection, summarizerClientType, RunWhileConnectedCoordinator, RetriableSummaryError, } from "./summary";
|
|
21
21
|
import { formExponentialFn, Throttler } from "./throttler";
|
|
22
|
-
import { GarbageCollector, GCNodeType, gcTombstoneGenerationOptionName,
|
|
22
|
+
import { GarbageCollector, GCNodeType, gcTombstoneGenerationOptionName, trimLeadingAndTrailingSlashes, } from "./gc";
|
|
23
23
|
import { channelToDataStore, isDataStoreAliasMessage } from "./dataStore";
|
|
24
24
|
import { BindBatchTracker } from "./batchTracker";
|
|
25
25
|
import { ScheduleManager } from "./scheduleManager";
|
|
@@ -44,6 +44,9 @@ function prepareLocalContainerRuntimeIdAllocationMessageForTransit(message) {
|
|
|
44
44
|
delete message.contents.stashedState;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
47
50
|
export const DefaultSummaryConfiguration = {
|
|
48
51
|
state: "enabled",
|
|
49
52
|
minIdleTime: 0,
|
|
@@ -60,6 +63,7 @@ export const DefaultSummaryConfiguration = {
|
|
|
60
63
|
};
|
|
61
64
|
/**
|
|
62
65
|
* Accepted header keys for requests coming to the runtime.
|
|
66
|
+
* @public
|
|
63
67
|
*/
|
|
64
68
|
export var RuntimeHeaders;
|
|
65
69
|
(function (RuntimeHeaders) {
|
|
@@ -68,13 +72,24 @@ export var RuntimeHeaders;
|
|
|
68
72
|
/** True if the request is coming from an IFluidHandle. */
|
|
69
73
|
RuntimeHeaders["viaHandle"] = "viaHandle";
|
|
70
74
|
})(RuntimeHeaders || (RuntimeHeaders = {}));
|
|
71
|
-
/** True if a tombstoned object should be returned without erroring
|
|
75
|
+
/** True if a tombstoned object should be returned without erroring
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
72
78
|
export const AllowTombstoneRequestHeaderKey = "allowTombstone"; // Belongs in the enum above, but avoiding the breaking change
|
|
73
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* [IRRELEVANT IF throwOnInactiveLoad OPTION NOT SET] True if an inactive object should be returned without erroring
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
74
83
|
export const AllowInactiveRequestHeaderKey = "allowInactive"; // Belongs in the enum above, but avoiding the breaking change
|
|
75
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Tombstone error responses will have this header set to true
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
76
88
|
export const TombstoneResponseHeaderKey = "isTombstoned";
|
|
77
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Inactive error responses will have this header set to true
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
78
93
|
export const InactiveResponseHeaderKey = "isInactive";
|
|
79
94
|
/** Default values for Runtime Headers */
|
|
80
95
|
export const defaultRuntimeHeaderData = {
|
|
@@ -84,6 +99,7 @@ export const defaultRuntimeHeaderData = {
|
|
|
84
99
|
};
|
|
85
100
|
/**
|
|
86
101
|
* Available compression algorithms for op compression.
|
|
102
|
+
* @public
|
|
87
103
|
*/
|
|
88
104
|
export var CompressionAlgorithms;
|
|
89
105
|
(function (CompressionAlgorithms) {
|
|
@@ -113,7 +129,8 @@ export const defaultPendingOpsRetryDelayMs = 1000;
|
|
|
113
129
|
*/
|
|
114
130
|
const defaultCloseSummarizerDelayMs = 5000; // 5 seconds
|
|
115
131
|
/**
|
|
116
|
-
* @deprecated
|
|
132
|
+
* @deprecated use ContainerRuntimeMessageType instead
|
|
133
|
+
* @public
|
|
117
134
|
*/
|
|
118
135
|
export var RuntimeMessage;
|
|
119
136
|
(function (RuntimeMessage) {
|
|
@@ -126,7 +143,8 @@ export var RuntimeMessage;
|
|
|
126
143
|
RuntimeMessage["Operation"] = "op";
|
|
127
144
|
})(RuntimeMessage || (RuntimeMessage = {}));
|
|
128
145
|
/**
|
|
129
|
-
* @deprecated
|
|
146
|
+
* @deprecated please use version in driver-utils
|
|
147
|
+
* @public
|
|
130
148
|
*/
|
|
131
149
|
export function isRuntimeMessage(message) {
|
|
132
150
|
return Object.values(RuntimeMessage).includes(message.type);
|
|
@@ -135,6 +153,7 @@ export function isRuntimeMessage(message) {
|
|
|
135
153
|
* Legacy ID for the built-in AgentScheduler. To minimize disruption while removing it, retaining this as a
|
|
136
154
|
* special-case for document dirty state. Ultimately we should have no special-cases from the
|
|
137
155
|
* ContainerRuntime's perspective.
|
|
156
|
+
* @public
|
|
138
157
|
*/
|
|
139
158
|
export const agentSchedulerId = "_scheduler";
|
|
140
159
|
// safely check navigator and get the hardware spec value
|
|
@@ -202,6 +221,7 @@ async function createSummarizer(loader, url) {
|
|
|
202
221
|
}
|
|
203
222
|
/**
|
|
204
223
|
* This function is not supported publicly and exists for e2e testing
|
|
224
|
+
* @internal
|
|
205
225
|
*/
|
|
206
226
|
export async function TEST_requestSummarizer(loader, url) {
|
|
207
227
|
return createSummarizer(loader, url);
|
|
@@ -209,16 +229,17 @@ export async function TEST_requestSummarizer(loader, url) {
|
|
|
209
229
|
/**
|
|
210
230
|
* Represents the runtime of the container. Contains helper functions/state of the container.
|
|
211
231
|
* It will define the store level mappings.
|
|
232
|
+
* @public
|
|
212
233
|
*/
|
|
213
234
|
export class ContainerRuntime extends TypedEventEmitter {
|
|
214
235
|
/**
|
|
215
|
-
* @deprecated
|
|
236
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
216
237
|
*/
|
|
217
238
|
get IFluidRouter() {
|
|
218
239
|
return this;
|
|
219
240
|
}
|
|
220
241
|
/**
|
|
221
|
-
* @deprecated
|
|
242
|
+
* @deprecated use loadRuntime instead.
|
|
222
243
|
* Load the stores from a snapshot and returns the runtime.
|
|
223
244
|
* @param context - Context of the container.
|
|
224
245
|
* @param registryEntries - Mapping to the stores.
|
|
@@ -423,6 +444,18 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
423
444
|
? this.summaryConfiguration.initialSummarizerDelayMs
|
|
424
445
|
: 0;
|
|
425
446
|
}
|
|
447
|
+
/** If false, loading or using a Tombstoned object should merely log, not fail */
|
|
448
|
+
get gcTombstoneEnforcementAllowed() {
|
|
449
|
+
return this.garbageCollector.tombstoneEnforcementAllowed;
|
|
450
|
+
}
|
|
451
|
+
/** If true, throw an error when a tombstone data store is retrieved */
|
|
452
|
+
get gcThrowOnTombstoneLoad() {
|
|
453
|
+
return this.garbageCollector.throwOnTombstoneLoad;
|
|
454
|
+
}
|
|
455
|
+
/** If true, throw an error when a tombstone data store is used. */
|
|
456
|
+
get gcThrowOnTombstoneUsage() {
|
|
457
|
+
return this.garbageCollector.throwOnTombstoneUsage;
|
|
458
|
+
}
|
|
426
459
|
/**
|
|
427
460
|
* @internal
|
|
428
461
|
*/
|
|
@@ -527,7 +560,6 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
527
560
|
// Note that we only need to pull the *initial* connected state from the context.
|
|
528
561
|
// Later updates come through calls to setConnectionState.
|
|
529
562
|
this._connected = connected;
|
|
530
|
-
this.gcTombstoneEnforcementAllowed = shouldAllowGcTombstoneEnforcement(metadata?.gcFeatureMatrix?.tombstoneGeneration /* persisted */, this.runtimeOptions.gcOptions[gcTombstoneGenerationOptionName] /* current */);
|
|
531
563
|
this.mc.logger.sendTelemetryEvent({
|
|
532
564
|
eventName: "GCFeatureMatrix",
|
|
533
565
|
metadataValue: JSON.stringify(metadata?.gcFeatureMatrix),
|
|
@@ -801,7 +833,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
801
833
|
/**
|
|
802
834
|
* Notifies this object about the request made to the container.
|
|
803
835
|
* @param request - Request made to the handler.
|
|
804
|
-
* @deprecated
|
|
836
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
805
837
|
*/
|
|
806
838
|
async request(request) {
|
|
807
839
|
try {
|
|
@@ -850,7 +882,9 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
850
882
|
: create404Response(request);
|
|
851
883
|
}
|
|
852
884
|
else if (requestParser.pathParts.length > 0) {
|
|
853
|
-
|
|
885
|
+
// Differentiate between requesting the dataStore directly, or one of its children
|
|
886
|
+
const requestForChild = !requestParser.isLeaf(1);
|
|
887
|
+
const dataStore = await this.getDataStoreFromRequest(id, request, requestForChild);
|
|
854
888
|
const subRequest = requestParser.createSubRequest(1);
|
|
855
889
|
// We always expect createSubRequest to include a leading slash, but asserting here to protect against
|
|
856
890
|
// unintentionally modifying the url if that changes.
|
|
@@ -873,7 +907,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
873
907
|
internalId(maybeAlias) {
|
|
874
908
|
return this.dataStores.aliases.get(maybeAlias) ?? maybeAlias;
|
|
875
909
|
}
|
|
876
|
-
async getDataStoreFromRequest(id, request) {
|
|
910
|
+
async getDataStoreFromRequest(id, request, requestForChild) {
|
|
877
911
|
const headerData = {};
|
|
878
912
|
if (typeof request.headers?.[RuntimeHeaders.wait] === "boolean") {
|
|
879
913
|
headerData.wait = request.headers[RuntimeHeaders.wait];
|
|
@@ -884,6 +918,10 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
884
918
|
if (typeof request.headers?.[AllowTombstoneRequestHeaderKey] === "boolean") {
|
|
885
919
|
headerData.allowTombstone = request.headers[AllowTombstoneRequestHeaderKey];
|
|
886
920
|
}
|
|
921
|
+
// We allow Tombstone requests for sub-DataStore objects
|
|
922
|
+
if (requestForChild) {
|
|
923
|
+
headerData.allowTombstone = true;
|
|
924
|
+
}
|
|
887
925
|
await this.dataStores.waitIfPendingAlias(id);
|
|
888
926
|
const internalId = this.internalId(id);
|
|
889
927
|
const dataStoreContext = await this.dataStores.getDataStore(internalId, headerData);
|
|
@@ -1314,7 +1352,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1314
1352
|
* Returns the runtime of the data store.
|
|
1315
1353
|
* @param id - Id supplied during creating the data store.
|
|
1316
1354
|
* @param wait - True if you want to wait for it.
|
|
1317
|
-
* @deprecated
|
|
1355
|
+
* @deprecated Use getAliasedDataStoreEntryPoint instead to get an aliased data store's entry point.
|
|
1318
1356
|
*/
|
|
1319
1357
|
// eslint-disable-next-line import/no-deprecated
|
|
1320
1358
|
async getRootDataStore(id, wait = true) {
|
|
@@ -1482,15 +1520,22 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1482
1520
|
* Submits the signal to be sent to other clients.
|
|
1483
1521
|
* @param type - Type of the signal.
|
|
1484
1522
|
* @param content - Content of the signal.
|
|
1523
|
+
* @param targetClientId - When specified, the signal is only sent to the provided client id.
|
|
1485
1524
|
*/
|
|
1486
|
-
submitSignal(type, content) {
|
|
1525
|
+
submitSignal(type, content, targetClientId) {
|
|
1487
1526
|
this.verifyNotClosed();
|
|
1488
1527
|
const envelope = this.createNewSignalEnvelope(undefined /* address */, type, content);
|
|
1489
|
-
return this.submitSignalFn(envelope);
|
|
1528
|
+
return this.submitSignalFn(envelope, targetClientId);
|
|
1490
1529
|
}
|
|
1491
|
-
|
|
1530
|
+
/**
|
|
1531
|
+
* Submits the signal to be sent to other clients.
|
|
1532
|
+
* @param type - Type of the signal.
|
|
1533
|
+
* @param content - Content of the signal.
|
|
1534
|
+
* @param targetClientId - When specified, the signal is only sent to the provided client id.
|
|
1535
|
+
*/
|
|
1536
|
+
submitDataStoreSignal(address, type, content, targetClientId) {
|
|
1492
1537
|
const envelope = this.createNewSignalEnvelope(address, type, content);
|
|
1493
|
-
return this.submitSignalFn(envelope);
|
|
1538
|
+
return this.submitSignalFn(envelope, targetClientId);
|
|
1494
1539
|
}
|
|
1495
1540
|
setAttachState(attachState) {
|
|
1496
1541
|
if (attachState === AttachState.Attaching) {
|
|
@@ -1613,7 +1658,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1613
1658
|
this.dataStores.updateUnusedRoutes(dataStoreRoutes);
|
|
1614
1659
|
}
|
|
1615
1660
|
/**
|
|
1616
|
-
* @deprecated
|
|
1661
|
+
* @deprecated Replaced by deleteSweepReadyNodes.
|
|
1617
1662
|
*/
|
|
1618
1663
|
deleteUnusedNodes(unusedRoutes) {
|
|
1619
1664
|
throw new Error("deleteUnusedRoutes should not be called");
|
|
@@ -2349,11 +2394,11 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
2349
2394
|
* and then close as the current main client is likely to be re-elected as the parent summarizer again.
|
|
2350
2395
|
*/
|
|
2351
2396
|
if (!result.isSummaryTracked && result.isSummaryNewer) {
|
|
2352
|
-
const fetchResult = await this.
|
|
2397
|
+
const fetchResult = await this.fetchLatestSnapshotFromStorage(summaryLogger, {
|
|
2353
2398
|
eventName: "RefreshLatestSummaryAckFetch",
|
|
2354
2399
|
ackHandle,
|
|
2355
2400
|
targetSequenceNumber: summaryRefSeq,
|
|
2356
|
-
}, readAndParseBlob
|
|
2401
|
+
}, readAndParseBlob);
|
|
2357
2402
|
/**
|
|
2358
2403
|
* If the fetched snapshot is older than the one for which the ack was received, close the container.
|
|
2359
2404
|
* This should never happen because an ack should be sent after the latest summary is updated in the server.
|
|
@@ -2389,9 +2434,9 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
2389
2434
|
const readAndParseBlob = async (id) => readAndParse(this.storage, id);
|
|
2390
2435
|
// This is a performance optimization as the same parent is likely to be elected again, and would use its
|
|
2391
2436
|
// cache to fetch the snapshot instead of the network.
|
|
2392
|
-
await this.
|
|
2437
|
+
await this.fetchLatestSnapshotFromStorage(summaryLogger, {
|
|
2393
2438
|
eventName: "RefreshLatestSummaryFromServerFetch",
|
|
2394
|
-
}, readAndParseBlob
|
|
2439
|
+
}, readAndParseBlob);
|
|
2395
2440
|
await this.closeStaleSummarizer("RefreshLatestSummaryFromServerFetch");
|
|
2396
2441
|
return {
|
|
2397
2442
|
stage: "base",
|
|
@@ -2401,27 +2446,21 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
2401
2446
|
};
|
|
2402
2447
|
}
|
|
2403
2448
|
async closeStaleSummarizer(codePath) {
|
|
2404
|
-
this.mc.logger.sendTelemetryEvent({
|
|
2405
|
-
eventName: "ClosingSummarizerOnSummaryStale",
|
|
2406
|
-
codePath,
|
|
2407
|
-
message: "Stopping fetch from storage",
|
|
2408
|
-
closeSummarizerDelayMs: this.closeSummarizerDelayMs,
|
|
2409
|
-
}, new GenericError("Restarting summarizer instead of refreshing"));
|
|
2410
2449
|
// Delay before restarting summarizer to prevent the summarizer from restarting too frequently.
|
|
2411
2450
|
await delay(this.closeSummarizerDelayMs);
|
|
2412
2451
|
this._summarizer?.stop("latestSummaryStateStale");
|
|
2413
2452
|
this.disposeFn();
|
|
2414
2453
|
}
|
|
2415
2454
|
/**
|
|
2416
|
-
* Downloads
|
|
2455
|
+
* Downloads the latest snapshot from storage.
|
|
2417
2456
|
* By default, it also closes the container after downloading the snapshot. However, this may be
|
|
2418
2457
|
* overridden via options.
|
|
2419
2458
|
*/
|
|
2420
|
-
async
|
|
2459
|
+
async fetchLatestSnapshotFromStorage(logger, event, readAndParseBlob) {
|
|
2421
2460
|
return PerformanceEvent.timedExecAsync(logger, event, async (perfEvent) => {
|
|
2422
2461
|
const stats = {};
|
|
2423
2462
|
const trace = Trace.start();
|
|
2424
|
-
const versions = await this.storage.getVersions(
|
|
2463
|
+
const versions = await this.storage.getVersions(null, 1, "prefetchLatestSummaryBeforeClose", FetchSource.noCache);
|
|
2425
2464
|
assert(!!versions && !!versions[0], 0x137 /* "Failed to get version from storage" */);
|
|
2426
2465
|
stats.getVersionDuration = trace.trace().duration;
|
|
2427
2466
|
const maybeSnapshot = await this.storage.getSnapshotTree(versions[0]);
|
|
@@ -2446,6 +2485,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
2446
2485
|
}, async (event) => {
|
|
2447
2486
|
this.verifyNotClosed();
|
|
2448
2487
|
const waitBlobsToAttach = props?.notifyImminentClosure;
|
|
2488
|
+
const stopBlobAttachingSignal = props?.stopBlobAttachingSignal;
|
|
2449
2489
|
if (this._orderSequentiallyCalls !== 0) {
|
|
2450
2490
|
throw new UsageError("can't get state during orderSequentially");
|
|
2451
2491
|
}
|
|
@@ -2454,7 +2494,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
2454
2494
|
// to close current batch.
|
|
2455
2495
|
this.flush();
|
|
2456
2496
|
const pendingAttachmentBlobs = waitBlobsToAttach
|
|
2457
|
-
? await this.blobManager.attachAndGetPendingBlobs()
|
|
2497
|
+
? await this.blobManager.attachAndGetPendingBlobs(stopBlobAttachingSignal)
|
|
2458
2498
|
: undefined;
|
|
2459
2499
|
const pending = this.pendingStateManager.getLocalState();
|
|
2460
2500
|
if (!pendingAttachmentBlobs && !this.hasPendingMessages()) {
|