@fluidframework/container-runtime 0.59.4001 → 1.1.0-75972
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/.eslintrc.js +1 -1
- package/dist/blobManager.d.ts +2 -2
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +12 -11
- package/dist/blobManager.js.map +1 -1
- package/dist/connectionTelemetry.d.ts +19 -0
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +23 -23
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerRuntime.d.ts +137 -29
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +338 -118
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +14 -3
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +4 -2
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +16 -5
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreRegistry.d.ts +0 -4
- package/dist/dataStoreRegistry.d.ts.map +1 -1
- package/dist/dataStoreRegistry.js +12 -1
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/dataStores.d.ts +4 -3
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +13 -7
- package/dist/dataStores.js.map +1 -1
- package/dist/garbageCollection.d.ts +23 -27
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +44 -119
- 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 +2 -1
- package/dist/index.js.map +1 -1
- package/dist/orderedClientElection.js +0 -4
- package/dist/orderedClientElection.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/pendingStateManager.d.ts +30 -29
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +72 -109
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/runningSummarizer.d.ts +4 -3
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +11 -6
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/serializedSnapshotStorage.d.ts +58 -0
- package/dist/serializedSnapshotStorage.d.ts.map +1 -0
- package/dist/serializedSnapshotStorage.js +108 -0
- package/dist/serializedSnapshotStorage.js.map +1 -0
- package/dist/summarizer.d.ts +11 -4
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +18 -9
- package/dist/summarizer.js.map +1 -1
- package/dist/summarizerHeuristics.d.ts +5 -3
- package/dist/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summarizerHeuristics.js +10 -3
- package/dist/summarizerHeuristics.js.map +1 -1
- package/dist/summarizerTypes.d.ts +4 -2
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryManager.d.ts +3 -3
- package/dist/summaryManager.d.ts.map +1 -1
- package/dist/summaryManager.js +7 -7
- package/dist/summaryManager.js.map +1 -1
- package/garbageCollection.md +9 -1
- package/lib/blobManager.d.ts +2 -2
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +12 -11
- package/lib/blobManager.js.map +1 -1
- package/lib/connectionTelemetry.d.ts +19 -0
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js +23 -23
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerRuntime.d.ts +137 -29
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +341 -121
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +15 -4
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +4 -2
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +16 -5
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreRegistry.d.ts +0 -4
- package/lib/dataStoreRegistry.d.ts.map +1 -1
- package/lib/dataStoreRegistry.js +12 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/dataStores.d.ts +4 -3
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +14 -8
- package/lib/dataStores.js.map +1 -1
- package/lib/garbageCollection.d.ts +23 -27
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +43 -117
- 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 +1 -1
- package/lib/index.js.map +1 -1
- package/lib/orderedClientElection.js +0 -4
- package/lib/orderedClientElection.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/pendingStateManager.d.ts +30 -29
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +72 -109
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/runningSummarizer.d.ts +4 -3
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +11 -6
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/serializedSnapshotStorage.d.ts +58 -0
- package/lib/serializedSnapshotStorage.d.ts.map +1 -0
- package/lib/serializedSnapshotStorage.js +104 -0
- package/lib/serializedSnapshotStorage.js.map +1 -0
- package/lib/summarizer.d.ts +11 -4
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +18 -9
- package/lib/summarizer.js.map +1 -1
- package/lib/summarizerHeuristics.d.ts +5 -3
- package/lib/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summarizerHeuristics.js +10 -3
- package/lib/summarizerHeuristics.js.map +1 -1
- package/lib/summarizerTypes.d.ts +4 -2
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryManager.d.ts +3 -3
- package/lib/summaryManager.d.ts.map +1 -1
- package/lib/summaryManager.js +7 -7
- package/lib/summaryManager.js.map +1 -1
- package/package.json +19 -32
- package/src/blobManager.ts +29 -15
- package/src/connectionTelemetry.ts +60 -39
- package/src/containerRuntime.ts +502 -156
- package/src/dataStore.ts +21 -4
- package/src/dataStoreContext.ts +27 -5
- package/src/dataStoreRegistry.ts +8 -1
- package/src/dataStores.ts +21 -8
- package/src/garbageCollection.ts +81 -166
- package/src/index.ts +7 -1
- package/src/orderedClientElection.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +104 -123
- package/src/runningSummarizer.ts +20 -10
- package/src/serializedSnapshotStorage.ts +146 -0
- package/src/summarizer.ts +20 -16
- package/src/summarizerHeuristics.ts +21 -5
- package/src/summarizerTypes.ts +4 -2
- package/src/summaryManager.ts +5 -6
package/src/summarizer.ts
CHANGED
|
@@ -19,8 +19,8 @@ import {
|
|
|
19
19
|
} from "@fluidframework/core-interfaces";
|
|
20
20
|
import {
|
|
21
21
|
ISequencedDocumentMessage,
|
|
22
|
-
ISummaryConfiguration,
|
|
23
22
|
} from "@fluidframework/protocol-definitions";
|
|
23
|
+
import { ISummaryConfiguration } from "./containerRuntime";
|
|
24
24
|
import { ICancellableSummarizerController } from "./runWhileConnectedCoordinator";
|
|
25
25
|
import { summarizerClientType } from "./summarizerClientElection";
|
|
26
26
|
import { SummaryCollection } from "./summaryCollection";
|
|
@@ -29,7 +29,6 @@ import { RunningSummarizer } from "./runningSummarizer";
|
|
|
29
29
|
import {
|
|
30
30
|
ISummarizer,
|
|
31
31
|
ISummarizerInternalsProvider,
|
|
32
|
-
ISummarizerOptions,
|
|
33
32
|
ISummarizerRuntime,
|
|
34
33
|
ISummarizingWarning,
|
|
35
34
|
SummarizerStopReason,
|
|
@@ -136,11 +135,9 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
136
135
|
return fluidObject.ISummarizer;
|
|
137
136
|
}
|
|
138
137
|
|
|
139
|
-
public async run(
|
|
140
|
-
onBehalfOf: string,
|
|
141
|
-
options?: Readonly<Partial<ISummarizerOptions>>): Promise<SummarizerStopReason> {
|
|
138
|
+
public async run(onBehalfOf: string): Promise<SummarizerStopReason> {
|
|
142
139
|
try {
|
|
143
|
-
return await this.runCore(onBehalfOf
|
|
140
|
+
return await this.runCore(onBehalfOf);
|
|
144
141
|
} catch (error) {
|
|
145
142
|
this.stop("summarizerException");
|
|
146
143
|
throw SummarizingWarning.wrap(error, false /* logged */, this.logger);
|
|
@@ -165,9 +162,7 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
165
162
|
this.runtime.closeFn();
|
|
166
163
|
}
|
|
167
164
|
|
|
168
|
-
private async runCore(
|
|
169
|
-
onBehalfOf: string,
|
|
170
|
-
options?: Readonly<Partial<ISummarizerOptions>>): Promise<SummarizerStopReason> {
|
|
165
|
+
private async runCore(onBehalfOf: string): Promise<SummarizerStopReason> {
|
|
171
166
|
const runCoordinator: ICancellableSummarizerController = await this.runCoordinatorCreateFn(this.runtime);
|
|
172
167
|
|
|
173
168
|
// Wait for either external signal to cancel, or loss of connectivity.
|
|
@@ -184,7 +179,7 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
184
179
|
return runCoordinator.waitCancelled;
|
|
185
180
|
}
|
|
186
181
|
|
|
187
|
-
const runningSummarizer = await this.start(onBehalfOf, runCoordinator
|
|
182
|
+
const runningSummarizer = await this.start(onBehalfOf, runCoordinator);
|
|
188
183
|
|
|
189
184
|
// Wait for either external signal to cancel, or loss of connectivity.
|
|
190
185
|
const stopReason = await stopP;
|
|
@@ -206,7 +201,8 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
206
201
|
// cons of #2 substantially.
|
|
207
202
|
|
|
208
203
|
// Cleanup after running
|
|
209
|
-
await runningSummarizer.waitStop(
|
|
204
|
+
await runningSummarizer.waitStop(
|
|
205
|
+
!runCoordinator.cancelled && Summarizer.stopReasonCanRunLastSummary(stopReason));
|
|
210
206
|
|
|
211
207
|
// Propagate reason and ensure that if someone is waiting for cancellation token, they are moving to exit
|
|
212
208
|
runCoordinator.stop(stopReason);
|
|
@@ -214,19 +210,28 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
214
210
|
return stopReason;
|
|
215
211
|
}
|
|
216
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Should we try to run a last summary for the given stop reason?
|
|
215
|
+
* Currently only allows "parentNotConnected"
|
|
216
|
+
* @param stopReason - SummarizerStopReason
|
|
217
|
+
* @returns - true if the stop reason can run a last summary
|
|
218
|
+
*/
|
|
219
|
+
public static stopReasonCanRunLastSummary(stopReason: SummarizerStopReason): boolean {
|
|
220
|
+
return stopReason === "parentNotConnected";
|
|
221
|
+
}
|
|
222
|
+
|
|
217
223
|
/**
|
|
218
224
|
* Put the summarizer in a started state, including creating and initializing the RunningSummarizer.
|
|
219
225
|
* The start request can come either from the SummaryManager (in the auto-summarize case) or from the user
|
|
220
226
|
* (in the on-demand case).
|
|
221
227
|
* @param onBehalfOf - ID of the client that requested that the summarizer start
|
|
222
228
|
* @param runCoordinator - cancellation token
|
|
223
|
-
* @param
|
|
229
|
+
* @param newConfig - Summary configuration to override the existing config when invoking the RunningSummarizer.
|
|
224
230
|
* @returns - Promise that is fulfilled when the RunningSummarizer is ready
|
|
225
231
|
*/
|
|
226
232
|
private async start(
|
|
227
233
|
onBehalfOf: string,
|
|
228
|
-
runCoordinator: ICancellableSummarizerController
|
|
229
|
-
options?: Readonly<Partial<ISummarizerOptions>>): Promise<RunningSummarizer> {
|
|
234
|
+
runCoordinator: ICancellableSummarizerController): Promise<RunningSummarizer> {
|
|
230
235
|
if (this.runningSummarizer) {
|
|
231
236
|
if (this.runningSummarizer.disposed) {
|
|
232
237
|
throw new UsageError("Starting a disposed summarizer");
|
|
@@ -272,7 +277,6 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
272
277
|
this.summaryCollection,
|
|
273
278
|
runCoordinator /* cancellationToken */,
|
|
274
279
|
(reason) => runCoordinator.stop(reason), /* stopSummarizerCallback */
|
|
275
|
-
options,
|
|
276
280
|
);
|
|
277
281
|
this.runningSummarizer = runningSummarizer;
|
|
278
282
|
this.starting = false;
|
|
@@ -343,7 +347,7 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
343
347
|
coordinatorCreateP.then((runCoordinator) => {
|
|
344
348
|
// Successully created the cancellation token. Start the summarizer.
|
|
345
349
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
346
|
-
const startP = this.start(this.runtime.clientId!, runCoordinator
|
|
350
|
+
const startP = this.start(this.runtime.clientId!, runCoordinator);
|
|
347
351
|
startP.then(async (runningSummarizer) => {
|
|
348
352
|
// Successfully started the summarizer. Run it.
|
|
349
353
|
runningSummarizer.summarizeOnDemand(builder, ...args);
|
|
@@ -3,9 +3,15 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
6
7
|
import { Timer } from "@fluidframework/common-utils";
|
|
7
|
-
import {
|
|
8
|
-
|
|
8
|
+
import { ISummaryConfigurationHeuristics } from "./containerRuntime";
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
ISummarizeHeuristicData,
|
|
12
|
+
ISummarizeHeuristicRunner,
|
|
13
|
+
ISummarizeAttempt,
|
|
14
|
+
} from "./summarizerTypes";
|
|
9
15
|
import { SummarizeReason } from "./summaryGenerator";
|
|
10
16
|
|
|
11
17
|
/** Simple implementation of class for tracking summarize heuristic data. */
|
|
@@ -51,16 +57,18 @@ export class SummarizeHeuristicData implements ISummarizeHeuristicData {
|
|
|
51
57
|
*/
|
|
52
58
|
export class SummarizeHeuristicRunner implements ISummarizeHeuristicRunner {
|
|
53
59
|
private readonly idleTimer: Timer;
|
|
60
|
+
private readonly minOpsForLastSummaryAttempt: number;
|
|
54
61
|
|
|
55
62
|
public constructor(
|
|
56
63
|
private readonly heuristicData: ISummarizeHeuristicData,
|
|
57
|
-
private readonly configuration:
|
|
64
|
+
private readonly configuration: ISummaryConfigurationHeuristics,
|
|
58
65
|
private readonly trySummarize: (reason: SummarizeReason) => void,
|
|
59
|
-
private readonly
|
|
66
|
+
private readonly logger: ITelemetryLogger,
|
|
60
67
|
) {
|
|
61
68
|
this.idleTimer = new Timer(
|
|
62
69
|
this.configuration.idleTime,
|
|
63
70
|
() => this.trySummarize("idle"));
|
|
71
|
+
this.minOpsForLastSummaryAttempt = this.configuration.minOpsForLastSummaryAttempt;
|
|
64
72
|
}
|
|
65
73
|
|
|
66
74
|
public get opsSinceLastAck(): number {
|
|
@@ -83,7 +91,15 @@ export class SummarizeHeuristicRunner implements ISummarizeHeuristicRunner {
|
|
|
83
91
|
|
|
84
92
|
public shouldRunLastSummary(): boolean {
|
|
85
93
|
const opsSinceLastAck = this.opsSinceLastAck;
|
|
86
|
-
|
|
94
|
+
const minOpsForLastSummaryAttempt = this.minOpsForLastSummaryAttempt;
|
|
95
|
+
|
|
96
|
+
this.logger.sendTelemetryEvent({
|
|
97
|
+
eventName: "ShouldRunLastSummary",
|
|
98
|
+
opsSinceLastAck,
|
|
99
|
+
minOpsForLastSummaryAttempt,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
return opsSinceLastAck >= minOpsForLastSummaryAttempt;
|
|
87
103
|
}
|
|
88
104
|
|
|
89
105
|
public dispose() {
|
package/src/summarizerTypes.ts
CHANGED
|
@@ -67,7 +67,9 @@ export interface ISummarizerInternalsProvider {
|
|
|
67
67
|
): Promise<void>;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated Options that control the behavior of a running summarizer.
|
|
72
|
+
* */
|
|
71
73
|
export interface ISummarizerOptions {
|
|
72
74
|
/**
|
|
73
75
|
* Set to true to disable the default heuristics from running; false by default.
|
|
@@ -309,7 +311,7 @@ export interface ISummarizer extends
|
|
|
309
311
|
/* Closes summarizer. Any pending processes (summary in flight) are abandoned. */
|
|
310
312
|
close(): void;
|
|
311
313
|
|
|
312
|
-
run(onBehalfOf: string,
|
|
314
|
+
run(onBehalfOf: string, disableHeuristics?: boolean): Promise<SummarizerStopReason>;
|
|
313
315
|
|
|
314
316
|
/**
|
|
315
317
|
* Attempts to generate a summary on demand. If already running, takes no action.
|
package/src/summaryManager.ts
CHANGED
|
@@ -11,7 +11,6 @@ import { ISummarizerClientElection } from "./summarizerClientElection";
|
|
|
11
11
|
import { IThrottler } from "./throttler";
|
|
12
12
|
import {
|
|
13
13
|
ISummarizer,
|
|
14
|
-
ISummarizerOptions,
|
|
15
14
|
SummarizerStopReason,
|
|
16
15
|
} from "./summarizerTypes";
|
|
17
16
|
import { SummaryCollection } from "./summaryCollection";
|
|
@@ -97,7 +96,7 @@ export class SummaryManager implements IDisposable {
|
|
|
97
96
|
initialDelayMs = defaultInitialDelayMs,
|
|
98
97
|
opsToBypassInitialDelay = defaultOpsToBypassInitialDelay,
|
|
99
98
|
}: Readonly<Partial<ISummaryManagerConfig>> = {},
|
|
100
|
-
private readonly
|
|
99
|
+
private readonly disableHeuristics?: boolean,
|
|
101
100
|
) {
|
|
102
101
|
this.logger = ChildLogger.create(
|
|
103
102
|
parentLogger,
|
|
@@ -141,12 +140,12 @@ export class SummaryManager implements IDisposable {
|
|
|
141
140
|
// enforce connectedState.clientId === clientElection.electedClientId. But once we're Running, we should
|
|
142
141
|
// only transition to Stopping when the electedParentId changes. Stopping the summarizer without
|
|
143
142
|
// changing the electedParent will just cause us to transition to Starting again.
|
|
144
|
-
if (
|
|
145
|
-
return { shouldSummarize: false, stopReason: "parentNotConnected" };
|
|
146
|
-
} else if (this.connectedState.clientId !== this.clientElection.electedParentId ||
|
|
143
|
+
if (this.connectedState.clientId !== this.clientElection.electedParentId ||
|
|
147
144
|
(this.state !== SummaryManagerState.Running &&
|
|
148
145
|
this.connectedState.clientId !== this.clientElection.electedClientId)) {
|
|
149
146
|
return { shouldSummarize: false, stopReason: "parentShouldNotSummarize" };
|
|
147
|
+
} else if (!this.connectedState.connected) {
|
|
148
|
+
return { shouldSummarize: false, stopReason: "parentNotConnected" };
|
|
150
149
|
} else if (this.disposed) {
|
|
151
150
|
assert(false, 0x260 /* "Disposed should mean disconnected!" */);
|
|
152
151
|
} else {
|
|
@@ -227,7 +226,7 @@ export class SummaryManager implements IDisposable {
|
|
|
227
226
|
return PerformanceEvent.timedExecAsync(
|
|
228
227
|
this.logger,
|
|
229
228
|
{ eventName: "RunningSummarizer", attempt: this.startThrottler.numAttempts },
|
|
230
|
-
async () => summarizer.run(clientId, this.
|
|
229
|
+
async () => summarizer.run(clientId, this.disableHeuristics),
|
|
231
230
|
);
|
|
232
231
|
}).then((reason: string) => {
|
|
233
232
|
this.logger.sendTelemetryEvent({
|