@fluidframework/container-loader 2.0.0-dev.6.4.0.192049 → 2.0.0-dev.7.2.0.203917
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 +122 -0
- package/api-extractor.json +9 -1
- package/api-report/container-loader.api.md +153 -0
- package/dist/catchUpMonitor.d.ts +2 -2
- package/dist/catchUpMonitor.d.ts.map +1 -1
- package/dist/connectionManager.d.ts +2 -15
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +110 -98
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionState.js +1 -1
- package/dist/connectionState.js.map +1 -1
- package/dist/connectionStateHandler.js +9 -9
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container-loader-alpha.d.ts +333 -0
- package/dist/container-loader-beta.d.ts +333 -0
- package/dist/container-loader-public.d.ts +333 -0
- package/dist/container-loader-untrimmed.d.ts +333 -0
- package/dist/container.d.ts +22 -2
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +235 -222
- package/dist/container.js.map +1 -1
- package/dist/containerContext.js +16 -16
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +1 -1
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +9 -11
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +5 -4
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/debugLogger.d.ts.map +1 -1
- package/dist/debugLogger.js +5 -4
- package/dist/debugLogger.js.map +1 -1
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +92 -96
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.js +14 -14
- package/dist/deltaQueue.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +6 -9
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +26 -91
- package/dist/loader.js.map +1 -1
- package/dist/location-redirection-utilities/index.d.ts +6 -0
- package/dist/location-redirection-utilities/index.d.ts.map +1 -0
- package/dist/location-redirection-utilities/index.js +11 -0
- package/dist/location-redirection-utilities/index.js.map +1 -0
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +22 -0
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -0
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.js +51 -0
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/protocol.d.ts +1 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +3 -5
- package/dist/protocol.js.map +1 -1
- package/dist/retriableDocumentStorageService.d.ts +3 -2
- package/dist/retriableDocumentStorageService.d.ts.map +1 -1
- package/dist/retriableDocumentStorageService.js +18 -11
- package/dist/retriableDocumentStorageService.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/utils.d.ts +23 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +11 -3
- package/dist/utils.js.map +1 -1
- package/lib/catchUpMonitor.d.ts +2 -2
- package/lib/catchUpMonitor.d.ts.map +1 -1
- package/lib/connectionManager.d.ts +2 -15
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +113 -99
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.js +9 -9
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +22 -2
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +236 -223
- package/lib/container.js.map +1 -1
- package/lib/containerContext.js +16 -16
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts +1 -1
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +9 -11
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/contracts.d.ts +5 -4
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/debugLogger.d.ts.map +1 -1
- package/lib/debugLogger.js +5 -4
- package/lib/debugLogger.js.map +1 -1
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +92 -96
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.js +14 -14
- package/lib/deltaQueue.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/loader.d.ts +6 -9
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +27 -92
- package/lib/loader.js.map +1 -1
- package/lib/location-redirection-utilities/index.d.ts +6 -0
- package/lib/location-redirection-utilities/index.d.ts.map +1 -0
- package/lib/location-redirection-utilities/index.js +6 -0
- package/lib/location-redirection-utilities/index.js.map +1 -0
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts +22 -0
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -0
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js +46 -0
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/protocol.d.ts +1 -2
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +1 -3
- package/lib/protocol.js.map +1 -1
- package/lib/retriableDocumentStorageService.d.ts +3 -2
- package/lib/retriableDocumentStorageService.d.ts.map +1 -1
- package/lib/retriableDocumentStorageService.js +18 -11
- package/lib/retriableDocumentStorageService.js.map +1 -1
- package/lib/utils.d.ts +23 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +9 -1
- package/lib/utils.js.map +1 -1
- package/package.json +24 -26
- package/src/connectionManager.ts +58 -31
- package/src/container.ts +48 -30
- package/src/containerStorageAdapter.ts +3 -9
- package/src/contracts.ts +8 -4
- package/src/debugLogger.ts +5 -1
- package/src/deltaManager.ts +16 -31
- package/src/index.ts +5 -0
- package/src/loader.ts +31 -99
- package/src/location-redirection-utilities/index.ts +9 -0
- package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +59 -0
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +2 -6
- package/src/retriableDocumentStorageService.ts +29 -15
- package/src/utils.ts +23 -1
package/dist/container.d.ts
CHANGED
|
@@ -136,7 +136,6 @@ export interface IPendingContainerState {
|
|
|
136
136
|
*/
|
|
137
137
|
savedOps: ISequencedDocumentMessage[];
|
|
138
138
|
url: string;
|
|
139
|
-
term: number;
|
|
140
139
|
clientId?: string;
|
|
141
140
|
}
|
|
142
141
|
export declare class Container extends EventEmitterWithErrorHandling<IContainerEvents> implements IContainer, IContainerExperimental {
|
|
@@ -207,6 +206,7 @@ export declare class Container extends EventEmitterWithErrorHandling<IContainerE
|
|
|
207
206
|
private readonly savedOps;
|
|
208
207
|
private baseSnapshot?;
|
|
209
208
|
private baseSnapshotBlobs?;
|
|
209
|
+
private readonly _containerId;
|
|
210
210
|
private lastVisible;
|
|
211
211
|
private readonly visibilityEventHandler;
|
|
212
212
|
private readonly connectionStateHandler;
|
|
@@ -214,11 +214,28 @@ export declare class Container extends EventEmitterWithErrorHandling<IContainerE
|
|
|
214
214
|
private setAutoReconnectTime;
|
|
215
215
|
private noopHeuristic;
|
|
216
216
|
private get connectionMode();
|
|
217
|
+
/**
|
|
218
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
219
|
+
*/
|
|
217
220
|
get IFluidRouter(): IFluidRouter;
|
|
218
221
|
get resolvedUrl(): IResolvedUrl | undefined;
|
|
219
222
|
get readOnlyInfo(): ReadOnlyInfo;
|
|
220
223
|
/**
|
|
221
|
-
*
|
|
224
|
+
* Sends signal to runtime (and data stores) to be read-only.
|
|
225
|
+
* Hosts may have read only views, indicating to data stores that no edits are allowed.
|
|
226
|
+
* This is independent from this._readonlyPermissions (permissions) and this.connectionMode
|
|
227
|
+
* (server can return "write" mode even when asked for "read")
|
|
228
|
+
* Leveraging same "readonly" event as runtime & data stores should behave the same in such case
|
|
229
|
+
* as in read-only permissions.
|
|
230
|
+
* But this.active can be used by some DDSes to figure out if ops can be sent
|
|
231
|
+
* (for example, read-only view still participates in code proposals / upgrades decisions)
|
|
232
|
+
*
|
|
233
|
+
* Forcing Readonly does not prevent DDS from generating ops. It is up to user code to honour
|
|
234
|
+
* the readonly flag. If ops are generated, they will accumulate locally and not be sent. If
|
|
235
|
+
* there are pending in the outbound queue, it will stop sending until force readonly is
|
|
236
|
+
* cleared.
|
|
237
|
+
*
|
|
238
|
+
* @param readonly - set or clear force readonly.
|
|
222
239
|
*/
|
|
223
240
|
forceReadonly(readonly: boolean): void;
|
|
224
241
|
get deltaManager(): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
|
|
@@ -281,6 +298,9 @@ export declare class Container extends EventEmitterWithErrorHandling<IContainerE
|
|
|
281
298
|
attach(request: IRequest, attachProps?: {
|
|
282
299
|
deltaConnection?: "none" | "delayed";
|
|
283
300
|
}): Promise<void>;
|
|
301
|
+
/**
|
|
302
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
303
|
+
*/
|
|
284
304
|
request(path: IRequest): Promise<IResponse>;
|
|
285
305
|
private setAutoReconnectInternal;
|
|
286
306
|
connect(): void;
|
package/dist/container.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAEN,oBAAoB,EAEpB,QAAQ,EACR,SAAS,
|
|
1
|
+
{"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jD"}
|
package/dist/container.js
CHANGED
|
@@ -36,6 +36,7 @@ const detachedContainerRefSeqNumber = 0;
|
|
|
36
36
|
const dirtyContainerEvent = "dirty";
|
|
37
37
|
const savedContainerEvent = "saved";
|
|
38
38
|
const packageNotFactoryError = "Code package does not implement IRuntimeFactory";
|
|
39
|
+
const hasBlobsSummaryTree = ".hasAttachmentBlobs";
|
|
39
40
|
/**
|
|
40
41
|
* Waits until container connects to delta storage and gets up-to-date.
|
|
41
42
|
*
|
|
@@ -129,6 +130,222 @@ async function ReportIfTooLong(logger, eventName, action) {
|
|
|
129
130
|
exports.ReportIfTooLong = ReportIfTooLong;
|
|
130
131
|
const summarizerClientType = "summarizer";
|
|
131
132
|
class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
133
|
+
/**
|
|
134
|
+
* Load an existing container.
|
|
135
|
+
* @internal
|
|
136
|
+
*/
|
|
137
|
+
static async load(loadProps, createProps) {
|
|
138
|
+
const { version, pendingLocalState, loadMode, resolvedUrl, loadToSequenceNumber } = loadProps;
|
|
139
|
+
const container = new Container(createProps, loadProps);
|
|
140
|
+
const disableRecordHeapSize = container.mc.config.getBoolean("Fluid.Loader.DisableRecordHeapSize");
|
|
141
|
+
return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "Load" }, async (event) => new Promise((resolve, reject) => {
|
|
142
|
+
const defaultMode = { opsBeforeReturn: "cached" };
|
|
143
|
+
// if we have pendingLocalState, anything we cached is not useful and we shouldn't wait for connection
|
|
144
|
+
// to return container, so ignore this value and use undefined for opsBeforeReturn
|
|
145
|
+
const mode = pendingLocalState
|
|
146
|
+
? { ...(loadMode ?? defaultMode), opsBeforeReturn: undefined }
|
|
147
|
+
: loadMode ?? defaultMode;
|
|
148
|
+
const onClosed = (err) => {
|
|
149
|
+
// pre-0.58 error message: containerClosedWithoutErrorDuringLoad
|
|
150
|
+
reject(err ?? new telemetry_utils_1.GenericError("Container closed without error during load"));
|
|
151
|
+
};
|
|
152
|
+
container.on("closed", onClosed);
|
|
153
|
+
container
|
|
154
|
+
.load(version, mode, resolvedUrl, pendingLocalState, loadToSequenceNumber)
|
|
155
|
+
.finally(() => {
|
|
156
|
+
container.removeListener("closed", onClosed);
|
|
157
|
+
})
|
|
158
|
+
.then((props) => {
|
|
159
|
+
event.end({ ...props, ...loadMode });
|
|
160
|
+
resolve(container);
|
|
161
|
+
}, (error) => {
|
|
162
|
+
const err = (0, telemetry_utils_1.normalizeError)(error);
|
|
163
|
+
// Depending where error happens, we can be attempting to connect to web socket
|
|
164
|
+
// and continuously retrying (consider offline mode)
|
|
165
|
+
// Host has no container to close, so it's prudent to do it here
|
|
166
|
+
// Note: We could only dispose the container instead of just close but that would
|
|
167
|
+
// the telemetry where users sometimes search for ContainerClose event to look
|
|
168
|
+
// for load failures. So not removing this at this time.
|
|
169
|
+
container.close(err);
|
|
170
|
+
container.dispose(err);
|
|
171
|
+
onClosed(err);
|
|
172
|
+
});
|
|
173
|
+
}), { start: true, end: true, cancel: "generic" }, disableRecordHeapSize !== true /* recordHeapSize */);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Create a new container in a detached state.
|
|
177
|
+
*/
|
|
178
|
+
static async createDetached(createProps, codeDetails) {
|
|
179
|
+
const container = new Container(createProps);
|
|
180
|
+
return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "CreateDetached" }, async (_event) => {
|
|
181
|
+
await container.createDetached(codeDetails);
|
|
182
|
+
return container;
|
|
183
|
+
}, { start: true, end: true, cancel: "generic" });
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Create a new container in a detached state that is initialized with a
|
|
187
|
+
* snapshot from a previous detached container.
|
|
188
|
+
*/
|
|
189
|
+
static async rehydrateDetachedFromSnapshot(createProps, snapshot) {
|
|
190
|
+
const container = new Container(createProps);
|
|
191
|
+
return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "RehydrateDetachedFromSnapshot" }, async (_event) => {
|
|
192
|
+
const deserializedSummary = JSON.parse(snapshot);
|
|
193
|
+
if (!(0, driver_utils_1.isCombinedAppAndProtocolSummary)(deserializedSummary, hasBlobsSummaryTree)) {
|
|
194
|
+
throw new telemetry_utils_1.UsageError("Cannot rehydrate detached container. Incorrect format");
|
|
195
|
+
}
|
|
196
|
+
await container.rehydrateDetachedFromSnapshot(deserializedSummary);
|
|
197
|
+
return container;
|
|
198
|
+
}, { start: true, end: true, cancel: "generic" });
|
|
199
|
+
}
|
|
200
|
+
setLoaded() {
|
|
201
|
+
// It's conceivable the container could be closed when this is called
|
|
202
|
+
// Only transition states if currently loading
|
|
203
|
+
if (this._lifecycleState === "loading") {
|
|
204
|
+
// Propagate current connection state through the system.
|
|
205
|
+
this.propagateConnectionState(true /* initial transition */);
|
|
206
|
+
this._lifecycleState = "loaded";
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
get closed() {
|
|
210
|
+
return (this._lifecycleState === "closing" || this._lifecycleState === "closed" || this.disposed);
|
|
211
|
+
}
|
|
212
|
+
get disposed() {
|
|
213
|
+
return this._lifecycleState === "disposing" || this._lifecycleState === "disposed";
|
|
214
|
+
}
|
|
215
|
+
get runtime() {
|
|
216
|
+
if (this._runtime === undefined) {
|
|
217
|
+
throw new Error("Attempted to access runtime before it was defined");
|
|
218
|
+
}
|
|
219
|
+
return this._runtime;
|
|
220
|
+
}
|
|
221
|
+
get protocolHandler() {
|
|
222
|
+
if (this._protocolHandler === undefined) {
|
|
223
|
+
throw new Error("Attempted to access protocolHandler before it was defined");
|
|
224
|
+
}
|
|
225
|
+
return this._protocolHandler;
|
|
226
|
+
}
|
|
227
|
+
get connectionMode() {
|
|
228
|
+
return this._deltaManager.connectionManager.connectionMode;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
232
|
+
*/
|
|
233
|
+
// eslint-disable-next-line import/no-deprecated
|
|
234
|
+
get IFluidRouter() {
|
|
235
|
+
return this;
|
|
236
|
+
}
|
|
237
|
+
get resolvedUrl() {
|
|
238
|
+
/**
|
|
239
|
+
* All attached containers will have a document service,
|
|
240
|
+
* this is required, as attached containers are attached to
|
|
241
|
+
* a service. Detached containers will neither have a document
|
|
242
|
+
* service or a resolved url as they only exist locally.
|
|
243
|
+
* in order to create a document service a resolved url must
|
|
244
|
+
* first be obtained, this is how the container is identified.
|
|
245
|
+
* Because of this, the document service's resolved url
|
|
246
|
+
* is always the same as the containers, as we had to
|
|
247
|
+
* obtain the resolved url, and then create the service from it.
|
|
248
|
+
*/
|
|
249
|
+
return this.service?.resolvedUrl;
|
|
250
|
+
}
|
|
251
|
+
get readOnlyInfo() {
|
|
252
|
+
return this._deltaManager.readOnlyInfo;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Sends signal to runtime (and data stores) to be read-only.
|
|
256
|
+
* Hosts may have read only views, indicating to data stores that no edits are allowed.
|
|
257
|
+
* This is independent from this._readonlyPermissions (permissions) and this.connectionMode
|
|
258
|
+
* (server can return "write" mode even when asked for "read")
|
|
259
|
+
* Leveraging same "readonly" event as runtime & data stores should behave the same in such case
|
|
260
|
+
* as in read-only permissions.
|
|
261
|
+
* But this.active can be used by some DDSes to figure out if ops can be sent
|
|
262
|
+
* (for example, read-only view still participates in code proposals / upgrades decisions)
|
|
263
|
+
*
|
|
264
|
+
* Forcing Readonly does not prevent DDS from generating ops. It is up to user code to honour
|
|
265
|
+
* the readonly flag. If ops are generated, they will accumulate locally and not be sent. If
|
|
266
|
+
* there are pending in the outbound queue, it will stop sending until force readonly is
|
|
267
|
+
* cleared.
|
|
268
|
+
*
|
|
269
|
+
* @param readonly - set or clear force readonly.
|
|
270
|
+
*/
|
|
271
|
+
forceReadonly(readonly) {
|
|
272
|
+
this._deltaManager.connectionManager.forceReadonly(readonly);
|
|
273
|
+
}
|
|
274
|
+
get deltaManager() {
|
|
275
|
+
return this._deltaManager;
|
|
276
|
+
}
|
|
277
|
+
get connectionState() {
|
|
278
|
+
return this.connectionStateHandler.connectionState;
|
|
279
|
+
}
|
|
280
|
+
get connected() {
|
|
281
|
+
return this.connectionStateHandler.connectionState === connectionState_1.ConnectionState.Connected;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* The server provided id of the client.
|
|
285
|
+
* Set once this.connected is true, otherwise undefined
|
|
286
|
+
*/
|
|
287
|
+
get clientId() {
|
|
288
|
+
return this._clientId;
|
|
289
|
+
}
|
|
290
|
+
get offlineLoadEnabled() {
|
|
291
|
+
const enabled = this.mc.config.getBoolean("Fluid.Container.enableOfflineLoad") ??
|
|
292
|
+
this.options?.enableOfflineLoad === true;
|
|
293
|
+
// summarizer will not have any pending state we want to save
|
|
294
|
+
return enabled && this.deltaManager.clientDetails.capabilities.interactive;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Get the code details that are currently specified for the container.
|
|
298
|
+
* @returns The current code details if any are specified, undefined if none are specified.
|
|
299
|
+
*/
|
|
300
|
+
getSpecifiedCodeDetails() {
|
|
301
|
+
return this.getCodeDetailsFromQuorum();
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Get the code details that were used to load the container.
|
|
305
|
+
* @returns The code details that were used to load the container if it is loaded, undefined if it is not yet
|
|
306
|
+
* loaded.
|
|
307
|
+
*/
|
|
308
|
+
getLoadedCodeDetails() {
|
|
309
|
+
return this._loadedCodeDetails;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Retrieves the audience associated with the document
|
|
313
|
+
*/
|
|
314
|
+
get audience() {
|
|
315
|
+
return this.protocolHandler.audience;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Returns true if container is dirty.
|
|
319
|
+
* Which means data loss if container is closed at that same moment
|
|
320
|
+
* Most likely that happens when there is no network connection to Relay Service
|
|
321
|
+
*/
|
|
322
|
+
get isDirty() {
|
|
323
|
+
return this._dirtyContainer;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* {@inheritDoc @fluidframework/container-definitions#IContainer.entryPoint}
|
|
327
|
+
*/
|
|
328
|
+
async getEntryPoint() {
|
|
329
|
+
if (this._disposed) {
|
|
330
|
+
throw new telemetry_utils_1.UsageError("The context is already disposed");
|
|
331
|
+
}
|
|
332
|
+
if (this._runtime !== undefined) {
|
|
333
|
+
return this._runtime.getEntryPoint?.();
|
|
334
|
+
}
|
|
335
|
+
return new Promise((resolve, reject) => {
|
|
336
|
+
const runtimeInstantiatedHandler = () => {
|
|
337
|
+
(0, core_utils_1.assert)(this._runtime !== undefined, 0x5a3 /* runtimeInstantiated fired but runtime is still undefined */);
|
|
338
|
+
resolve(this._runtime.getEntryPoint?.());
|
|
339
|
+
this._lifecycleEvents.off("disposed", disposedHandler);
|
|
340
|
+
};
|
|
341
|
+
const disposedHandler = () => {
|
|
342
|
+
reject(new Error("ContainerContext was disposed"));
|
|
343
|
+
this._lifecycleEvents.off("runtimeInstantiated", runtimeInstantiatedHandler);
|
|
344
|
+
};
|
|
345
|
+
this._lifecycleEvents.once("runtimeInstantiated", runtimeInstantiatedHandler);
|
|
346
|
+
this._lifecycleEvents.once("disposed", disposedHandler);
|
|
347
|
+
});
|
|
348
|
+
}
|
|
132
349
|
/**
|
|
133
350
|
* @internal
|
|
134
351
|
*/
|
|
@@ -209,6 +426,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
209
426
|
const type = this.client.details.type;
|
|
210
427
|
const interactive = this.client.details.capabilities.interactive;
|
|
211
428
|
const clientType = `${interactive ? "interactive" : "noninteractive"}${type !== undefined && type !== "" ? `/${type}` : ""}`;
|
|
429
|
+
this._containerId = (0, uuid_1.v4)();
|
|
212
430
|
// Need to use the property getter for docId because for detached flow we don't have the docId initially.
|
|
213
431
|
// We assign the id later so property getter is used.
|
|
214
432
|
this.subLogger = (0, telemetry_utils_1.createChildLogger)({
|
|
@@ -216,7 +434,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
216
434
|
properties: {
|
|
217
435
|
all: {
|
|
218
436
|
clientType,
|
|
219
|
-
containerId:
|
|
437
|
+
containerId: this._containerId,
|
|
220
438
|
docId: () => this.resolvedUrl?.id,
|
|
221
439
|
containerAttachState: () => this._attachState,
|
|
222
440
|
containerLifecycleState: () => this._lifecycleState,
|
|
@@ -331,201 +549,6 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
331
549
|
document.addEventListener("visibilitychange", this.visibilityEventHandler);
|
|
332
550
|
}
|
|
333
551
|
}
|
|
334
|
-
/**
|
|
335
|
-
* Load an existing container.
|
|
336
|
-
* @internal
|
|
337
|
-
*/
|
|
338
|
-
static async load(loadProps, createProps) {
|
|
339
|
-
const { version, pendingLocalState, loadMode, resolvedUrl, loadToSequenceNumber } = loadProps;
|
|
340
|
-
const container = new Container(createProps, loadProps);
|
|
341
|
-
const disableRecordHeapSize = container.mc.config.getBoolean("Fluid.Loader.DisableRecordHeapSize");
|
|
342
|
-
return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "Load" }, async (event) => new Promise((resolve, reject) => {
|
|
343
|
-
const defaultMode = { opsBeforeReturn: "cached" };
|
|
344
|
-
// if we have pendingLocalState, anything we cached is not useful and we shouldn't wait for connection
|
|
345
|
-
// to return container, so ignore this value and use undefined for opsBeforeReturn
|
|
346
|
-
const mode = pendingLocalState
|
|
347
|
-
? { ...(loadMode ?? defaultMode), opsBeforeReturn: undefined }
|
|
348
|
-
: loadMode ?? defaultMode;
|
|
349
|
-
const onClosed = (err) => {
|
|
350
|
-
// pre-0.58 error message: containerClosedWithoutErrorDuringLoad
|
|
351
|
-
reject(err ?? new telemetry_utils_1.GenericError("Container closed without error during load"));
|
|
352
|
-
};
|
|
353
|
-
container.on("closed", onClosed);
|
|
354
|
-
container
|
|
355
|
-
.load(version, mode, resolvedUrl, pendingLocalState, loadToSequenceNumber)
|
|
356
|
-
.finally(() => {
|
|
357
|
-
container.removeListener("closed", onClosed);
|
|
358
|
-
})
|
|
359
|
-
.then((props) => {
|
|
360
|
-
event.end({ ...props, ...loadMode });
|
|
361
|
-
resolve(container);
|
|
362
|
-
}, (error) => {
|
|
363
|
-
const err = (0, telemetry_utils_1.normalizeError)(error);
|
|
364
|
-
// Depending where error happens, we can be attempting to connect to web socket
|
|
365
|
-
// and continuously retrying (consider offline mode)
|
|
366
|
-
// Host has no container to close, so it's prudent to do it here
|
|
367
|
-
// Note: We could only dispose the container instead of just close but that would
|
|
368
|
-
// the telemetry where users sometimes search for ContainerClose event to look
|
|
369
|
-
// for load failures. So not removing this at this time.
|
|
370
|
-
container.close(err);
|
|
371
|
-
container.dispose(err);
|
|
372
|
-
onClosed(err);
|
|
373
|
-
});
|
|
374
|
-
}), { start: true, end: true, cancel: "generic" }, disableRecordHeapSize !== true /* recordHeapSize */);
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Create a new container in a detached state.
|
|
378
|
-
*/
|
|
379
|
-
static async createDetached(createProps, codeDetails) {
|
|
380
|
-
const container = new Container(createProps);
|
|
381
|
-
return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "CreateDetached" }, async (_event) => {
|
|
382
|
-
await container.createDetached(codeDetails);
|
|
383
|
-
return container;
|
|
384
|
-
}, { start: true, end: true, cancel: "generic" });
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Create a new container in a detached state that is initialized with a
|
|
388
|
-
* snapshot from a previous detached container.
|
|
389
|
-
*/
|
|
390
|
-
static async rehydrateDetachedFromSnapshot(createProps, snapshot) {
|
|
391
|
-
const container = new Container(createProps);
|
|
392
|
-
return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "RehydrateDetachedFromSnapshot" }, async (_event) => {
|
|
393
|
-
const deserializedSummary = JSON.parse(snapshot);
|
|
394
|
-
await container.rehydrateDetachedFromSnapshot(deserializedSummary);
|
|
395
|
-
return container;
|
|
396
|
-
}, { start: true, end: true, cancel: "generic" });
|
|
397
|
-
}
|
|
398
|
-
setLoaded() {
|
|
399
|
-
// It's conceivable the container could be closed when this is called
|
|
400
|
-
// Only transition states if currently loading
|
|
401
|
-
if (this._lifecycleState === "loading") {
|
|
402
|
-
// Propagate current connection state through the system.
|
|
403
|
-
this.propagateConnectionState(true /* initial transition */);
|
|
404
|
-
this._lifecycleState = "loaded";
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
get closed() {
|
|
408
|
-
return (this._lifecycleState === "closing" || this._lifecycleState === "closed" || this.disposed);
|
|
409
|
-
}
|
|
410
|
-
get disposed() {
|
|
411
|
-
return this._lifecycleState === "disposing" || this._lifecycleState === "disposed";
|
|
412
|
-
}
|
|
413
|
-
get runtime() {
|
|
414
|
-
if (this._runtime === undefined) {
|
|
415
|
-
throw new Error("Attempted to access runtime before it was defined");
|
|
416
|
-
}
|
|
417
|
-
return this._runtime;
|
|
418
|
-
}
|
|
419
|
-
get protocolHandler() {
|
|
420
|
-
if (this._protocolHandler === undefined) {
|
|
421
|
-
throw new Error("Attempted to access protocolHandler before it was defined");
|
|
422
|
-
}
|
|
423
|
-
return this._protocolHandler;
|
|
424
|
-
}
|
|
425
|
-
get connectionMode() {
|
|
426
|
-
return this._deltaManager.connectionManager.connectionMode;
|
|
427
|
-
}
|
|
428
|
-
get IFluidRouter() {
|
|
429
|
-
return this;
|
|
430
|
-
}
|
|
431
|
-
get resolvedUrl() {
|
|
432
|
-
/**
|
|
433
|
-
* All attached containers will have a document service,
|
|
434
|
-
* this is required, as attached containers are attached to
|
|
435
|
-
* a service. Detached containers will neither have a document
|
|
436
|
-
* service or a resolved url as they only exist locally.
|
|
437
|
-
* in order to create a document service a resolved url must
|
|
438
|
-
* first be obtained, this is how the container is identified.
|
|
439
|
-
* Because of this, the document service's resolved url
|
|
440
|
-
* is always the same as the containers, as we had to
|
|
441
|
-
* obtain the resolved url, and then create the service from it.
|
|
442
|
-
*/
|
|
443
|
-
return this.service?.resolvedUrl;
|
|
444
|
-
}
|
|
445
|
-
get readOnlyInfo() {
|
|
446
|
-
return this._deltaManager.readOnlyInfo;
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* Tracks host requiring read-only mode.
|
|
450
|
-
*/
|
|
451
|
-
forceReadonly(readonly) {
|
|
452
|
-
this._deltaManager.connectionManager.forceReadonly(readonly);
|
|
453
|
-
}
|
|
454
|
-
get deltaManager() {
|
|
455
|
-
return this._deltaManager;
|
|
456
|
-
}
|
|
457
|
-
get connectionState() {
|
|
458
|
-
return this.connectionStateHandler.connectionState;
|
|
459
|
-
}
|
|
460
|
-
get connected() {
|
|
461
|
-
return this.connectionStateHandler.connectionState === connectionState_1.ConnectionState.Connected;
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* The server provided id of the client.
|
|
465
|
-
* Set once this.connected is true, otherwise undefined
|
|
466
|
-
*/
|
|
467
|
-
get clientId() {
|
|
468
|
-
return this._clientId;
|
|
469
|
-
}
|
|
470
|
-
get offlineLoadEnabled() {
|
|
471
|
-
const enabled = this.mc.config.getBoolean("Fluid.Container.enableOfflineLoad") ??
|
|
472
|
-
this.options?.enableOfflineLoad === true;
|
|
473
|
-
// summarizer will not have any pending state we want to save
|
|
474
|
-
return enabled && this.deltaManager.clientDetails.capabilities.interactive;
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* Get the code details that are currently specified for the container.
|
|
478
|
-
* @returns The current code details if any are specified, undefined if none are specified.
|
|
479
|
-
*/
|
|
480
|
-
getSpecifiedCodeDetails() {
|
|
481
|
-
return this.getCodeDetailsFromQuorum();
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Get the code details that were used to load the container.
|
|
485
|
-
* @returns The code details that were used to load the container if it is loaded, undefined if it is not yet
|
|
486
|
-
* loaded.
|
|
487
|
-
*/
|
|
488
|
-
getLoadedCodeDetails() {
|
|
489
|
-
return this._loadedCodeDetails;
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Retrieves the audience associated with the document
|
|
493
|
-
*/
|
|
494
|
-
get audience() {
|
|
495
|
-
return this.protocolHandler.audience;
|
|
496
|
-
}
|
|
497
|
-
/**
|
|
498
|
-
* Returns true if container is dirty.
|
|
499
|
-
* Which means data loss if container is closed at that same moment
|
|
500
|
-
* Most likely that happens when there is no network connection to Relay Service
|
|
501
|
-
*/
|
|
502
|
-
get isDirty() {
|
|
503
|
-
return this._dirtyContainer;
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* {@inheritDoc @fluidframework/container-definitions#IContainer.entryPoint}
|
|
507
|
-
*/
|
|
508
|
-
async getEntryPoint() {
|
|
509
|
-
if (this._disposed) {
|
|
510
|
-
throw new telemetry_utils_1.UsageError("The context is already disposed");
|
|
511
|
-
}
|
|
512
|
-
if (this._runtime !== undefined) {
|
|
513
|
-
return this._runtime.getEntryPoint?.();
|
|
514
|
-
}
|
|
515
|
-
return new Promise((resolve, reject) => {
|
|
516
|
-
const runtimeInstantiatedHandler = () => {
|
|
517
|
-
(0, core_utils_1.assert)(this._runtime !== undefined, 0x5a3 /* runtimeInstantiated fired but runtime is still undefined */);
|
|
518
|
-
resolve(this._runtime.getEntryPoint?.());
|
|
519
|
-
this._lifecycleEvents.off("disposed", disposedHandler);
|
|
520
|
-
};
|
|
521
|
-
const disposedHandler = () => {
|
|
522
|
-
reject(new Error("ContainerContext was disposed"));
|
|
523
|
-
this._lifecycleEvents.off("runtimeInstantiated", runtimeInstantiatedHandler);
|
|
524
|
-
};
|
|
525
|
-
this._lifecycleEvents.once("runtimeInstantiated", runtimeInstantiatedHandler);
|
|
526
|
-
this._lifecycleEvents.once("disposed", disposedHandler);
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
552
|
/**
|
|
530
553
|
* Retrieves the quorum associated with the document
|
|
531
554
|
*/
|
|
@@ -660,7 +683,6 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
660
683
|
snapshotBlobs: this.baseSnapshotBlobs,
|
|
661
684
|
savedOps: this.savedOps,
|
|
662
685
|
url: this.resolvedUrl.url,
|
|
663
|
-
term: protocol_1.OnlyValidTermValue,
|
|
664
686
|
// no need to save this if there is no pending runtime state
|
|
665
687
|
clientId: pendingRuntimeState !== undefined ? this.clientId : undefined,
|
|
666
688
|
};
|
|
@@ -676,7 +698,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
676
698
|
const protocolSummary = this.captureProtocolSummary();
|
|
677
699
|
const combinedSummary = (0, utils_1.combineAppAndProtocolSummary)(appSummary, protocolSummary);
|
|
678
700
|
if (this.detachedBlobStorage && this.detachedBlobStorage.size > 0) {
|
|
679
|
-
combinedSummary.tree[
|
|
701
|
+
combinedSummary.tree[hasBlobsSummaryTree] = {
|
|
680
702
|
type: protocol_definitions_1.SummaryType.Blob,
|
|
681
703
|
content: "true",
|
|
682
704
|
};
|
|
@@ -726,7 +748,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
726
748
|
cancel: this._deltaManager.closeAbortController.signal,
|
|
727
749
|
});
|
|
728
750
|
}
|
|
729
|
-
|
|
751
|
+
this.storageAdapter.connectToService(this.service);
|
|
730
752
|
if (hasAttachmentBlobs) {
|
|
731
753
|
// upload blobs to storage
|
|
732
754
|
(0, core_utils_1.assert)(!!this.detachedBlobStorage, 0x24e /* "assertion for type narrowing" */);
|
|
@@ -782,6 +804,9 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
782
804
|
}
|
|
783
805
|
}, { start: true, end: true, cancel: "generic" });
|
|
784
806
|
}
|
|
807
|
+
/**
|
|
808
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
809
|
+
*/
|
|
785
810
|
async request(path) {
|
|
786
811
|
return telemetry_utils_1.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "Request" }, async () => this.runtime.request(path), { end: true, cancel: "error" });
|
|
787
812
|
}
|
|
@@ -932,18 +957,14 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
932
957
|
async load(specifiedVersion, loadMode, resolvedUrl, pendingLocalState, loadToSequenceNumber) {
|
|
933
958
|
const timings = { phase1: client_utils_1.performance.now() };
|
|
934
959
|
this.service = await this.serviceFactory.createDocumentService(resolvedUrl, this.subLogger, this.client.details.type === summarizerClientType);
|
|
935
|
-
//
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
// That all said, "read" does not work with memorylicious workflows (that opens two simultaneous
|
|
941
|
-
// connections to same file) in two ways:
|
|
942
|
-
// A) creation flow breaks (as one of the clients "sees" file as existing, and hits #2 above)
|
|
943
|
-
// B) Once file is created, transition from view-only connection to write does not work - some bugs to be fixed.
|
|
960
|
+
// Except in cases where it has stashed ops or requested by feature gate, the container will connect in "read" mode
|
|
961
|
+
const mode = this.mc.config.getBoolean("Fluid.Container.ForceWriteConnection") === true ||
|
|
962
|
+
(pendingLocalState?.savedOps.length ?? 0) > 0
|
|
963
|
+
? "write"
|
|
964
|
+
: "read";
|
|
944
965
|
const connectionArgs = {
|
|
945
966
|
reason: { text: "DocumentOpen" },
|
|
946
|
-
mode
|
|
967
|
+
mode,
|
|
947
968
|
fetchOpsFromStorage: false,
|
|
948
969
|
};
|
|
949
970
|
// Start websocket connection as soon as possible. Note that there is no op handler attached yet, but the
|
|
@@ -951,15 +972,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
951
972
|
if (loadMode.deltaConnection === undefined && !pendingLocalState) {
|
|
952
973
|
this.connectToDeltaStream(connectionArgs);
|
|
953
974
|
}
|
|
954
|
-
|
|
955
|
-
await this.storageAdapter.connectToService(this.service);
|
|
956
|
-
}
|
|
957
|
-
else {
|
|
958
|
-
// if we have pendingLocalState we can load without storage; don't wait for connection
|
|
959
|
-
this.storageAdapter.connectToService(this.service).catch((error) => {
|
|
960
|
-
this.close(error);
|
|
961
|
-
});
|
|
962
|
-
}
|
|
975
|
+
this.storageAdapter.connectToService(this.service);
|
|
963
976
|
this._attachState = container_definitions_1.AttachState.Attached;
|
|
964
977
|
timings.phase2 = client_utils_1.performance.now();
|
|
965
978
|
// Fetch specified snapshot.
|
|
@@ -1108,7 +1121,6 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1108
1121
|
async createDetached(codeDetails) {
|
|
1109
1122
|
const attributes = {
|
|
1110
1123
|
sequenceNumber: detachedContainerRefSeqNumber,
|
|
1111
|
-
term: protocol_1.OnlyValidTermValue,
|
|
1112
1124
|
minimumSequenceNumber: 0,
|
|
1113
1125
|
};
|
|
1114
1126
|
await this.attachDeltaManagerOpHandler(attributes);
|
|
@@ -1123,9 +1135,10 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1123
1135
|
this.setLoaded();
|
|
1124
1136
|
}
|
|
1125
1137
|
async rehydrateDetachedFromSnapshot(detachedContainerSnapshot) {
|
|
1126
|
-
if (detachedContainerSnapshot.tree[
|
|
1138
|
+
if (detachedContainerSnapshot.tree[hasBlobsSummaryTree] !== undefined) {
|
|
1127
1139
|
(0, core_utils_1.assert)(!!this.detachedBlobStorage && this.detachedBlobStorage.size > 0, 0x250 /* "serialized container with attachment blobs must be rehydrated with detached blob storage" */);
|
|
1128
|
-
delete
|
|
1140
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
1141
|
+
delete detachedContainerSnapshot.tree[hasBlobsSummaryTree];
|
|
1129
1142
|
}
|
|
1130
1143
|
const snapshotTree = (0, utils_1.getSnapshotTreeFromSerializedContainer)(detachedContainerSnapshot);
|
|
1131
1144
|
this.storageAdapter.loadSnapshotForRehydratingContainer(snapshotTree);
|
|
@@ -1148,7 +1161,6 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1148
1161
|
return {
|
|
1149
1162
|
minimumSequenceNumber: 0,
|
|
1150
1163
|
sequenceNumber: 0,
|
|
1151
|
-
term: protocol_1.OnlyValidTermValue,
|
|
1152
1164
|
};
|
|
1153
1165
|
}
|
|
1154
1166
|
// Backward compatibility: old docs would have ".attributes" instead of "attributes"
|
|
@@ -1259,6 +1271,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1259
1271
|
client.details.environment = [
|
|
1260
1272
|
client.details.environment,
|
|
1261
1273
|
` loaderVersion:${packageVersion_1.pkgVersion}`,
|
|
1274
|
+
` containerId:${this._containerId}`,
|
|
1262
1275
|
].join(";");
|
|
1263
1276
|
return client;
|
|
1264
1277
|
}
|