@fluidframework/container-runtime 1.2.2 → 2.0.0-internal.1.0.0.82159
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/blobManager.d.ts +81 -25
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +301 -100
- package/dist/blobManager.js.map +1 -1
- package/dist/containerRuntime.d.ts +65 -11
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +101 -82
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +32 -26
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +3 -4
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +16 -23
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStores.d.ts +5 -2
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +11 -3
- package/dist/dataStores.js.map +1 -1
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +17 -12
- package/dist/garbageCollection.js.map +1 -1
- package/dist/opProperties.d.ts +7 -0
- package/dist/opProperties.d.ts.map +1 -0
- package/dist/opProperties.js +20 -0
- package/dist/opProperties.js.map +1 -0
- 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/runningSummarizer.d.ts +14 -4
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +68 -26
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/summarizer.d.ts +0 -2
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +1 -12
- package/dist/summarizer.js.map +1 -1
- package/dist/summarizerHeuristics.d.ts +26 -4
- package/dist/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summarizerHeuristics.js +95 -18
- package/dist/summarizerHeuristics.js.map +1 -1
- package/dist/summarizerTypes.d.ts +30 -10
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryCollection.js +1 -1
- package/dist/summaryCollection.js.map +1 -1
- package/dist/summaryFormat.d.ts +0 -5
- package/dist/summaryFormat.d.ts.map +1 -1
- package/dist/summaryFormat.js.map +1 -1
- package/dist/summaryGenerator.d.ts +1 -0
- package/dist/summaryGenerator.d.ts.map +1 -1
- package/dist/summaryGenerator.js +11 -9
- package/dist/summaryGenerator.js.map +1 -1
- package/lib/blobManager.d.ts +81 -25
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +302 -101
- package/lib/blobManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +65 -11
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +103 -84
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +32 -26
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +3 -4
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +17 -24
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStores.d.ts +5 -2
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +11 -3
- package/lib/dataStores.js.map +1 -1
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +17 -12
- package/lib/garbageCollection.js.map +1 -1
- package/lib/opProperties.d.ts +7 -0
- package/lib/opProperties.d.ts.map +1 -0
- package/lib/opProperties.js +16 -0
- package/lib/opProperties.js.map +1 -0
- 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/runningSummarizer.d.ts +14 -4
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +68 -26
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/summarizer.d.ts +0 -2
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +1 -12
- package/lib/summarizer.js.map +1 -1
- package/lib/summarizerHeuristics.d.ts +26 -4
- package/lib/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summarizerHeuristics.js +95 -18
- package/lib/summarizerHeuristics.js.map +1 -1
- package/lib/summarizerTypes.d.ts +30 -10
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryCollection.js +1 -1
- package/lib/summaryCollection.js.map +1 -1
- package/lib/summaryFormat.d.ts +0 -5
- package/lib/summaryFormat.d.ts.map +1 -1
- package/lib/summaryFormat.js.map +1 -1
- package/lib/summaryGenerator.d.ts +1 -0
- package/lib/summaryGenerator.d.ts.map +1 -1
- package/lib/summaryGenerator.js +11 -9
- package/lib/summaryGenerator.js.map +1 -1
- package/package.json +45 -20
- package/src/blobManager.ts +360 -119
- package/src/containerRuntime.ts +203 -103
- package/src/dataStore.ts +53 -38
- package/src/dataStoreContext.ts +16 -23
- package/src/dataStores.ts +14 -3
- package/src/garbageCollection.ts +13 -7
- package/src/opProperties.ts +19 -0
- package/src/packageVersion.ts +1 -1
- package/src/runningSummarizer.ts +75 -22
- package/src/summarizer.ts +1 -18
- package/src/summarizerHeuristics.ts +133 -19
- package/src/summarizerTypes.ts +37 -10
- package/src/summaryCollection.ts +1 -1
- package/src/summaryFormat.ts +0 -6
- package/src/summaryGenerator.ts +40 -22
- package/dist/opTelemetry.d.ts +0 -22
- package/dist/opTelemetry.d.ts.map +0 -1
- package/dist/opTelemetry.js +0 -59
- package/dist/opTelemetry.js.map +0 -1
- package/lib/opTelemetry.d.ts +0 -22
- package/lib/opTelemetry.d.ts.map +0 -1
- package/lib/opTelemetry.js +0 -55
- package/lib/opTelemetry.js.map +0 -1
- package/src/opTelemetry.ts +0 -71
|
@@ -9,6 +9,26 @@ export class SummarizeHeuristicData {
|
|
|
9
9
|
/** Baseline attempt data used for comparisons with subsequent attempts/calculations. */
|
|
10
10
|
attemptBaseline) {
|
|
11
11
|
this.lastOpSequenceNumber = lastOpSequenceNumber;
|
|
12
|
+
this.numNonRuntimeOps = 0;
|
|
13
|
+
this.totalOpsSize = 0;
|
|
14
|
+
this.hasMissingOpData = false;
|
|
15
|
+
/**
|
|
16
|
+
* Cumulative size in bytes of all the ops at the beginning of the summarization attempt.
|
|
17
|
+
* Is used to adjust totalOpsSize appropriately after successful summarization.
|
|
18
|
+
*/
|
|
19
|
+
/** */
|
|
20
|
+
this.totalOpsSizeBefore = 0;
|
|
21
|
+
/**
|
|
22
|
+
* Number of system ops at beginning of attempting to summarize.
|
|
23
|
+
* Is used to adjust numSystemOps appropriately after successful summarization.
|
|
24
|
+
*/
|
|
25
|
+
this.numSystemOpsBefore = 0;
|
|
26
|
+
this.numRuntimeOps = 0;
|
|
27
|
+
/**
|
|
28
|
+
* Number of non-system ops at beginning of attempting to summarize.
|
|
29
|
+
* Is used to adjust numNonSystemOps appropriately after successful summarization.
|
|
30
|
+
*/
|
|
31
|
+
this.numNonSystemOpsBefore = 0;
|
|
12
32
|
this._lastAttempt = attemptBaseline;
|
|
13
33
|
this._lastSuccessfulSummary = Object.assign({}, attemptBaseline);
|
|
14
34
|
}
|
|
@@ -27,44 +47,70 @@ export class SummarizeHeuristicData {
|
|
|
27
47
|
refSequenceNumber: refSequenceNumber !== null && refSequenceNumber !== void 0 ? refSequenceNumber : this.lastOpSequenceNumber,
|
|
28
48
|
summaryTime: Date.now(),
|
|
29
49
|
};
|
|
50
|
+
this.numSystemOpsBefore = this.numNonRuntimeOps;
|
|
51
|
+
this.numNonSystemOpsBefore = this.numRuntimeOps;
|
|
52
|
+
this.totalOpsSizeBefore = this.totalOpsSize;
|
|
30
53
|
}
|
|
31
54
|
markLastAttemptAsSuccessful() {
|
|
32
55
|
this._lastSuccessfulSummary = Object.assign({}, this.lastAttempt);
|
|
56
|
+
this.numNonRuntimeOps -= this.numSystemOpsBefore;
|
|
57
|
+
this.numSystemOpsBefore = 0;
|
|
58
|
+
this.numRuntimeOps -= this.numNonSystemOpsBefore;
|
|
59
|
+
this.numNonSystemOpsBefore = 0;
|
|
60
|
+
this.totalOpsSize -= this.totalOpsSizeBefore;
|
|
61
|
+
this.totalOpsSizeBefore = 0;
|
|
33
62
|
}
|
|
34
63
|
}
|
|
35
64
|
/**
|
|
36
65
|
* This class contains the heuristics for when to summarize.
|
|
37
66
|
*/
|
|
38
67
|
export class SummarizeHeuristicRunner {
|
|
39
|
-
constructor(heuristicData, configuration, trySummarize, logger) {
|
|
68
|
+
constructor(heuristicData, configuration, trySummarize, logger, summarizeStrategies = getDefaultSummaryHeuristicStrategies()) {
|
|
40
69
|
this.heuristicData = heuristicData;
|
|
41
70
|
this.configuration = configuration;
|
|
42
|
-
this.trySummarize = trySummarize;
|
|
43
71
|
this.logger = logger;
|
|
44
|
-
this.
|
|
45
|
-
this.
|
|
72
|
+
this.summarizeStrategies = summarizeStrategies;
|
|
73
|
+
this.idleTimer = new Timer(this.idleTime, () => this.runSummarize("idle"));
|
|
74
|
+
this.runSummarize = (reason) => {
|
|
75
|
+
var _a;
|
|
76
|
+
(_a = this.idleTimer) === null || _a === void 0 ? void 0 : _a.clear();
|
|
77
|
+
// We shouldn't attempt a summary if there are no new processed ops
|
|
78
|
+
const opsSinceLastAck = this.opsSinceLastAck;
|
|
79
|
+
if (opsSinceLastAck > 0) {
|
|
80
|
+
trySummarize(reason);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
get idleTime() {
|
|
85
|
+
const maxIdleTime = this.configuration.maxIdleTime;
|
|
86
|
+
const minIdleTime = this.configuration.minIdleTime;
|
|
87
|
+
const weightedNumOfOps = getWeightedNumberOfOps(this.heuristicData.numRuntimeOps, this.heuristicData.numNonRuntimeOps, this.configuration.runtimeOpWeight, this.configuration.nonRuntimeOpWeight);
|
|
88
|
+
const pToMaxOps = weightedNumOfOps * 1.0 / this.configuration.maxOps;
|
|
89
|
+
if (pToMaxOps >= 1) {
|
|
90
|
+
return minIdleTime;
|
|
91
|
+
}
|
|
92
|
+
// Return a ratioed idle time based on the percentage of ops
|
|
93
|
+
return maxIdleTime - ((maxIdleTime - minIdleTime) * pToMaxOps);
|
|
46
94
|
}
|
|
47
95
|
get opsSinceLastAck() {
|
|
48
96
|
return this.heuristicData.lastOpSequenceNumber - this.heuristicData.lastSuccessfulSummary.refSequenceNumber;
|
|
49
97
|
}
|
|
98
|
+
start() {
|
|
99
|
+
var _a;
|
|
100
|
+
(_a = this.idleTimer) === null || _a === void 0 ? void 0 : _a.start(this.idleTime);
|
|
101
|
+
}
|
|
50
102
|
run() {
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
else if (opsSinceLastAck > this.configuration.maxOps) {
|
|
58
|
-
this.idleTimer.clear();
|
|
59
|
-
this.trySummarize("maxOps");
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
this.idleTimer.restart();
|
|
103
|
+
var _a;
|
|
104
|
+
for (const strategy of this.summarizeStrategies) {
|
|
105
|
+
if (strategy.shouldRunSummary(this.configuration, this.heuristicData)) {
|
|
106
|
+
return this.runSummarize(strategy.summarizeReason);
|
|
107
|
+
}
|
|
63
108
|
}
|
|
109
|
+
(_a = this.idleTimer) === null || _a === void 0 ? void 0 : _a.restart(this.idleTime);
|
|
64
110
|
}
|
|
65
111
|
shouldRunLastSummary() {
|
|
66
112
|
const opsSinceLastAck = this.opsSinceLastAck;
|
|
67
|
-
const minOpsForLastSummaryAttempt = this.minOpsForLastSummaryAttempt;
|
|
113
|
+
const minOpsForLastSummaryAttempt = this.configuration.minOpsForLastSummaryAttempt;
|
|
68
114
|
this.logger.sendTelemetryEvent({
|
|
69
115
|
eventName: "ShouldRunLastSummary",
|
|
70
116
|
opsSinceLastAck,
|
|
@@ -73,7 +119,38 @@ export class SummarizeHeuristicRunner {
|
|
|
73
119
|
return opsSinceLastAck >= minOpsForLastSummaryAttempt;
|
|
74
120
|
}
|
|
75
121
|
dispose() {
|
|
76
|
-
|
|
122
|
+
var _a;
|
|
123
|
+
(_a = this.idleTimer) === null || _a === void 0 ? void 0 : _a.clear();
|
|
77
124
|
}
|
|
78
125
|
}
|
|
126
|
+
/** Strategy used to run a summary when it's been a while since our last successful summary */
|
|
127
|
+
class MaxTimeSummaryHeuristicStrategy {
|
|
128
|
+
constructor() {
|
|
129
|
+
this.summarizeReason = "maxTime";
|
|
130
|
+
}
|
|
131
|
+
shouldRunSummary(configuration, heuristicData) {
|
|
132
|
+
const timeSinceLastSummary = Date.now() - heuristicData.lastSuccessfulSummary.summaryTime;
|
|
133
|
+
return timeSinceLastSummary > configuration.maxTime;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function getWeightedNumberOfOps(runtimeOpCount, nonRuntimeOpCount, runtimeOpWeight, nonRuntimeOpWeight) {
|
|
137
|
+
return (runtimeOpWeight * runtimeOpCount)
|
|
138
|
+
+ (nonRuntimeOpWeight * nonRuntimeOpCount);
|
|
139
|
+
}
|
|
140
|
+
/** Strategy used to do a weighted analysis on the ops we've processed since the last successful summary */
|
|
141
|
+
class WeightedOpsSummaryHeuristicStrategy {
|
|
142
|
+
constructor() {
|
|
143
|
+
this.summarizeReason = "maxOps";
|
|
144
|
+
}
|
|
145
|
+
shouldRunSummary(configuration, heuristicData) {
|
|
146
|
+
const weightedNumOfOps = getWeightedNumberOfOps(heuristicData.numRuntimeOps, heuristicData.numNonRuntimeOps, configuration.runtimeOpWeight, configuration.nonRuntimeOpWeight);
|
|
147
|
+
return weightedNumOfOps > configuration.maxOps;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function getDefaultSummaryHeuristicStrategies() {
|
|
151
|
+
return [
|
|
152
|
+
new MaxTimeSummaryHeuristicStrategy(),
|
|
153
|
+
new WeightedOpsSummaryHeuristicStrategy(),
|
|
154
|
+
];
|
|
155
|
+
}
|
|
79
156
|
//# sourceMappingURL=summarizerHeuristics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerHeuristics.js","sourceRoot":"","sources":["../src/summarizerHeuristics.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAUrD,4EAA4E;AAC5E,MAAM,OAAO,sBAAsB;IAW/B,YACW,oBAA4B;IACnC,wFAAwF;IACxF,eAAkC;QAF3B,yBAAoB,GAApB,oBAAoB,CAAQ;QAInC,IAAI,CAAC,YAAY,GAAG,eAAe,CAAC;QACpC,IAAI,CAAC,sBAAsB,qBAAQ,eAAe,CAAE,CAAC;IACzD,CAAC;IAhBD,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAGD,IAAW,qBAAqB;QAC5B,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACvC,CAAC;IAWM,4BAA4B,CAAC,WAAwC;QACxE,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,sBAAsB,qBAAQ,WAAW,CAAE,CAAC;IACrD,CAAC;IAEM,aAAa,CAAC,iBAA0B;QAC3C,IAAI,CAAC,YAAY,GAAG;YAChB,iBAAiB,EAAE,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,IAAI,CAAC,oBAAoB;YACjE,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE;SAC1B,CAAC;IACN,CAAC;IAEM,2BAA2B;QAC9B,IAAI,CAAC,sBAAsB,qBAAQ,IAAI,CAAC,WAAW,CAAE,CAAC;IAC1D,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,wBAAwB;IAIjC,YACqB,aAAsC,EACtC,aAA8C,EAC9C,YAA+C,EAC/C,MAAwB;QAHxB,kBAAa,GAAb,aAAa,CAAyB;QACtC,kBAA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,2BAA2B;SAC9B,CAAC,CAAC;QAEH,OAAO,eAAe,IAAI,2BAA2B,CAAC;IAC1D,CAAC;IAEM,OAAO;QACV,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { Timer } from \"@fluidframework/common-utils\";\nimport { ISummaryConfigurationHeuristics } from \"./containerRuntime\";\n\nimport {\n ISummarizeHeuristicData,\n ISummarizeHeuristicRunner,\n ISummarizeAttempt,\n} from \"./summarizerTypes\";\nimport { SummarizeReason } from \"./summaryGenerator\";\n\n/** Simple implementation of class for tracking summarize heuristic data. */\nexport class SummarizeHeuristicData implements ISummarizeHeuristicData {\n protected _lastAttempt: ISummarizeAttempt;\n public get lastAttempt(): ISummarizeAttempt {\n return this._lastAttempt;\n }\n\n protected _lastSuccessfulSummary: Readonly<ISummarizeAttempt>;\n public get lastSuccessfulSummary(): Readonly<ISummarizeAttempt> {\n return this._lastSuccessfulSummary;\n }\n\n constructor(\n public lastOpSequenceNumber: number,\n /** Baseline attempt data used for comparisons with subsequent attempts/calculations. */\n attemptBaseline: ISummarizeAttempt,\n ) {\n this._lastAttempt = attemptBaseline;\n this._lastSuccessfulSummary = { ...attemptBaseline };\n }\n\n public updateWithLastSummaryAckInfo(lastSummary: Readonly<ISummarizeAttempt>) {\n this._lastAttempt = lastSummary;\n this._lastSuccessfulSummary = { ...lastSummary };\n }\n\n public recordAttempt(refSequenceNumber?: number) {\n this._lastAttempt = {\n refSequenceNumber: refSequenceNumber ?? this.lastOpSequenceNumber,\n summaryTime: Date.now(),\n };\n }\n\n public markLastAttemptAsSuccessful() {\n this._lastSuccessfulSummary = { ...this.lastAttempt };\n }\n}\n\n/**\n * This class contains the heuristics for when to summarize.\n */\nexport class SummarizeHeuristicRunner implements ISummarizeHeuristicRunner {\n private readonly idleTimer: Timer;\n private readonly minOpsForLastSummaryAttempt: number;\n\n public constructor(\n private readonly heuristicData: ISummarizeHeuristicData,\n private readonly configuration: ISummaryConfigurationHeuristics,\n private readonly trySummarize: (reason: SummarizeReason) => void,\n private readonly logger: ITelemetryLogger,\n ) {\n this.idleTimer = new Timer(\n this.configuration.idleTime,\n () => this.trySummarize(\"idle\"));\n this.minOpsForLastSummaryAttempt = this.configuration.minOpsForLastSummaryAttempt;\n }\n\n public get opsSinceLastAck(): number {\n return this.heuristicData.lastOpSequenceNumber - this.heuristicData.lastSuccessfulSummary.refSequenceNumber;\n }\n\n public run() {\n const timeSinceLastSummary = Date.now() - this.heuristicData.lastSuccessfulSummary.summaryTime;\n const opsSinceLastAck = this.opsSinceLastAck;\n if (timeSinceLastSummary > this.configuration.maxTime) {\n this.idleTimer.clear();\n this.trySummarize(\"maxTime\");\n } else if (opsSinceLastAck > this.configuration.maxOps) {\n this.idleTimer.clear();\n this.trySummarize(\"maxOps\");\n } else {\n this.idleTimer.restart();\n }\n }\n\n public shouldRunLastSummary(): boolean {\n const opsSinceLastAck = this.opsSinceLastAck;\n const minOpsForLastSummaryAttempt = this.minOpsForLastSummaryAttempt;\n\n this.logger.sendTelemetryEvent({\n eventName: \"ShouldRunLastSummary\",\n opsSinceLastAck,\n minOpsForLastSummaryAttempt,\n });\n\n return opsSinceLastAck >= minOpsForLastSummaryAttempt;\n }\n\n public dispose() {\n this.idleTimer.clear();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"summarizerHeuristics.js","sourceRoot":"","sources":["../src/summarizerHeuristics.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAUrD,4EAA4E;AAC5E,MAAM,OAAO,sBAAsB;IAmC/B,YACW,oBAA4B;IACnC,wFAAwF;IACxF,eAAkC;QAF3B,yBAAoB,GAApB,oBAAoB,CAAQ;QAzBhC,qBAAgB,GAAW,CAAC,CAAC;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,+BAA+B;IAArC;QACoB,oBAAe,GAA8B,SAAS,CAAC;IAS3E,CAAC;IAPU,gBAAgB,CACnB,aAA8C,EAC9C,aAAsC;QAEtC,MAAM,oBAAoB,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,aAAa,CAAC,qBAAqB,CAAC,WAAW,CAAC;QAC1F,OAAO,oBAAoB,GAAG,aAAa,CAAC,OAAO,CAAC;IACxD,CAAC;CACJ;AAED,SAAS,sBAAsB,CAC3B,cAAsB,EACtB,iBAAyB,EACzB,eAAuB,EACvB,kBAA0B;IAE1B,OAAO,CAAC,eAAe,GAAG,cAAc,CAAC;UAClC,CAAC,kBAAkB,GAAG,iBAAiB,CAAC,CAAC;AACpD,CAAC;AAED,2GAA2G;AAC3G,MAAM,mCAAmC;IAAzC;QACoB,oBAAe,GAA8B,QAAQ,CAAC;IAc1E,CAAC;IAZU,gBAAgB,CACnB,aAA8C,EAC9C,aAAsC;QAEtC,MAAM,gBAAgB,GAAG,sBAAsB,CAC3C,aAAa,CAAC,aAAa,EAC3B,aAAa,CAAC,gBAAgB,EAC9B,aAAa,CAAC,eAAe,EAC7B,aAAa,CAAC,kBAAkB,CACnC,CAAC;QACF,OAAO,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC;IACnD,CAAC;CACJ;AAED,SAAS,oCAAoC;IACzC,OAAO;QACH,IAAI,+BAA+B,EAAE;QACrC,IAAI,mCAAmC,EAAE;KAC5C,CAAC;AACN,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { Timer } from \"@fluidframework/common-utils\";\nimport { ISummaryConfigurationHeuristics } from \"./containerRuntime\";\nimport {\n ISummarizeHeuristicData,\n ISummarizeHeuristicRunner,\n ISummarizeAttempt,\n ISummaryHeuristicStrategy,\n} from \"./summarizerTypes\";\nimport { SummarizeReason } from \"./summaryGenerator\";\n\n/** Simple implementation of class for tracking summarize heuristic data. */\nexport class SummarizeHeuristicData implements ISummarizeHeuristicData {\n protected _lastAttempt: ISummarizeAttempt;\n public get lastAttempt(): ISummarizeAttempt {\n return this._lastAttempt;\n }\n\n protected _lastSuccessfulSummary: Readonly<ISummarizeAttempt>;\n public get lastSuccessfulSummary(): Readonly<ISummarizeAttempt> {\n return this._lastSuccessfulSummary;\n }\n\n public numNonRuntimeOps: number = 0;\n public totalOpsSize: number = 0;\n public hasMissingOpData: boolean = false;\n\n /**\n * Cumulative size in bytes of all the ops at the beginning of the summarization attempt.\n * Is used to adjust totalOpsSize appropriately after successful summarization.\n */\n /** */\n private totalOpsSizeBefore: number = 0;\n\n /**\n * Number of system ops at beginning of attempting to summarize.\n * Is used to adjust numSystemOps appropriately after successful summarization.\n */\n private numSystemOpsBefore: number = 0;\n\n public numRuntimeOps: number = 0;\n /**\n * Number of non-system ops at beginning of attempting to summarize.\n * Is used to adjust numNonSystemOps appropriately after successful summarization.\n */\n private numNonSystemOpsBefore: number = 0;\n\n constructor(\n public lastOpSequenceNumber: number,\n /** Baseline attempt data used for comparisons with subsequent attempts/calculations. */\n attemptBaseline: ISummarizeAttempt,\n ) {\n this._lastAttempt = attemptBaseline;\n this._lastSuccessfulSummary = { ...attemptBaseline };\n }\n\n public updateWithLastSummaryAckInfo(lastSummary: Readonly<ISummarizeAttempt>) {\n this._lastAttempt = lastSummary;\n this._lastSuccessfulSummary = { ...lastSummary };\n }\n\n public recordAttempt(refSequenceNumber?: number) {\n this._lastAttempt = {\n refSequenceNumber: refSequenceNumber ?? this.lastOpSequenceNumber,\n summaryTime: Date.now(),\n };\n\n this.numSystemOpsBefore = this.numNonRuntimeOps;\n this.numNonSystemOpsBefore = this.numRuntimeOps;\n this.totalOpsSizeBefore = this.totalOpsSize;\n }\n\n public markLastAttemptAsSuccessful() {\n this._lastSuccessfulSummary = { ...this.lastAttempt };\n\n this.numNonRuntimeOps -= this.numSystemOpsBefore;\n this.numSystemOpsBefore = 0;\n\n this.numRuntimeOps -= this.numNonSystemOpsBefore;\n this.numNonSystemOpsBefore = 0;\n\n this.totalOpsSize -= this.totalOpsSizeBefore;\n this.totalOpsSizeBefore = 0;\n }\n}\n\n/**\n * This class contains the heuristics for when to summarize.\n */\nexport class SummarizeHeuristicRunner implements ISummarizeHeuristicRunner {\n private readonly idleTimer: Timer | undefined;\n private readonly runSummarize: (reason: SummarizeReason) => void;\n\n public constructor(\n private readonly heuristicData: ISummarizeHeuristicData,\n private readonly configuration: ISummaryConfigurationHeuristics,\n trySummarize: (reason: SummarizeReason) => void,\n private readonly logger: ITelemetryLogger,\n private readonly summarizeStrategies: ISummaryHeuristicStrategy[] = getDefaultSummaryHeuristicStrategies(),\n ) {\n this.idleTimer = new Timer(\n this.idleTime,\n () => this.runSummarize(\"idle\"));\n\n this.runSummarize = (reason: SummarizeReason) => {\n this.idleTimer?.clear();\n\n // We shouldn't attempt a summary if there are no new processed ops\n const opsSinceLastAck = this.opsSinceLastAck;\n if (opsSinceLastAck > 0) {\n trySummarize(reason);\n }\n };\n }\n\n public get idleTime(): number {\n const maxIdleTime = this.configuration.maxIdleTime;\n const minIdleTime = this.configuration.minIdleTime;\n const weightedNumOfOps = getWeightedNumberOfOps(\n this.heuristicData.numRuntimeOps,\n this.heuristicData.numNonRuntimeOps,\n this.configuration.runtimeOpWeight,\n this.configuration.nonRuntimeOpWeight,\n );\n const pToMaxOps = weightedNumOfOps * 1.0 / this.configuration.maxOps;\n\n if (pToMaxOps >= 1) {\n return minIdleTime;\n }\n\n // Return a ratioed idle time based on the percentage of ops\n return maxIdleTime - ((maxIdleTime - minIdleTime) * pToMaxOps);\n }\n\n public get opsSinceLastAck(): number {\n return this.heuristicData.lastOpSequenceNumber - this.heuristicData.lastSuccessfulSummary.refSequenceNumber;\n }\n\n public start() {\n this.idleTimer?.start(this.idleTime);\n }\n\n public run() {\n for (const strategy of this.summarizeStrategies) {\n if (strategy.shouldRunSummary(this.configuration, this.heuristicData)) {\n return this.runSummarize(strategy.summarizeReason);\n }\n }\n\n this.idleTimer?.restart(this.idleTime);\n }\n\n public shouldRunLastSummary(): boolean {\n const opsSinceLastAck = this.opsSinceLastAck;\n const minOpsForLastSummaryAttempt = this.configuration.minOpsForLastSummaryAttempt;\n\n this.logger.sendTelemetryEvent({\n eventName: \"ShouldRunLastSummary\",\n opsSinceLastAck,\n minOpsForLastSummaryAttempt,\n });\n\n return opsSinceLastAck >= minOpsForLastSummaryAttempt;\n }\n\n public dispose() {\n this.idleTimer?.clear();\n }\n}\n\n/** Strategy used to run a summary when it's been a while since our last successful summary */\nclass MaxTimeSummaryHeuristicStrategy implements ISummaryHeuristicStrategy {\n public readonly summarizeReason: Readonly<SummarizeReason> = \"maxTime\";\n\n public shouldRunSummary(\n configuration: ISummaryConfigurationHeuristics,\n heuristicData: ISummarizeHeuristicData,\n ): boolean {\n const timeSinceLastSummary = Date.now() - heuristicData.lastSuccessfulSummary.summaryTime;\n return timeSinceLastSummary > configuration.maxTime;\n }\n}\n\nfunction getWeightedNumberOfOps(\n runtimeOpCount: number,\n nonRuntimeOpCount: number,\n runtimeOpWeight: number,\n nonRuntimeOpWeight: number,\n): number {\n return (runtimeOpWeight * runtimeOpCount)\n + (nonRuntimeOpWeight * nonRuntimeOpCount);\n}\n\n/** Strategy used to do a weighted analysis on the ops we've processed since the last successful summary */\nclass WeightedOpsSummaryHeuristicStrategy implements ISummaryHeuristicStrategy {\n public readonly summarizeReason: Readonly<SummarizeReason> = \"maxOps\";\n\n public shouldRunSummary(\n configuration: ISummaryConfigurationHeuristics,\n heuristicData: ISummarizeHeuristicData,\n ): boolean {\n const weightedNumOfOps = getWeightedNumberOfOps(\n heuristicData.numRuntimeOps,\n heuristicData.numNonRuntimeOps,\n configuration.runtimeOpWeight,\n configuration.nonRuntimeOpWeight,\n );\n return weightedNumOfOps > configuration.maxOps;\n }\n}\n\nfunction getDefaultSummaryHeuristicStrategies() {\n return [\n new MaxTimeSummaryHeuristicStrategy(),\n new WeightedOpsSummaryHeuristicStrategy(),\n ];\n}\n"]}
|
package/lib/summarizerTypes.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ import { ContainerWarning, IDeltaManager } from "@fluidframework/container-defin
|
|
|
9
9
|
import { ISequencedDocumentMessage, ISummaryTree, IDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
10
10
|
import { ISummaryStats } from "@fluidframework/runtime-definitions";
|
|
11
11
|
import { ISummaryAckMessage, ISummaryNackMessage, ISummaryOpMessage } from "./summaryCollection";
|
|
12
|
+
import { SummarizeReason } from "./summaryGenerator";
|
|
13
|
+
import { ISummaryConfigurationHeuristics } from ".";
|
|
12
14
|
/**
|
|
13
15
|
* @deprecated - This will be removed in a later release.
|
|
14
16
|
*/
|
|
@@ -70,7 +72,9 @@ export interface ISummarizerRuntime extends IConnectableRuntime {
|
|
|
70
72
|
/** clientId of parent (non-summarizing) container that owns summarizer container */
|
|
71
73
|
readonly summarizerClientId: string | undefined;
|
|
72
74
|
closeFn(): void;
|
|
75
|
+
/** @deprecated 1.0, please remove all implementations and usage */
|
|
73
76
|
on(event: "batchEnd", listener: (error: any, op: ISequencedDocumentMessage) => void): this;
|
|
77
|
+
/** @deprecated 1.0, please remove all implementations and usage */
|
|
74
78
|
removeListener(event: "batchEnd", listener: (error: any, op: ISequencedDocumentMessage) => void): this;
|
|
75
79
|
}
|
|
76
80
|
/** Options affecting summarize behavior. */
|
|
@@ -117,10 +121,6 @@ export interface IGeneratedSummaryStats extends ISummaryStats {
|
|
|
117
121
|
readonly gcTotalBlobsSize?: number;
|
|
118
122
|
/** The number of gc blobs in this summary. */
|
|
119
123
|
readonly gcBlobNodeCount?: number;
|
|
120
|
-
/** Sum of the sizes of all op contents since the last summary */
|
|
121
|
-
readonly opsSizesSinceLastSummary: number;
|
|
122
|
-
/** Number of non-system ops since the last summary. See {@link @fluidframework/protocol-base#isSystemMessage} */
|
|
123
|
-
readonly nonSystemOpsSinceLastSummary: number;
|
|
124
124
|
/** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */
|
|
125
125
|
readonly summaryNumber: number;
|
|
126
126
|
}
|
|
@@ -291,6 +291,14 @@ export interface ISummarizeHeuristicData {
|
|
|
291
291
|
readonly lastAttempt: ISummarizeAttempt;
|
|
292
292
|
/** Most recent summary that received an ack */
|
|
293
293
|
readonly lastSuccessfulSummary: Readonly<ISummarizeAttempt>;
|
|
294
|
+
/** Number of runtime ops since last summary */
|
|
295
|
+
numRuntimeOps: number;
|
|
296
|
+
/** Number of non-runtime ops since last summary */
|
|
297
|
+
numNonRuntimeOps: number;
|
|
298
|
+
/** Cumulative size in bytes of all the ops since the last summary */
|
|
299
|
+
totalOpsSize: number;
|
|
300
|
+
/** Wether or not this instance contains adjusted metrics due to missing op data */
|
|
301
|
+
hasMissingOpData: boolean;
|
|
294
302
|
/**
|
|
295
303
|
* Updates lastAttempt and lastSuccessfulAttempt based on the last summary.
|
|
296
304
|
* @param lastSummary - last ack summary
|
|
@@ -308,7 +316,9 @@ export interface ISummarizeHeuristicData {
|
|
|
308
316
|
}
|
|
309
317
|
/** Responsible for running heuristics determining when to summarize. */
|
|
310
318
|
export interface ISummarizeHeuristicRunner {
|
|
311
|
-
/**
|
|
319
|
+
/** Start specific heuristic trackers (ex: idle timer) */
|
|
320
|
+
start(): void;
|
|
321
|
+
/** Runs the heuristics to determine if it should try to summarize */
|
|
312
322
|
run(): void;
|
|
313
323
|
/** Runs a different heuristic to check if it should summarize before closing */
|
|
314
324
|
shouldRunLastSummary(): boolean;
|
|
@@ -326,6 +336,17 @@ declare type ISummarizeTelemetryOptionalProperties =
|
|
|
326
336
|
/** One-based count of phases we've attempted (used to index into an array of ISummarizeOptions */
|
|
327
337
|
"summaryAttemptPhase" | keyof ISummarizeOptions;
|
|
328
338
|
export declare type ISummarizeTelemetryProperties = Pick<ITelemetryProperties, ISummarizeTelemetryRequiredProperties> & Partial<Pick<ITelemetryProperties, ISummarizeTelemetryOptionalProperties>>;
|
|
339
|
+
/** Strategy used to heuristically determine when we should run a summary */
|
|
340
|
+
export interface ISummaryHeuristicStrategy {
|
|
341
|
+
/** Summarize reason for this summarize heuristic strategy (ex: "maxTime") */
|
|
342
|
+
summarizeReason: Readonly<SummarizeReason>;
|
|
343
|
+
/**
|
|
344
|
+
* Determines if this strategy's summarize criteria been met
|
|
345
|
+
* @param configuration - summary configuration we are to check against
|
|
346
|
+
* @param heuristicData - heuristic data used to confirm conditions are met
|
|
347
|
+
*/
|
|
348
|
+
shouldRunSummary(configuration: ISummaryConfigurationHeuristics, heuristicData: ISummarizeHeuristicData): boolean;
|
|
349
|
+
}
|
|
329
350
|
declare type SummaryGeneratorRequiredTelemetryProperties =
|
|
330
351
|
/** True to generate the full tree with no handle reuse optimizations */
|
|
331
352
|
"fullTree" |
|
|
@@ -345,11 +366,10 @@ declare type SummaryGeneratorOptionalTelemetryProperties =
|
|
|
345
366
|
/** Delta in sum of op sizes between the current reference sequence number and the reference
|
|
346
367
|
* sequence number of the last summary */
|
|
347
368
|
"opsSizesSinceLastSummary" |
|
|
348
|
-
/**
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
"nonSystemOpsSinceLastSummary" |
|
|
369
|
+
/** Delta between the number of non-runtime ops since the last summary */
|
|
370
|
+
"nonRuntimeOpsSinceLastSummary" |
|
|
371
|
+
/** Wether or not this instance contains adjusted metrics due to missing op data */
|
|
372
|
+
"hasMissingOpData" |
|
|
353
373
|
/** Time it took to generate the summary tree and stats. */
|
|
354
374
|
"generateDuration" |
|
|
355
375
|
/** The handle returned by storage pointing to the uploaded summary tree. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerTypes.d.ts","sourceRoot":"","sources":["../src/summarizerTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,MAAM,EACN,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,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,kDAAkD;IAClD,4BAA4B,EAAE,MAAM,MAAM,CAAC;CAC9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerTypes.js","sourceRoot":"","sources":["../src/summarizerTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAA6B,aAAa,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IEvent,\n IEventProvider,\n ITelemetryLogger,\n ITelemetryProperties,\n} from \"@fluidframework/common-definitions\";\nimport { ITelemetryLoggerPropertyBag } from \"@fluidframework/telemetry-utils\";\nimport {\n IFluidLoadable,\n} from \"@fluidframework/core-interfaces\";\nimport { ContainerWarning, IDeltaManager } from \"@fluidframework/container-definitions\";\nimport {\n ISequencedDocumentMessage,\n ISummaryTree,\n IDocumentMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport { ISummaryStats } from \"@fluidframework/runtime-definitions\";\nimport { ISummaryAckMessage, ISummaryNackMessage, ISummaryOpMessage } from \"./summaryCollection\";\n\n/**\n * @deprecated - This will be removed in a later release.\n */\nexport const ISummarizer: keyof IProvideSummarizer = \"ISummarizer\";\n\n/**\n * @deprecated - This will be removed in a later release.\n */\nexport interface IProvideSummarizer {\n /**\n * @deprecated - This will be removed in a later release.\n */\n readonly ISummarizer: ISummarizer;\n}\n\n/**\n * Similar to AbortSignal, but using promise instead of events\n * @param T - cancellation reason type\n */\nexport interface ICancellationToken<T> {\n /** Tells if this cancellable token is cancelled */\n readonly cancelled: boolean;\n /**\n * Promise that gets fulfilled when this cancellable token is cancelled\n * @returns reason of cancellation\n */\n readonly waitCancelled: Promise<T>;\n}\n\n/* Similar to AbortSignal, but using promise instead of events */\nexport type ISummaryCancellationToken = ICancellationToken<SummarizerStopReason>;\n\nexport interface ISummarizerInternalsProvider {\n /** Encapsulates the work to walk the internals of the running container to generate a summary */\n submitSummary(options: ISubmitSummaryOptions): Promise<SubmitSummaryResult>;\n\n /** Callback whenever a new SummaryAck is received, to update internal tracking state */\n refreshLatestSummaryAck(\n proposalHandle: string,\n ackHandle: string,\n summaryRefSeq: number,\n summaryLogger: ITelemetryLogger,\n ): Promise<void>;\n}\n\n/**\n * @deprecated Options that control the behavior of a running summarizer.\n * */\nexport interface ISummarizerOptions {\n /**\n * Set to true to disable the default heuristics from running; false by default.\n * This affects only the heuristics around when a summarizer should\n * submit summaries. So when it is disabled, summarizer clients should\n * not be expected to summarize unless an on-demand summary is requested.\n */\n disableHeuristics: boolean;\n}\n\nexport interface ISummarizingWarning extends ContainerWarning {\n readonly errorType: \"summarizingError\";\n readonly logged: boolean;\n}\n\nexport interface IConnectableRuntime {\n readonly disposed: boolean;\n readonly connected: boolean;\n readonly clientId: string | undefined;\n readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n once(event: \"connected\" | \"disconnected\" | \"dispose\", listener: () => void): this;\n}\n\nexport interface ISummarizerRuntime extends IConnectableRuntime {\n readonly logger: ITelemetryLogger;\n /** clientId of parent (non-summarizing) container that owns summarizer container */\n readonly summarizerClientId: string | undefined;\n closeFn(): void;\n on(event: \"batchEnd\", listener: (error: any, op: ISequencedDocumentMessage) => void): this;\n removeListener(event: \"batchEnd\", listener: (error: any, op: ISequencedDocumentMessage) => void): this;\n}\n\n/** Options affecting summarize behavior. */\nexport interface ISummarizeOptions {\n /** True to generate the full tree with no handle reuse optimizations; defaults to false */\n readonly fullTree?: boolean;\n /** True to ask the server what the latest summary is first; defaults to false */\n readonly refreshLatestAck?: boolean;\n}\n\nexport interface ISubmitSummaryOptions extends ISummarizeOptions {\n /** Logger to use for correlated summary events */\n readonly summaryLogger: ITelemetryLogger;\n /** Tells when summary process should be cancelled */\n readonly cancellationToken: ISummaryCancellationToken;\n}\n\nexport interface IOnDemandSummarizeOptions extends ISummarizeOptions {\n /** Reason for generating summary. */\n readonly reason: string;\n}\n\n/** Options to use when enqueueing a summarize attempt. */\nexport interface IEnqueueSummarizeOptions extends IOnDemandSummarizeOptions {\n /** If specified, The summarize attempt will not occur until after this sequence number. */\n readonly afterSequenceNumber?: number;\n /**\n * True to override the existing enqueued summarize attempt if there is one.\n * This will guarantee that this attempt gets enqueued. If override is false,\n * than an existing enqueued summarize attempt will block a new one from being\n * enqueued. There can only be one enqueued at a time. Defaults to false.\n */\n readonly override?: boolean;\n}\n\n/**\n * In addition to the normal summary tree + stats, this contains additional stats\n * only relevant at the root of the tree.\n */\nexport interface IGeneratedSummaryStats extends ISummaryStats {\n /** The total number of data stores in the container. */\n readonly dataStoreCount: number;\n /** The number of data stores that were summarized in this summary. */\n readonly summarizedDataStoreCount: number;\n /** The number of data stores whose GC reference state was updated in this summary. */\n readonly gcStateUpdatedDataStoreCount?: number;\n /** The size of the gc blobs in this summary. */\n readonly gcTotalBlobsSize?: number;\n /** The number of gc blobs in this summary. */\n readonly gcBlobNodeCount?: number;\n /** Sum of the sizes of all op contents since the last summary */\n readonly opsSizesSinceLastSummary: number;\n /** Number of non-system ops since the last summary. See {@link @fluidframework/protocol-base#isSystemMessage} */\n readonly nonSystemOpsSinceLastSummary: number;\n /** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */\n readonly summaryNumber: number;\n}\n\n/** Base results for all submitSummary attempts. */\nexport interface IBaseSummarizeResult {\n readonly stage: \"base\";\n /** Error object related to failed summarize attempt. */\n readonly error: any;\n /** Reference sequence number as of the generate summary attempt. */\n readonly referenceSequenceNumber: number;\n readonly minimumSequenceNumber: number;\n}\n\n/** Results of submitSummary after generating the summary tree. */\nexport interface IGenerateSummaryTreeResult extends Omit<IBaseSummarizeResult, \"stage\"> {\n readonly stage: \"generate\";\n /** Generated summary tree. */\n readonly summaryTree: ISummaryTree;\n /** Stats for generated summary tree. */\n readonly summaryStats: IGeneratedSummaryStats;\n /** Time it took to generate the summary tree and stats. */\n readonly generateDuration: number;\n /** True if the full tree regeneration with no handle reuse optimizations was forced. */\n readonly forcedFullTree: boolean;\n}\n\n/** Results of submitSummary after uploading the tree to storage. */\nexport interface IUploadSummaryResult extends Omit<IGenerateSummaryTreeResult, \"stage\"> {\n readonly stage: \"upload\";\n /** The handle returned by storage pointing to the uploaded summary tree. */\n readonly handle: string;\n /** Time it took to upload the summary tree to storage. */\n readonly uploadDuration: number;\n}\n\n/** Results of submitSummary after submitting the summarize op. */\nexport interface ISubmitSummaryOpResult extends Omit<IUploadSummaryResult, \"stage\" | \"error\"> {\n readonly stage: \"submit\";\n /** The client sequence number of the summarize op submitted for the summary. */\n readonly clientSequenceNumber: number;\n /** Time it took to submit the summarize op to the broadcasting service. */\n readonly submitOpDuration: number;\n}\n\n/**\n * Strict type representing result of a submitSummary attempt.\n * The result consists of 4 possible stages, each with its own data.\n * The data is cumulative, so each stage will contain the data from the previous stages.\n * If the final \"submitted\" stage is not reached, the result may contain the error object.\n * Stages:\n * 1. \"base\" - stopped before the summary tree was even generated, and the result only contains the base data\n * 2. \"generate\" - the summary tree was generated, and the result will contain that tree + stats\n * 3. \"upload\" - the summary was uploaded to storage, and the result contains the server-provided handle\n * 4. \"submit\" - the summarize op was submitted, and the result contains the op client sequence number.\n */\nexport type SubmitSummaryResult =\n | IBaseSummarizeResult\n | IGenerateSummaryTreeResult\n | IUploadSummaryResult\n | ISubmitSummaryOpResult;\n\nexport interface IBroadcastSummaryResult {\n readonly summarizeOp: ISummaryOpMessage;\n readonly broadcastDuration: number;\n}\n\nexport interface IAckSummaryResult {\n readonly summaryAckOp: ISummaryAckMessage;\n readonly ackNackDuration: number;\n}\n\nexport interface INackSummaryResult {\n readonly summaryNackOp: ISummaryNackMessage;\n readonly ackNackDuration: number;\n}\n\nexport type SummarizeResultPart<TSuccess, TFailure = undefined> = {\n success: true;\n data: TSuccess;\n} | {\n success: false;\n data: TFailure | undefined;\n message: string;\n error: any;\n retryAfterSeconds?: number;\n};\n\nexport interface ISummarizeResults {\n /** Resolves when we generate, upload, and submit the summary. */\n readonly summarySubmitted: Promise<SummarizeResultPart<SubmitSummaryResult>>;\n /** Resolves when we observe our summarize op broadcast. */\n readonly summaryOpBroadcasted: Promise<SummarizeResultPart<IBroadcastSummaryResult>>;\n /** Resolves when we receive a summaryAck or summaryNack. */\n readonly receivedSummaryAckOrNack: Promise<SummarizeResultPart<IAckSummaryResult, INackSummaryResult>>;\n}\n\nexport type EnqueueSummarizeResult = (ISummarizeResults & {\n /**\n * Indicates that another summarize attempt is not already enqueued,\n * and this attempt has been enqueued.\n */\n readonly alreadyEnqueued?: undefined;\n}) | (ISummarizeResults & {\n /** Indicates that another summarize attempt was already enqueued. */\n readonly alreadyEnqueued: true;\n /**\n * Indicates that the other enqueued summarize attempt was abandoned,\n * and this attempt has been enqueued enqueued.\n */\n readonly overridden: true;\n}) | {\n /** Indicates that another summarize attempt was already enqueued. */\n readonly alreadyEnqueued: true;\n /**\n * Indicates that the other enqueued summarize attempt remains enqueued,\n * and this attempt has not been enqueued.\n */\n readonly overridden?: undefined;\n};\n\nexport type SummarizerStopReason =\n /** Summarizer client failed to summarize in all 3 consecutive attempts. */\n | \"failToSummarize\"\n /** Parent client reported that it is no longer connected. */\n | \"parentNotConnected\"\n /**\n * Parent client reported that it is no longer elected the summarizer.\n * This is the normal flow; a disconnect will always trigger the parent\n * client to no longer be elected as responsible for summaries. Then it\n * tries to stop its spawned summarizer client.\n */\n | \"parentShouldNotSummarize\"\n /** Summarizer client was disconnected */\n | \"summarizerClientDisconnected\"\n /* running summarizer threw an exception */\n | \"summarizerException\";\n\nexport interface ISummarizerEvents extends IEvent {\n /**\n * An event indicating that the Summarizer is having problems summarizing\n */\n (event: \"summarizingError\", listener: (error: ISummarizingWarning) => void);\n}\n\nexport interface ISummarizer extends\n IEventProvider<ISummarizerEvents>, IFluidLoadable, Partial<IProvideSummarizer> {\n /*\n * Asks summarizer to move to exit.\n * Summarizer will finish current processes, which may take a while.\n * For example, summarizer may complete last summary before exiting.\n */\n stop(reason: SummarizerStopReason): void;\n\n /* Closes summarizer. Any pending processes (summary in flight) are abandoned. */\n close(): void;\n\n run(onBehalfOf: string, disableHeuristics?: boolean): Promise<SummarizerStopReason>;\n\n /**\n * Attempts to generate a summary on demand. If already running, takes no action.\n * @param options - options controlling the summarize attempt\n * @returns an alreadyRunning promise if a summarize attempt is already in progress,\n * which will resolve when the current attempt completes. At that point caller can\n * decide to try again or not. Otherwise, it will return an object containing promises\n * that resolve as the summarize attempt progresses. They will resolve with success\n * false if a failure is encountered.\n */\n summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults;\n /**\n * Enqueue an attempt to summarize after the specified sequence number.\n * If afterSequenceNumber is provided, the summarize attempt is \"enqueued\"\n * to run once an eligible op comes in with sequenceNumber \\>= afterSequenceNumber.\n * @param options - options controlling the summarize attempt\n * @returns an object containing an alreadyEnqueued flag to indicate if another\n * summarize attempt has already been enqueued. It also may contain an overridden flag\n * when alreadyEnqueued is true, that indicates whether this attempt forced the\n * previous attempt to abort. If this attempt becomes enqueued, it returns an object\n * containing promises that resolve as the summarize attempt progresses. They will\n * resolve with success false if a failure is encountered.\n */\n enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult;\n}\n\n/** Data about an attempt to summarize used for heuristics. */\nexport interface ISummarizeAttempt {\n /** Reference sequence number when summary was generated or attempted */\n readonly refSequenceNumber: number;\n\n /** Time of summary attempt after it was sent or attempted */\n readonly summaryTime: number;\n\n /** Sequence number of summary op */\n summarySequenceNumber?: number;\n}\n\n/** Data relevant for summary heuristics. */\nexport interface ISummarizeHeuristicData {\n /** Latest received op sequence number */\n lastOpSequenceNumber: number;\n\n /** Most recent summary attempt from this client */\n readonly lastAttempt: ISummarizeAttempt;\n\n /** Most recent summary that received an ack */\n readonly lastSuccessfulSummary: Readonly<ISummarizeAttempt>;\n\n /**\n * Updates lastAttempt and lastSuccessfulAttempt based on the last summary.\n * @param lastSummary - last ack summary\n */\n updateWithLastSummaryAckInfo(lastSummary: ISummarizeAttempt): void;\n\n /**\n * Records a summary attempt. If the attempt was successfully sent,\n * provide the reference sequence number, otherwise it will be set\n * to the last seen op sequence number.\n * @param referenceSequenceNumber - reference sequence number of sent summary\n */\n recordAttempt(referenceSequenceNumber?: number): void;\n\n /** Mark that the last sent summary attempt has received an ack */\n markLastAttemptAsSuccessful(): void;\n}\n\n/** Responsible for running heuristics determining when to summarize. */\nexport interface ISummarizeHeuristicRunner {\n /** Runs the heuristic to determine if it should try to summarize */\n run(): void;\n\n /** Runs a different heuristic to check if it should summarize before closing */\n shouldRunLastSummary(): boolean;\n\n /** Disposes of resources */\n dispose(): void;\n}\n\ntype ISummarizeTelemetryRequiredProperties =\n /** Reason code for attempting to summarize */\n \"reason\";\n\ntype ISummarizeTelemetryOptionalProperties =\n /** Number of attempts within the last time window, used for calculating the throttle delay. */\n \"summaryAttempts\" |\n /** Number of attempts within the current phase (currently capped at 2 ) */\n \"summaryAttemptsPerPhase\" |\n /** One-based count of phases we've attempted (used to index into an array of ISummarizeOptions */\n \"summaryAttemptPhase\" |\n keyof ISummarizeOptions;\n\nexport type ISummarizeTelemetryProperties =\n Pick<ITelemetryProperties, ISummarizeTelemetryRequiredProperties> &\n Partial<Pick<ITelemetryProperties, ISummarizeTelemetryOptionalProperties>>;\n\ntype SummaryGeneratorRequiredTelemetryProperties =\n /** True to generate the full tree with no handle reuse optimizations */\n \"fullTree\" |\n /** Time since we last attempted to generate a summary */\n \"timeSinceLastAttempt\" |\n /** Time since we last successfully generated a summary */\n \"timeSinceLastSummary\";\n\ntype SummaryGeneratorOptionalTelemetryProperties =\n /** Reference sequence number as of the generate summary attempt. */\n \"referenceSequenceNumber\" |\n /** minimum sequence number (at the reference sequence number) */\n \"minimumSequenceNumber\" |\n /** Delta between the current reference sequence number and the reference sequence number of the last attempt */\n \"opsSinceLastAttempt\" |\n /** Delta between the current reference sequence number and the reference sequence number of the last summary */\n \"opsSinceLastSummary\" |\n /** Delta in sum of op sizes between the current reference sequence number and the reference\n * sequence number of the last summary */\n \"opsSizesSinceLastSummary\" |\n /**\n * Delta between the number of non-system ops since the last summary.\n * See {@link @fluidframework/protocol-base#isSystemMessage}\n */\n \"nonSystemOpsSinceLastSummary\" |\n /** Time it took to generate the summary tree and stats. */\n \"generateDuration\" |\n /** The handle returned by storage pointing to the uploaded summary tree. */\n \"handle\" |\n /** Time it took to upload the summary tree to storage. */\n \"uploadDuration\" |\n /** The client sequence number of the summarize op submitted for the summary. */\n \"clientSequenceNumber\" |\n /** Time it took for this summary to be acked after it was generated */\n \"ackWaitDuration\" |\n /** Reference sequence number of the ack/nack message */\n \"ackNackSequenceNumber\" |\n /** Actual sequence number of the summary op proposal. */\n \"summarySequenceNumber\" |\n /** Optional Retry-After time in seconds. If specified, the client should wait this many seconds before retrying. */\n \"nackRetryAfter\";\n\nexport type SummaryGeneratorTelemetry =\n Pick<ITelemetryProperties, SummaryGeneratorRequiredTelemetryProperties> &\n Partial<Pick<ITelemetryProperties, SummaryGeneratorOptionalTelemetryProperties>>;\n\nexport interface ISummarizeRunnerTelemetry extends ITelemetryLoggerPropertyBag {\n /** Number of times the summarizer run. */\n summarizeCount: () => number;\n /** Number of successful attempts to summarize. */\n summarizerSuccessfulAttempts: () => number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"summarizerTypes.js","sourceRoot":"","sources":["../src/summarizerTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuBH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAA6B,aAAa,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IEvent,\n IEventProvider,\n ITelemetryLogger,\n ITelemetryProperties,\n} from \"@fluidframework/common-definitions\";\nimport { ITelemetryLoggerPropertyBag } from \"@fluidframework/telemetry-utils\";\nimport {\n IFluidLoadable,\n} from \"@fluidframework/core-interfaces\";\nimport { ContainerWarning, IDeltaManager } from \"@fluidframework/container-definitions\";\nimport {\n ISequencedDocumentMessage,\n ISummaryTree,\n IDocumentMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport { ISummaryStats } from \"@fluidframework/runtime-definitions\";\nimport { ISummaryAckMessage, ISummaryNackMessage, ISummaryOpMessage } from \"./summaryCollection\";\nimport { SummarizeReason } from \"./summaryGenerator\";\nimport { ISummaryConfigurationHeuristics } from \".\";\n\n/**\n * @deprecated - This will be removed in a later release.\n */\nexport const ISummarizer: keyof IProvideSummarizer = \"ISummarizer\";\n\n/**\n * @deprecated - This will be removed in a later release.\n */\nexport interface IProvideSummarizer {\n /**\n * @deprecated - This will be removed in a later release.\n */\n readonly ISummarizer: ISummarizer;\n}\n\n/**\n * Similar to AbortSignal, but using promise instead of events\n * @param T - cancellation reason type\n */\nexport interface ICancellationToken<T> {\n /** Tells if this cancellable token is cancelled */\n readonly cancelled: boolean;\n /**\n * Promise that gets fulfilled when this cancellable token is cancelled\n * @returns reason of cancellation\n */\n readonly waitCancelled: Promise<T>;\n}\n\n/* Similar to AbortSignal, but using promise instead of events */\nexport type ISummaryCancellationToken = ICancellationToken<SummarizerStopReason>;\n\nexport interface ISummarizerInternalsProvider {\n /** Encapsulates the work to walk the internals of the running container to generate a summary */\n submitSummary(options: ISubmitSummaryOptions): Promise<SubmitSummaryResult>;\n\n /** Callback whenever a new SummaryAck is received, to update internal tracking state */\n refreshLatestSummaryAck(\n proposalHandle: string,\n ackHandle: string,\n summaryRefSeq: number,\n summaryLogger: ITelemetryLogger,\n ): Promise<void>;\n}\n\n/**\n * @deprecated Options that control the behavior of a running summarizer.\n * */\nexport interface ISummarizerOptions {\n /**\n * Set to true to disable the default heuristics from running; false by default.\n * This affects only the heuristics around when a summarizer should\n * submit summaries. So when it is disabled, summarizer clients should\n * not be expected to summarize unless an on-demand summary is requested.\n */\n disableHeuristics: boolean;\n}\n\nexport interface ISummarizingWarning extends ContainerWarning {\n readonly errorType: \"summarizingError\";\n readonly logged: boolean;\n}\n\nexport interface IConnectableRuntime {\n readonly disposed: boolean;\n readonly connected: boolean;\n readonly clientId: string | undefined;\n readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n once(event: \"connected\" | \"disconnected\" | \"dispose\", listener: () => void): this;\n}\n\nexport interface ISummarizerRuntime extends IConnectableRuntime {\n readonly logger: ITelemetryLogger;\n /** clientId of parent (non-summarizing) container that owns summarizer container */\n readonly summarizerClientId: string | undefined;\n closeFn(): void;\n /** @deprecated 1.0, please remove all implementations and usage */\n on(event: \"batchEnd\", listener: (error: any, op: ISequencedDocumentMessage) => void): this;\n /** @deprecated 1.0, please remove all implementations and usage */\n removeListener(event: \"batchEnd\", listener: (error: any, op: ISequencedDocumentMessage) => void): this;\n}\n\n/** Options affecting summarize behavior. */\nexport interface ISummarizeOptions {\n /** True to generate the full tree with no handle reuse optimizations; defaults to false */\n readonly fullTree?: boolean;\n /** True to ask the server what the latest summary is first; defaults to false */\n readonly refreshLatestAck?: boolean;\n}\n\nexport interface ISubmitSummaryOptions extends ISummarizeOptions {\n /** Logger to use for correlated summary events */\n readonly summaryLogger: ITelemetryLogger;\n /** Tells when summary process should be cancelled */\n readonly cancellationToken: ISummaryCancellationToken;\n}\n\nexport interface IOnDemandSummarizeOptions extends ISummarizeOptions {\n /** Reason for generating summary. */\n readonly reason: string;\n}\n\n/** Options to use when enqueueing a summarize attempt. */\nexport interface IEnqueueSummarizeOptions extends IOnDemandSummarizeOptions {\n /** If specified, The summarize attempt will not occur until after this sequence number. */\n readonly afterSequenceNumber?: number;\n /**\n * True to override the existing enqueued summarize attempt if there is one.\n * This will guarantee that this attempt gets enqueued. If override is false,\n * than an existing enqueued summarize attempt will block a new one from being\n * enqueued. There can only be one enqueued at a time. Defaults to false.\n */\n readonly override?: boolean;\n}\n\n/**\n * In addition to the normal summary tree + stats, this contains additional stats\n * only relevant at the root of the tree.\n */\nexport interface IGeneratedSummaryStats extends ISummaryStats {\n /** The total number of data stores in the container. */\n readonly dataStoreCount: number;\n /** The number of data stores that were summarized in this summary. */\n readonly summarizedDataStoreCount: number;\n /** The number of data stores whose GC reference state was updated in this summary. */\n readonly gcStateUpdatedDataStoreCount?: number;\n /** The size of the gc blobs in this summary. */\n readonly gcTotalBlobsSize?: number;\n /** The number of gc blobs in this summary. */\n readonly gcBlobNodeCount?: number;\n /** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */\n readonly summaryNumber: number;\n}\n\n/** Base results for all submitSummary attempts. */\nexport interface IBaseSummarizeResult {\n readonly stage: \"base\";\n /** Error object related to failed summarize attempt. */\n readonly error: any;\n /** Reference sequence number as of the generate summary attempt. */\n readonly referenceSequenceNumber: number;\n readonly minimumSequenceNumber: number;\n}\n\n/** Results of submitSummary after generating the summary tree. */\nexport interface IGenerateSummaryTreeResult extends Omit<IBaseSummarizeResult, \"stage\"> {\n readonly stage: \"generate\";\n /** Generated summary tree. */\n readonly summaryTree: ISummaryTree;\n /** Stats for generated summary tree. */\n readonly summaryStats: IGeneratedSummaryStats;\n /** Time it took to generate the summary tree and stats. */\n readonly generateDuration: number;\n /** True if the full tree regeneration with no handle reuse optimizations was forced. */\n readonly forcedFullTree: boolean;\n}\n\n/** Results of submitSummary after uploading the tree to storage. */\nexport interface IUploadSummaryResult extends Omit<IGenerateSummaryTreeResult, \"stage\"> {\n readonly stage: \"upload\";\n /** The handle returned by storage pointing to the uploaded summary tree. */\n readonly handle: string;\n /** Time it took to upload the summary tree to storage. */\n readonly uploadDuration: number;\n}\n\n/** Results of submitSummary after submitting the summarize op. */\nexport interface ISubmitSummaryOpResult extends Omit<IUploadSummaryResult, \"stage\" | \"error\"> {\n readonly stage: \"submit\";\n /** The client sequence number of the summarize op submitted for the summary. */\n readonly clientSequenceNumber: number;\n /** Time it took to submit the summarize op to the broadcasting service. */\n readonly submitOpDuration: number;\n}\n\n/**\n * Strict type representing result of a submitSummary attempt.\n * The result consists of 4 possible stages, each with its own data.\n * The data is cumulative, so each stage will contain the data from the previous stages.\n * If the final \"submitted\" stage is not reached, the result may contain the error object.\n * Stages:\n * 1. \"base\" - stopped before the summary tree was even generated, and the result only contains the base data\n * 2. \"generate\" - the summary tree was generated, and the result will contain that tree + stats\n * 3. \"upload\" - the summary was uploaded to storage, and the result contains the server-provided handle\n * 4. \"submit\" - the summarize op was submitted, and the result contains the op client sequence number.\n */\nexport type SubmitSummaryResult =\n | IBaseSummarizeResult\n | IGenerateSummaryTreeResult\n | IUploadSummaryResult\n | ISubmitSummaryOpResult;\n\nexport interface IBroadcastSummaryResult {\n readonly summarizeOp: ISummaryOpMessage;\n readonly broadcastDuration: number;\n}\n\nexport interface IAckSummaryResult {\n readonly summaryAckOp: ISummaryAckMessage;\n readonly ackNackDuration: number;\n}\n\nexport interface INackSummaryResult {\n readonly summaryNackOp: ISummaryNackMessage;\n readonly ackNackDuration: number;\n}\n\nexport type SummarizeResultPart<TSuccess, TFailure = undefined> = {\n success: true;\n data: TSuccess;\n} | {\n success: false;\n data: TFailure | undefined;\n message: string;\n error: any;\n retryAfterSeconds?: number;\n};\n\nexport interface ISummarizeResults {\n /** Resolves when we generate, upload, and submit the summary. */\n readonly summarySubmitted: Promise<SummarizeResultPart<SubmitSummaryResult>>;\n /** Resolves when we observe our summarize op broadcast. */\n readonly summaryOpBroadcasted: Promise<SummarizeResultPart<IBroadcastSummaryResult>>;\n /** Resolves when we receive a summaryAck or summaryNack. */\n readonly receivedSummaryAckOrNack: Promise<SummarizeResultPart<IAckSummaryResult, INackSummaryResult>>;\n}\n\nexport type EnqueueSummarizeResult = (ISummarizeResults & {\n /**\n * Indicates that another summarize attempt is not already enqueued,\n * and this attempt has been enqueued.\n */\n readonly alreadyEnqueued?: undefined;\n}) | (ISummarizeResults & {\n /** Indicates that another summarize attempt was already enqueued. */\n readonly alreadyEnqueued: true;\n /**\n * Indicates that the other enqueued summarize attempt was abandoned,\n * and this attempt has been enqueued enqueued.\n */\n readonly overridden: true;\n}) | {\n /** Indicates that another summarize attempt was already enqueued. */\n readonly alreadyEnqueued: true;\n /**\n * Indicates that the other enqueued summarize attempt remains enqueued,\n * and this attempt has not been enqueued.\n */\n readonly overridden?: undefined;\n};\n\nexport type SummarizerStopReason =\n /** Summarizer client failed to summarize in all 3 consecutive attempts. */\n | \"failToSummarize\"\n /** Parent client reported that it is no longer connected. */\n | \"parentNotConnected\"\n /**\n * Parent client reported that it is no longer elected the summarizer.\n * This is the normal flow; a disconnect will always trigger the parent\n * client to no longer be elected as responsible for summaries. Then it\n * tries to stop its spawned summarizer client.\n */\n | \"parentShouldNotSummarize\"\n /** Summarizer client was disconnected */\n | \"summarizerClientDisconnected\"\n /* running summarizer threw an exception */\n | \"summarizerException\";\n\nexport interface ISummarizerEvents extends IEvent {\n /**\n * An event indicating that the Summarizer is having problems summarizing\n */\n (event: \"summarizingError\", listener: (error: ISummarizingWarning) => void);\n}\n\nexport interface ISummarizer extends\n IEventProvider<ISummarizerEvents>, IFluidLoadable, Partial<IProvideSummarizer> {\n /*\n * Asks summarizer to move to exit.\n * Summarizer will finish current processes, which may take a while.\n * For example, summarizer may complete last summary before exiting.\n */\n stop(reason: SummarizerStopReason): void;\n\n /* Closes summarizer. Any pending processes (summary in flight) are abandoned. */\n close(): void;\n\n run(onBehalfOf: string, disableHeuristics?: boolean): Promise<SummarizerStopReason>;\n\n /**\n * Attempts to generate a summary on demand. If already running, takes no action.\n * @param options - options controlling the summarize attempt\n * @returns an alreadyRunning promise if a summarize attempt is already in progress,\n * which will resolve when the current attempt completes. At that point caller can\n * decide to try again or not. Otherwise, it will return an object containing promises\n * that resolve as the summarize attempt progresses. They will resolve with success\n * false if a failure is encountered.\n */\n summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults;\n /**\n * Enqueue an attempt to summarize after the specified sequence number.\n * If afterSequenceNumber is provided, the summarize attempt is \"enqueued\"\n * to run once an eligible op comes in with sequenceNumber \\>= afterSequenceNumber.\n * @param options - options controlling the summarize attempt\n * @returns an object containing an alreadyEnqueued flag to indicate if another\n * summarize attempt has already been enqueued. It also may contain an overridden flag\n * when alreadyEnqueued is true, that indicates whether this attempt forced the\n * previous attempt to abort. If this attempt becomes enqueued, it returns an object\n * containing promises that resolve as the summarize attempt progresses. They will\n * resolve with success false if a failure is encountered.\n */\n enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult;\n}\n\n/** Data about an attempt to summarize used for heuristics. */\nexport interface ISummarizeAttempt {\n /** Reference sequence number when summary was generated or attempted */\n readonly refSequenceNumber: number;\n\n /** Time of summary attempt after it was sent or attempted */\n readonly summaryTime: number;\n\n /** Sequence number of summary op */\n summarySequenceNumber?: number;\n}\n\n/** Data relevant for summary heuristics. */\nexport interface ISummarizeHeuristicData {\n /** Latest received op sequence number */\n lastOpSequenceNumber: number;\n\n /** Most recent summary attempt from this client */\n readonly lastAttempt: ISummarizeAttempt;\n\n /** Most recent summary that received an ack */\n readonly lastSuccessfulSummary: Readonly<ISummarizeAttempt>;\n\n /** Number of runtime ops since last summary */\n numRuntimeOps: number;\n\n /** Number of non-runtime ops since last summary */\n numNonRuntimeOps: number;\n\n /** Cumulative size in bytes of all the ops since the last summary */\n totalOpsSize: number;\n\n /** Wether or not this instance contains adjusted metrics due to missing op data */\n hasMissingOpData: boolean;\n\n /**\n * Updates lastAttempt and lastSuccessfulAttempt based on the last summary.\n * @param lastSummary - last ack summary\n */\n updateWithLastSummaryAckInfo(lastSummary: ISummarizeAttempt): void;\n\n /**\n * Records a summary attempt. If the attempt was successfully sent,\n * provide the reference sequence number, otherwise it will be set\n * to the last seen op sequence number.\n * @param referenceSequenceNumber - reference sequence number of sent summary\n */\n recordAttempt(referenceSequenceNumber?: number): void;\n\n /** Mark that the last sent summary attempt has received an ack */\n markLastAttemptAsSuccessful(): void;\n}\n\n/** Responsible for running heuristics determining when to summarize. */\nexport interface ISummarizeHeuristicRunner {\n /** Start specific heuristic trackers (ex: idle timer) */\n start(): void;\n\n /** Runs the heuristics to determine if it should try to summarize */\n run(): void;\n\n /** Runs a different heuristic to check if it should summarize before closing */\n shouldRunLastSummary(): boolean;\n\n /** Disposes of resources */\n dispose(): void;\n}\n\ntype ISummarizeTelemetryRequiredProperties =\n /** Reason code for attempting to summarize */\n \"reason\";\n\ntype ISummarizeTelemetryOptionalProperties =\n /** Number of attempts within the last time window, used for calculating the throttle delay. */\n \"summaryAttempts\" |\n /** Number of attempts within the current phase (currently capped at 2 ) */\n \"summaryAttemptsPerPhase\" |\n /** One-based count of phases we've attempted (used to index into an array of ISummarizeOptions */\n \"summaryAttemptPhase\" |\n keyof ISummarizeOptions;\n\nexport type ISummarizeTelemetryProperties =\n Pick<ITelemetryProperties, ISummarizeTelemetryRequiredProperties> &\n Partial<Pick<ITelemetryProperties, ISummarizeTelemetryOptionalProperties>>;\n\n/** Strategy used to heuristically determine when we should run a summary */\nexport interface ISummaryHeuristicStrategy {\n /** Summarize reason for this summarize heuristic strategy (ex: \"maxTime\") */\n summarizeReason: Readonly<SummarizeReason>;\n\n /**\n * Determines if this strategy's summarize criteria been met\n * @param configuration - summary configuration we are to check against\n * @param heuristicData - heuristic data used to confirm conditions are met\n */\n shouldRunSummary(configuration: ISummaryConfigurationHeuristics, heuristicData: ISummarizeHeuristicData): boolean;\n}\n\ntype SummaryGeneratorRequiredTelemetryProperties =\n /** True to generate the full tree with no handle reuse optimizations */\n \"fullTree\" |\n /** Time since we last attempted to generate a summary */\n \"timeSinceLastAttempt\" |\n /** Time since we last successfully generated a summary */\n \"timeSinceLastSummary\";\n\ntype SummaryGeneratorOptionalTelemetryProperties =\n /** Reference sequence number as of the generate summary attempt. */\n \"referenceSequenceNumber\" |\n /** minimum sequence number (at the reference sequence number) */\n \"minimumSequenceNumber\" |\n /** Delta between the current reference sequence number and the reference sequence number of the last attempt */\n \"opsSinceLastAttempt\" |\n /** Delta between the current reference sequence number and the reference sequence number of the last summary */\n \"opsSinceLastSummary\" |\n /** Delta in sum of op sizes between the current reference sequence number and the reference\n * sequence number of the last summary */\n \"opsSizesSinceLastSummary\" |\n /** Delta between the number of non-runtime ops since the last summary */\n \"nonRuntimeOpsSinceLastSummary\" |\n /** Wether or not this instance contains adjusted metrics due to missing op data */\n \"hasMissingOpData\" |\n /** Time it took to generate the summary tree and stats. */\n \"generateDuration\" |\n /** The handle returned by storage pointing to the uploaded summary tree. */\n \"handle\" |\n /** Time it took to upload the summary tree to storage. */\n \"uploadDuration\" |\n /** The client sequence number of the summarize op submitted for the summary. */\n \"clientSequenceNumber\" |\n /** Time it took for this summary to be acked after it was generated */\n \"ackWaitDuration\" |\n /** Reference sequence number of the ack/nack message */\n \"ackNackSequenceNumber\" |\n /** Actual sequence number of the summary op proposal. */\n \"summarySequenceNumber\" |\n /** Optional Retry-After time in seconds. If specified, the client should wait this many seconds before retrying. */\n \"nackRetryAfter\";\n\nexport type SummaryGeneratorTelemetry =\n Pick<ITelemetryProperties, SummaryGeneratorRequiredTelemetryProperties> &\n Partial<Pick<ITelemetryProperties, SummaryGeneratorOptionalTelemetryProperties>>;\n\nexport interface ISummarizeRunnerTelemetry extends ITelemetryLoggerPropertyBag {\n /** Number of times the summarizer run. */\n summarizeCount: () => number;\n /** Number of successful attempts to summarize. */\n summarizerSuccessfulAttempts: () => number;\n}\n"]}
|
package/lib/summaryCollection.js
CHANGED
|
@@ -256,7 +256,7 @@ export class SummaryCollection extends TypedEventEmitter {
|
|
|
256
256
|
// Potential causes for it to be later than our initialSequenceNumber
|
|
257
257
|
// are that the summaryOp was nacked then acked, double-acked, or
|
|
258
258
|
// the summarySequenceNumber is incorrect.
|
|
259
|
-
this.logger.
|
|
259
|
+
this.logger.sendTelemetryEvent({
|
|
260
260
|
eventName: "SummaryAckWithoutOp",
|
|
261
261
|
sequenceNumber: op.sequenceNumber,
|
|
262
262
|
summarySequenceNumber: seq,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summaryCollection.js","sourceRoot":"","sources":["../src/summaryCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEnF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OAAO,EAAE;YACT,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACpB,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;SAC1C;IACL,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, IEvent, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { Deferred, assert, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport {\n IDocumentMessage,\n ISequencedDocumentMessage,\n ISummaryAck,\n ISummaryContent,\n ISummaryNack,\n MessageType,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Interface for summary op messages with typed contents.\n */\nexport interface ISummaryOpMessage extends ISequencedDocumentMessage {\n type: MessageType.Summarize;\n contents: ISummaryContent;\n}\n\n/**\n * Interface for summary ack messages with typed contents.\n */\nexport interface ISummaryAckMessage extends ISequencedDocumentMessage {\n type: MessageType.SummaryAck;\n contents: ISummaryAck;\n}\n\n/**\n * Interface for summary nack messages with typed contents.\n */\nexport interface ISummaryNackMessage extends ISequencedDocumentMessage {\n type: MessageType.SummaryNack;\n contents: ISummaryNack;\n}\n\n/**\n * A single summary which can be tracked as it goes through its life cycle.\n * The life cycle is: Local to Broadcast to Acked/Nacked.\n */\nexport interface ISummary {\n readonly clientId: string;\n readonly clientSequenceNumber: number;\n waitBroadcast(): Promise<ISummaryOpMessage>;\n waitAckNack(): Promise<ISummaryAckMessage | ISummaryNackMessage>;\n}\n\n/**\n * A single summary which has already been acked by the server.\n */\nexport interface IAckedSummary {\n readonly summaryOp: ISummaryOpMessage;\n readonly summaryAck: ISummaryAckMessage;\n}\n\nenum SummaryState {\n Local = 0,\n Broadcast = 1,\n Acked = 2,\n Nacked = -1,\n}\n\nclass Summary implements ISummary {\n public static createLocal(clientId: string, clientSequenceNumber: number) {\n return new Summary(clientId, clientSequenceNumber);\n }\n public static createFromOp(op: ISummaryOpMessage) {\n const summary = new Summary(op.clientId, op.clientSequenceNumber);\n summary.broadcast(op);\n return summary;\n }\n\n private state = SummaryState.Local;\n\n private _summaryOp?: ISummaryOpMessage;\n private _summaryAckNack?: ISummaryAckMessage | ISummaryNackMessage;\n\n private readonly defSummaryOp = new Deferred<void>();\n private readonly defSummaryAck = new Deferred<void>();\n\n public get summaryOp() { return this._summaryOp; }\n public get summaryAckNack() { return this._summaryAckNack; }\n\n private constructor(\n public readonly clientId: string,\n public readonly clientSequenceNumber: number) { }\n\n public hasBeenAcked(): this is IAckedSummary {\n return this.state === SummaryState.Acked;\n }\n\n public broadcast(op: ISummaryOpMessage) {\n assert(this.state === SummaryState.Local, 0x175 /* \"Can only broadcast if summarizer starts in local state\" */);\n this._summaryOp = op;\n this.defSummaryOp.resolve();\n this.state = SummaryState.Broadcast;\n return true;\n }\n\n public ackNack(op: ISummaryAckMessage | ISummaryNackMessage) {\n assert(this.state === SummaryState.Broadcast,\n 0x176 /* \"Can only ack/nack if summarizer is in broadcasting state\" */);\n this._summaryAckNack = op;\n this.defSummaryAck.resolve();\n this.state = op.type === MessageType.SummaryAck ? SummaryState.Acked : SummaryState.Nacked;\n return true;\n }\n\n public async waitBroadcast(): Promise<ISummaryOpMessage> {\n await this.defSummaryOp.promise;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._summaryOp!;\n }\n\n public async waitAckNack(): Promise<ISummaryAckMessage | ISummaryNackMessage> {\n await this.defSummaryAck.promise;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._summaryAckNack!;\n }\n}\n\n/**\n * Watches summaries created by a specific client.\n */\nexport interface IClientSummaryWatcher extends IDisposable {\n watchSummary(clientSequenceNumber: number): ISummary;\n waitFlushed(): Promise<IAckedSummary | undefined>;\n}\n\n/**\n * This class watches summaries created by a specific client.\n * It should be created and managed from a SummaryCollection.\n */\nclass ClientSummaryWatcher implements IClientSummaryWatcher {\n // key: clientSeqNum\n private readonly localSummaries = new Map<number, Summary>();\n private _disposed = false;\n\n public get disposed() { return this._disposed; }\n\n public constructor(\n public readonly clientId: string,\n private readonly summaryCollection: SummaryCollection,\n ) { }\n\n /**\n * Watches for a specific sent summary op.\n * @param clientSequenceNumber - client sequence number of sent summary op\n */\n public watchSummary(clientSequenceNumber: number): ISummary {\n let summary = this.localSummaries.get(clientSequenceNumber);\n if (!summary) {\n summary = Summary.createLocal(this.clientId, clientSequenceNumber);\n this.localSummaries.set(summary.clientSequenceNumber, summary);\n }\n return summary;\n }\n\n /**\n * Waits until all of the pending summaries in the underlying SummaryCollection\n * are acked/nacked.\n */\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n public waitFlushed() {\n return this.summaryCollection.waitFlushed();\n }\n\n /**\n * Gets a watched summary or returns undefined if not watched.\n * @param clientSequenceNumber - client sequence number of sent summary op\n */\n public tryGetSummary(clientSequenceNumber: number) {\n return this.localSummaries.get(clientSequenceNumber);\n }\n\n /**\n * Starts watching a summary made by this client.\n * @param summary - summary to start watching\n */\n public setSummary(summary: Summary) {\n this.localSummaries.set(summary.clientSequenceNumber, summary);\n }\n\n public dispose() {\n this.summaryCollection.removeWatcher(this.clientId);\n this._disposed = true;\n }\n}\n\nexport type OpActionEventName = MessageType.Summarize | MessageType.SummaryAck | MessageType.SummaryNack | \"default\";\nexport type OpActionEventListener = (op: ISequencedDocumentMessage) => void;\nexport interface ISummaryCollectionOpEvents extends IEvent {\n (event: OpActionEventName, listener: OpActionEventListener);\n}\n\n/**\n * Data structure that looks at the op stream to track summaries as they\n * are broadcast, acked and nacked.\n * It provides functionality for watching specific summaries.\n */\nexport class SummaryCollection extends TypedEventEmitter<ISummaryCollectionOpEvents> {\n // key: clientId\n private readonly summaryWatchers = new Map<string, ClientSummaryWatcher>();\n // key: summarySeqNum\n private readonly pendingSummaries = new Map<number, Summary>();\n private refreshWaitNextAck = new Deferred<void>();\n\n private lastSummaryTimestamp: number | undefined;\n private maxAckWaitTime: number | undefined;\n private pendingAckTimerTimeoutCallback: (() => void) | undefined;\n private lastAck: IAckedSummary | undefined;\n\n public get latestAck(): IAckedSummary | undefined { return this.lastAck; }\n\n public emit(event: OpActionEventName, ...args: Parameters<OpActionEventListener>): boolean {\n return super.emit(event, ...args);\n }\n\n public get opsSinceLastAck() {\n return this.deltaManager.lastSequenceNumber -\n (this.lastAck?.summaryAck.sequenceNumber ?? this.deltaManager.initialSequenceNumber);\n }\n\n public addOpListener(listener: () => void) {\n this.deltaManager.on(\"op\", listener);\n }\n\n public removeOpListener(listener: () => void) {\n this.deltaManager.off(\"op\", listener);\n }\n\n public constructor(\n private readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n private readonly logger: ITelemetryLogger,\n ) {\n super();\n this.deltaManager.on(\n \"op\",\n (op) => this.handleOp(op));\n }\n\n /**\n * Creates and returns a summary watcher for a specific client.\n * This will allow for local sent summaries to be better tracked.\n * @param clientId - client id for watcher\n */\n public createWatcher(clientId: string): IClientSummaryWatcher {\n const watcher = new ClientSummaryWatcher(clientId, this);\n this.summaryWatchers.set(clientId, watcher);\n return watcher;\n }\n\n public removeWatcher(clientId: string) {\n this.summaryWatchers.delete(clientId);\n }\n\n public setPendingAckTimerTimeoutCallback(maxAckWaitTime: number, timeoutCallback: () => void) {\n this.maxAckWaitTime = maxAckWaitTime;\n this.pendingAckTimerTimeoutCallback = timeoutCallback;\n }\n\n public unsetPendingAckTimerTimeoutCallback() {\n this.maxAckWaitTime = undefined;\n this.pendingAckTimerTimeoutCallback = undefined;\n }\n\n /**\n * Returns a promise that resolves once all pending summary ops\n * have been acked or nacked.\n */\n public async waitFlushed(): Promise<IAckedSummary | undefined> {\n while (this.pendingSummaries.size > 0) {\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n const promises = Array.from(this.pendingSummaries, ([, summary]) => summary.waitAckNack());\n await Promise.all(promises);\n }\n return this.lastAck;\n }\n\n /**\n * Returns a promise that resolves once a summary is acked that has a reference\n * sequence number greater than or equal to the passed in sequence number.\n * @param referenceSequenceNumber - reference sequence number to wait for\n * @returns The latest acked summary\n */\n public async waitSummaryAck(referenceSequenceNumber: number): Promise<IAckedSummary> {\n while (!this.lastAck || this.lastAck.summaryOp.referenceSequenceNumber < referenceSequenceNumber) {\n await this.refreshWaitNextAck.promise;\n }\n return this.lastAck;\n }\n\n /**\n * Handler for ops; only handles ops relating to summaries.\n * @param op - op message to handle\n */\n private handleOp(op: ISequencedDocumentMessage) {\n switch (op.type) {\n case MessageType.Summarize: {\n this.handleSummaryOp(op as ISummaryOpMessage);\n return;\n }\n case MessageType.SummaryAck: {\n this.handleSummaryAck(op as ISummaryAckMessage);\n return;\n }\n case MessageType.SummaryNack: {\n this.handleSummaryNack(op as ISummaryNackMessage);\n return;\n }\n default: {\n // If the difference between timestamp of current op and last summary op is greater than\n // the maxAckWaitTime, then we need to inform summarizer to not wait and summarize\n // immediately as we have already waited for maxAckWaitTime.\n const lastOpTimestamp = op.timestamp;\n if (this.lastSummaryTimestamp !== undefined &&\n this.maxAckWaitTime !== undefined &&\n lastOpTimestamp - this.lastSummaryTimestamp >= this.maxAckWaitTime\n ) {\n this.pendingAckTimerTimeoutCallback?.();\n }\n this.emit(\"default\", op);\n\n return;\n }\n }\n }\n\n private handleSummaryOp(op: ISummaryOpMessage) {\n let summary: Summary | undefined;\n\n // Check if summary already being watched, broadcast if so\n const watcher = this.summaryWatchers.get(op.clientId);\n if (watcher) {\n summary = watcher.tryGetSummary(op.clientSequenceNumber);\n if (summary) {\n summary.broadcast(op);\n }\n }\n\n // If not watched, create from op\n if (!summary) {\n summary = Summary.createFromOp(op);\n if (watcher) {\n watcher.setSummary(summary);\n }\n }\n this.pendingSummaries.set(op.sequenceNumber, summary);\n this.lastSummaryTimestamp = op.timestamp;\n this.emit(MessageType.Summarize, op);\n }\n\n private handleSummaryAck(op: ISummaryAckMessage) {\n const seq = op.contents.summaryProposal.summarySequenceNumber;\n const summary = this.pendingSummaries.get(seq);\n if (!summary || summary.summaryOp === undefined) {\n // Summary ack without an op should be rare. We could fetch the\n // reference sequence number from the snapshot, but instead we\n // will not emit this ack. It should be the case that the summary\n // op that this ack is for is earlier than this file was loaded\n // from. i.e. initialSequenceNumber > summarySequenceNumber.\n // We really don't care about it for now, since it is older than\n // the one we loaded from.\n if (seq >= this.deltaManager.initialSequenceNumber) {\n // Potential causes for it to be later than our initialSequenceNumber\n // are that the summaryOp was nacked then acked, double-acked, or\n // the summarySequenceNumber is incorrect.\n this.logger.sendErrorEvent({\n eventName: \"SummaryAckWithoutOp\",\n sequenceNumber: op.sequenceNumber, // summary ack seq #\n summarySequenceNumber: seq, // missing summary seq #\n initialSequenceNumber: this.deltaManager.initialSequenceNumber,\n });\n }\n return;\n }\n summary.ackNack(op);\n this.pendingSummaries.delete(seq);\n\n // Track latest ack\n if (!this.lastAck || seq > this.lastAck.summaryAck.contents.summaryProposal.summarySequenceNumber) {\n this.lastAck = {\n summaryOp: summary.summaryOp,\n summaryAck: op,\n };\n this.refreshWaitNextAck.resolve();\n this.refreshWaitNextAck = new Deferred<void>();\n this.emit(MessageType.SummaryAck, op);\n }\n }\n\n private handleSummaryNack(op: ISummaryNackMessage) {\n const seq = op.contents.summaryProposal.summarySequenceNumber;\n const summary = this.pendingSummaries.get(seq);\n if (summary) {\n summary.ackNack(op);\n this.pendingSummaries.delete(seq);\n this.emit(MessageType.SummaryNack, op);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"summaryCollection.js","sourceRoot":"","sources":["../src/summaryCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAMH,WAAW,GACd,MAAM,sCAAsC,CAAC;AA6C9C,IAAK,YAKJ;AALD,WAAK,YAAY;IACb,iDAAS,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MAAM,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;SAC1C;IACL,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, IEvent, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { Deferred, assert, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport {\n IDocumentMessage,\n ISequencedDocumentMessage,\n ISummaryAck,\n ISummaryContent,\n ISummaryNack,\n MessageType,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Interface for summary op messages with typed contents.\n */\nexport interface ISummaryOpMessage extends ISequencedDocumentMessage {\n type: MessageType.Summarize;\n contents: ISummaryContent;\n}\n\n/**\n * Interface for summary ack messages with typed contents.\n */\nexport interface ISummaryAckMessage extends ISequencedDocumentMessage {\n type: MessageType.SummaryAck;\n contents: ISummaryAck;\n}\n\n/**\n * Interface for summary nack messages with typed contents.\n */\nexport interface ISummaryNackMessage extends ISequencedDocumentMessage {\n type: MessageType.SummaryNack;\n contents: ISummaryNack;\n}\n\n/**\n * A single summary which can be tracked as it goes through its life cycle.\n * The life cycle is: Local to Broadcast to Acked/Nacked.\n */\nexport interface ISummary {\n readonly clientId: string;\n readonly clientSequenceNumber: number;\n waitBroadcast(): Promise<ISummaryOpMessage>;\n waitAckNack(): Promise<ISummaryAckMessage | ISummaryNackMessage>;\n}\n\n/**\n * A single summary which has already been acked by the server.\n */\nexport interface IAckedSummary {\n readonly summaryOp: ISummaryOpMessage;\n readonly summaryAck: ISummaryAckMessage;\n}\n\nenum SummaryState {\n Local = 0,\n Broadcast = 1,\n Acked = 2,\n Nacked = -1,\n}\n\nclass Summary implements ISummary {\n public static createLocal(clientId: string, clientSequenceNumber: number) {\n return new Summary(clientId, clientSequenceNumber);\n }\n public static createFromOp(op: ISummaryOpMessage) {\n const summary = new Summary(op.clientId, op.clientSequenceNumber);\n summary.broadcast(op);\n return summary;\n }\n\n private state = SummaryState.Local;\n\n private _summaryOp?: ISummaryOpMessage;\n private _summaryAckNack?: ISummaryAckMessage | ISummaryNackMessage;\n\n private readonly defSummaryOp = new Deferred<void>();\n private readonly defSummaryAck = new Deferred<void>();\n\n public get summaryOp() { return this._summaryOp; }\n public get summaryAckNack() { return this._summaryAckNack; }\n\n private constructor(\n public readonly clientId: string,\n public readonly clientSequenceNumber: number) { }\n\n public hasBeenAcked(): this is IAckedSummary {\n return this.state === SummaryState.Acked;\n }\n\n public broadcast(op: ISummaryOpMessage) {\n assert(this.state === SummaryState.Local, 0x175 /* \"Can only broadcast if summarizer starts in local state\" */);\n this._summaryOp = op;\n this.defSummaryOp.resolve();\n this.state = SummaryState.Broadcast;\n return true;\n }\n\n public ackNack(op: ISummaryAckMessage | ISummaryNackMessage) {\n assert(this.state === SummaryState.Broadcast,\n 0x176 /* \"Can only ack/nack if summarizer is in broadcasting state\" */);\n this._summaryAckNack = op;\n this.defSummaryAck.resolve();\n this.state = op.type === MessageType.SummaryAck ? SummaryState.Acked : SummaryState.Nacked;\n return true;\n }\n\n public async waitBroadcast(): Promise<ISummaryOpMessage> {\n await this.defSummaryOp.promise;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._summaryOp!;\n }\n\n public async waitAckNack(): Promise<ISummaryAckMessage | ISummaryNackMessage> {\n await this.defSummaryAck.promise;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._summaryAckNack!;\n }\n}\n\n/**\n * Watches summaries created by a specific client.\n */\nexport interface IClientSummaryWatcher extends IDisposable {\n watchSummary(clientSequenceNumber: number): ISummary;\n waitFlushed(): Promise<IAckedSummary | undefined>;\n}\n\n/**\n * This class watches summaries created by a specific client.\n * It should be created and managed from a SummaryCollection.\n */\nclass ClientSummaryWatcher implements IClientSummaryWatcher {\n // key: clientSeqNum\n private readonly localSummaries = new Map<number, Summary>();\n private _disposed = false;\n\n public get disposed() { return this._disposed; }\n\n public constructor(\n public readonly clientId: string,\n private readonly summaryCollection: SummaryCollection,\n ) { }\n\n /**\n * Watches for a specific sent summary op.\n * @param clientSequenceNumber - client sequence number of sent summary op\n */\n public watchSummary(clientSequenceNumber: number): ISummary {\n let summary = this.localSummaries.get(clientSequenceNumber);\n if (!summary) {\n summary = Summary.createLocal(this.clientId, clientSequenceNumber);\n this.localSummaries.set(summary.clientSequenceNumber, summary);\n }\n return summary;\n }\n\n /**\n * Waits until all of the pending summaries in the underlying SummaryCollection\n * are acked/nacked.\n */\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n public waitFlushed() {\n return this.summaryCollection.waitFlushed();\n }\n\n /**\n * Gets a watched summary or returns undefined if not watched.\n * @param clientSequenceNumber - client sequence number of sent summary op\n */\n public tryGetSummary(clientSequenceNumber: number) {\n return this.localSummaries.get(clientSequenceNumber);\n }\n\n /**\n * Starts watching a summary made by this client.\n * @param summary - summary to start watching\n */\n public setSummary(summary: Summary) {\n this.localSummaries.set(summary.clientSequenceNumber, summary);\n }\n\n public dispose() {\n this.summaryCollection.removeWatcher(this.clientId);\n this._disposed = true;\n }\n}\n\nexport type OpActionEventName = MessageType.Summarize | MessageType.SummaryAck | MessageType.SummaryNack | \"default\";\nexport type OpActionEventListener = (op: ISequencedDocumentMessage) => void;\nexport interface ISummaryCollectionOpEvents extends IEvent {\n (event: OpActionEventName, listener: OpActionEventListener);\n}\n\n/**\n * Data structure that looks at the op stream to track summaries as they\n * are broadcast, acked and nacked.\n * It provides functionality for watching specific summaries.\n */\nexport class SummaryCollection extends TypedEventEmitter<ISummaryCollectionOpEvents> {\n // key: clientId\n private readonly summaryWatchers = new Map<string, ClientSummaryWatcher>();\n // key: summarySeqNum\n private readonly pendingSummaries = new Map<number, Summary>();\n private refreshWaitNextAck = new Deferred<void>();\n\n private lastSummaryTimestamp: number | undefined;\n private maxAckWaitTime: number | undefined;\n private pendingAckTimerTimeoutCallback: (() => void) | undefined;\n private lastAck: IAckedSummary | undefined;\n\n public get latestAck(): IAckedSummary | undefined { return this.lastAck; }\n\n public emit(event: OpActionEventName, ...args: Parameters<OpActionEventListener>): boolean {\n return super.emit(event, ...args);\n }\n\n public get opsSinceLastAck() {\n return this.deltaManager.lastSequenceNumber -\n (this.lastAck?.summaryAck.sequenceNumber ?? this.deltaManager.initialSequenceNumber);\n }\n\n public addOpListener(listener: () => void) {\n this.deltaManager.on(\"op\", listener);\n }\n\n public removeOpListener(listener: () => void) {\n this.deltaManager.off(\"op\", listener);\n }\n\n public constructor(\n private readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n private readonly logger: ITelemetryLogger,\n ) {\n super();\n this.deltaManager.on(\n \"op\",\n (op) => this.handleOp(op));\n }\n\n /**\n * Creates and returns a summary watcher for a specific client.\n * This will allow for local sent summaries to be better tracked.\n * @param clientId - client id for watcher\n */\n public createWatcher(clientId: string): IClientSummaryWatcher {\n const watcher = new ClientSummaryWatcher(clientId, this);\n this.summaryWatchers.set(clientId, watcher);\n return watcher;\n }\n\n public removeWatcher(clientId: string) {\n this.summaryWatchers.delete(clientId);\n }\n\n public setPendingAckTimerTimeoutCallback(maxAckWaitTime: number, timeoutCallback: () => void) {\n this.maxAckWaitTime = maxAckWaitTime;\n this.pendingAckTimerTimeoutCallback = timeoutCallback;\n }\n\n public unsetPendingAckTimerTimeoutCallback() {\n this.maxAckWaitTime = undefined;\n this.pendingAckTimerTimeoutCallback = undefined;\n }\n\n /**\n * Returns a promise that resolves once all pending summary ops\n * have been acked or nacked.\n */\n public async waitFlushed(): Promise<IAckedSummary | undefined> {\n while (this.pendingSummaries.size > 0) {\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n const promises = Array.from(this.pendingSummaries, ([, summary]) => summary.waitAckNack());\n await Promise.all(promises);\n }\n return this.lastAck;\n }\n\n /**\n * Returns a promise that resolves once a summary is acked that has a reference\n * sequence number greater than or equal to the passed in sequence number.\n * @param referenceSequenceNumber - reference sequence number to wait for\n * @returns The latest acked summary\n */\n public async waitSummaryAck(referenceSequenceNumber: number): Promise<IAckedSummary> {\n while (!this.lastAck || this.lastAck.summaryOp.referenceSequenceNumber < referenceSequenceNumber) {\n await this.refreshWaitNextAck.promise;\n }\n return this.lastAck;\n }\n\n /**\n * Handler for ops; only handles ops relating to summaries.\n * @param op - op message to handle\n */\n private handleOp(op: ISequencedDocumentMessage) {\n switch (op.type) {\n case MessageType.Summarize: {\n this.handleSummaryOp(op as ISummaryOpMessage);\n return;\n }\n case MessageType.SummaryAck: {\n this.handleSummaryAck(op as ISummaryAckMessage);\n return;\n }\n case MessageType.SummaryNack: {\n this.handleSummaryNack(op as ISummaryNackMessage);\n return;\n }\n default: {\n // If the difference between timestamp of current op and last summary op is greater than\n // the maxAckWaitTime, then we need to inform summarizer to not wait and summarize\n // immediately as we have already waited for maxAckWaitTime.\n const lastOpTimestamp = op.timestamp;\n if (this.lastSummaryTimestamp !== undefined &&\n this.maxAckWaitTime !== undefined &&\n lastOpTimestamp - this.lastSummaryTimestamp >= this.maxAckWaitTime\n ) {\n this.pendingAckTimerTimeoutCallback?.();\n }\n this.emit(\"default\", op);\n\n return;\n }\n }\n }\n\n private handleSummaryOp(op: ISummaryOpMessage) {\n let summary: Summary | undefined;\n\n // Check if summary already being watched, broadcast if so\n const watcher = this.summaryWatchers.get(op.clientId);\n if (watcher) {\n summary = watcher.tryGetSummary(op.clientSequenceNumber);\n if (summary) {\n summary.broadcast(op);\n }\n }\n\n // If not watched, create from op\n if (!summary) {\n summary = Summary.createFromOp(op);\n if (watcher) {\n watcher.setSummary(summary);\n }\n }\n this.pendingSummaries.set(op.sequenceNumber, summary);\n this.lastSummaryTimestamp = op.timestamp;\n this.emit(MessageType.Summarize, op);\n }\n\n private handleSummaryAck(op: ISummaryAckMessage) {\n const seq = op.contents.summaryProposal.summarySequenceNumber;\n const summary = this.pendingSummaries.get(seq);\n if (!summary || summary.summaryOp === undefined) {\n // Summary ack without an op should be rare. We could fetch the\n // reference sequence number from the snapshot, but instead we\n // will not emit this ack. It should be the case that the summary\n // op that this ack is for is earlier than this file was loaded\n // from. i.e. initialSequenceNumber > summarySequenceNumber.\n // We really don't care about it for now, since it is older than\n // the one we loaded from.\n if (seq >= this.deltaManager.initialSequenceNumber) {\n // Potential causes for it to be later than our initialSequenceNumber\n // are that the summaryOp was nacked then acked, double-acked, or\n // the summarySequenceNumber is incorrect.\n this.logger.sendTelemetryEvent({\n eventName: \"SummaryAckWithoutOp\",\n sequenceNumber: op.sequenceNumber, // summary ack seq #\n summarySequenceNumber: seq, // missing summary seq #\n initialSequenceNumber: this.deltaManager.initialSequenceNumber,\n });\n }\n return;\n }\n summary.ackNack(op);\n this.pendingSummaries.delete(seq);\n\n // Track latest ack\n if (!this.lastAck || seq > this.lastAck.summaryAck.contents.summaryProposal.summarySequenceNumber) {\n this.lastAck = {\n summaryOp: summary.summaryOp,\n summaryAck: op,\n };\n this.refreshWaitNextAck.resolve();\n this.refreshWaitNextAck = new Deferred<void>();\n this.emit(MessageType.SummaryAck, op);\n }\n }\n\n private handleSummaryNack(op: ISummaryNackMessage) {\n const seq = op.contents.summaryProposal.summarySequenceNumber;\n const summary = this.pendingSummaries.get(seq);\n if (summary) {\n summary.ackNack(op);\n this.pendingSummaries.delete(seq);\n this.emit(MessageType.SummaryNack, op);\n }\n }\n}\n"]}
|
package/lib/summaryFormat.d.ts
CHANGED
|
@@ -50,11 +50,6 @@ export interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGC
|
|
|
50
50
|
readonly disableIsolatedChannels?: true;
|
|
51
51
|
/** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */
|
|
52
52
|
readonly summaryNumber?: number;
|
|
53
|
-
/**
|
|
54
|
-
* @deprecated - User summaryNumber instead.
|
|
55
|
-
* Counter of the last summary happened, increments every time we summarize
|
|
56
|
-
*/
|
|
57
|
-
readonly summaryCount?: number;
|
|
58
53
|
}
|
|
59
54
|
export interface ICreateContainerMetadata {
|
|
60
55
|
/** Runtime version of the container when it was first created */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summaryFormat.d.ts","sourceRoot":"","sources":["../src/summaryFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAe,MAAM,sCAAsC,CAAC;AAC7G,OAAO,EAAoB,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAG9F,aAAK,sBAAsB,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,uBAAuB,GAAG,sBAAsB,CAAC,CAAC;AAC3F,UAAU,0BAA0B;IAChC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,SAAS,CAAC;IAC3C,QAAQ,CAAC,oBAAoB,CAAC,EAAE,SAAS,CAAC;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACtC;AACD,UAAU,0BAA2B,SAAQ,sBAAsB,CAAC,0BAA0B,CAAC;IAC3F,QAAQ,CAAC,qBAAqB,EAAE,KAAK,CAAC;IACtC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,SAAS,CAAC;CAC7C;AACD,UAAU,0BAA2B,SAAQ,sBAAsB,CAAC,0BAA0B,CAAC;IAC3F,gEAAgE;IAChE,QAAQ,CAAC,qBAAqB,CAAC,EAAE,SAAS,CAAC;IAC3C,QAAQ,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,IAAI,CAAC;CAC3C;AACD;;;;GAIG;AACH,oBAAY,4BAA4B,GAClC,0BAA0B,GAC1B,0BAA0B,GAC1B,0BAA0B,CAAC;AACjC,oBAAY,6BAA6B,GAAG,0BAA0B,GAAG,0BAA0B,CAAC;AAEpG,wB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