@fluidframework/container-runtime 0.53.0 → 0.54.2
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/containerRuntime.d.ts +25 -16
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +126 -77
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +29 -3
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +29 -4
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStores.d.ts +7 -3
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +54 -5
- package/dist/dataStores.js.map +1 -1
- package/dist/garbageCollection.d.ts +22 -2
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +112 -34
- package/dist/garbageCollection.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/runningSummarizer.d.ts +3 -2
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +6 -6
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/summarizer.d.ts +22 -0
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +135 -33
- package/dist/summarizer.js.map +1 -1
- package/dist/summarizerTypes.d.ts +1 -8
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryFormat.d.ts +1 -0
- package/dist/summaryFormat.d.ts.map +1 -1
- package/dist/summaryFormat.js +2 -1
- package/dist/summaryFormat.js.map +1 -1
- package/dist/summaryManager.d.ts +0 -15
- package/dist/summaryManager.d.ts.map +1 -1
- package/dist/summaryManager.js +1 -35
- package/dist/summaryManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +25 -16
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +132 -83
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts +29 -3
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +29 -4
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStores.d.ts +7 -3
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +54 -5
- package/lib/dataStores.js.map +1 -1
- package/lib/garbageCollection.d.ts +22 -2
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +114 -36
- package/lib/garbageCollection.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/runningSummarizer.d.ts +3 -2
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +6 -6
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/summarizer.d.ts +22 -0
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +135 -33
- package/lib/summarizer.js.map +1 -1
- package/lib/summarizerTypes.d.ts +1 -8
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryFormat.d.ts +1 -0
- package/lib/summaryFormat.d.ts.map +1 -1
- package/lib/summaryFormat.js +1 -0
- package/lib/summaryFormat.js.map +1 -1
- package/lib/summaryManager.d.ts +0 -15
- package/lib/summaryManager.d.ts.map +1 -1
- package/lib/summaryManager.js +1 -34
- package/lib/summaryManager.js.map +1 -1
- package/package.json +13 -13
- package/src/containerRuntime.ts +177 -93
- package/src/dataStoreContext.ts +44 -6
- package/src/dataStores.ts +84 -4
- package/src/garbageCollection.ts +137 -46
- package/src/packageVersion.ts +1 -1
- package/src/runningSummarizer.ts +12 -10
- package/src/summarizer.ts +154 -38
- package/src/summarizerTypes.ts +2 -9
- package/src/summaryFormat.ts +1 -0
- package/src/summaryManager.ts +2 -49
- package/dist/localStorageFeatureGates.d.ts +0 -13
- package/dist/localStorageFeatureGates.d.ts.map +0 -1
- package/dist/localStorageFeatureGates.js +0 -31
- package/dist/localStorageFeatureGates.js.map +0 -1
- package/lib/localStorageFeatureGates.d.ts +0 -13
- package/lib/localStorageFeatureGates.d.ts.map +0 -1
- package/lib/localStorageFeatureGates.js +0 -27
- package/lib/localStorageFeatureGates.js.map +0 -1
- package/src/localStorageFeatureGates.ts +0 -27
|
@@ -10,7 +10,7 @@ import { IAudience, IFluidTokenProvider, IContainerContext, IDeltaManager, IRunt
|
|
|
10
10
|
import { IContainerRuntime, IContainerRuntimeEvents } from "@fluidframework/container-runtime-definitions";
|
|
11
11
|
import { TypedEventEmitter } from "@fluidframework/common-utils";
|
|
12
12
|
import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
13
|
-
import { IClientDetails, IDocumentMessage,
|
|
13
|
+
import { IClientDetails, IDocumentMessage, IQuorumClients, ISequencedDocumentMessage, ISignalMessage, ISummaryConfiguration, ISummaryTree, ITree, MessageType } from "@fluidframework/protocol-definitions";
|
|
14
14
|
import { FlushMode, IFluidDataStoreContextDetached, IFluidDataStoreRegistry, IGarbageCollectionData, NamedFluidDataStoreRegistryEntries, ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
|
|
15
15
|
import { IPendingLocalState } from "./pendingStateManager";
|
|
16
16
|
import { SubmitSummaryResult, ISubmitSummaryOptions, ISummarizer, ISummarizerInternalsProvider, ISummarizerOptions, ISummarizerRuntime } from "./summarizerTypes";
|
|
@@ -20,7 +20,8 @@ export declare enum ContainerMessageType {
|
|
|
20
20
|
Attach = "attach",
|
|
21
21
|
ChunkedOp = "chunkedOp",
|
|
22
22
|
BlobAttach = "blobAttach",
|
|
23
|
-
Rejoin = "rejoin"
|
|
23
|
+
Rejoin = "rejoin",
|
|
24
|
+
Alias = "alias"
|
|
24
25
|
}
|
|
25
26
|
export interface IChunkedOp {
|
|
26
27
|
chunkId: number;
|
|
@@ -145,11 +146,6 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
145
146
|
private _storage?;
|
|
146
147
|
get IContainerRuntime(): this;
|
|
147
148
|
get IFluidRouter(): this;
|
|
148
|
-
/**
|
|
149
|
-
* @internal
|
|
150
|
-
* @deprecated Back-compat only. Used by the loader in versions earlier than 0.35.
|
|
151
|
-
*/
|
|
152
|
-
readonly runtimeVersion: string;
|
|
153
149
|
/**
|
|
154
150
|
* Load the stores from a snapshot and returns the runtime.
|
|
155
151
|
* @param context - Context of the container.
|
|
@@ -159,6 +155,9 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
159
155
|
* @param existing - (optional) When loading from an existing snapshot. Precedes context.existing if provided
|
|
160
156
|
*/
|
|
161
157
|
static load(context: IContainerContext, registryEntries: NamedFluidDataStoreRegistryEntries, requestHandler?: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>, runtimeOptions?: IContainerRuntimeOptions, containerScope?: FluidObject, existing?: boolean): Promise<ContainerRuntime>;
|
|
158
|
+
/**
|
|
159
|
+
* @deprecated This will be removed in a later release. Deprecated in 0.53
|
|
160
|
+
*/
|
|
162
161
|
get id(): string;
|
|
163
162
|
get options(): ILoaderOptions;
|
|
164
163
|
get clientId(): string | undefined;
|
|
@@ -171,8 +170,9 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
171
170
|
get scope(): IFluidObject & FluidObject;
|
|
172
171
|
get IFluidDataStoreRegistry(): IFluidDataStoreRegistry;
|
|
173
172
|
get attachState(): AttachState;
|
|
174
|
-
|
|
175
|
-
private readonly
|
|
173
|
+
get IFluidHandleContext(): IFluidHandleContext;
|
|
174
|
+
private readonly handleContext;
|
|
175
|
+
private readonly mc;
|
|
176
176
|
private readonly summarizerClientElection?;
|
|
177
177
|
/**
|
|
178
178
|
* summaryManager will only be created if this client is permitted to spawn a summarizing client
|
|
@@ -222,8 +222,8 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
222
222
|
readonly disableIsolatedChannels: boolean;
|
|
223
223
|
/** The message in the metadata of the base summary this container is loaded from. */
|
|
224
224
|
private readonly baseSummaryMessage;
|
|
225
|
-
private static get defaultFlushMode();
|
|
226
225
|
private get summarizer();
|
|
226
|
+
private get summariesDisabled();
|
|
227
227
|
private readonly createContainerMetadata;
|
|
228
228
|
private summaryCount;
|
|
229
229
|
private constructor();
|
|
@@ -269,6 +269,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
269
269
|
private applyStashedOp;
|
|
270
270
|
setConnectionState(connected: boolean, clientId?: string): void;
|
|
271
271
|
process(messageArg: ISequencedDocumentMessage, local: boolean): void;
|
|
272
|
+
private processAliasMessage;
|
|
272
273
|
processSignal(message: ISignalMessage, local: boolean): void;
|
|
273
274
|
getRootDataStore(id: string, wait?: boolean): Promise<IFluidRouter>;
|
|
274
275
|
protected getDataStore(id: string, wait?: boolean): Promise<IFluidRouter>;
|
|
@@ -283,7 +284,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
283
284
|
_createDataStoreWithProps(pkg: string | string[], props?: any, id?: string, isRoot?: boolean): Promise<IFluidRouter>;
|
|
284
285
|
private _createDataStore;
|
|
285
286
|
private canSendOps;
|
|
286
|
-
getQuorum():
|
|
287
|
+
getQuorum(): IQuorumClients;
|
|
287
288
|
getAudience(): IAudience;
|
|
288
289
|
readonly raiseContainerWarning: (warning: ContainerWarning) => void;
|
|
289
290
|
/**
|
|
@@ -343,7 +344,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
343
344
|
*/
|
|
344
345
|
updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number): IUsedStateStats;
|
|
345
346
|
/**
|
|
346
|
-
* Runs garbage collection and
|
|
347
|
+
* Runs garbage collection and updates the reference / used state of the nodes in the container.
|
|
347
348
|
* @returns the statistics of the garbage collection run.
|
|
348
349
|
*/
|
|
349
350
|
collectGarbage(options: {
|
|
@@ -354,6 +355,13 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
354
355
|
/** True to generate full GC data */
|
|
355
356
|
fullGC?: boolean;
|
|
356
357
|
}): Promise<IGCStats>;
|
|
358
|
+
/**
|
|
359
|
+
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
360
|
+
* all references added in the system.
|
|
361
|
+
* @param srcHandle - The handle of the node that added the reference.
|
|
362
|
+
* @param outboundHandle - The handle of the outbound node that is referenced.
|
|
363
|
+
*/
|
|
364
|
+
addedGCOutboundReference(srcHandle: IFluidHandle, outboundHandle: IFluidHandle): void;
|
|
357
365
|
/**
|
|
358
366
|
* Generates the summary tree, uploads it to storage, and then submits the summarize op.
|
|
359
367
|
* This is intended to be called by the summarizer, since it is the implementation of
|
|
@@ -396,11 +404,12 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
396
404
|
private refreshLatestSummaryAckFromServer;
|
|
397
405
|
private fetchSnapshotFromStorage;
|
|
398
406
|
getPendingLocalState(): IPendingLocalState | undefined;
|
|
399
|
-
/**
|
|
400
|
-
* @returns true if summaries are explicitly disabled for this ContainerRuntime, false otherwise
|
|
401
|
-
*/
|
|
402
|
-
summariesDisabled(): boolean;
|
|
403
407
|
readonly summarizeOnDemand: ISummarizer["summarizeOnDemand"];
|
|
404
408
|
readonly enqueueSummarize: ISummarizer["enqueueSummarize"];
|
|
409
|
+
/**
|
|
410
|
+
* * Forms a function that will request a Summarizer.
|
|
411
|
+
* @param loaderRouter - the loader acting as an IFluidRouter
|
|
412
|
+
* */
|
|
413
|
+
private formRequestSummarizerFn;
|
|
405
414
|
}
|
|
406
415
|
//# sourceMappingURL=containerRuntime.d.ts.map
|
|
@@ -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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,OAAO,CAAC,mBAAmB,CAAC;IAmLxF,OAAO,CAAC,2BAA2B;IAoBnC,OAAO,CAAC,QAAQ;IAWhB,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,wBAAwB;IAYzB,iBAAiB,CACpB,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,GAAG,EACb,eAAe,GAAE,OAAmB,GAAG,IAAI;IAQlC,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IAKtF,OAAO,CAAC,MAAM;IAmEd,OAAO,CAAC,oBAAoB;IAqB5B,OAAO,CAAC,mBAAmB;IAoB3B,OAAO,CAAC,oBAAoB;IAgB5B;;;OAGG;IACH,OAAO,CAAC,eAAe;IAMvB;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IA6BhB,6EAA6E;IAChE,uBAAuB,CAChC,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,gBAAgB;IAkBnC;;;;;OAKG;YACW,iCAAiC;YAuBjC,wBAAwB;IAmB/B,oBAAoB;IAI3B,SAAgB,iBAAiB,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAajE;IAEF,SAAgB,gBAAgB,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAa/D;IAEF;;;SAGK;IACL,OAAO,CAAC,uBAAuB;CAyBlC"}
|
package/dist/containerRuntime.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.ContainerRuntime = exports.getDeviceSpec = exports.agentSchedulerId = ex
|
|
|
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
|
+
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
11
12
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
12
13
|
const container_utils_1 = require("@fluidframework/container-utils");
|
|
13
14
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
@@ -26,7 +27,6 @@ const blobManager_1 = require("./blobManager");
|
|
|
26
27
|
const dataStores_1 = require("./dataStores");
|
|
27
28
|
const summaryFormat_1 = require("./summaryFormat");
|
|
28
29
|
const summaryCollection_1 = require("./summaryCollection");
|
|
29
|
-
const localStorageFeatureGates_1 = require("./localStorageFeatureGates");
|
|
30
30
|
const orderedClientElection_1 = require("./orderedClientElection");
|
|
31
31
|
const summarizerClientElection_1 = require("./summarizerClientElection");
|
|
32
32
|
const throttler_1 = require("./throttler");
|
|
@@ -44,6 +44,8 @@ var ContainerMessageType;
|
|
|
44
44
|
ContainerMessageType["BlobAttach"] = "blobAttach";
|
|
45
45
|
// Ties our new clientId to our old one on reconnect
|
|
46
46
|
ContainerMessageType["Rejoin"] = "rejoin";
|
|
47
|
+
// Sets the alias of a root data store
|
|
48
|
+
ContainerMessageType["Alias"] = "alias";
|
|
47
49
|
})(ContainerMessageType = exports.ContainerMessageType || (exports.ContainerMessageType = {}));
|
|
48
50
|
// Consider idle 5s of no activity. And snapshot if a minute has gone by with no snapshot.
|
|
49
51
|
const IdleDetectionTime = 5000;
|
|
@@ -58,12 +60,13 @@ const DefaultSummaryConfiguration = {
|
|
|
58
60
|
maxAckWaitTime: 120000,
|
|
59
61
|
};
|
|
60
62
|
// Local storage key to set the default flush mode to TurnBased
|
|
61
|
-
const turnBasedFlushModeKey = "
|
|
63
|
+
const turnBasedFlushModeKey = "Fluid.ContainerRuntime.FlushModeTurnBased";
|
|
62
64
|
function isRuntimeMessage(message) {
|
|
63
65
|
switch (message.type) {
|
|
64
66
|
case ContainerMessageType.FluidDataStoreOp:
|
|
65
67
|
case ContainerMessageType.ChunkedOp:
|
|
66
68
|
case ContainerMessageType.Attach:
|
|
69
|
+
case ContainerMessageType.Alias:
|
|
67
70
|
case ContainerMessageType.BlobAttach:
|
|
68
71
|
case ContainerMessageType.Rejoin:
|
|
69
72
|
case protocol_definitions_1.MessageType.Operation:
|
|
@@ -331,8 +334,8 @@ exports.getDeviceSpec = getDeviceSpec;
|
|
|
331
334
|
* It will define the store level mappings.
|
|
332
335
|
*/
|
|
333
336
|
class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
334
|
-
constructor(context, registry, metadata, electedSummarizerData, chunks, runtimeOptions, containerScope, logger, existing, blobManagerSnapshot, requestHandler, _storage) {
|
|
335
|
-
var _a, _b, _c, _d;
|
|
337
|
+
constructor(context, registry, metadata, electedSummarizerData, chunks, dataStoreAliasMap, runtimeOptions, containerScope, logger, existing, blobManagerSnapshot, requestHandler, _storage) {
|
|
338
|
+
var _a, _b, _c, _d, _e;
|
|
336
339
|
super();
|
|
337
340
|
this.context = context;
|
|
338
341
|
this.registry = registry;
|
|
@@ -341,14 +344,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
341
344
|
this.logger = logger;
|
|
342
345
|
this.requestHandler = requestHandler;
|
|
343
346
|
this._storage = _storage;
|
|
344
|
-
// back-compat: Used by loader in <= 0.35
|
|
345
|
-
/**
|
|
346
|
-
* @internal
|
|
347
|
-
* @deprecated Back-compat only. Used by the loader in versions earlier than 0.35.
|
|
348
|
-
*/
|
|
349
|
-
this.runtimeVersion = packageVersion_1.pkgVersion;
|
|
350
347
|
this._orderSequentiallyCalls = 0;
|
|
351
|
-
this._flushMode = ContainerRuntime.defaultFlushMode;
|
|
352
348
|
this.needsFlush = false;
|
|
353
349
|
this.flushTrigger = false;
|
|
354
350
|
this.paused = false;
|
|
@@ -391,7 +387,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
391
387
|
// If we're not the summarizer, and we don't have a summaryManager, we expect that
|
|
392
388
|
// disableSummaries is turned on. We are throwing instead of returning a failure here,
|
|
393
389
|
// because it is a misuse of the API rather than an expected failure.
|
|
394
|
-
throw new
|
|
390
|
+
throw new container_utils_1.UsageError(`Can't summarize, disableSummaries: ${this.summariesDisabled}`);
|
|
395
391
|
}
|
|
396
392
|
};
|
|
397
393
|
this.enqueueSummarize = (...args) => {
|
|
@@ -405,7 +401,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
405
401
|
// If we're not the summarizer, and we don't have a summaryManager, we expect that
|
|
406
402
|
// generateSummaries is turned off. We are throwing instead of returning a failure here,
|
|
407
403
|
// because it is a misuse of the API rather than an expected failure.
|
|
408
|
-
throw new
|
|
404
|
+
throw new container_utils_1.UsageError(`Can't summarize, disableSummaries: ${this.summariesDisabled}`);
|
|
409
405
|
}
|
|
410
406
|
};
|
|
411
407
|
this.baseSummaryMessage = metadata === null || metadata === void 0 ? void 0 : metadata.message;
|
|
@@ -428,20 +424,24 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
428
424
|
this.disableIsolatedChannels = (_a = this.runtimeOptions.summaryOptions.disableIsolatedChannels) !== null && _a !== void 0 ? _a : false;
|
|
429
425
|
this._connected = this.context.connected;
|
|
430
426
|
this.chunkMap = new Map(chunks);
|
|
431
|
-
this.
|
|
432
|
-
this.
|
|
427
|
+
this.handleContext = new containerHandleContext_1.ContainerFluidHandleContext("", this);
|
|
428
|
+
this.mc = telemetry_utils_1.loggerToMonitoringContext(telemetry_utils_1.ChildLogger.create(this.logger, "ContainerRuntime"));
|
|
429
|
+
this._flushMode =
|
|
430
|
+
((_b = this.mc.config.getBoolean(turnBasedFlushModeKey)) !== null && _b !== void 0 ? _b : false) ? runtime_definitions_1.FlushMode.TurnBased : runtime_definitions_1.FlushMode.Immediate;
|
|
433
431
|
/**
|
|
434
432
|
* Function that return the current server timestamp. This is used by the garbage collector to set the
|
|
435
433
|
* time when a node becomes unreferenced.
|
|
436
|
-
*
|
|
434
|
+
* We use the timestamp of the last op for current timestamp. However, there can be cases where
|
|
437
435
|
* 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
|
|
436
|
+
* of this client's connection.
|
|
439
437
|
*/
|
|
440
438
|
const getCurrentTimestamp = () => {
|
|
441
|
-
var _a, _b;
|
|
442
|
-
|
|
439
|
+
var _a, _b, _c;
|
|
440
|
+
const client = this.clientId !== undefined ? this.getAudience().getMember(this.clientId) : undefined;
|
|
441
|
+
const timestamp = client === null || client === void 0 ? void 0 : client.timestamp;
|
|
442
|
+
return (_c = (_b = (_a = this.deltaManager.lastMessage) === null || _a === void 0 ? void 0 : _a.timestamp) !== null && _b !== void 0 ? _b : timestamp) !== null && _c !== void 0 ? _c : Date.now();
|
|
443
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.
|
|
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.mc.logger, existing, metadata);
|
|
445
445
|
const loadedFromSequenceNumber = this.deltaManager.initialSequenceNumber;
|
|
446
446
|
this.summarizerNode = runtime_utils_1.createRootSummarizerNodeWithGC(telemetry_utils_1.ChildLogger.create(this.logger, "SummarizerNode"),
|
|
447
447
|
// Summarize function to call when summarize is called. Summarizer node always tracks summary state.
|
|
@@ -462,8 +462,8 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
462
462
|
if (this.context.baseSnapshot) {
|
|
463
463
|
this.summarizerNode.loadBaseSummaryWithoutDifferential(this.context.baseSnapshot);
|
|
464
464
|
}
|
|
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.
|
|
466
|
-
this.blobManager = new blobManager_1.BlobManager(this.
|
|
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.mc.logger, async () => this.garbageCollector.getDataStoreBaseGCDetails(), (id) => this.garbageCollector.nodeChanged(id), new Map(dataStoreAliasMap));
|
|
466
|
+
this.blobManager = new blobManager_1.BlobManager(this.handleContext, blobManagerSnapshot, () => this.storage, (blobId) => this.submit(ContainerMessageType.BlobAttach, undefined, undefined, { blobId }), this, this.logger);
|
|
467
467
|
this.scheduleManager = new ScheduleManager(context.deltaManager, this, telemetry_utils_1.ChildLogger.create(this.logger, "ScheduleManager"));
|
|
468
468
|
this.deltaSender = this.deltaManager;
|
|
469
469
|
this.pendingStateManager = new pendingStateManager_1.PendingStateManager(this, async (type, content) => this.applyStashedOp(type, content), context.pendingLocalState);
|
|
@@ -471,49 +471,45 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
471
471
|
this.clearPartialChunks(clientId);
|
|
472
472
|
});
|
|
473
473
|
this.summaryCollection = new summaryCollection_1.SummaryCollection(this.deltaManager, this.logger);
|
|
474
|
-
// Only create a SummaryManager if summaries are enabled and we are not the summarizer client
|
|
475
474
|
// Map the deprecated generateSummaries flag to disableSummaries.
|
|
476
475
|
if (this.runtimeOptions.summaryOptions.generateSummaries === false) {
|
|
477
476
|
this.runtimeOptions.summaryOptions.disableSummaries = true;
|
|
478
477
|
}
|
|
479
|
-
if (this.summariesDisabled
|
|
480
|
-
this.
|
|
478
|
+
if (this.summariesDisabled) {
|
|
479
|
+
this.mc.logger.sendTelemetryEvent({ eventName: "SummariesDisabled" });
|
|
481
480
|
}
|
|
482
481
|
else {
|
|
483
|
-
const maxOpsSinceLastSummary = (_b = this.runtimeOptions.summaryOptions.maxOpsSinceLastSummary) !== null && _b !== void 0 ? _b : 7000;
|
|
484
|
-
const defaultAction = () => {
|
|
485
|
-
if (this.summaryCollection.opsSinceLastAck > maxOpsSinceLastSummary) {
|
|
486
|
-
this.logger.sendErrorEvent({ eventName: "SummaryStatus:Behind" });
|
|
487
|
-
// unregister default to no log on every op after falling behind
|
|
488
|
-
// and register summary ack handler to re-register this handler
|
|
489
|
-
// after successful summary
|
|
490
|
-
this.summaryCollection.once(protocol_definitions_1.MessageType.SummaryAck, () => {
|
|
491
|
-
this.logger.sendTelemetryEvent({ eventName: "SummaryStatus:CaughtUp" });
|
|
492
|
-
// we've caught up, so re-register the default action to monitor for
|
|
493
|
-
// falling behind, and unregister ourself
|
|
494
|
-
this.summaryCollection.on("default", defaultAction);
|
|
495
|
-
});
|
|
496
|
-
this.summaryCollection.off("default", defaultAction);
|
|
497
|
-
}
|
|
498
|
-
};
|
|
499
|
-
this.summaryCollection.on("default", defaultAction);
|
|
500
482
|
const orderedClientLogger = telemetry_utils_1.ChildLogger.create(this.logger, "OrderedClientElection");
|
|
501
483
|
const orderedClientCollection = new orderedClientElection_1.OrderedClientCollection(orderedClientLogger, this.context.deltaManager, this.context.quorum);
|
|
502
484
|
const orderedClientElectionForSummarizer = new orderedClientElection_1.OrderedClientElection(orderedClientLogger, orderedClientCollection, electedSummarizerData !== null && electedSummarizerData !== void 0 ? electedSummarizerData : this.context.deltaManager.lastSequenceNumber, summarizerClientElection_1.SummarizerClientElection.isClientEligible);
|
|
503
|
-
const summarizerClientElectionEnabled = (_c =
|
|
485
|
+
const summarizerClientElectionEnabled = (_c = this.mc.config.getBoolean("Fluid.ContainerRuntime.summarizerClientElection")) !== null && _c !== void 0 ? _c : ((_d = this.runtimeOptions.summaryOptions) === null || _d === void 0 ? void 0 : _d.summarizerClientElection) === true;
|
|
486
|
+
const maxOpsSinceLastSummary = (_e = this.runtimeOptions.summaryOptions.maxOpsSinceLastSummary) !== null && _e !== void 0 ? _e : 7000;
|
|
504
487
|
this.summarizerClientElection = new summarizerClientElection_1.SummarizerClientElection(orderedClientLogger, this.summaryCollection, orderedClientElectionForSummarizer, maxOpsSinceLastSummary, summarizerClientElectionEnabled);
|
|
505
488
|
if (this.context.clientDetails.type === summarizerClientElection_1.summarizerClientType) {
|
|
506
|
-
this._summarizer = new summarizer_1.Summarizer("/_summarizer", this /* ISummarizerRuntime */, () => this.summaryConfiguration, this /* ISummarizerInternalsProvider */, this.
|
|
489
|
+
this._summarizer = new summarizer_1.Summarizer("/_summarizer", this /* ISummarizerRuntime */, () => this.summaryConfiguration, this /* ISummarizerInternalsProvider */, this.handleContext, this.summaryCollection, async (runtime) => runWhileConnectedCoordinator_1.RunWhileConnectedCoordinator.create(runtime));
|
|
507
490
|
}
|
|
508
491
|
else if (summarizerClientElection_1.SummarizerClientElection.clientDetailsPermitElection(this.context.clientDetails)) {
|
|
509
|
-
//
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
492
|
+
// Only create a SummaryManager and SummarizerClientElection
|
|
493
|
+
// if summaries are enabled and we are not the summarizer client.
|
|
494
|
+
const defaultAction = () => {
|
|
495
|
+
if (this.summaryCollection.opsSinceLastAck > maxOpsSinceLastSummary) {
|
|
496
|
+
this.logger.sendErrorEvent({ eventName: "SummaryStatus:Behind" });
|
|
497
|
+
// unregister default to no log on every op after falling behind
|
|
498
|
+
// and register summary ack handler to re-register this handler
|
|
499
|
+
// after successful summary
|
|
500
|
+
this.summaryCollection.once(protocol_definitions_1.MessageType.SummaryAck, () => {
|
|
501
|
+
this.logger.sendTelemetryEvent({ eventName: "SummaryStatus:CaughtUp" });
|
|
502
|
+
// we've caught up, so re-register the default action to monitor for
|
|
503
|
+
// falling behind, and unregister ourself
|
|
504
|
+
this.summaryCollection.on("default", defaultAction);
|
|
505
|
+
});
|
|
506
|
+
this.summaryCollection.off("default", defaultAction);
|
|
507
|
+
}
|
|
514
508
|
};
|
|
509
|
+
this.summaryCollection.on("default", defaultAction);
|
|
510
|
+
// Create the SummaryManager and mark the initial state
|
|
515
511
|
this.summaryManager = new summaryManager_1.SummaryManager(this.summarizerClientElection, this, // IConnectedState
|
|
516
|
-
this.summaryCollection, this.logger,
|
|
512
|
+
this.summaryCollection, this.logger, this.formRequestSummarizerFn(this.context.loader), new throttler_1.Throttler(60 * 1000, // 60 sec delay window
|
|
517
513
|
30 * 1000, // 30 sec max delay
|
|
518
514
|
// throttling function increases exponentially (0ms, 40ms, 80ms, 160ms, etc)
|
|
519
515
|
throttler_1.formExponentialFn({ coefficient: 20, initialDelay: 0 })), {
|
|
@@ -526,7 +522,6 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
526
522
|
this.deltaManager.on("readonly", (readonly) => {
|
|
527
523
|
// we accumulate ops while being in read-only state.
|
|
528
524
|
// once user gets write permissions and we have active connection, flush all pending ops.
|
|
529
|
-
// eslint-disable-next-line max-len
|
|
530
525
|
common_utils_1.assert(readonly === this.deltaManager.readOnlyInfo.readonly, 0x124 /* "inconsistent readonly property/event state" */);
|
|
531
526
|
// We need to be very careful with when we (re)send pending ops, to ensure that we only send ops
|
|
532
527
|
// when we either never send an op, or attempted to send it but we know for sure it was not
|
|
@@ -563,7 +558,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
563
558
|
* @param existing - (optional) When loading from an existing snapshot. Precedes context.existing if provided
|
|
564
559
|
*/
|
|
565
560
|
static async load(context, registryEntries, requestHandler, runtimeOptions = {}, containerScope = context.scope, existing) {
|
|
566
|
-
var _a, _b, _c
|
|
561
|
+
var _a, _b, _c;
|
|
567
562
|
// If taggedLogger exists, use it. Otherwise, wrap the vanilla logger:
|
|
568
563
|
const passLogger = (_a = context.taggedLogger) !== null && _a !== void 0 ? _a : new telemetry_utils_1.TaggedLoggerAdapter(context.logger);
|
|
569
564
|
const logger = telemetry_utils_1.ChildLogger.create(passLogger, undefined, {
|
|
@@ -605,19 +600,22 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
605
600
|
return driver_utils_1.readAndParse(storage, blobId);
|
|
606
601
|
}
|
|
607
602
|
};
|
|
608
|
-
const chunks
|
|
609
|
-
|
|
610
|
-
|
|
603
|
+
const [chunks, metadata, electedSummarizerData, aliases] = await Promise.all([
|
|
604
|
+
tryFetchBlob(summaryFormat_1.chunksBlobName),
|
|
605
|
+
tryFetchBlob(summaryFormat_1.metadataBlobName),
|
|
606
|
+
tryFetchBlob(summaryFormat_1.electedSummarizerBlobName),
|
|
607
|
+
tryFetchBlob(summaryFormat_1.aliasBlobName),
|
|
608
|
+
]);
|
|
611
609
|
const loadExisting = existing === true || context.existing === true;
|
|
612
610
|
// read snapshot blobs needed for BlobManager to load
|
|
613
|
-
const blobManagerSnapshot = await blobManager_1.BlobManager.load((
|
|
611
|
+
const blobManagerSnapshot = await blobManager_1.BlobManager.load((_b = context.baseSnapshot) === null || _b === void 0 ? void 0 : _b.trees[summaryFormat_1.blobsTreeName], async (id) => {
|
|
614
612
|
// IContainerContext storage api return type still has undefined in 0.39 package version.
|
|
615
613
|
// So once we release 0.40 container-defn package we can remove this check.
|
|
616
614
|
common_utils_1.assert(storage !== undefined, 0x256 /* "storage undefined in attached container" */);
|
|
617
615
|
return driver_utils_1.readAndParse(storage, id);
|
|
618
616
|
});
|
|
619
617
|
// Verify summary runtime sequence number matches protocol sequence number.
|
|
620
|
-
const runtimeSequenceNumber = (
|
|
618
|
+
const runtimeSequenceNumber = (_c = metadata === null || metadata === void 0 ? void 0 : metadata.message) === null || _c === void 0 ? void 0 : _c.sequenceNumber;
|
|
621
619
|
if (runtimeSequenceNumber !== undefined) {
|
|
622
620
|
const protocolSequenceNumber = context.deltaManager.initialSequenceNumber;
|
|
623
621
|
// Unless bypass is explicitly set, then take action when sequence numbers mismatch.
|
|
@@ -632,13 +630,16 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
632
630
|
}
|
|
633
631
|
}
|
|
634
632
|
}
|
|
635
|
-
const runtime = new ContainerRuntime(context, registry, metadata, electedSummarizerData, chunks, {
|
|
633
|
+
const runtime = new ContainerRuntime(context, registry, metadata, electedSummarizerData, chunks !== null && chunks !== void 0 ? chunks : [], aliases !== null && aliases !== void 0 ? aliases : [], {
|
|
636
634
|
summaryOptions,
|
|
637
635
|
gcOptions,
|
|
638
636
|
loadSequenceNumberVerification,
|
|
639
637
|
}, containerScope, logger, loadExisting, blobManagerSnapshot, requestHandler, storage);
|
|
640
638
|
return runtime;
|
|
641
639
|
}
|
|
640
|
+
/**
|
|
641
|
+
* @deprecated This will be removed in a later release. Deprecated in 0.53
|
|
642
|
+
*/
|
|
642
643
|
get id() {
|
|
643
644
|
return this.context.id;
|
|
644
645
|
}
|
|
@@ -689,6 +690,9 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
689
690
|
get attachState() {
|
|
690
691
|
return this.context.attachState;
|
|
691
692
|
}
|
|
693
|
+
get IFluidHandleContext() {
|
|
694
|
+
return this.handleContext;
|
|
695
|
+
}
|
|
692
696
|
get connected() {
|
|
693
697
|
return this._connected;
|
|
694
698
|
}
|
|
@@ -709,13 +713,15 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
709
713
|
get writeGCDataAtRoot() {
|
|
710
714
|
return this.garbageCollector.writeDataAtRoot;
|
|
711
715
|
}
|
|
712
|
-
static get defaultFlushMode() {
|
|
713
|
-
return localStorageFeatureGates_1.getLocalStorageFeatureGate(turnBasedFlushModeKey) ? runtime_definitions_1.FlushMode.TurnBased : runtime_definitions_1.FlushMode.Immediate;
|
|
714
|
-
}
|
|
715
716
|
get summarizer() {
|
|
716
717
|
common_utils_1.assert(this._summarizer !== undefined, 0x257 /* "This is not summarizing container" */);
|
|
717
718
|
return this._summarizer;
|
|
718
719
|
}
|
|
720
|
+
get summariesDisabled() {
|
|
721
|
+
var _a;
|
|
722
|
+
return this.runtimeOptions.summaryOptions.disableSummaries === true ||
|
|
723
|
+
((_a = this.runtimeOptions.summaryOptions.summaryConfigOverrides) === null || _a === void 0 ? void 0 : _a.disableSummaries) === true;
|
|
724
|
+
}
|
|
719
725
|
dispose(error) {
|
|
720
726
|
var _a;
|
|
721
727
|
if (this._disposed) {
|
|
@@ -875,6 +881,10 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
875
881
|
const content = JSON.stringify([...this.chunkMap]);
|
|
876
882
|
runtime_utils_1.addBlobToSummary(summaryTree, summaryFormat_1.chunksBlobName, content);
|
|
877
883
|
}
|
|
884
|
+
const dataStoreAliases = this.dataStores.aliases();
|
|
885
|
+
if (dataStoreAliases.size > 0) {
|
|
886
|
+
runtime_utils_1.addBlobToSummary(summaryTree, summaryFormat_1.aliasBlobName, JSON.stringify([...dataStoreAliases]));
|
|
887
|
+
}
|
|
878
888
|
if (this.summarizerClientElection) {
|
|
879
889
|
const electedSummarizerContent = JSON.stringify((_a = this.summarizerClientElection) === null || _a === void 0 ? void 0 : _a.serialize());
|
|
880
890
|
runtime_utils_1.addBlobToSummary(summaryTree, summaryFormat_1.electedSummarizerBlobName, electedSummarizerContent);
|
|
@@ -926,6 +936,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
926
936
|
return this.dataStores.applyStashedOp(op);
|
|
927
937
|
case ContainerMessageType.Attach:
|
|
928
938
|
return this.dataStores.applyStashedAttachOp(op);
|
|
939
|
+
case ContainerMessageType.Alias:
|
|
929
940
|
case ContainerMessageType.BlobAttach:
|
|
930
941
|
return;
|
|
931
942
|
case ContainerMessageType.ChunkedOp:
|
|
@@ -947,7 +958,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
947
958
|
this.replayPendingStates();
|
|
948
959
|
}
|
|
949
960
|
this.dataStores.setConnectionState(connected, clientId);
|
|
950
|
-
telemetry_utils_1.raiseConnectedEvent(this.
|
|
961
|
+
telemetry_utils_1.raiseConnectedEvent(this.mc.logger, this, connected, clientId);
|
|
951
962
|
}
|
|
952
963
|
process(messageArg, local) {
|
|
953
964
|
var _a;
|
|
@@ -981,6 +992,9 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
981
992
|
case ContainerMessageType.Attach:
|
|
982
993
|
this.dataStores.processAttachMessage(message, local || localAck);
|
|
983
994
|
break;
|
|
995
|
+
case ContainerMessageType.Alias:
|
|
996
|
+
this.processAliasMessage(message, localOpMetadata, local);
|
|
997
|
+
break;
|
|
984
998
|
case ContainerMessageType.FluidDataStoreOp:
|
|
985
999
|
// if localAck === true, treat this as a local op because it's one we sent on a previous container
|
|
986
1000
|
this.dataStores.processFluidDataStoreOp(message, local || localAck, localOpMetadata);
|
|
@@ -999,6 +1013,9 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
999
1013
|
throw e;
|
|
1000
1014
|
}
|
|
1001
1015
|
}
|
|
1016
|
+
processAliasMessage(message, localOpMetadata, local) {
|
|
1017
|
+
this.dataStores.processAliasMessage(message, localOpMetadata, local);
|
|
1018
|
+
}
|
|
1002
1019
|
processSignal(message, local) {
|
|
1003
1020
|
const envelope = message.content;
|
|
1004
1021
|
const transformed = {
|
|
@@ -1048,6 +1065,11 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1048
1065
|
return;
|
|
1049
1066
|
}
|
|
1050
1067
|
this.needsFlush = false;
|
|
1068
|
+
// Did we disconnect in the middle of turn-based batch?
|
|
1069
|
+
// If so, do nothing, as pending state manager will resubmit it correctly on reconnect.
|
|
1070
|
+
if (!this.canSendOps()) {
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1051
1073
|
return this.deltaSender.flush();
|
|
1052
1074
|
}
|
|
1053
1075
|
orderSequentially(callback) {
|
|
@@ -1064,11 +1086,13 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1064
1086
|
this.setFlushMode(runtime_definitions_1.FlushMode.TurnBased);
|
|
1065
1087
|
try {
|
|
1066
1088
|
this.trackOrderSequentiallyCalls(callback);
|
|
1067
|
-
}
|
|
1068
|
-
finally {
|
|
1069
1089
|
this.flush();
|
|
1070
1090
|
this.setFlushMode(savedFlushMode);
|
|
1071
1091
|
}
|
|
1092
|
+
catch (error) {
|
|
1093
|
+
this.closeFn(container_utils_1.CreateProcessingError(error, "orderSequentially"));
|
|
1094
|
+
throw error; // throw the original error for the consumer of the runtime
|
|
1095
|
+
}
|
|
1072
1096
|
}
|
|
1073
1097
|
trackOrderSequentiallyCalls(callback) {
|
|
1074
1098
|
try {
|
|
@@ -1236,12 +1260,21 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1236
1260
|
return this.dataStores.updateUsedRoutes(usedRoutes, gcTimestamp);
|
|
1237
1261
|
}
|
|
1238
1262
|
/**
|
|
1239
|
-
* Runs garbage collection and
|
|
1263
|
+
* Runs garbage collection and updates the reference / used state of the nodes in the container.
|
|
1240
1264
|
* @returns the statistics of the garbage collection run.
|
|
1241
1265
|
*/
|
|
1242
1266
|
async collectGarbage(options) {
|
|
1243
1267
|
return this.garbageCollector.collectGarbage(options);
|
|
1244
1268
|
}
|
|
1269
|
+
/**
|
|
1270
|
+
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
1271
|
+
* all references added in the system.
|
|
1272
|
+
* @param srcHandle - The handle of the node that added the reference.
|
|
1273
|
+
* @param outboundHandle - The handle of the outbound node that is referenced.
|
|
1274
|
+
*/
|
|
1275
|
+
addedGCOutboundReference(srcHandle, outboundHandle) {
|
|
1276
|
+
this.garbageCollector.addedOutboundReference(srcHandle.absolutePath, outboundHandle.absolutePath);
|
|
1277
|
+
}
|
|
1245
1278
|
/**
|
|
1246
1279
|
* Generates the summary tree, uploads it to storage, and then submits the summarize op.
|
|
1247
1280
|
* This is intended to be called by the summarizer, since it is the implementation of
|
|
@@ -1431,10 +1464,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1431
1464
|
this.dirtyContainer = dirty;
|
|
1432
1465
|
if (this.emitDirtyDocumentEvent) {
|
|
1433
1466
|
this.emit(dirty ? "dirty" : "saved");
|
|
1434
|
-
|
|
1435
|
-
if (this.context.updateDirtyContainerState !== undefined) {
|
|
1436
|
-
this.context.updateDirtyContainerState(dirty);
|
|
1437
|
-
}
|
|
1467
|
+
this.context.updateDirtyContainerState(dirty);
|
|
1438
1468
|
}
|
|
1439
1469
|
}
|
|
1440
1470
|
submitDataStoreOp(id, contents, localOpMetadata = undefined) {
|
|
@@ -1515,7 +1545,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1515
1545
|
// That might be not what caller hopes to get, but we can look deeper if telemetry tells us it's a problem.
|
|
1516
1546
|
const middleOfBatch = this.flushMode === runtime_definitions_1.FlushMode.TurnBased && this.needsFlush;
|
|
1517
1547
|
if (middleOfBatch) {
|
|
1518
|
-
this.
|
|
1548
|
+
this.mc.logger.sendErrorEvent({ eventName: "submitSystemMessageError", type });
|
|
1519
1549
|
}
|
|
1520
1550
|
return this.context.submitFn(type, contents, middleOfBatch);
|
|
1521
1551
|
}
|
|
@@ -1548,6 +1578,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1548
1578
|
this.dataStores.resubmitDataStoreOp(content, localOpMetadata);
|
|
1549
1579
|
break;
|
|
1550
1580
|
case ContainerMessageType.Attach:
|
|
1581
|
+
case ContainerMessageType.Alias:
|
|
1551
1582
|
this.submit(type, content, localOpMetadata);
|
|
1552
1583
|
break;
|
|
1553
1584
|
case ContainerMessageType.ChunkedOp:
|
|
@@ -1579,7 +1610,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1579
1610
|
* @returns downloaded snapshot's reference sequence number
|
|
1580
1611
|
*/
|
|
1581
1612
|
async refreshLatestSummaryAckFromServer(summaryLogger) {
|
|
1582
|
-
const snapshot = await this.fetchSnapshotFromStorage(
|
|
1613
|
+
const snapshot = await this.fetchSnapshotFromStorage(null, summaryLogger, {
|
|
1583
1614
|
eventName: "RefreshLatestSummaryGetSnapshot",
|
|
1584
1615
|
fetchLatest: true,
|
|
1585
1616
|
});
|
|
@@ -1608,12 +1639,30 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1608
1639
|
return this.pendingStateManager.getLocalState();
|
|
1609
1640
|
}
|
|
1610
1641
|
/**
|
|
1611
|
-
*
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
return
|
|
1616
|
-
|
|
1642
|
+
* * Forms a function that will request a Summarizer.
|
|
1643
|
+
* @param loaderRouter - the loader acting as an IFluidRouter
|
|
1644
|
+
* */
|
|
1645
|
+
formRequestSummarizerFn(loaderRouter) {
|
|
1646
|
+
return async () => {
|
|
1647
|
+
const request = {
|
|
1648
|
+
headers: {
|
|
1649
|
+
[container_definitions_1.LoaderHeader.cache]: false,
|
|
1650
|
+
[container_definitions_1.LoaderHeader.clientDetails]: {
|
|
1651
|
+
capabilities: { interactive: false },
|
|
1652
|
+
type: summarizerClientElection_1.summarizerClientType,
|
|
1653
|
+
},
|
|
1654
|
+
[driver_definitions_1.DriverHeader.summarizingClient]: true,
|
|
1655
|
+
[container_definitions_1.LoaderHeader.reconnect]: false,
|
|
1656
|
+
},
|
|
1657
|
+
url: "/_summarizer",
|
|
1658
|
+
};
|
|
1659
|
+
const fluidObject = await runtime_utils_1.requestFluidObject(loaderRouter, request);
|
|
1660
|
+
const summarizer = fluidObject.ISummarizer;
|
|
1661
|
+
if (!summarizer) {
|
|
1662
|
+
throw new container_utils_1.UsageError("Fluid object does not implement ISummarizer");
|
|
1663
|
+
}
|
|
1664
|
+
return summarizer;
|
|
1665
|
+
};
|
|
1617
1666
|
}
|
|
1618
1667
|
}
|
|
1619
1668
|
exports.ContainerRuntime = ContainerRuntime;
|