@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,8 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { ChildLogger, TelemetryLogger } from "@fluidframework/telemetry-utils";
|
|
6
|
+
import { ITelemetryLoggerExt, ChildLogger, TelemetryLogger } from "@fluidframework/telemetry-utils";
|
|
8
7
|
import { IDeltaManager } from "@fluidframework/container-definitions";
|
|
9
8
|
import {
|
|
10
9
|
IDocumentMessage,
|
|
@@ -69,12 +68,12 @@ class OpPerfTelemetry {
|
|
|
69
68
|
private connectionStartTime = 0;
|
|
70
69
|
private gap = 0;
|
|
71
70
|
|
|
72
|
-
private readonly logger:
|
|
71
|
+
private readonly logger: ITelemetryLoggerExt;
|
|
73
72
|
|
|
74
73
|
public constructor(
|
|
75
74
|
private clientId: string | undefined,
|
|
76
75
|
private readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,
|
|
77
|
-
logger:
|
|
76
|
+
logger: ITelemetryLoggerExt,
|
|
78
77
|
) {
|
|
79
78
|
this.logger = ChildLogger.create(logger, "OpPerf");
|
|
80
79
|
|
|
@@ -314,7 +313,7 @@ export interface IPerfSignalReport {
|
|
|
314
313
|
export function ReportOpPerfTelemetry(
|
|
315
314
|
clientId: string | undefined,
|
|
316
315
|
deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,
|
|
317
|
-
logger:
|
|
316
|
+
logger: ITelemetryLoggerExt,
|
|
318
317
|
) {
|
|
319
318
|
new OpPerfTelemetry(clientId, deltaManager, logger);
|
|
320
319
|
}
|
package/src/containerRuntime.ts
CHANGED
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
ITelemetryBaseLogger,
|
|
7
|
-
ITelemetryGenericEvent,
|
|
8
|
-
ITelemetryLogger,
|
|
9
|
-
} from "@fluidframework/common-definitions";
|
|
5
|
+
import { ITelemetryBaseLogger, ITelemetryGenericEvent } from "@fluidframework/common-definitions";
|
|
10
6
|
import {
|
|
11
7
|
FluidObject,
|
|
12
8
|
IFluidHandle,
|
|
@@ -45,6 +41,7 @@ import {
|
|
|
45
41
|
MonitoringContext,
|
|
46
42
|
loggerToMonitoringContext,
|
|
47
43
|
wrapError,
|
|
44
|
+
ITelemetryLoggerExt,
|
|
48
45
|
} from "@fluidframework/telemetry-utils";
|
|
49
46
|
import {
|
|
50
47
|
DriverHeader,
|
|
@@ -584,9 +581,6 @@ export class ContainerRuntime
|
|
|
584
581
|
extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
585
582
|
implements IContainerRuntime, IRuntime, ISummarizerRuntime, ISummarizerInternalsProvider
|
|
586
583
|
{
|
|
587
|
-
public get IContainerRuntime() {
|
|
588
|
-
return this;
|
|
589
|
-
}
|
|
590
584
|
public get IFluidRouter() {
|
|
591
585
|
return this;
|
|
592
586
|
}
|
|
@@ -828,7 +822,7 @@ export class ContainerRuntime
|
|
|
828
822
|
opMetadata: Record<string, unknown> | undefined,
|
|
829
823
|
) => void {
|
|
830
824
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
831
|
-
return this.
|
|
825
|
+
return this.reSubmitCore;
|
|
832
826
|
}
|
|
833
827
|
|
|
834
828
|
public get disposeFn(): (error?: ICriticalContainerError) => void {
|
|
@@ -1054,7 +1048,7 @@ export class ContainerRuntime
|
|
|
1054
1048
|
dataStoreAliasMap: [string, string][],
|
|
1055
1049
|
private readonly runtimeOptions: Readonly<Required<IContainerRuntimeOptions>>,
|
|
1056
1050
|
private readonly containerScope: FluidObject,
|
|
1057
|
-
public readonly logger:
|
|
1051
|
+
public readonly logger: ITelemetryLoggerExt,
|
|
1058
1052
|
existing: boolean,
|
|
1059
1053
|
blobManagerSnapshot: IBlobManagerLoadInfo,
|
|
1060
1054
|
private readonly _storage: IDocumentStorageService,
|
|
@@ -1305,7 +1299,6 @@ export class ContainerRuntime
|
|
|
1305
1299
|
close: this.closeFn,
|
|
1306
1300
|
connected: () => this.connected,
|
|
1307
1301
|
reSubmit: this.reSubmit.bind(this),
|
|
1308
|
-
rollback: this.rollback.bind(this),
|
|
1309
1302
|
orderSequentially: this.orderSequentially.bind(this),
|
|
1310
1303
|
},
|
|
1311
1304
|
pendingRuntimeState?.pending,
|
|
@@ -1818,7 +1811,23 @@ export class ContainerRuntime
|
|
|
1818
1811
|
this.idCompressor = IdCompressor.deserialize(op.stashedState);
|
|
1819
1812
|
}
|
|
1820
1813
|
|
|
1821
|
-
|
|
1814
|
+
/**
|
|
1815
|
+
* Parse an op's type and actual content from given serialized content
|
|
1816
|
+
* ! Note: this format needs to be in-line with what is set in the "ContainerRuntime.submit(...)" method
|
|
1817
|
+
*/
|
|
1818
|
+
private parseOpContent(serializedContent?: string): {
|
|
1819
|
+
type: ContainerMessageType;
|
|
1820
|
+
contents: unknown;
|
|
1821
|
+
} {
|
|
1822
|
+
assert(serializedContent !== undefined, "content must be defined");
|
|
1823
|
+
const parsed = JSON.parse(serializedContent);
|
|
1824
|
+
assert(parsed.type !== undefined, "incorrect op content format");
|
|
1825
|
+
return { type: parsed.type as ContainerMessageType, contents: parsed.contents };
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
private async applyStashedOp(op: string): Promise<unknown> {
|
|
1829
|
+
// Need to parse from string for back-compat
|
|
1830
|
+
const { type, contents } = this.parseOpContent(op);
|
|
1822
1831
|
switch (type) {
|
|
1823
1832
|
case ContainerMessageType.FluidDataStoreOp:
|
|
1824
1833
|
return this.dataStores.applyStashedOp(contents as IEnvelope);
|
|
@@ -2158,11 +2167,7 @@ export class ContainerRuntime
|
|
|
2158
2167
|
// This will throw and close the container if rollback fails
|
|
2159
2168
|
try {
|
|
2160
2169
|
checkpoint.rollback((message: BatchMessage) =>
|
|
2161
|
-
this.rollback(
|
|
2162
|
-
message.deserializedContent.type,
|
|
2163
|
-
message.deserializedContent.contents,
|
|
2164
|
-
message.localOpMetadata,
|
|
2165
|
-
),
|
|
2170
|
+
this.rollback(message.contents, message.localOpMetadata),
|
|
2166
2171
|
);
|
|
2167
2172
|
} catch (err) {
|
|
2168
2173
|
const error2 = wrapError(err, (message) => {
|
|
@@ -2415,7 +2420,7 @@ export class ContainerRuntime
|
|
|
2415
2420
|
/** True to track the state for this summary in the SummarizerNodes; defaults to true */
|
|
2416
2421
|
trackState?: boolean;
|
|
2417
2422
|
/** Logger to use for correlated summary events */
|
|
2418
|
-
summaryLogger?:
|
|
2423
|
+
summaryLogger?: ITelemetryLoggerExt;
|
|
2419
2424
|
/** True to run garbage collection before summarizing; defaults to true */
|
|
2420
2425
|
runGC?: boolean;
|
|
2421
2426
|
/** True to generate full GC data */
|
|
@@ -2632,7 +2637,7 @@ export class ContainerRuntime
|
|
|
2632
2637
|
public async collectGarbage(
|
|
2633
2638
|
options: {
|
|
2634
2639
|
/** Logger to use for logging GC events */
|
|
2635
|
-
logger?:
|
|
2640
|
+
logger?: ITelemetryLoggerExt;
|
|
2636
2641
|
/** True to run GC sweep phase after the mark phase */
|
|
2637
2642
|
runSweep?: boolean;
|
|
2638
2643
|
/** True to generate full GC data */
|
|
@@ -2979,10 +2984,10 @@ export class ContainerRuntime
|
|
|
2979
2984
|
};
|
|
2980
2985
|
idAllocationBatchMessage = {
|
|
2981
2986
|
contents: JSON.stringify(idAllocationMessage),
|
|
2982
|
-
deserializedContent: idAllocationMessage,
|
|
2983
2987
|
referenceSequenceNumber: this.deltaManager.lastSequenceNumber,
|
|
2984
2988
|
metadata: undefined,
|
|
2985
2989
|
localOpMetadata: this.idCompressor?.serialize(true),
|
|
2990
|
+
type: ContainerMessageType.IdAllocation,
|
|
2986
2991
|
};
|
|
2987
2992
|
}
|
|
2988
2993
|
|
|
@@ -3020,7 +3025,7 @@ export class ContainerRuntime
|
|
|
3020
3025
|
|
|
3021
3026
|
const message: BatchMessage = {
|
|
3022
3027
|
contents: serializedContent,
|
|
3023
|
-
|
|
3028
|
+
type,
|
|
3024
3029
|
metadata,
|
|
3025
3030
|
localOpMetadata,
|
|
3026
3031
|
referenceSequenceNumber: this.deltaManager.lastSequenceNumber,
|
|
@@ -3175,13 +3180,23 @@ export class ContainerRuntime
|
|
|
3175
3180
|
}
|
|
3176
3181
|
}
|
|
3177
3182
|
|
|
3183
|
+
private reSubmit(
|
|
3184
|
+
content: string,
|
|
3185
|
+
localOpMetadata: unknown,
|
|
3186
|
+
opMetadata: Record<string, unknown> | undefined,
|
|
3187
|
+
) {
|
|
3188
|
+
// Need to parse from string for back-compat
|
|
3189
|
+
const { contents, type } = this.parseOpContent(content);
|
|
3190
|
+
this.reSubmitCore(type, contents, localOpMetadata, opMetadata);
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3178
3193
|
/**
|
|
3179
3194
|
* Finds the right store and asks it to resubmit the message. This typically happens when we
|
|
3180
3195
|
* reconnect and there are pending messages.
|
|
3181
3196
|
* @param content - The content of the original message.
|
|
3182
3197
|
* @param localOpMetadata - The local metadata associated with the original message.
|
|
3183
3198
|
*/
|
|
3184
|
-
private
|
|
3199
|
+
private reSubmitCore(
|
|
3185
3200
|
type: ContainerMessageType,
|
|
3186
3201
|
content: any,
|
|
3187
3202
|
localOpMetadata: unknown,
|
|
@@ -3195,7 +3210,13 @@ export class ContainerRuntime
|
|
|
3195
3210
|
break;
|
|
3196
3211
|
case ContainerMessageType.Attach:
|
|
3197
3212
|
case ContainerMessageType.Alias:
|
|
3213
|
+
this.submit(type, content, localOpMetadata);
|
|
3214
|
+
break;
|
|
3198
3215
|
case ContainerMessageType.IdAllocation:
|
|
3216
|
+
// Remove the stashedState from the op if it's a stashed op
|
|
3217
|
+
if (content.stashedState !== undefined) {
|
|
3218
|
+
delete content.stashedState;
|
|
3219
|
+
}
|
|
3199
3220
|
this.submit(type, content, localOpMetadata);
|
|
3200
3221
|
break;
|
|
3201
3222
|
case ContainerMessageType.ChunkedOp:
|
|
@@ -3211,12 +3232,14 @@ export class ContainerRuntime
|
|
|
3211
3232
|
}
|
|
3212
3233
|
}
|
|
3213
3234
|
|
|
3214
|
-
private rollback(
|
|
3235
|
+
private rollback(content: string | undefined, localOpMetadata: unknown) {
|
|
3236
|
+
// Need to parse from string for back-compat
|
|
3237
|
+
const { type, contents } = this.parseOpContent(content);
|
|
3215
3238
|
switch (type) {
|
|
3216
3239
|
case ContainerMessageType.FluidDataStoreOp:
|
|
3217
3240
|
// For operations, call rollbackDataStoreOp which will find the right store
|
|
3218
3241
|
// and trigger rollback on it.
|
|
3219
|
-
this.dataStores.rollbackDataStoreOp(
|
|
3242
|
+
this.dataStores.rollbackDataStoreOp(contents as IEnvelope, localOpMetadata);
|
|
3220
3243
|
break;
|
|
3221
3244
|
default:
|
|
3222
3245
|
throw new Error(`Can't rollback ${type}`);
|
|
@@ -3225,7 +3248,7 @@ export class ContainerRuntime
|
|
|
3225
3248
|
|
|
3226
3249
|
private async waitForDeltaManagerToCatchup(
|
|
3227
3250
|
latestSnapshotRefSeq: number,
|
|
3228
|
-
summaryLogger:
|
|
3251
|
+
summaryLogger: ITelemetryLoggerExt,
|
|
3229
3252
|
): Promise<void> {
|
|
3230
3253
|
if (latestSnapshotRefSeq > this.deltaManager.lastSequenceNumber) {
|
|
3231
3254
|
// We need to catch up to the latest summary's reference sequence number before proceeding.
|
|
@@ -3337,7 +3360,7 @@ export class ContainerRuntime
|
|
|
3337
3360
|
* @returns downloaded snapshot's reference sequence number
|
|
3338
3361
|
*/
|
|
3339
3362
|
private async refreshLatestSummaryAckFromServer(
|
|
3340
|
-
summaryLogger:
|
|
3363
|
+
summaryLogger: ITelemetryLoggerExt,
|
|
3341
3364
|
): Promise<{ latestSnapshotRefSeq: number; latestSnapshotVersionId: string | undefined }> {
|
|
3342
3365
|
const readAndParseBlob = async <T>(id: string) => readAndParse<T>(this.storage, id);
|
|
3343
3366
|
const { snapshotTree, versionId, latestSnapshotRefSeq } =
|
|
@@ -3371,7 +3394,7 @@ export class ContainerRuntime
|
|
|
3371
3394
|
}
|
|
3372
3395
|
|
|
3373
3396
|
private async fetchLatestSnapshotFromStorage(
|
|
3374
|
-
logger:
|
|
3397
|
+
logger: ITelemetryLoggerExt,
|
|
3375
3398
|
event: ITelemetryGenericEvent,
|
|
3376
3399
|
readAndParseBlob: ReadAndParseBlob,
|
|
3377
3400
|
): Promise<{ snapshotTree: ISnapshotTree; versionId: string; latestSnapshotRefSeq: number }> {
|
|
@@ -3379,7 +3402,7 @@ export class ContainerRuntime
|
|
|
3379
3402
|
}
|
|
3380
3403
|
|
|
3381
3404
|
private async fetchSnapshotFromStorage(
|
|
3382
|
-
logger:
|
|
3405
|
+
logger: ITelemetryLoggerExt,
|
|
3383
3406
|
event: ITelemetryGenericEvent,
|
|
3384
3407
|
readAndParseBlob: ReadAndParseBlob,
|
|
3385
3408
|
versionId: string | null,
|
package/src/dataStore.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ITelemetryLoggerExt, TelemetryDataTag } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { assert, unreachableCase } from "@fluidframework/common-utils";
|
|
8
8
|
import { AttachState } from "@fluidframework/container-definitions";
|
|
9
9
|
import { UsageError } from "@fluidframework/container-utils";
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
IDataStore,
|
|
14
14
|
IFluidDataStoreChannel,
|
|
15
15
|
} from "@fluidframework/runtime-definitions";
|
|
16
|
-
import { TelemetryDataTag } from "@fluidframework/telemetry-utils";
|
|
17
16
|
import { ContainerRuntime } from "./containerRuntime";
|
|
18
17
|
import { DataStores } from "./dataStores";
|
|
19
18
|
|
|
@@ -48,7 +47,7 @@ export const channelToDataStore = (
|
|
|
48
47
|
internalId: string,
|
|
49
48
|
runtime: ContainerRuntime,
|
|
50
49
|
datastores: DataStores,
|
|
51
|
-
logger:
|
|
50
|
+
logger: ITelemetryLoggerExt,
|
|
52
51
|
): IDataStore => new DataStore(fluidDataStoreChannel, internalId, runtime, datastores, logger);
|
|
53
52
|
|
|
54
53
|
enum AliasState {
|
|
@@ -175,7 +174,7 @@ class DataStore implements IDataStore {
|
|
|
175
174
|
private readonly internalId: string,
|
|
176
175
|
private readonly runtime: ContainerRuntime,
|
|
177
176
|
private readonly datastores: DataStores,
|
|
178
|
-
private readonly logger:
|
|
177
|
+
private readonly logger: ITelemetryLoggerExt,
|
|
179
178
|
) {
|
|
180
179
|
this.pendingAliases = datastores.pendingAliases;
|
|
181
180
|
}
|
package/src/dataStoreContext.ts
CHANGED
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
IDisposable,
|
|
8
|
-
ITelemetryLogger,
|
|
9
|
-
ITelemetryProperties,
|
|
10
|
-
} from "@fluidframework/common-definitions";
|
|
6
|
+
import { IDisposable, ITelemetryProperties } from "@fluidframework/common-definitions";
|
|
11
7
|
import { FluidObject, IRequest, IResponse, IFluidHandle } from "@fluidframework/core-interfaces";
|
|
12
8
|
import {
|
|
13
9
|
IAudience,
|
|
@@ -59,6 +55,7 @@ import {
|
|
|
59
55
|
import {
|
|
60
56
|
ChildLogger,
|
|
61
57
|
generateStack,
|
|
58
|
+
ITelemetryLoggerExt,
|
|
62
59
|
loggerToMonitoringContext,
|
|
63
60
|
LoggingError,
|
|
64
61
|
MonitoringContext,
|
|
@@ -162,7 +159,7 @@ export abstract class FluidDataStoreContext
|
|
|
162
159
|
return this._containerRuntime.clientDetails;
|
|
163
160
|
}
|
|
164
161
|
|
|
165
|
-
public get logger():
|
|
162
|
+
public get logger(): ITelemetryLoggerExt {
|
|
166
163
|
return this._containerRuntime.logger;
|
|
167
164
|
}
|
|
168
165
|
|
package/src/dataStoreContexts.ts
CHANGED
|
@@ -3,13 +3,9 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
IDisposable,
|
|
8
|
-
ITelemetryBaseLogger,
|
|
9
|
-
ITelemetryLogger,
|
|
10
|
-
} from "@fluidframework/common-definitions";
|
|
6
|
+
import { IDisposable, ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
11
7
|
import { assert, Deferred, Lazy } from "@fluidframework/common-utils";
|
|
12
|
-
import { ChildLogger } from "@fluidframework/telemetry-utils";
|
|
8
|
+
import { ChildLogger, ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
13
9
|
import { FluidDataStoreContext, LocalFluidDataStoreContext } from "./dataStoreContext";
|
|
14
10
|
|
|
15
11
|
export class DataStoreContexts implements Iterable<[string, FluidDataStoreContext]>, IDisposable {
|
|
@@ -46,7 +42,7 @@ export class DataStoreContexts implements Iterable<[string, FluidDataStoreContex
|
|
|
46
42
|
}
|
|
47
43
|
});
|
|
48
44
|
|
|
49
|
-
private readonly _logger:
|
|
45
|
+
private readonly _logger: ITelemetryLoggerExt;
|
|
50
46
|
|
|
51
47
|
constructor(baseLogger: ITelemetryBaseLogger) {
|
|
52
48
|
this._logger = ChildLogger.create(baseLogger);
|
package/src/deltaScheduler.ts
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ITelemetryLoggerExt, TelemetryLogger } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { performance } from "@fluidframework/common-utils";
|
|
8
8
|
import { IDeltaManager } from "@fluidframework/container-definitions";
|
|
9
9
|
import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
10
10
|
|
|
11
|
-
import { TelemetryLogger } from "@fluidframework/telemetry-utils";
|
|
12
11
|
/**
|
|
13
12
|
* DeltaScheduler is responsible for the scheduling of inbound delta queue in cases where there
|
|
14
13
|
* is more than one op a particular run of the queue. It does not schedule if there is just one
|
|
@@ -52,7 +51,7 @@ export class DeltaScheduler {
|
|
|
52
51
|
|
|
53
52
|
constructor(
|
|
54
53
|
deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,
|
|
55
|
-
private readonly logger:
|
|
54
|
+
private readonly logger: ITelemetryLoggerExt,
|
|
56
55
|
) {
|
|
57
56
|
this.deltaManager = deltaManager;
|
|
58
57
|
this.deltaManager.inbound.on("idle", () => {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
7
6
|
import { LazyPromise, Timer } from "@fluidframework/common-utils";
|
|
8
7
|
import { ClientSessionExpiredError, DataProcessingError } from "@fluidframework/container-utils";
|
|
9
8
|
import { IRequestHeader } from "@fluidframework/core-interfaces";
|
|
@@ -17,6 +16,7 @@ import {
|
|
|
17
16
|
import { ReadAndParseBlob } from "@fluidframework/runtime-utils";
|
|
18
17
|
import {
|
|
19
18
|
ChildLogger,
|
|
19
|
+
ITelemetryLoggerExt,
|
|
20
20
|
loggerToMonitoringContext,
|
|
21
21
|
MonitoringContext,
|
|
22
22
|
PerformanceEvent,
|
|
@@ -446,7 +446,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
446
446
|
public async collectGarbage(
|
|
447
447
|
options: {
|
|
448
448
|
/** Logger to use for logging GC events */
|
|
449
|
-
logger?:
|
|
449
|
+
logger?: ITelemetryLoggerExt;
|
|
450
450
|
/** True to run GC sweep phase after the mark phase */
|
|
451
451
|
runSweep?: boolean;
|
|
452
452
|
/** True to generate full GC data */
|
|
@@ -528,7 +528,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
528
528
|
private async runGC(
|
|
529
529
|
fullGC: boolean,
|
|
530
530
|
currentReferenceTimestampMs: number,
|
|
531
|
-
logger:
|
|
531
|
+
logger: ITelemetryLoggerExt,
|
|
532
532
|
): Promise<IGCStats> {
|
|
533
533
|
// 1. Generate / analyze the runtime's reference graph.
|
|
534
534
|
// Get the reference graph (gcData) and run GC algorithm to get referenced / unreferenced nodes.
|
|
@@ -641,7 +641,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
641
641
|
gcResult: IGCResult,
|
|
642
642
|
sweepReadyNodes: string[],
|
|
643
643
|
currentReferenceTimestampMs: number,
|
|
644
|
-
logger:
|
|
644
|
+
logger: ITelemetryLoggerExt,
|
|
645
645
|
): string[] {
|
|
646
646
|
// Log events for objects that are ready to be deleted by sweep. This will give us data on sweep when
|
|
647
647
|
// its not enabled.
|
|
@@ -719,7 +719,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
719
719
|
private findAllNodesReferencedBetweenGCs(
|
|
720
720
|
currentGCData: IGarbageCollectionData,
|
|
721
721
|
previousGCData: IGarbageCollectionData | undefined,
|
|
722
|
-
logger:
|
|
722
|
+
logger: ITelemetryLoggerExt,
|
|
723
723
|
): string[] | undefined {
|
|
724
724
|
// If we haven't run GC before there is nothing to do.
|
|
725
725
|
// No previousGCData, means nothing is unreferenced, and there are no reference state trackers to clear
|
package/src/gc/gcDefinitions.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
ITelemetryContext,
|
|
14
14
|
} from "@fluidframework/runtime-definitions";
|
|
15
15
|
import { ReadAndParseBlob } from "@fluidframework/runtime-utils";
|
|
16
|
-
import {
|
|
16
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
17
17
|
import {
|
|
18
18
|
IContainerRuntimeMetadata,
|
|
19
19
|
ICreateContainerMetadata,
|
|
@@ -211,7 +211,7 @@ export interface IGarbageCollector {
|
|
|
211
211
|
/** Run garbage collection and update the reference / used state of the system. */
|
|
212
212
|
collectGarbage(
|
|
213
213
|
options: {
|
|
214
|
-
logger?:
|
|
214
|
+
logger?: ITelemetryLoggerExt;
|
|
215
215
|
runSweep?: boolean;
|
|
216
216
|
fullGC?: boolean;
|
|
217
217
|
},
|
|
@@ -253,7 +253,7 @@ export interface IGarbageCollector {
|
|
|
253
253
|
export interface IGarbageCollectorCreateParams {
|
|
254
254
|
readonly runtime: IGarbageCollectionRuntime;
|
|
255
255
|
readonly gcOptions: IGCRuntimeOptions;
|
|
256
|
-
readonly baseLogger:
|
|
256
|
+
readonly baseLogger: ITelemetryLoggerExt;
|
|
257
257
|
readonly existing: boolean;
|
|
258
258
|
readonly metadata: IContainerRuntimeMetadata | undefined;
|
|
259
259
|
readonly createContainerMetadata: ICreateContainerMetadata;
|
package/src/gc/gcTelemetry.ts
CHANGED
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { ITelemetryGenericEvent
|
|
6
|
+
import { ITelemetryGenericEvent } from "@fluidframework/common-definitions";
|
|
7
7
|
import { IGarbageCollectionData } from "@fluidframework/runtime-definitions";
|
|
8
8
|
import { packagePathToTelemetryProperty } from "@fluidframework/runtime-utils";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
generateStack,
|
|
11
|
+
ITelemetryLoggerExt,
|
|
12
|
+
MonitoringContext,
|
|
13
|
+
} from "@fluidframework/telemetry-utils";
|
|
10
14
|
import { ICreateContainerMetadata } from "../summary";
|
|
11
15
|
import {
|
|
12
16
|
disableSweepLogKey,
|
|
@@ -243,7 +247,7 @@ export class GCTelemetryTracker {
|
|
|
243
247
|
currentGCData: IGarbageCollectionData,
|
|
244
248
|
previousGCData: IGarbageCollectionData,
|
|
245
249
|
explicitReferences: Map<string, string[]>,
|
|
246
|
-
logger:
|
|
250
|
+
logger: ITelemetryLoggerExt,
|
|
247
251
|
) {
|
|
248
252
|
for (const [nodeId, currentOutboundRoutes] of Object.entries(currentGCData.gcNodes)) {
|
|
249
253
|
const previousRoutes = previousGCData.gcNodes[nodeId] ?? [];
|
|
@@ -284,7 +288,7 @@ export class GCTelemetryTracker {
|
|
|
284
288
|
* Log events that are pending in pendingEventsQueue. This is called after GC runs in the summarizer client
|
|
285
289
|
* so that the state of an unreferenced node is updated.
|
|
286
290
|
*/
|
|
287
|
-
public async logPendingEvents(logger:
|
|
291
|
+
public async logPendingEvents(logger: ITelemetryLoggerExt) {
|
|
288
292
|
// Events sent come only from the summarizer client. In between summaries, events are pushed to a queue and at
|
|
289
293
|
// summary time they are then logged.
|
|
290
294
|
// Events generated:
|
|
@@ -333,7 +337,7 @@ export class GCTelemetryTracker {
|
|
|
333
337
|
* this will give us a view into how much deleted content a container has.
|
|
334
338
|
*/
|
|
335
339
|
public logSweepEvents(
|
|
336
|
-
logger:
|
|
340
|
+
logger: ITelemetryLoggerExt,
|
|
337
341
|
currentReferenceTimestampMs: number,
|
|
338
342
|
unreferencedNodesState: Map<string, UnreferencedStateTracker>,
|
|
339
343
|
completedGCRuns: number,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
9
9
|
import { assert } from "@fluidframework/common-utils";
|
|
10
10
|
import {
|
|
11
11
|
IIdCompressor,
|
|
@@ -311,7 +311,7 @@ export class IdCompressor implements IIdCompressorCore, IIdCompressor {
|
|
|
311
311
|
*/
|
|
312
312
|
public constructor(
|
|
313
313
|
public readonly localSessionId: SessionId,
|
|
314
|
-
private readonly logger?:
|
|
314
|
+
private readonly logger?: ITelemetryLoggerExt,
|
|
315
315
|
) {
|
|
316
316
|
this.localSession = this.createSession(localSessionId);
|
|
317
317
|
}
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
import { IBatchMessage } from "@fluidframework/container-definitions";
|
|
7
7
|
import { ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
|
|
8
|
-
import { CompressionAlgorithms, ContainerMessageType
|
|
8
|
+
import { CompressionAlgorithms, ContainerMessageType } from "..";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Batch message type used internally by the runtime
|
|
12
12
|
*/
|
|
13
13
|
export type BatchMessage = IBatchMessage & {
|
|
14
14
|
localOpMetadata: unknown;
|
|
15
|
-
|
|
15
|
+
type: ContainerMessageType;
|
|
16
16
|
referenceSequenceNumber: number;
|
|
17
17
|
compression?: CompressionAlgorithms;
|
|
18
18
|
};
|
|
@@ -3,10 +3,9 @@
|
|
|
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, IsoBuffer } from "@fluidframework/common-utils";
|
|
8
8
|
import { UsageError } from "@fluidframework/container-utils";
|
|
9
|
-
import { ChildLogger } from "@fluidframework/telemetry-utils";
|
|
10
9
|
import { compress } from "lz4js";
|
|
11
10
|
import { CompressionAlgorithms } from "../containerRuntime";
|
|
12
11
|
import { estimateSocketSize } from "./batchManager";
|
|
@@ -20,7 +19,7 @@ import { IBatch, BatchMessage } from "./definitions";
|
|
|
20
19
|
export class OpCompressor {
|
|
21
20
|
private readonly logger;
|
|
22
21
|
|
|
23
|
-
constructor(logger:
|
|
22
|
+
constructor(logger: ITelemetryLoggerExt) {
|
|
24
23
|
this.logger = ChildLogger.create(logger, "OpCompressor");
|
|
25
24
|
}
|
|
26
25
|
|
|
@@ -47,10 +46,7 @@ export class OpCompressor {
|
|
|
47
46
|
// Add empty placeholder messages to reserve the sequence numbers
|
|
48
47
|
for (const message of batch.content.slice(1)) {
|
|
49
48
|
messages.push({
|
|
50
|
-
|
|
51
|
-
contents: undefined,
|
|
52
|
-
type: message.deserializedContent.type,
|
|
53
|
-
},
|
|
49
|
+
type: message.type,
|
|
54
50
|
localOpMetadata: message.localOpMetadata,
|
|
55
51
|
metadata: message.metadata,
|
|
56
52
|
referenceSequenceNumber: message.referenceSequenceNumber,
|
|
@@ -79,7 +75,7 @@ export class OpCompressor {
|
|
|
79
75
|
|
|
80
76
|
private serializeBatch(batch: IBatch): string {
|
|
81
77
|
try {
|
|
82
|
-
return
|
|
78
|
+
return `[${batch.content.map((message) => message.contents).join(",")}]`;
|
|
83
79
|
} catch (e: any) {
|
|
84
80
|
if (e.message === "Invalid string length") {
|
|
85
81
|
// This is how JSON.stringify signals that
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
import { decompress } from "lz4js";
|
|
7
7
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
8
8
|
import { assert, IsoBuffer, Uint8ArrayToString } from "@fluidframework/common-utils";
|
|
9
|
-
import { ChildLogger } from "@fluidframework/telemetry-utils";
|
|
10
|
-
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
9
|
+
import { ChildLogger, ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
11
10
|
import { CompressionAlgorithms } from "../containerRuntime";
|
|
12
11
|
import { IMessageProcessingResult } from "./definitions";
|
|
13
12
|
|
|
@@ -25,7 +24,7 @@ export class OpDecompressor {
|
|
|
25
24
|
private processedCount = 0;
|
|
26
25
|
private readonly logger;
|
|
27
26
|
|
|
28
|
-
constructor(logger:
|
|
27
|
+
constructor(logger: ITelemetryLoggerExt) {
|
|
29
28
|
this.logger = ChildLogger.create(logger, "OpDecompressor");
|
|
30
29
|
}
|
|
31
30
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { assert } from "@fluidframework/common-utils";
|
|
7
7
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
8
|
-
import { ContainerMessageType
|
|
8
|
+
import { ContainerMessageType } from "..";
|
|
9
9
|
import { IBatch } from "./definitions";
|
|
10
10
|
|
|
11
11
|
interface IGroupedMessage {
|
|
@@ -26,7 +26,7 @@ export class OpGroupingManager {
|
|
|
26
26
|
|
|
27
27
|
for (const message of batch.content) {
|
|
28
28
|
// Blob attaches cannot be grouped (grouped batching would hide metadata)
|
|
29
|
-
if (message.
|
|
29
|
+
if (message.type === ContainerMessageType.BlobAttach) {
|
|
30
30
|
return batch;
|
|
31
31
|
}
|
|
32
32
|
if (message.metadata) {
|
|
@@ -39,14 +39,14 @@ export class OpGroupingManager {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
const
|
|
42
|
+
const serializedContent = JSON.stringify({
|
|
43
43
|
type: OpGroupingManager.groupedBatchOp,
|
|
44
44
|
contents: batch.content.map<IGroupedMessage>((message) => ({
|
|
45
45
|
contents: message.contents === undefined ? undefined : JSON.parse(message.contents),
|
|
46
46
|
metadata: message.metadata,
|
|
47
47
|
compression: message.compression,
|
|
48
48
|
})),
|
|
49
|
-
};
|
|
49
|
+
});
|
|
50
50
|
|
|
51
51
|
const groupedBatch: IBatch = {
|
|
52
52
|
...batch,
|
|
@@ -55,9 +55,8 @@ export class OpGroupingManager {
|
|
|
55
55
|
localOpMetadata: undefined,
|
|
56
56
|
metadata: undefined,
|
|
57
57
|
referenceSequenceNumber: batch.content[0].referenceSequenceNumber,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
contents: JSON.stringify(deserializedContent),
|
|
58
|
+
contents: serializedContent,
|
|
59
|
+
type: OpGroupingManager.groupedBatchOp as ContainerMessageType,
|
|
61
60
|
},
|
|
62
61
|
],
|
|
63
62
|
};
|