@fluidframework/container-runtime 2.0.0-internal.4.4.1 → 2.0.0-internal.5.0.1
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/CHANGELOG.md +41 -0
- package/dist/batchTracker.d.ts +4 -4
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +2 -2
- package/dist/batchTracker.js.map +1 -1
- package/dist/connectionTelemetry.d.ts +2 -2
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerRuntime.d.ts +12 -11
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +33 -12
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts +2 -2
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +1 -1
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +3 -3
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/deltaScheduler.d.ts +2 -2
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +1 -1
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +2 -2
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +3 -3
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +5 -5
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/id-compressor/idCompressor.d.ts +2 -2
- package/dist/id-compressor/idCompressor.d.ts.map +1 -1
- package/dist/id-compressor/idCompressor.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +2 -2
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts +2 -2
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +3 -6
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts +2 -2
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/dist/opLifecycle/opGroupingManager.js +5 -6
- package/dist/opLifecycle/opGroupingManager.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts +2 -2
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +3 -3
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +2 -2
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +7 -3
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +18 -14
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +35 -55
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.d.ts +2 -2
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +4 -3
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js +1 -1
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +4 -3
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +5 -6
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.d.ts +2 -3
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +2 -3
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerClientElection.d.ts +3 -2
- package/dist/summary/summarizerClientElection.d.ts.map +1 -1
- package/dist/summary/summarizerClientElection.js.map +1 -1
- package/dist/summary/summarizerHeuristics.d.ts +2 -2
- package/dist/summary/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summary/summarizerHeuristics.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.d.ts +10 -9
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +3 -3
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +6 -6
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +8 -8
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +3 -2
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts +2 -2
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +1 -1
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryManager.d.ts +3 -2
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js.map +1 -1
- package/lib/batchTracker.d.ts +4 -4
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +2 -2
- package/lib/batchTracker.js.map +1 -1
- package/lib/connectionTelemetry.d.ts +2 -2
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerRuntime.d.ts +12 -11
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +33 -12
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts +2 -2
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +1 -1
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +3 -3
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/deltaScheduler.d.ts +2 -2
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +1 -1
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +2 -2
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +3 -3
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +5 -5
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +1 -1
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/id-compressor/idCompressor.d.ts +2 -2
- package/lib/id-compressor/idCompressor.d.ts.map +1 -1
- package/lib/id-compressor/idCompressor.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +2 -2
- package/lib/opLifecycle/definitions.d.ts.map +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts +2 -2
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js +3 -6
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts +2 -2
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/lib/opLifecycle/opGroupingManager.js +5 -6
- package/lib/opLifecycle/opGroupingManager.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts +2 -2
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +3 -3
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +2 -2
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +7 -3
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts +18 -14
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +35 -55
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/scheduleManager.d.ts +2 -2
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +4 -3
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js +1 -1
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runningSummarizer.d.ts +4 -3
- package/lib/summary/runningSummarizer.d.ts.map +1 -1
- package/lib/summary/runningSummarizer.js +5 -6
- package/lib/summary/runningSummarizer.js.map +1 -1
- package/lib/summary/summarizer.d.ts +2 -3
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +2 -3
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerClientElection.d.ts +3 -2
- package/lib/summary/summarizerClientElection.d.ts.map +1 -1
- package/lib/summary/summarizerClientElection.js.map +1 -1
- package/lib/summary/summarizerHeuristics.d.ts +2 -2
- package/lib/summary/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summary/summarizerHeuristics.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.d.ts +10 -9
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +3 -3
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +6 -6
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +8 -8
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +3 -2
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryGenerator.d.ts +2 -2
- package/lib/summary/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.js +1 -1
- package/lib/summary/summaryGenerator.js.map +1 -1
- package/lib/summary/summaryManager.d.ts +3 -2
- package/lib/summary/summaryManager.d.ts.map +1 -1
- package/lib/summary/summaryManager.js +1 -1
- package/lib/summary/summaryManager.js.map +1 -1
- package/package.json +18 -15
- package/src/batchTracker.ts +5 -6
- package/src/connectionTelemetry.ts +4 -5
- package/src/containerRuntime.ts +51 -28
- package/src/dataStore.ts +3 -4
- package/src/dataStoreContext.ts +3 -6
- package/src/dataStoreContexts.ts +3 -7
- package/src/deltaScheduler.ts +2 -3
- package/src/gc/garbageCollection.ts +5 -5
- package/src/gc/gcDefinitions.ts +3 -3
- package/src/gc/gcTelemetry.ts +9 -5
- package/src/id-compressor/idCompressor.ts +2 -2
- package/src/opLifecycle/definitions.ts +2 -2
- package/src/opLifecycle/opCompressor.ts +4 -8
- package/src/opLifecycle/opDecompressor.ts +2 -3
- package/src/opLifecycle/opGroupingManager.ts +6 -7
- package/src/opLifecycle/opSplitter.ts +4 -5
- package/src/opLifecycle/outbox.ts +10 -9
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +60 -91
- package/src/scheduleManager.ts +3 -4
- package/src/summary/orderedClientElection.ts +5 -5
- package/src/summary/runningSummarizer.ts +11 -10
- package/src/summary/summarizer.ts +8 -8
- package/src/summary/summarizerClientElection.ts +3 -2
- package/src/summary/summarizerHeuristics.ts +2 -2
- package/src/summary/summarizerNode/summarizerNode.ts +15 -14
- package/src/summary/summarizerNode/summarizerNodeUtils.ts +3 -3
- package/src/summary/summarizerNode/summarizerNodeWithGc.ts +10 -7
- package/src/summary/summarizerTypes.ts +8 -13
- package/src/summary/summaryCollection.ts +3 -2
- package/src/summary/summaryGenerator.ts +7 -3
- package/src/summary/summaryManager.ts +8 -9
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ITelemetryLoggerExt, ChildLogger } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { assert } from "@fluidframework/common-utils";
|
|
8
8
|
import { IBatchMessage } from "@fluidframework/container-definitions";
|
|
9
9
|
import {
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
extractSafePropertiesFromMessage,
|
|
12
12
|
} from "@fluidframework/container-utils";
|
|
13
13
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
14
|
-
import { ChildLogger } from "@fluidframework/telemetry-utils";
|
|
15
14
|
import { ContainerMessageType, ContainerRuntimeMessage } from "../containerRuntime";
|
|
16
15
|
import { estimateSocketSize } from "./batchManager";
|
|
17
16
|
import { BatchMessage, IBatch, IChunkedOp, IMessageProcessingResult } from "./definitions";
|
|
@@ -31,7 +30,7 @@ export class OpSplitter {
|
|
|
31
30
|
| undefined,
|
|
32
31
|
public readonly chunkSizeInBytes: number,
|
|
33
32
|
private readonly maxBatchSizeInBytes: number,
|
|
34
|
-
logger:
|
|
33
|
+
logger: ITelemetryLoggerExt,
|
|
35
34
|
) {
|
|
36
35
|
this.chunkMap = new Map<string, string[]>(chunks);
|
|
37
36
|
this.logger = ChildLogger.create(logger, "OpSplitter");
|
|
@@ -214,7 +213,7 @@ const chunkToBatchMessage = (
|
|
|
214
213
|
};
|
|
215
214
|
return {
|
|
216
215
|
contents: JSON.stringify(payload),
|
|
217
|
-
|
|
216
|
+
type: payload.type,
|
|
218
217
|
metadata,
|
|
219
218
|
localOpMetadata: undefined,
|
|
220
219
|
referenceSequenceNumber,
|
|
@@ -251,7 +250,7 @@ export const splitOp = (
|
|
|
251
250
|
const chunk: IChunkedOp = {
|
|
252
251
|
chunkId,
|
|
253
252
|
contents: op.contents.substr(offset, chunkSizeInBytes),
|
|
254
|
-
originalType: op.
|
|
253
|
+
originalType: op.type,
|
|
255
254
|
totalChunks: chunkCount,
|
|
256
255
|
};
|
|
257
256
|
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
7
|
-
import { assert } from "@fluidframework/common-utils";
|
|
8
|
-
import { IContainerContext } from "@fluidframework/container-definitions";
|
|
9
|
-
import { GenericError, UsageError } from "@fluidframework/container-utils";
|
|
10
|
-
import { MessageType } from "@fluidframework/protocol-definitions";
|
|
11
6
|
import {
|
|
7
|
+
ITelemetryLoggerExt,
|
|
12
8
|
ChildLogger,
|
|
13
9
|
loggerToMonitoringContext,
|
|
14
10
|
MonitoringContext,
|
|
15
11
|
} from "@fluidframework/telemetry-utils";
|
|
12
|
+
import { assert } from "@fluidframework/common-utils";
|
|
13
|
+
import { IContainerContext } from "@fluidframework/container-definitions";
|
|
14
|
+
import { GenericError, UsageError } from "@fluidframework/container-utils";
|
|
15
|
+
import { MessageType } from "@fluidframework/protocol-definitions";
|
|
16
16
|
import { ICompressionRuntimeOptions } from "../containerRuntime";
|
|
17
17
|
import { PendingStateManager } from "../pendingStateManager";
|
|
18
18
|
import {
|
|
@@ -40,7 +40,7 @@ export interface IOutboxParameters {
|
|
|
40
40
|
readonly config: IOutboxConfig;
|
|
41
41
|
readonly compressor: OpCompressor;
|
|
42
42
|
readonly splitter: OpSplitter;
|
|
43
|
-
readonly logger:
|
|
43
|
+
readonly logger: ITelemetryLoggerExt;
|
|
44
44
|
readonly groupingManager: OpGroupingManager;
|
|
45
45
|
readonly getCurrentSequenceNumbers: () => BatchSequenceNumbers;
|
|
46
46
|
}
|
|
@@ -279,7 +279,8 @@ export class Outbox {
|
|
|
279
279
|
for (const message of batch.content) {
|
|
280
280
|
this.params.containerContext.submitFn(
|
|
281
281
|
MessageType.Operation,
|
|
282
|
-
|
|
282
|
+
// For back-compat (submitFn only works on deserialized content)
|
|
283
|
+
message.contents === undefined ? undefined : JSON.parse(message.contents),
|
|
283
284
|
true, // batch
|
|
284
285
|
message.metadata,
|
|
285
286
|
);
|
|
@@ -308,9 +309,9 @@ export class Outbox {
|
|
|
308
309
|
// In future, need to shift toward keeping batch as a whole!
|
|
309
310
|
for (const message of batch) {
|
|
310
311
|
this.params.pendingStateManager.onSubmitMessage(
|
|
311
|
-
|
|
312
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
313
|
+
message.contents!,
|
|
312
314
|
message.referenceSequenceNumber,
|
|
313
|
-
message.deserializedContent.contents,
|
|
314
315
|
message.localOpMetadata,
|
|
315
316
|
message.metadata,
|
|
316
317
|
);
|
package/src/packageVersion.ts
CHANGED
|
@@ -13,10 +13,9 @@ import { ContainerMessageType } from "./containerRuntime";
|
|
|
13
13
|
import { pkgVersion } from "./packageVersion";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
* ContainerRuntime. This message has either not been ack'd by the server or has not been submitted to the server yet.
|
|
16
|
+
* ! TODO: Remove this interface in "2.0.0-internal.7.0.0" once we only read IPendingMessageNew
|
|
18
17
|
*/
|
|
19
|
-
export interface
|
|
18
|
+
export interface IPendingMessageOld {
|
|
20
19
|
type: "message";
|
|
21
20
|
messageType: ContainerMessageType;
|
|
22
21
|
clientSequenceNumber: number;
|
|
@@ -27,16 +26,22 @@ export interface IPendingMessage {
|
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
|
-
* This represents
|
|
31
|
-
* to
|
|
32
|
-
* ! TODO: Remove in "2.0.0-internal.5.0.0" AB#2496
|
|
29
|
+
* This represents a message that has been submitted and is added to the pending queue when `submit` is called on the
|
|
30
|
+
* ContainerRuntime. This message has either not been ack'd by the server or has not been submitted to the server yet.
|
|
33
31
|
*/
|
|
34
|
-
export interface
|
|
35
|
-
type: "
|
|
32
|
+
export interface IPendingMessageNew {
|
|
33
|
+
type: "message";
|
|
34
|
+
clientSequenceNumber: number;
|
|
35
|
+
referenceSequenceNumber: number;
|
|
36
|
+
content: string;
|
|
37
|
+
localOpMetadata: unknown;
|
|
38
|
+
opMetadata: Record<string, unknown> | undefined;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
|
-
/**
|
|
39
|
-
|
|
41
|
+
/**
|
|
42
|
+
* ! TODO: Remove this type in "2.0.0-internal.7.0.0"
|
|
43
|
+
*/
|
|
44
|
+
export type IPendingState = IPendingMessageOld | IPendingMessageNew;
|
|
40
45
|
|
|
41
46
|
export interface IPendingLocalState {
|
|
42
47
|
/**
|
|
@@ -49,14 +54,12 @@ export interface IRuntimeStateHandler {
|
|
|
49
54
|
connected(): boolean;
|
|
50
55
|
clientId(): string | undefined;
|
|
51
56
|
close(error?: ICriticalContainerError): void;
|
|
52
|
-
applyStashedOp
|
|
57
|
+
applyStashedOp(content: string): Promise<unknown>;
|
|
53
58
|
reSubmit(
|
|
54
|
-
|
|
55
|
-
content: any,
|
|
59
|
+
content: string | undefined,
|
|
56
60
|
localOpMetadata: unknown,
|
|
57
61
|
opMetadata: Record<string, unknown> | undefined,
|
|
58
62
|
): void;
|
|
59
|
-
rollback(type: ContainerMessageType, content: any, localOpMetadata: unknown): void;
|
|
60
63
|
orderSequentially(callback: () => void): void;
|
|
61
64
|
}
|
|
62
65
|
|
|
@@ -70,8 +73,8 @@ export interface IRuntimeStateHandler {
|
|
|
70
73
|
* It verifies that all the ops are acked, are received in the right order and batch information is correct.
|
|
71
74
|
*/
|
|
72
75
|
export class PendingStateManager implements IDisposable {
|
|
73
|
-
private readonly pendingMessages = new Deque<
|
|
74
|
-
private readonly initialMessages = new Deque<
|
|
76
|
+
private readonly pendingMessages = new Deque<IPendingMessageNew>();
|
|
77
|
+
private readonly initialMessages = new Deque<IPendingMessageNew>();
|
|
75
78
|
private readonly disposeOnce = new Lazy<void>(() => {
|
|
76
79
|
this.initialMessages.clear();
|
|
77
80
|
this.pendingMessages.clear();
|
|
@@ -105,22 +108,23 @@ export class PendingStateManager implements IDisposable {
|
|
|
105
108
|
);
|
|
106
109
|
if (!this.pendingMessages.isEmpty()) {
|
|
107
110
|
return {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
pendingStates: this.pendingMessages.toArray().map((message) => {
|
|
112
|
+
// ! TODO: Remove conversion to IPendingMessageOld in "2.0.0-internal.6.0.0" AB#3826
|
|
113
|
+
const content = JSON.parse(message.content);
|
|
111
114
|
// IdAllocations need their localOpMetadata stashed in the contents
|
|
112
115
|
// of the op to correctly resume the session when processing stashed ops
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
116
|
+
if (content.type === ContainerMessageType.IdAllocation) {
|
|
117
|
+
content.contents.stashedState = message.localOpMetadata;
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
...message,
|
|
121
|
+
messageType: content.type,
|
|
122
|
+
content: content.contents,
|
|
123
|
+
// delete localOpMetadata since it may not be serializable
|
|
124
|
+
// and will be regenerated by applyStashedOp()
|
|
125
|
+
localOpMetadata: undefined,
|
|
126
|
+
};
|
|
127
|
+
}),
|
|
124
128
|
};
|
|
125
129
|
}
|
|
126
130
|
}
|
|
@@ -130,34 +134,27 @@ export class PendingStateManager implements IDisposable {
|
|
|
130
134
|
initialLocalState: IPendingLocalState | undefined,
|
|
131
135
|
) {
|
|
132
136
|
/**
|
|
133
|
-
* Convert old local state format to the new format
|
|
134
|
-
*
|
|
135
|
-
* The new format instead uses batch metadata on the last message to indicate batch ends
|
|
136
|
-
* ! TODO: Remove this conversion in "2.0.0-internal.5.0.0" as version from "2.0.0-internal.4.0.0" will be new format
|
|
137
|
-
* AB#2496 tracks removal
|
|
137
|
+
* Convert old local state format to the new format (IPendingMessageOld to IPendingMessageNew)
|
|
138
|
+
* ! TODO: Remove this conversion in "2.0.0-internal.7.0.0"
|
|
138
139
|
*/
|
|
139
140
|
if (initialLocalState?.pendingStates) {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
} else if (
|
|
152
|
-
// End of batch if we are currently batching and this is last message or next message is flush
|
|
153
|
-
currentlyBatching &&
|
|
154
|
-
(i === pendingStates.length - 1 || pendingStates[i + 1].type === "flush")
|
|
155
|
-
) {
|
|
156
|
-
currentlyBatching = false;
|
|
157
|
-
initialState.opMetadata = { ...initialState.opMetadata, batch: false };
|
|
158
|
-
}
|
|
159
|
-
this.initialMessages.push(initialState);
|
|
141
|
+
for (const initialState of initialLocalState.pendingStates) {
|
|
142
|
+
let messageContent = initialState.content;
|
|
143
|
+
if (
|
|
144
|
+
(initialState as IPendingMessageOld).messageType !== undefined &&
|
|
145
|
+
typeof initialState.content !== "string"
|
|
146
|
+
) {
|
|
147
|
+
// Convert IPendingMessageOld to IPendingMessageNew
|
|
148
|
+
messageContent = JSON.stringify({
|
|
149
|
+
type: (initialState as IPendingMessageOld).messageType,
|
|
150
|
+
contents: initialState.content,
|
|
151
|
+
});
|
|
160
152
|
}
|
|
153
|
+
// Note: this object may contain "messageType" prop, but it should not be easily accesible due to interface being used
|
|
154
|
+
this.initialMessages.push({
|
|
155
|
+
...initialState,
|
|
156
|
+
content: messageContent,
|
|
157
|
+
});
|
|
161
158
|
}
|
|
162
159
|
}
|
|
163
160
|
}
|
|
@@ -175,15 +172,13 @@ export class PendingStateManager implements IDisposable {
|
|
|
175
172
|
* @param localOpMetadata - The local metadata associated with the message.
|
|
176
173
|
*/
|
|
177
174
|
public onSubmitMessage(
|
|
178
|
-
|
|
175
|
+
content: string,
|
|
179
176
|
referenceSequenceNumber: number,
|
|
180
|
-
content: any,
|
|
181
177
|
localOpMetadata: unknown,
|
|
182
178
|
opMetadata: Record<string, unknown> | undefined,
|
|
183
179
|
) {
|
|
184
|
-
const pendingMessage:
|
|
180
|
+
const pendingMessage: IPendingMessageNew = {
|
|
185
181
|
type: "message",
|
|
186
|
-
messageType: type,
|
|
187
182
|
clientSequenceNumber: -1, // dummy value (not to be used anywhere)
|
|
188
183
|
referenceSequenceNumber,
|
|
189
184
|
content,
|
|
@@ -213,18 +208,9 @@ export class PendingStateManager implements IDisposable {
|
|
|
213
208
|
}
|
|
214
209
|
|
|
215
210
|
// applyStashedOp will cause the DDS to behave as if it has sent the op but not actually send it
|
|
216
|
-
const localOpMetadata = await this.stateHandler.applyStashedOp(
|
|
217
|
-
nextMessage.messageType,
|
|
218
|
-
nextMessage.content,
|
|
219
|
-
);
|
|
211
|
+
const localOpMetadata = await this.stateHandler.applyStashedOp(nextMessage.content);
|
|
220
212
|
nextMessage.localOpMetadata = localOpMetadata;
|
|
221
213
|
|
|
222
|
-
if (nextMessage.messageType === ContainerMessageType.IdAllocation) {
|
|
223
|
-
// Remove the stashed state from the op
|
|
224
|
-
// so that it doesn't go over the wire
|
|
225
|
-
delete nextMessage.content.stashedState;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
214
|
// then we push onto pendingMessages which will cause PendingStateManager to resubmit when we connect
|
|
229
215
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
230
216
|
this.pendingMessages.push(this.initialMessages.shift()!);
|
|
@@ -248,32 +234,17 @@ export class PendingStateManager implements IDisposable {
|
|
|
248
234
|
);
|
|
249
235
|
this.pendingMessages.shift();
|
|
250
236
|
|
|
251
|
-
|
|
252
|
-
// Close the container because this could indicate data corruption.
|
|
253
|
-
this.stateHandler.close(
|
|
254
|
-
DataProcessingError.create(
|
|
255
|
-
"pending local message type mismatch",
|
|
256
|
-
"unexpectedAckReceived",
|
|
257
|
-
message,
|
|
258
|
-
{
|
|
259
|
-
expectedMessageType: pendingMessage.messageType,
|
|
260
|
-
},
|
|
261
|
-
),
|
|
262
|
-
);
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
const pendingMessageContent = JSON.stringify(pendingMessage.content);
|
|
267
|
-
const messageContent = JSON.stringify(message.contents);
|
|
268
|
-
|
|
237
|
+
const messageContent = JSON.stringify({ type: message.type, contents: message.contents });
|
|
269
238
|
// Stringified content does not match
|
|
270
|
-
if (
|
|
271
|
-
// Close the container because this could indicate data corruption.
|
|
239
|
+
if (pendingMessage.content !== messageContent) {
|
|
272
240
|
this.stateHandler.close(
|
|
273
241
|
DataProcessingError.create(
|
|
274
242
|
"pending local message content mismatch",
|
|
275
243
|
"unexpectedAckReceived",
|
|
276
244
|
message,
|
|
245
|
+
{
|
|
246
|
+
expectedMessageType: JSON.parse(pendingMessage.content).type,
|
|
247
|
+
},
|
|
277
248
|
),
|
|
278
249
|
);
|
|
279
250
|
return;
|
|
@@ -412,7 +383,6 @@ export class PendingStateManager implements IDisposable {
|
|
|
412
383
|
while (pendingMessagesCount >= 0) {
|
|
413
384
|
// check is >= because batch end may be last pending message
|
|
414
385
|
this.stateHandler.reSubmit(
|
|
415
|
-
pendingMessage.messageType,
|
|
416
386
|
pendingMessage.content,
|
|
417
387
|
pendingMessage.localOpMetadata,
|
|
418
388
|
pendingMessage.opMetadata,
|
|
@@ -434,7 +404,6 @@ export class PendingStateManager implements IDisposable {
|
|
|
434
404
|
});
|
|
435
405
|
} else {
|
|
436
406
|
this.stateHandler.reSubmit(
|
|
437
|
-
pendingMessage.messageType,
|
|
438
407
|
pendingMessage.content,
|
|
439
408
|
pendingMessage.localOpMetadata,
|
|
440
409
|
pendingMessage.opMetadata,
|
package/src/scheduleManager.ts
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
import { EventEmitter } from "events";
|
|
6
6
|
import { IDeltaManager } from "@fluidframework/container-definitions";
|
|
7
7
|
import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
8
|
-
import {
|
|
9
|
-
import { ChildLogger } from "@fluidframework/telemetry-utils";
|
|
8
|
+
import { ITelemetryLoggerExt, ChildLogger } from "@fluidframework/telemetry-utils";
|
|
10
9
|
import { assert, performance } from "@fluidframework/common-utils";
|
|
11
10
|
import { isRuntimeMessage } from "@fluidframework/driver-utils";
|
|
12
11
|
import {
|
|
@@ -41,7 +40,7 @@ export class ScheduleManager {
|
|
|
41
40
|
private readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,
|
|
42
41
|
private readonly emitter: EventEmitter,
|
|
43
42
|
readonly getClientId: () => string | undefined,
|
|
44
|
-
private readonly logger:
|
|
43
|
+
private readonly logger: ITelemetryLoggerExt,
|
|
45
44
|
) {
|
|
46
45
|
this.deltaScheduler = new DeltaScheduler(
|
|
47
46
|
this.deltaManager,
|
|
@@ -106,7 +105,7 @@ class ScheduleManagerCore {
|
|
|
106
105
|
constructor(
|
|
107
106
|
private readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,
|
|
108
107
|
private readonly getClientId: () => string | undefined,
|
|
109
|
-
private readonly logger:
|
|
108
|
+
private readonly logger: ITelemetryLoggerExt,
|
|
110
109
|
) {
|
|
111
110
|
// Listen for delta manager sends and add batch metadata to messages
|
|
112
111
|
this.deltaManager.on("prepareSend", (messages: IDocumentMessage[]) => {
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
/* eslint-disable @rushstack/no-new-null */
|
|
6
|
-
import { IEvent, IEventProvider
|
|
6
|
+
import { IEvent, IEventProvider } from "@fluidframework/common-definitions";
|
|
7
|
+
import { ITelemetryLoggerExt, ChildLogger } from "@fluidframework/telemetry-utils";
|
|
7
8
|
import { assert, TypedEventEmitter } from "@fluidframework/common-utils";
|
|
8
9
|
import { IDeltaManager } from "@fluidframework/container-definitions";
|
|
9
10
|
import { UsageError } from "@fluidframework/container-utils";
|
|
10
11
|
import { IClient, IQuorumClients, ISequencedClient } from "@fluidframework/protocol-definitions";
|
|
11
|
-
import { ChildLogger } from "@fluidframework/telemetry-utils";
|
|
12
12
|
import { summarizerClientType } from "./summarizerClientElection";
|
|
13
13
|
|
|
14
14
|
// helper types for recursive readonly.
|
|
@@ -91,7 +91,7 @@ export class OrderedClientCollection
|
|
|
91
91
|
};
|
|
92
92
|
/** Pointer to end of linked list, for optimized client adds. */
|
|
93
93
|
private _youngestClient: LinkNode = this.rootNode;
|
|
94
|
-
private readonly logger:
|
|
94
|
+
private readonly logger: ITelemetryLoggerExt;
|
|
95
95
|
|
|
96
96
|
public get count() {
|
|
97
97
|
return this.clientMap.size;
|
|
@@ -101,7 +101,7 @@ export class OrderedClientCollection
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
constructor(
|
|
104
|
-
logger:
|
|
104
|
+
logger: ITelemetryLoggerExt,
|
|
105
105
|
deltaManager: Pick<IDeltaManager<unknown, unknown>, "lastSequenceNumber">,
|
|
106
106
|
quorum: Pick<IQuorumClients, "getMembers" | "on">,
|
|
107
107
|
) {
|
|
@@ -336,7 +336,7 @@ export class OrderedClientElection
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
constructor(
|
|
339
|
-
private readonly logger:
|
|
339
|
+
private readonly logger: ITelemetryLoggerExt,
|
|
340
340
|
private readonly orderedClientCollection: IOrderedClientCollection,
|
|
341
341
|
/** Serialized state from summary or current sequence number at time of load if new. */
|
|
342
342
|
initialState: ISerializedElection | number,
|
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IDisposable
|
|
7
|
-
import { assert, delay, Deferred, PromiseTimer } from "@fluidframework/common-utils";
|
|
8
|
-
import { UsageError } from "@fluidframework/container-utils";
|
|
9
|
-
import { DriverErrorType } from "@fluidframework/driver-definitions";
|
|
10
|
-
import { isRuntimeMessage } from "@fluidframework/driver-utils";
|
|
11
|
-
import { ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
|
|
6
|
+
import { IDisposable } from "@fluidframework/common-definitions";
|
|
12
7
|
import {
|
|
8
|
+
ITelemetryLoggerExt,
|
|
13
9
|
ChildLogger,
|
|
14
10
|
isFluidError,
|
|
15
11
|
loggerToMonitoringContext,
|
|
16
12
|
MonitoringContext,
|
|
17
13
|
} from "@fluidframework/telemetry-utils";
|
|
14
|
+
import { assert, delay, Deferred, PromiseTimer } from "@fluidframework/common-utils";
|
|
15
|
+
import { UsageError } from "@fluidframework/container-utils";
|
|
16
|
+
import { DriverErrorType } from "@fluidframework/driver-definitions";
|
|
17
|
+
import { isRuntimeMessage } from "@fluidframework/driver-utils";
|
|
18
|
+
import { ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
|
|
18
19
|
import { ISummaryConfiguration } from "../containerRuntime";
|
|
19
20
|
import { opSize } from "../opProperties";
|
|
20
21
|
import { SummarizeHeuristicRunner } from "./summarizerHeuristics";
|
|
@@ -56,7 +57,7 @@ const defaultNumberSummarizationAttempts = 2; // only up to 2 attempts
|
|
|
56
57
|
*/
|
|
57
58
|
export class RunningSummarizer implements IDisposable {
|
|
58
59
|
public static async start(
|
|
59
|
-
logger:
|
|
60
|
+
logger: ITelemetryLoggerExt,
|
|
60
61
|
summaryWatcher: IClientSummaryWatcher,
|
|
61
62
|
configuration: ISummaryConfiguration,
|
|
62
63
|
submitSummaryCallback: (options: ISubmitSummaryOptions) => Promise<SubmitSummaryResult>,
|
|
@@ -149,7 +150,7 @@ export class RunningSummarizer implements IDisposable {
|
|
|
149
150
|
private readonly runtimeListener;
|
|
150
151
|
|
|
151
152
|
private constructor(
|
|
152
|
-
baseLogger:
|
|
153
|
+
baseLogger: ITelemetryLoggerExt,
|
|
153
154
|
private readonly summaryWatcher: IClientSummaryWatcher,
|
|
154
155
|
private readonly configuration: ISummaryConfiguration,
|
|
155
156
|
private readonly submitSummaryCallback: (
|
|
@@ -252,7 +253,7 @@ export class RunningSummarizer implements IDisposable {
|
|
|
252
253
|
// Can remove and only listen to runtime once loader version is past 2.0.0-internal.1.2.0 (https://github.com/microsoft/FluidFramework/pull/11832)
|
|
253
254
|
// Tracked by AB#3883
|
|
254
255
|
this.runtime.deltaManager.on("op", this.deltaManagerListener);
|
|
255
|
-
this.runtime.on
|
|
256
|
+
this.runtime.on("op", this.runtimeListener);
|
|
256
257
|
}
|
|
257
258
|
|
|
258
259
|
private async handleSummaryAck(): Promise<number> {
|
|
@@ -347,7 +348,7 @@ export class RunningSummarizer implements IDisposable {
|
|
|
347
348
|
|
|
348
349
|
public dispose(): void {
|
|
349
350
|
this.runtime.deltaManager.off("op", this.deltaManagerListener);
|
|
350
|
-
this.runtime.off
|
|
351
|
+
this.runtime.off("op", this.runtimeListener);
|
|
351
352
|
this.summaryWatcher.dispose();
|
|
352
353
|
this.heuristicRunner?.dispose();
|
|
353
354
|
this.heuristicRunner = undefined;
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
|
|
6
6
|
import { EventEmitter } from "events";
|
|
7
7
|
import { Deferred } from "@fluidframework/common-utils";
|
|
8
|
-
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
9
|
-
import { ILoader, LoaderHeader } from "@fluidframework/container-definitions";
|
|
10
|
-
import { UsageError } from "@fluidframework/container-utils";
|
|
11
|
-
import { DriverHeader } from "@fluidframework/driver-definitions";
|
|
12
|
-
import { requestFluidObject } from "@fluidframework/runtime-utils";
|
|
13
8
|
import {
|
|
9
|
+
ITelemetryLoggerExt,
|
|
14
10
|
ChildLogger,
|
|
15
11
|
IFluidErrorBase,
|
|
16
12
|
LoggingError,
|
|
17
13
|
wrapErrorAndLog,
|
|
18
14
|
} from "@fluidframework/telemetry-utils";
|
|
15
|
+
import { ILoader, LoaderHeader } from "@fluidframework/container-definitions";
|
|
16
|
+
import { UsageError } from "@fluidframework/container-utils";
|
|
17
|
+
import { DriverHeader } from "@fluidframework/driver-definitions";
|
|
18
|
+
import { requestFluidObject } from "@fluidframework/runtime-utils";
|
|
19
19
|
import { FluidObject, IFluidHandleContext, IRequest } from "@fluidframework/core-interfaces";
|
|
20
20
|
import { ISummaryConfiguration } from "../containerRuntime";
|
|
21
21
|
import { ICancellableSummarizerController } from "./runWhileConnectedCoordinator";
|
|
@@ -47,7 +47,7 @@ export class SummarizingWarning
|
|
|
47
47
|
super(errorMessage);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
static wrap(error: any, logged: boolean = false, logger:
|
|
50
|
+
static wrap(error: any, logged: boolean = false, logger: ITelemetryLoggerExt) {
|
|
51
51
|
const newErrorFn = (errMsg: string) => new SummarizingWarning(errMsg, logged);
|
|
52
52
|
return wrapErrorAndLog<SummarizingWarning>(error, newErrorFn, logger);
|
|
53
53
|
}
|
|
@@ -66,7 +66,7 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
66
66
|
return this;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
private readonly logger:
|
|
69
|
+
private readonly logger: ITelemetryLoggerExt;
|
|
70
70
|
private runningSummarizer?: RunningSummarizer;
|
|
71
71
|
private _disposed: boolean = false;
|
|
72
72
|
private starting: boolean = false;
|
|
@@ -152,7 +152,7 @@ export class Summarizer extends EventEmitter implements ISummarizer {
|
|
|
152
152
|
// This will result in "summarizerClientDisconnected" stop reason recorded in telemetry,
|
|
153
153
|
// unless stop() was called earlier
|
|
154
154
|
this.dispose();
|
|
155
|
-
|
|
155
|
+
this.runtime.disposeFn();
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
private async runCore(onBehalfOf: string): Promise<SummarizerStopReason> {
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IEvent, IEventProvider
|
|
6
|
+
import { IEvent, IEventProvider } from "@fluidframework/common-definitions";
|
|
7
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
7
8
|
import { TypedEventEmitter } from "@fluidframework/common-utils";
|
|
8
9
|
import { IClientDetails, MessageType } from "@fluidframework/protocol-definitions";
|
|
9
10
|
import {
|
|
@@ -55,7 +56,7 @@ export class SummarizerClientElection
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
constructor(
|
|
58
|
-
private readonly logger:
|
|
59
|
+
private readonly logger: ITelemetryLoggerExt,
|
|
59
60
|
private readonly summaryCollection: IEventProvider<ISummaryCollectionOpEvents>,
|
|
60
61
|
public readonly clientElection: IOrderedClientElection,
|
|
61
62
|
private readonly maxOpsSinceLastSummary: number,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { Timer } from "@fluidframework/common-utils";
|
|
8
8
|
import { ISummaryConfigurationHeuristics } from "../containerRuntime";
|
|
9
9
|
import {
|
|
@@ -103,7 +103,7 @@ export class SummarizeHeuristicRunner implements ISummarizeHeuristicRunner {
|
|
|
103
103
|
private readonly heuristicData: ISummarizeHeuristicData,
|
|
104
104
|
private readonly configuration: ISummaryConfigurationHeuristics,
|
|
105
105
|
trySummarize: (reason: SummarizeReason) => void,
|
|
106
|
-
private readonly logger:
|
|
106
|
+
private readonly logger: ITelemetryLoggerExt,
|
|
107
107
|
private readonly summarizeStrategies: ISummaryHeuristicStrategy[] = getDefaultSummaryHeuristicStrategies(),
|
|
108
108
|
) {
|
|
109
109
|
this.idleTimer = new Timer(this.idleTime, () => this.runSummarize("idle"));
|
|
@@ -20,7 +20,14 @@ import {
|
|
|
20
20
|
ISnapshotTree,
|
|
21
21
|
SummaryObject,
|
|
22
22
|
} from "@fluidframework/protocol-definitions";
|
|
23
|
-
import { ITelemetryErrorEvent
|
|
23
|
+
import { ITelemetryErrorEvent } from "@fluidframework/common-definitions";
|
|
24
|
+
import {
|
|
25
|
+
ITelemetryLoggerExt,
|
|
26
|
+
ChildLogger,
|
|
27
|
+
LoggingError,
|
|
28
|
+
PerformanceEvent,
|
|
29
|
+
TelemetryDataTag,
|
|
30
|
+
} from "@fluidframework/telemetry-utils";
|
|
24
31
|
import { assert, unreachableCase } from "@fluidframework/common-utils";
|
|
25
32
|
import {
|
|
26
33
|
convertToSummaryTree,
|
|
@@ -28,12 +35,6 @@ import {
|
|
|
28
35
|
mergeStats,
|
|
29
36
|
ReadAndParseBlob,
|
|
30
37
|
} from "@fluidframework/runtime-utils";
|
|
31
|
-
import {
|
|
32
|
-
ChildLogger,
|
|
33
|
-
LoggingError,
|
|
34
|
-
PerformanceEvent,
|
|
35
|
-
TelemetryDataTag,
|
|
36
|
-
} from "@fluidframework/telemetry-utils";
|
|
37
38
|
import {
|
|
38
39
|
EscapedPath,
|
|
39
40
|
ICreateChildDetails,
|
|
@@ -76,21 +77,21 @@ export class SummarizerNode implements IRootSummarizerNode {
|
|
|
76
77
|
private wipLocalPaths: { localPath: EscapedPath; additionalPath?: EscapedPath } | undefined;
|
|
77
78
|
private wipSkipRecursion = false;
|
|
78
79
|
|
|
79
|
-
protected readonly logger:
|
|
80
|
+
protected readonly logger: ITelemetryLoggerExt;
|
|
80
81
|
|
|
81
82
|
/**
|
|
82
83
|
* Do not call constructor directly.
|
|
83
84
|
* Use createRootSummarizerNode to create root node, or createChild to create child nodes.
|
|
84
85
|
*/
|
|
85
86
|
public constructor(
|
|
86
|
-
baseLogger:
|
|
87
|
+
baseLogger: ITelemetryLoggerExt,
|
|
87
88
|
private readonly summarizeInternalFn: SummarizeInternalFn,
|
|
88
89
|
config: ISummarizerNodeConfig,
|
|
89
90
|
private _changeSequenceNumber: number,
|
|
90
91
|
/** Undefined means created without summary */
|
|
91
92
|
private _latestSummary?: SummaryNode,
|
|
92
93
|
private readonly initialSummary?: IInitialSummary,
|
|
93
|
-
protected wipSummaryLogger?:
|
|
94
|
+
protected wipSummaryLogger?: ITelemetryLoggerExt,
|
|
94
95
|
/** A unique id of this node to be logged when sending telemetry. */
|
|
95
96
|
protected telemetryNodeId?: string,
|
|
96
97
|
) {
|
|
@@ -106,7 +107,7 @@ export class SummarizerNode implements IRootSummarizerNode {
|
|
|
106
107
|
});
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
public startSummary(referenceSequenceNumber: number, summaryLogger:
|
|
110
|
+
public startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryLoggerExt) {
|
|
110
111
|
assert(
|
|
111
112
|
this.wipSummaryLogger === undefined,
|
|
112
113
|
0x19f /* "wipSummaryLogger should not be set yet in startSummary" */,
|
|
@@ -306,7 +307,7 @@ export class SummarizerNode implements IRootSummarizerNode {
|
|
|
306
307
|
summaryRefSeq: number,
|
|
307
308
|
fetchLatestSnapshot: () => Promise<IFetchSnapshotResult>,
|
|
308
309
|
readAndParseBlob: ReadAndParseBlob,
|
|
309
|
-
correlatedSummaryLogger:
|
|
310
|
+
correlatedSummaryLogger: ITelemetryLoggerExt,
|
|
310
311
|
): Promise<RefreshSummaryResult> {
|
|
311
312
|
const eventProps: {
|
|
312
313
|
proposalHandle: string | undefined;
|
|
@@ -449,7 +450,7 @@ export class SummarizerNode implements IRootSummarizerNode {
|
|
|
449
450
|
snapshotTree: ISnapshotTree,
|
|
450
451
|
basePath: EscapedPath | undefined,
|
|
451
452
|
localPath: EscapedPath,
|
|
452
|
-
correlatedSummaryLogger:
|
|
453
|
+
correlatedSummaryLogger: ITelemetryLoggerExt,
|
|
453
454
|
readAndParseBlob: ReadAndParseBlob,
|
|
454
455
|
): Promise<void> {
|
|
455
456
|
// Possible re-entrancy. If we have already seen a summary later than this one, ignore it.
|
|
@@ -746,7 +747,7 @@ export class SummarizerNode implements IRootSummarizerNode {
|
|
|
746
747
|
* @param config - Configure behavior of summarizer node
|
|
747
748
|
*/
|
|
748
749
|
export const createRootSummarizerNode = (
|
|
749
|
-
logger:
|
|
750
|
+
logger: ITelemetryLoggerExt,
|
|
750
751
|
summarizeInternalFn: SummarizeInternalFn,
|
|
751
752
|
changeSequenceNumber: number,
|
|
752
753
|
referenceSequenceNumber: number | undefined,
|