@fluidframework/container-runtime 0.52.1 → 0.53.0-46105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/containerHandleContext.d.ts +0 -1
- package/dist/containerHandleContext.d.ts.map +1 -1
- package/dist/containerHandleContext.js +0 -1
- package/dist/containerHandleContext.js.map +1 -1
- package/dist/containerRuntime.d.ts +18 -3
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +84 -42
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +4 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +16 -13
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStores.d.ts +8 -8
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +20 -37
- package/dist/dataStores.js.map +1 -1
- package/dist/garbageCollection.d.ts +61 -14
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +275 -20
- package/dist/garbageCollection.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/summarizer.d.ts +1 -3
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +0 -12
- package/dist/summarizer.js.map +1 -1
- package/dist/summarizerTypes.d.ts +2 -2
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryFormat.d.ts +9 -1
- package/dist/summaryFormat.d.ts.map +1 -1
- package/dist/summaryFormat.js.map +1 -1
- package/dist/summaryGenerator.d.ts.map +1 -1
- package/dist/summaryGenerator.js +1 -3
- package/dist/summaryGenerator.js.map +1 -1
- package/lib/containerHandleContext.d.ts +0 -1
- package/lib/containerHandleContext.d.ts.map +1 -1
- package/lib/containerHandleContext.js +0 -1
- package/lib/containerHandleContext.js.map +1 -1
- package/lib/containerRuntime.d.ts +18 -3
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +84 -43
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts +4 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +16 -13
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStores.d.ts +8 -8
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +23 -40
- package/lib/dataStores.js.map +1 -1
- package/lib/garbageCollection.d.ts +61 -14
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +276 -21
- package/lib/garbageCollection.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/summarizer.d.ts +1 -3
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +0 -12
- package/lib/summarizer.js.map +1 -1
- package/lib/summarizerTypes.d.ts +2 -2
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryFormat.d.ts +9 -1
- package/lib/summaryFormat.d.ts.map +1 -1
- package/lib/summaryFormat.js.map +1 -1
- package/lib/summaryGenerator.d.ts.map +1 -1
- package/lib/summaryGenerator.js +1 -3
- package/lib/summaryGenerator.js.map +1 -1
- package/package.json +13 -13
- package/src/containerHandleContext.ts +0 -1
- package/src/containerRuntime.ts +110 -53
- package/src/dataStoreContext.ts +15 -14
- package/src/dataStores.ts +32 -50
- package/src/garbageCollection.ts +390 -18
- package/src/index.ts +20 -2
- package/src/packageVersion.ts +1 -1
- package/src/summarizer.ts +0 -15
- package/src/summarizerTypes.ts +1 -2
- package/src/summaryFormat.ts +10 -1
- package/src/summaryGenerator.ts +2 -3
|
@@ -8,7 +8,6 @@ export declare class ContainerFluidHandleContext implements IFluidHandleContext
|
|
|
8
8
|
readonly path: string;
|
|
9
9
|
private readonly runtime;
|
|
10
10
|
readonly routeContext?: IFluidHandleContext | undefined;
|
|
11
|
-
get IFluidRouter(): this;
|
|
12
11
|
get IFluidHandleContext(): this;
|
|
13
12
|
readonly absolutePath: string;
|
|
14
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerHandleContext.d.ts","sourceRoot":"","sources":["../src/containerHandleContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACZ,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,qBAAa,2BAA4B,YAAW,mBAAmB;
|
|
1
|
+
{"version":3,"file":"containerHandleContext.d.ts","sourceRoot":"","sources":["../src/containerHandleContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACZ,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,qBAAa,2BAA4B,YAAW,mBAAmB;aAW/C,IAAI,EAAE,MAAM;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO;aACR,YAAY,CAAC;IAZjC,IAAW,mBAAmB,SAAmB;IACjD,SAAgB,YAAY,EAAE,MAAM,CAAC;IAErC;;;;;OAKG;gBAEiB,IAAI,EAAE,MAAM,EACX,OAAO,EAAE,gBAAgB,EAC1B,YAAY,CAAC,iCAAqB;IAK/C,WAAW,IAAI,IAAI;IAI1B,IAAW,UAAU,YAEpB;IAEY,aAAa,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;CAGpE"}
|
|
@@ -20,7 +20,6 @@ class ContainerFluidHandleContext {
|
|
|
20
20
|
this.routeContext = routeContext;
|
|
21
21
|
this.absolutePath = runtime_utils_1.generateHandleContextPath(path, this.routeContext);
|
|
22
22
|
}
|
|
23
|
-
get IFluidRouter() { return this; }
|
|
24
23
|
get IFluidHandleContext() { return this; }
|
|
25
24
|
attachGraph() {
|
|
26
25
|
throw new Error("can't attach container runtime form within container!");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerHandleContext.js","sourceRoot":"","sources":["../src/containerHandleContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,iFAAoE;AACpE,iEAA0E;AAG1E,MAAa,2BAA2B;
|
|
1
|
+
{"version":3,"file":"containerHandleContext.js","sourceRoot":"","sources":["../src/containerHandleContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,iFAAoE;AACpE,iEAA0E;AAG1E,MAAa,2BAA2B;IAIpC;;;;;OAKG;IACH,YACoB,IAAY,EACX,OAAyB,EAC1B,YAAkC;QAFlC,SAAI,GAAJ,IAAI,CAAQ;QACX,YAAO,GAAP,OAAO,CAAkB;QAC1B,iBAAY,GAAZ,YAAY,CAAsB;QAElD,IAAI,CAAC,YAAY,GAAG,yCAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3E,CAAC;IAfD,IAAW,mBAAmB,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAiB1C,WAAW;QACd,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC7E,CAAC;IAED,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,mCAAW,CAAC,QAAQ,CAAC;IAC7D,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,OAAiB;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;CACJ;AA7BD,kEA6BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IFluidHandleContext,\n IRequest,\n IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { generateHandleContextPath } from \"@fluidframework/runtime-utils\";\nimport { ContainerRuntime } from \"./containerRuntime\";\n\nexport class ContainerFluidHandleContext implements IFluidHandleContext {\n public get IFluidHandleContext() { return this; }\n public readonly absolutePath: string;\n\n /**\n * Creates a new ContainerFluidHandleContext.\n * @param path - The path to this handle relative to the routeContext.\n * @param runtime - The IRuntime object this context represents.\n * @param routeContext - The parent IFluidHandleContext that has a route to this handle.\n */\n constructor(\n public readonly path: string,\n private readonly runtime: ContainerRuntime,\n public readonly routeContext?: IFluidHandleContext,\n ) {\n this.absolutePath = generateHandleContextPath(path, this.routeContext);\n }\n\n public attachGraph(): void {\n throw new Error(\"can't attach container runtime form within container!\");\n }\n\n public get isAttached() {\n return this.runtime.attachState !== AttachState.Detached;\n }\n\n public async resolveHandle(request: IRequest): Promise<IResponse> {\n return this.runtime.resolveHandle(request);\n }\n}\n"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/// <reference types="node" />
|
|
6
6
|
import { EventEmitter } from "events";
|
|
7
7
|
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
8
|
-
import {
|
|
8
|
+
import { FluidObject, IFluidConfiguration, IFluidHandle, IFluidHandleContext, IFluidObject, IFluidRouter, IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
9
9
|
import { IAudience, IFluidTokenProvider, IContainerContext, IDeltaManager, IRuntime, ContainerWarning, ICriticalContainerError, AttachState, ILoaderOptions } from "@fluidframework/container-definitions";
|
|
10
10
|
import { IContainerRuntime, IContainerRuntimeEvents } from "@fluidframework/container-runtime-definitions";
|
|
11
11
|
import { TypedEventEmitter } from "@fluidframework/common-utils";
|
|
@@ -124,6 +124,13 @@ export declare class ScheduleManager {
|
|
|
124
124
|
* ContainerRuntime's perspective.
|
|
125
125
|
*/
|
|
126
126
|
export declare const agentSchedulerId = "_scheduler";
|
|
127
|
+
export declare function getDeviceSpec(): {
|
|
128
|
+
deviceMemory: any;
|
|
129
|
+
hardwareConcurrency: number;
|
|
130
|
+
} | {
|
|
131
|
+
deviceMemory?: undefined;
|
|
132
|
+
hardwareConcurrency?: undefined;
|
|
133
|
+
};
|
|
127
134
|
/**
|
|
128
135
|
* Represents the runtime of the container. Contains helper functions/state of the container.
|
|
129
136
|
* It will define the store level mappings.
|
|
@@ -164,7 +171,6 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
164
171
|
get scope(): IFluidObject & FluidObject;
|
|
165
172
|
get IFluidDataStoreRegistry(): IFluidDataStoreRegistry;
|
|
166
173
|
get attachState(): AttachState;
|
|
167
|
-
readonly IFluidSerializer: IFluidSerializer;
|
|
168
174
|
readonly IFluidHandleContext: IFluidHandleContext;
|
|
169
175
|
private readonly _logger;
|
|
170
176
|
private readonly summarizerClientElection?;
|
|
@@ -203,6 +209,11 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
203
209
|
private readonly garbageCollector;
|
|
204
210
|
private readonly chunkMap;
|
|
205
211
|
private readonly dataStores;
|
|
212
|
+
/**
|
|
213
|
+
* True, if GC data should be written at root of the summary tree.
|
|
214
|
+
* False, if data stores should write GC blobs in their summary tree.
|
|
215
|
+
*/
|
|
216
|
+
get writeGCDataAtRoot(): boolean;
|
|
206
217
|
/**
|
|
207
218
|
* True if generating summaries with isolated channels is
|
|
208
219
|
* explicitly disabled. This only affects how summaries are written,
|
|
@@ -213,6 +224,8 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
213
224
|
private readonly baseSummaryMessage;
|
|
214
225
|
private static get defaultFlushMode();
|
|
215
226
|
private get summarizer();
|
|
227
|
+
private readonly createContainerMetadata;
|
|
228
|
+
private summaryCount;
|
|
216
229
|
private constructor();
|
|
217
230
|
dispose(error?: Error): void;
|
|
218
231
|
get IFluidTokenProvider(): IFluidTokenProvider | undefined;
|
|
@@ -324,9 +337,11 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
324
337
|
* Implementation of IGarbageCollectionRuntime::updateUsedRoutes.
|
|
325
338
|
* After GC has run, called to notify this container's nodes of routes that are used in it.
|
|
326
339
|
* @param usedRoutes - The routes that are used in all nodes in this Container.
|
|
340
|
+
* @param gcTimestamp - The time when GC was run that generated these used routes. If any node node becomes
|
|
341
|
+
* unreferenced as part of this GC run, this should be used to update the time when it happens.
|
|
327
342
|
* @returns the statistics of the used state of the data stores.
|
|
328
343
|
*/
|
|
329
|
-
updateUsedRoutes(usedRoutes: string[]): IUsedStateStats;
|
|
344
|
+
updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number): IUsedStateStats;
|
|
330
345
|
/**
|
|
331
346
|
* Runs garbage collection and udpates the reference / used state of the nodes in the container.
|
|
332
347
|
* @returns the statistics of the garbage collection run.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerRuntime.d.ts","sourceRoot":"","sources":["../src/containerRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAA0B,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,EACH,
|
|
1
|
+
{"version":3,"file":"containerRuntime.d.ts","sourceRoot":"","sources":["../src/containerRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAA0B,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,EACH,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,SAAS,E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AAoB;IAI3B;;OAEG;IACI,iBAAiB,IAAI,OAAO;IAKnC,SAAgB,iBAAiB,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAajE;IAEF,SAAgB,gBAAgB,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAa/D;CACL"}
|
package/dist/containerRuntime.js
CHANGED
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ContainerRuntime = exports.agentSchedulerId = exports.ScheduleManager = exports.unpackRuntimeMessage = exports.isRuntimeMessage = exports.ContainerMessageType = void 0;
|
|
7
|
+
exports.ContainerRuntime = exports.getDeviceSpec = exports.agentSchedulerId = exports.ScheduleManager = exports.unpackRuntimeMessage = exports.isRuntimeMessage = exports.ContainerMessageType = void 0;
|
|
8
8
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
9
9
|
const common_utils_1 = require("@fluidframework/common-utils");
|
|
10
10
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
11
11
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
12
12
|
const container_utils_1 = require("@fluidframework/container-utils");
|
|
13
|
-
const protocol_base_1 = require("@fluidframework/protocol-base");
|
|
14
13
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
15
14
|
const runtime_definitions_1 = require("@fluidframework/runtime-definitions");
|
|
16
15
|
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
@@ -312,6 +311,21 @@ exports.ScheduleManager = ScheduleManager;
|
|
|
312
311
|
* ContainerRuntime's perspective.
|
|
313
312
|
*/
|
|
314
313
|
exports.agentSchedulerId = "_scheduler";
|
|
314
|
+
// safely check navigator and get the hardware spec value
|
|
315
|
+
function getDeviceSpec() {
|
|
316
|
+
try {
|
|
317
|
+
if (typeof navigator === "object" && navigator !== null) {
|
|
318
|
+
return {
|
|
319
|
+
deviceMemory: navigator.deviceMemory,
|
|
320
|
+
hardwareConcurrency: navigator.hardwareConcurrency,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
catch (_a) {
|
|
325
|
+
}
|
|
326
|
+
return {};
|
|
327
|
+
}
|
|
328
|
+
exports.getDeviceSpec = getDeviceSpec;
|
|
315
329
|
/**
|
|
316
330
|
* Represents the runtime of the container. Contains helper functions/state of the container.
|
|
317
331
|
* It will define the store level mappings.
|
|
@@ -395,14 +409,39 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
395
409
|
}
|
|
396
410
|
};
|
|
397
411
|
this.baseSummaryMessage = metadata === null || metadata === void 0 ? void 0 : metadata.message;
|
|
412
|
+
// If this is an existing container, we get values from metadata.
|
|
413
|
+
// otherwise, we initialize them.
|
|
414
|
+
if (existing) {
|
|
415
|
+
this.createContainerMetadata = {
|
|
416
|
+
createContainerRuntimeVersion: metadata === null || metadata === void 0 ? void 0 : metadata.createContainerRuntimeVersion,
|
|
417
|
+
createContainerTimestamp: metadata === null || metadata === void 0 ? void 0 : metadata.createContainerTimestamp,
|
|
418
|
+
};
|
|
419
|
+
this.summaryCount = metadata === null || metadata === void 0 ? void 0 : metadata.summaryCount;
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
this.createContainerMetadata = {
|
|
423
|
+
createContainerRuntimeVersion: packageVersion_1.pkgVersion,
|
|
424
|
+
createContainerTimestamp: Date.now(),
|
|
425
|
+
};
|
|
426
|
+
}
|
|
398
427
|
// Default to false (enabled).
|
|
399
428
|
this.disableIsolatedChannels = (_a = this.runtimeOptions.summaryOptions.disableIsolatedChannels) !== null && _a !== void 0 ? _a : false;
|
|
400
429
|
this._connected = this.context.connected;
|
|
401
430
|
this.chunkMap = new Map(chunks);
|
|
402
431
|
this.IFluidHandleContext = new containerHandleContext_1.ContainerFluidHandleContext("", this);
|
|
403
|
-
this.IFluidSerializer = new runtime_utils_1.FluidSerializer(this.IFluidHandleContext);
|
|
404
432
|
this._logger = telemetry_utils_1.ChildLogger.create(this.logger, "ContainerRuntime");
|
|
405
|
-
|
|
433
|
+
/**
|
|
434
|
+
* Function that return the current server timestamp. This is used by the garbage collector to set the
|
|
435
|
+
* time when a node becomes unreferenced.
|
|
436
|
+
* For now, we use the timestamp of the last op for gcTimestamp. However, there can be cases where
|
|
437
|
+
* we don't have an op (on demand summaries for instance). In those cases, we will use the timestamp
|
|
438
|
+
* of this client's connection - https://github.com/microsoft/FluidFramework/issues/8375.
|
|
439
|
+
*/
|
|
440
|
+
const getCurrentTimestamp = () => {
|
|
441
|
+
var _a, _b;
|
|
442
|
+
return (_b = (_a = this.deltaManager.lastMessage) === null || _a === void 0 ? void 0 : _a.timestamp) !== null && _b !== void 0 ? _b : Date.now();
|
|
443
|
+
};
|
|
444
|
+
this.garbageCollector = garbageCollection_1.GarbageCollector.create(this, this.runtimeOptions.gcOptions, (unusedRoutes) => this.dataStores.deleteUnusedRoutes(unusedRoutes), getCurrentTimestamp, context.baseSnapshot, async (id) => driver_utils_1.readAndParse(this.storage, id), this._logger, existing, metadata);
|
|
406
445
|
const loadedFromSequenceNumber = this.deltaManager.initialSequenceNumber;
|
|
407
446
|
this.summarizerNode = runtime_utils_1.createRootSummarizerNodeWithGC(telemetry_utils_1.ChildLogger.create(this.logger, "SummarizerNode"),
|
|
408
447
|
// Summarize function to call when summarize is called. Summarizer node always tracks summary state.
|
|
@@ -419,13 +458,11 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
419
458
|
throwOnFailure: true,
|
|
420
459
|
// If GC should not run, let the summarizer node know so that it does not track GC state.
|
|
421
460
|
gcDisabled: !this.garbageCollector.shouldRunGC,
|
|
422
|
-
// The max duration for which objects can be unreferenced before they are eligible for deletion.
|
|
423
|
-
maxUnreferencedDurationMs: this.runtimeOptions.gcOptions.maxUnreferencedDurationMs,
|
|
424
461
|
});
|
|
425
462
|
if (this.context.baseSnapshot) {
|
|
426
463
|
this.summarizerNode.loadBaseSummaryWithoutDifferential(this.context.baseSnapshot);
|
|
427
464
|
}
|
|
428
|
-
this.dataStores = new dataStores_1.DataStores(dataStores_1.getSummaryForDatastores(context.baseSnapshot, metadata), this, (attachMsg) => this.submit(ContainerMessageType.Attach, attachMsg), (id, createParam) => (summarizeInternal, getGCDataFn, getInitialGCSummaryDetailsFn) => this.summarizerNode.createChild(summarizeInternal, id, createParam, undefined, getGCDataFn, getInitialGCSummaryDetailsFn), (id) => this.summarizerNode.deleteChild(id), this._logger);
|
|
465
|
+
this.dataStores = new dataStores_1.DataStores(dataStores_1.getSummaryForDatastores(context.baseSnapshot, metadata), this, (attachMsg) => this.submit(ContainerMessageType.Attach, attachMsg), (id, createParam) => (summarizeInternal, getGCDataFn, getInitialGCSummaryDetailsFn) => this.summarizerNode.createChild(summarizeInternal, id, createParam, undefined, getGCDataFn, getInitialGCSummaryDetailsFn), (id) => this.summarizerNode.deleteChild(id), this._logger, async () => this.garbageCollector.getDataStoreBaseGCDetails(), (id) => this.garbageCollector.nodeChanged(id));
|
|
429
466
|
this.blobManager = new blobManager_1.BlobManager(this.IFluidHandleContext, blobManagerSnapshot, () => this.storage, (blobId) => this.submit(ContainerMessageType.BlobAttach, undefined, undefined, { blobId }), this, this.logger);
|
|
430
467
|
this.scheduleManager = new ScheduleManager(context.deltaManager, this, telemetry_utils_1.ChildLogger.create(this.logger, "ScheduleManager"));
|
|
431
468
|
this.deltaSender = this.deltaManager;
|
|
@@ -433,11 +470,6 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
433
470
|
this.context.quorum.on("removeMember", (clientId) => {
|
|
434
471
|
this.clearPartialChunks(clientId);
|
|
435
472
|
});
|
|
436
|
-
this.context.quorum.on("addProposal", (proposal) => {
|
|
437
|
-
if (proposal.key === "code" || proposal.key === "code2") {
|
|
438
|
-
this.emit("codeDetailsProposed", proposal.value, proposal);
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
473
|
this.summaryCollection = new summaryCollection_1.SummaryCollection(this.deltaManager, this.logger);
|
|
442
474
|
// Only create a SummaryManager if summaries are enabled and we are not the summarizer client
|
|
443
475
|
// Map the deprecated generateSummaries flag to disableSummaries.
|
|
@@ -494,7 +526,8 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
494
526
|
this.deltaManager.on("readonly", (readonly) => {
|
|
495
527
|
// we accumulate ops while being in read-only state.
|
|
496
528
|
// once user gets write permissions and we have active connection, flush all pending ops.
|
|
497
|
-
|
|
529
|
+
// eslint-disable-next-line max-len
|
|
530
|
+
common_utils_1.assert(readonly === this.deltaManager.readOnlyInfo.readonly, 0x124 /* "inconsistent readonly property/event state" */);
|
|
498
531
|
// We need to be very careful with when we (re)send pending ops, to ensure that we only send ops
|
|
499
532
|
// when we either never send an op, or attempted to send it but we know for sure it was not
|
|
500
533
|
// sequenced by server and will never be sequenced (i.e. was lost)
|
|
@@ -513,6 +546,10 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
513
546
|
if (context.pendingLocalState !== undefined) {
|
|
514
547
|
this.deltaManager.on("op", this.onOp);
|
|
515
548
|
}
|
|
549
|
+
// logging hardware telemetry
|
|
550
|
+
logger.sendTelemetryEvent(Object.assign({ eventName: "DeviceSpec" }, getDeviceSpec()));
|
|
551
|
+
// logging container load stats
|
|
552
|
+
this.logger.sendTelemetryEvent(Object.assign(Object.assign(Object.assign({ eventName: "ContainerLoadStats" }, this.createContainerMetadata), this.dataStores.containerLoadStats), { summaryCount: this.summaryCount, summaryFormatVersion: metadata === null || metadata === void 0 ? void 0 : metadata.summaryFormatVersion, disableIsolatedChannels: metadata === null || metadata === void 0 ? void 0 : metadata.disableIsolatedChannels, gcVersion: metadata === null || metadata === void 0 ? void 0 : metadata.gcFeature }));
|
|
516
553
|
connectionTelemetry_1.ReportOpPerfTelemetry(this.context.clientId, this.deltaManager, this.logger);
|
|
517
554
|
}
|
|
518
555
|
get IContainerRuntime() { return this; }
|
|
@@ -665,6 +702,13 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
665
702
|
return Object.assign(Object.assign(Object.assign({}, DefaultSummaryConfiguration), (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.serviceConfiguration) === null || _b === void 0 ? void 0 : _b.summary), (_c = this.runtimeOptions.summaryOptions) === null || _c === void 0 ? void 0 : _c.summaryConfigOverrides);
|
|
666
703
|
}
|
|
667
704
|
get disposed() { return this._disposed; }
|
|
705
|
+
/**
|
|
706
|
+
* True, if GC data should be written at root of the summary tree.
|
|
707
|
+
* False, if data stores should write GC blobs in their summary tree.
|
|
708
|
+
*/
|
|
709
|
+
get writeGCDataAtRoot() {
|
|
710
|
+
return this.garbageCollector.writeDataAtRoot;
|
|
711
|
+
}
|
|
668
712
|
static get defaultFlushMode() {
|
|
669
713
|
return localStorageFeatureGates_1.getLocalStorageFeatureGate(turnBasedFlushModeKey) ? runtime_definitions_1.FlushMode.TurnBased : runtime_definitions_1.FlushMode.Immediate;
|
|
670
714
|
}
|
|
@@ -785,14 +829,10 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
785
829
|
}
|
|
786
830
|
formMetadata() {
|
|
787
831
|
var _a;
|
|
788
|
-
return {
|
|
789
|
-
summaryFormatVersion: 1,
|
|
790
|
-
disableIsolatedChannels: this.disableIsolatedChannels || undefined,
|
|
791
|
-
gcFeature: this.garbageCollector.gcSummaryFeatureVersion,
|
|
832
|
+
return Object.assign(Object.assign({}, this.createContainerMetadata), { summaryCount: this.summaryCount, summaryFormatVersion: 1, disableIsolatedChannels: this.disableIsolatedChannels || undefined, gcFeature: this.garbageCollector.gcSummaryFeatureVersion,
|
|
792
833
|
// The last message processed at the time of summary. If there are no messages, nothing has changed from
|
|
793
834
|
// the base summary we loaded from. So, use the message from its metadata blob.
|
|
794
|
-
message: (_a = summaryFormat_1.extractSummaryMetadataMessage(this.deltaManager.lastMessage)) !== null && _a !== void 0 ? _a : this.baseSummaryMessage
|
|
795
|
-
};
|
|
835
|
+
message: (_a = summaryFormat_1.extractSummaryMetadataMessage(this.deltaManager.lastMessage)) !== null && _a !== void 0 ? _a : this.baseSummaryMessage });
|
|
796
836
|
}
|
|
797
837
|
/**
|
|
798
838
|
* Retrieves the runtime for a data store if it's referenced as per the initially summary that it is loaded with.
|
|
@@ -819,22 +859,14 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
819
859
|
* @deprecated - Use summarize to get summary of the container runtime.
|
|
820
860
|
*/
|
|
821
861
|
async snapshot() {
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
else {
|
|
831
|
-
root.entries.push(new protocol_base_1.TreeTreeEntry(runtime_definitions_1.channelsTreeName, { entries }));
|
|
832
|
-
}
|
|
833
|
-
root.entries.push(new protocol_base_1.BlobTreeEntry(summaryFormat_1.metadataBlobName, JSON.stringify(this.formMetadata())));
|
|
834
|
-
if (this.chunkMap.size > 0) {
|
|
835
|
-
root.entries.push(new protocol_base_1.BlobTreeEntry(summaryFormat_1.chunksBlobName, JSON.stringify([...this.chunkMap])));
|
|
836
|
-
}
|
|
837
|
-
return root;
|
|
862
|
+
const summaryResult = await this.summarize({
|
|
863
|
+
summaryLogger: this.logger,
|
|
864
|
+
fullTree: true,
|
|
865
|
+
trackState: false,
|
|
866
|
+
runGC: this.garbageCollector.shouldRunGC,
|
|
867
|
+
fullGC: true,
|
|
868
|
+
});
|
|
869
|
+
return runtime_utils_1.convertSummaryTreeToITree(summaryResult.summary);
|
|
838
870
|
}
|
|
839
871
|
addContainerBlobsToSummary(summaryTree) {
|
|
840
872
|
var _a;
|
|
@@ -854,6 +886,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
854
886
|
const blobsTree = runtime_utils_1.convertToSummaryTree(snapshot, false);
|
|
855
887
|
runtime_utils_1.addTreeToSummary(summaryTree, summaryFormat_1.blobsTreeName, blobsTree);
|
|
856
888
|
}
|
|
889
|
+
if (this.writeGCDataAtRoot) {
|
|
890
|
+
const gcSummary = this.garbageCollector.summarize();
|
|
891
|
+
if (gcSummary !== undefined) {
|
|
892
|
+
runtime_utils_1.addTreeToSummary(summaryTree, garbageCollection_1.gcTreeKey, gcSummary);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
857
895
|
}
|
|
858
896
|
replayPendingStates() {
|
|
859
897
|
// We need to be able to send ops to replay states
|
|
@@ -1186,19 +1224,16 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1186
1224
|
* Implementation of IGarbageCollectionRuntime::updateUsedRoutes.
|
|
1187
1225
|
* After GC has run, called to notify this container's nodes of routes that are used in it.
|
|
1188
1226
|
* @param usedRoutes - The routes that are used in all nodes in this Container.
|
|
1227
|
+
* @param gcTimestamp - The time when GC was run that generated these used routes. If any node node becomes
|
|
1228
|
+
* unreferenced as part of this GC run, this should be used to update the time when it happens.
|
|
1189
1229
|
* @returns the statistics of the used state of the data stores.
|
|
1190
1230
|
*/
|
|
1191
|
-
updateUsedRoutes(usedRoutes) {
|
|
1192
|
-
var _a;
|
|
1231
|
+
updateUsedRoutes(usedRoutes, gcTimestamp) {
|
|
1193
1232
|
// Update our summarizer node's used routes. Updating used routes in summarizer node before
|
|
1194
1233
|
// summarizing is required and asserted by the the summarizer node. We are the root and are
|
|
1195
1234
|
// always referenced, so the used routes is only self-route (empty string).
|
|
1196
1235
|
this.summarizerNode.updateUsedRoutes([""]);
|
|
1197
|
-
return this.dataStores.updateUsedRoutes(usedRoutes,
|
|
1198
|
-
// For now, we use the timestamp of the last op for gcTimestamp. However, there can be cases where
|
|
1199
|
-
// we don't have an op (on demand summaries for instance). In those cases, we will use the timestamp
|
|
1200
|
-
// of this client's connection - https://github.com/microsoft/FluidFramework/issues/7152.
|
|
1201
|
-
this.deltaManager.lastMessage) === null || _a === void 0 ? void 0 : _a.timestamp);
|
|
1236
|
+
return this.dataStores.updateUsedRoutes(usedRoutes, gcTimestamp);
|
|
1202
1237
|
}
|
|
1203
1238
|
/**
|
|
1204
1239
|
* Runs garbage collection and udpates the reference / used state of the nodes in the container.
|
|
@@ -1266,6 +1301,13 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1266
1301
|
if (!continueResult.continue) {
|
|
1267
1302
|
return { stage: "base", referenceSequenceNumber: summaryRefSeqNum, error: continueResult.error };
|
|
1268
1303
|
}
|
|
1304
|
+
// increment summary count
|
|
1305
|
+
if (this.summaryCount !== undefined) {
|
|
1306
|
+
this.summaryCount++;
|
|
1307
|
+
}
|
|
1308
|
+
else {
|
|
1309
|
+
this.summaryCount = 1;
|
|
1310
|
+
}
|
|
1269
1311
|
const trace = common_utils_1.Trace.start();
|
|
1270
1312
|
let summarizeResult;
|
|
1271
1313
|
try {
|