@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerHandleContext.js","sourceRoot":"","sources":["../src/containerHandleContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAG1E,MAAM,OAAO,2BAA2B;
|
|
1
|
+
{"version":3,"file":"containerHandleContext.js","sourceRoot":"","sources":["../src/containerHandleContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAG1E,MAAM,OAAO,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,yBAAyB,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,WAAW,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","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,EACZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,SAAS,EACT,mBAAmB,EACnB,i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EAAE,WAAW,CAAC,mBAAmB,CAAC,CAajE;IAEF,SAAgB,gBAAgB,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAa/D;CACL"}
|
package/lib/containerRuntime.js
CHANGED
|
@@ -7,10 +7,9 @@ import { assert, Trace, TypedEventEmitter, unreachableCase, performance, } from
|
|
|
7
7
|
import { ChildLogger, raiseConnectedEvent, PerformanceEvent, normalizeError, TaggedLoggerAdapter, } from "@fluidframework/telemetry-utils";
|
|
8
8
|
import { readAndParse, BlobAggregationStorage } from "@fluidframework/driver-utils";
|
|
9
9
|
import { DataCorruptionError, GenericError, extractSafePropertiesFromMessage } from "@fluidframework/container-utils";
|
|
10
|
-
import { BlobTreeEntry, TreeTreeEntry, } from "@fluidframework/protocol-base";
|
|
11
10
|
import { MessageType, SummaryType, } from "@fluidframework/protocol-definitions";
|
|
12
11
|
import { FlushMode, channelsTreeName, } from "@fluidframework/runtime-definitions";
|
|
13
|
-
import { addBlobToSummary, addTreeToSummary, convertToSummaryTree, createRootSummarizerNodeWithGC,
|
|
12
|
+
import { addBlobToSummary, addTreeToSummary, convertToSummaryTree, createRootSummarizerNodeWithGC, RequestParser, create404Response, exceptionToResponse, responseToException, seqFromTree, convertSummaryTreeToITree, } from "@fluidframework/runtime-utils";
|
|
14
13
|
import { v4 as uuid } from "uuid";
|
|
15
14
|
import { ContainerFluidHandleContext } from "./containerHandleContext";
|
|
16
15
|
import { FluidDataStoreRegistry } from "./dataStoreRegistry";
|
|
@@ -29,7 +28,7 @@ import { OrderedClientCollection, OrderedClientElection } from "./orderedClientE
|
|
|
29
28
|
import { SummarizerClientElection, summarizerClientType } from "./summarizerClientElection";
|
|
30
29
|
import { formExponentialFn, Throttler } from "./throttler";
|
|
31
30
|
import { RunWhileConnectedCoordinator } from "./runWhileConnectedCoordinator";
|
|
32
|
-
import { GarbageCollector, } from "./garbageCollection";
|
|
31
|
+
import { GarbageCollector, gcTreeKey, } from "./garbageCollection";
|
|
33
32
|
export var ContainerMessageType;
|
|
34
33
|
(function (ContainerMessageType) {
|
|
35
34
|
// An op to be delivered to store
|
|
@@ -306,6 +305,20 @@ export class ScheduleManager {
|
|
|
306
305
|
* ContainerRuntime's perspective.
|
|
307
306
|
*/
|
|
308
307
|
export const agentSchedulerId = "_scheduler";
|
|
308
|
+
// safely check navigator and get the hardware spec value
|
|
309
|
+
export function getDeviceSpec() {
|
|
310
|
+
try {
|
|
311
|
+
if (typeof navigator === "object" && navigator !== null) {
|
|
312
|
+
return {
|
|
313
|
+
deviceMemory: navigator.deviceMemory,
|
|
314
|
+
hardwareConcurrency: navigator.hardwareConcurrency,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
catch (_a) {
|
|
319
|
+
}
|
|
320
|
+
return {};
|
|
321
|
+
}
|
|
309
322
|
/**
|
|
310
323
|
* Represents the runtime of the container. Contains helper functions/state of the container.
|
|
311
324
|
* It will define the store level mappings.
|
|
@@ -389,14 +402,39 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
389
402
|
}
|
|
390
403
|
};
|
|
391
404
|
this.baseSummaryMessage = metadata === null || metadata === void 0 ? void 0 : metadata.message;
|
|
405
|
+
// If this is an existing container, we get values from metadata.
|
|
406
|
+
// otherwise, we initialize them.
|
|
407
|
+
if (existing) {
|
|
408
|
+
this.createContainerMetadata = {
|
|
409
|
+
createContainerRuntimeVersion: metadata === null || metadata === void 0 ? void 0 : metadata.createContainerRuntimeVersion,
|
|
410
|
+
createContainerTimestamp: metadata === null || metadata === void 0 ? void 0 : metadata.createContainerTimestamp,
|
|
411
|
+
};
|
|
412
|
+
this.summaryCount = metadata === null || metadata === void 0 ? void 0 : metadata.summaryCount;
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
this.createContainerMetadata = {
|
|
416
|
+
createContainerRuntimeVersion: pkgVersion,
|
|
417
|
+
createContainerTimestamp: Date.now(),
|
|
418
|
+
};
|
|
419
|
+
}
|
|
392
420
|
// Default to false (enabled).
|
|
393
421
|
this.disableIsolatedChannels = (_a = this.runtimeOptions.summaryOptions.disableIsolatedChannels) !== null && _a !== void 0 ? _a : false;
|
|
394
422
|
this._connected = this.context.connected;
|
|
395
423
|
this.chunkMap = new Map(chunks);
|
|
396
424
|
this.IFluidHandleContext = new ContainerFluidHandleContext("", this);
|
|
397
|
-
this.IFluidSerializer = new FluidSerializer(this.IFluidHandleContext);
|
|
398
425
|
this._logger = ChildLogger.create(this.logger, "ContainerRuntime");
|
|
399
|
-
|
|
426
|
+
/**
|
|
427
|
+
* Function that return the current server timestamp. This is used by the garbage collector to set the
|
|
428
|
+
* time when a node becomes unreferenced.
|
|
429
|
+
* For now, we use the timestamp of the last op for gcTimestamp. However, there can be cases where
|
|
430
|
+
* we don't have an op (on demand summaries for instance). In those cases, we will use the timestamp
|
|
431
|
+
* of this client's connection - https://github.com/microsoft/FluidFramework/issues/8375.
|
|
432
|
+
*/
|
|
433
|
+
const getCurrentTimestamp = () => {
|
|
434
|
+
var _a, _b;
|
|
435
|
+
return (_b = (_a = this.deltaManager.lastMessage) === null || _a === void 0 ? void 0 : _a.timestamp) !== null && _b !== void 0 ? _b : Date.now();
|
|
436
|
+
};
|
|
437
|
+
this.garbageCollector = GarbageCollector.create(this, this.runtimeOptions.gcOptions, (unusedRoutes) => this.dataStores.deleteUnusedRoutes(unusedRoutes), getCurrentTimestamp, context.baseSnapshot, async (id) => readAndParse(this.storage, id), this._logger, existing, metadata);
|
|
400
438
|
const loadedFromSequenceNumber = this.deltaManager.initialSequenceNumber;
|
|
401
439
|
this.summarizerNode = createRootSummarizerNodeWithGC(ChildLogger.create(this.logger, "SummarizerNode"),
|
|
402
440
|
// Summarize function to call when summarize is called. Summarizer node always tracks summary state.
|
|
@@ -413,13 +451,11 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
413
451
|
throwOnFailure: true,
|
|
414
452
|
// If GC should not run, let the summarizer node know so that it does not track GC state.
|
|
415
453
|
gcDisabled: !this.garbageCollector.shouldRunGC,
|
|
416
|
-
// The max duration for which objects can be unreferenced before they are eligible for deletion.
|
|
417
|
-
maxUnreferencedDurationMs: this.runtimeOptions.gcOptions.maxUnreferencedDurationMs,
|
|
418
454
|
});
|
|
419
455
|
if (this.context.baseSnapshot) {
|
|
420
456
|
this.summarizerNode.loadBaseSummaryWithoutDifferential(this.context.baseSnapshot);
|
|
421
457
|
}
|
|
422
|
-
this.dataStores = new DataStores(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);
|
|
458
|
+
this.dataStores = new DataStores(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));
|
|
423
459
|
this.blobManager = new BlobManager(this.IFluidHandleContext, blobManagerSnapshot, () => this.storage, (blobId) => this.submit(ContainerMessageType.BlobAttach, undefined, undefined, { blobId }), this, this.logger);
|
|
424
460
|
this.scheduleManager = new ScheduleManager(context.deltaManager, this, ChildLogger.create(this.logger, "ScheduleManager"));
|
|
425
461
|
this.deltaSender = this.deltaManager;
|
|
@@ -427,11 +463,6 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
427
463
|
this.context.quorum.on("removeMember", (clientId) => {
|
|
428
464
|
this.clearPartialChunks(clientId);
|
|
429
465
|
});
|
|
430
|
-
this.context.quorum.on("addProposal", (proposal) => {
|
|
431
|
-
if (proposal.key === "code" || proposal.key === "code2") {
|
|
432
|
-
this.emit("codeDetailsProposed", proposal.value, proposal);
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
466
|
this.summaryCollection = new SummaryCollection(this.deltaManager, this.logger);
|
|
436
467
|
// Only create a SummaryManager if summaries are enabled and we are not the summarizer client
|
|
437
468
|
// Map the deprecated generateSummaries flag to disableSummaries.
|
|
@@ -488,7 +519,8 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
488
519
|
this.deltaManager.on("readonly", (readonly) => {
|
|
489
520
|
// we accumulate ops while being in read-only state.
|
|
490
521
|
// once user gets write permissions and we have active connection, flush all pending ops.
|
|
491
|
-
|
|
522
|
+
// eslint-disable-next-line max-len
|
|
523
|
+
assert(readonly === this.deltaManager.readOnlyInfo.readonly, 0x124 /* "inconsistent readonly property/event state" */);
|
|
492
524
|
// We need to be very careful with when we (re)send pending ops, to ensure that we only send ops
|
|
493
525
|
// when we either never send an op, or attempted to send it but we know for sure it was not
|
|
494
526
|
// sequenced by server and will never be sequenced (i.e. was lost)
|
|
@@ -507,6 +539,10 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
507
539
|
if (context.pendingLocalState !== undefined) {
|
|
508
540
|
this.deltaManager.on("op", this.onOp);
|
|
509
541
|
}
|
|
542
|
+
// logging hardware telemetry
|
|
543
|
+
logger.sendTelemetryEvent(Object.assign({ eventName: "DeviceSpec" }, getDeviceSpec()));
|
|
544
|
+
// logging container load stats
|
|
545
|
+
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 }));
|
|
510
546
|
ReportOpPerfTelemetry(this.context.clientId, this.deltaManager, this.logger);
|
|
511
547
|
}
|
|
512
548
|
get IContainerRuntime() { return this; }
|
|
@@ -659,6 +695,13 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
659
695
|
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);
|
|
660
696
|
}
|
|
661
697
|
get disposed() { return this._disposed; }
|
|
698
|
+
/**
|
|
699
|
+
* True, if GC data should be written at root of the summary tree.
|
|
700
|
+
* False, if data stores should write GC blobs in their summary tree.
|
|
701
|
+
*/
|
|
702
|
+
get writeGCDataAtRoot() {
|
|
703
|
+
return this.garbageCollector.writeDataAtRoot;
|
|
704
|
+
}
|
|
662
705
|
static get defaultFlushMode() {
|
|
663
706
|
return getLocalStorageFeatureGate(turnBasedFlushModeKey) ? FlushMode.TurnBased : FlushMode.Immediate;
|
|
664
707
|
}
|
|
@@ -779,14 +822,10 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
779
822
|
}
|
|
780
823
|
formMetadata() {
|
|
781
824
|
var _a;
|
|
782
|
-
return {
|
|
783
|
-
summaryFormatVersion: 1,
|
|
784
|
-
disableIsolatedChannels: this.disableIsolatedChannels || undefined,
|
|
785
|
-
gcFeature: this.garbageCollector.gcSummaryFeatureVersion,
|
|
825
|
+
return Object.assign(Object.assign({}, this.createContainerMetadata), { summaryCount: this.summaryCount, summaryFormatVersion: 1, disableIsolatedChannels: this.disableIsolatedChannels || undefined, gcFeature: this.garbageCollector.gcSummaryFeatureVersion,
|
|
786
826
|
// The last message processed at the time of summary. If there are no messages, nothing has changed from
|
|
787
827
|
// the base summary we loaded from. So, use the message from its metadata blob.
|
|
788
|
-
message: (_a = extractSummaryMetadataMessage(this.deltaManager.lastMessage)) !== null && _a !== void 0 ? _a : this.baseSummaryMessage
|
|
789
|
-
};
|
|
828
|
+
message: (_a = extractSummaryMetadataMessage(this.deltaManager.lastMessage)) !== null && _a !== void 0 ? _a : this.baseSummaryMessage });
|
|
790
829
|
}
|
|
791
830
|
/**
|
|
792
831
|
* Retrieves the runtime for a data store if it's referenced as per the initially summary that it is loaded with.
|
|
@@ -813,22 +852,14 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
813
852
|
* @deprecated - Use summarize to get summary of the container runtime.
|
|
814
853
|
*/
|
|
815
854
|
async snapshot() {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
else {
|
|
825
|
-
root.entries.push(new TreeTreeEntry(channelsTreeName, { entries }));
|
|
826
|
-
}
|
|
827
|
-
root.entries.push(new BlobTreeEntry(metadataBlobName, JSON.stringify(this.formMetadata())));
|
|
828
|
-
if (this.chunkMap.size > 0) {
|
|
829
|
-
root.entries.push(new BlobTreeEntry(chunksBlobName, JSON.stringify([...this.chunkMap])));
|
|
830
|
-
}
|
|
831
|
-
return root;
|
|
855
|
+
const summaryResult = await this.summarize({
|
|
856
|
+
summaryLogger: this.logger,
|
|
857
|
+
fullTree: true,
|
|
858
|
+
trackState: false,
|
|
859
|
+
runGC: this.garbageCollector.shouldRunGC,
|
|
860
|
+
fullGC: true,
|
|
861
|
+
});
|
|
862
|
+
return convertSummaryTreeToITree(summaryResult.summary);
|
|
832
863
|
}
|
|
833
864
|
addContainerBlobsToSummary(summaryTree) {
|
|
834
865
|
var _a;
|
|
@@ -848,6 +879,12 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
848
879
|
const blobsTree = convertToSummaryTree(snapshot, false);
|
|
849
880
|
addTreeToSummary(summaryTree, blobsTreeName, blobsTree);
|
|
850
881
|
}
|
|
882
|
+
if (this.writeGCDataAtRoot) {
|
|
883
|
+
const gcSummary = this.garbageCollector.summarize();
|
|
884
|
+
if (gcSummary !== undefined) {
|
|
885
|
+
addTreeToSummary(summaryTree, gcTreeKey, gcSummary);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
851
888
|
}
|
|
852
889
|
replayPendingStates() {
|
|
853
890
|
// We need to be able to send ops to replay states
|
|
@@ -1180,19 +1217,16 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1180
1217
|
* Implementation of IGarbageCollectionRuntime::updateUsedRoutes.
|
|
1181
1218
|
* After GC has run, called to notify this container's nodes of routes that are used in it.
|
|
1182
1219
|
* @param usedRoutes - The routes that are used in all nodes in this Container.
|
|
1220
|
+
* @param gcTimestamp - The time when GC was run that generated these used routes. If any node node becomes
|
|
1221
|
+
* unreferenced as part of this GC run, this should be used to update the time when it happens.
|
|
1183
1222
|
* @returns the statistics of the used state of the data stores.
|
|
1184
1223
|
*/
|
|
1185
|
-
updateUsedRoutes(usedRoutes) {
|
|
1186
|
-
var _a;
|
|
1224
|
+
updateUsedRoutes(usedRoutes, gcTimestamp) {
|
|
1187
1225
|
// Update our summarizer node's used routes. Updating used routes in summarizer node before
|
|
1188
1226
|
// summarizing is required and asserted by the the summarizer node. We are the root and are
|
|
1189
1227
|
// always referenced, so the used routes is only self-route (empty string).
|
|
1190
1228
|
this.summarizerNode.updateUsedRoutes([""]);
|
|
1191
|
-
return this.dataStores.updateUsedRoutes(usedRoutes,
|
|
1192
|
-
// For now, we use the timestamp of the last op for gcTimestamp. However, there can be cases where
|
|
1193
|
-
// we don't have an op (on demand summaries for instance). In those cases, we will use the timestamp
|
|
1194
|
-
// of this client's connection - https://github.com/microsoft/FluidFramework/issues/7152.
|
|
1195
|
-
this.deltaManager.lastMessage) === null || _a === void 0 ? void 0 : _a.timestamp);
|
|
1229
|
+
return this.dataStores.updateUsedRoutes(usedRoutes, gcTimestamp);
|
|
1196
1230
|
}
|
|
1197
1231
|
/**
|
|
1198
1232
|
* Runs garbage collection and udpates the reference / used state of the nodes in the container.
|
|
@@ -1260,6 +1294,13 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1260
1294
|
if (!continueResult.continue) {
|
|
1261
1295
|
return { stage: "base", referenceSequenceNumber: summaryRefSeqNum, error: continueResult.error };
|
|
1262
1296
|
}
|
|
1297
|
+
// increment summary count
|
|
1298
|
+
if (this.summaryCount !== undefined) {
|
|
1299
|
+
this.summaryCount++;
|
|
1300
|
+
}
|
|
1301
|
+
else {
|
|
1302
|
+
this.summaryCount = 1;
|
|
1303
|
+
}
|
|
1263
1304
|
const trace = Trace.start();
|
|
1264
1305
|
let summarizeResult;
|
|
1265
1306
|
try {
|