@fluidframework/container-runtime 2.0.0-internal.2.2.1 → 2.0.0-internal.2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +19 -8
- package/dist/batchTracker.d.ts +1 -2
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +44 -33
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +130 -97
- package/dist/blobManager.js.map +1 -1
- package/dist/containerRuntime.d.ts +39 -8
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +117 -61
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +1 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +4 -3
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStores.d.ts +9 -6
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +30 -24
- package/dist/dataStores.js.map +1 -1
- package/dist/garbageCollection.d.ts +41 -20
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +205 -151
- package/dist/garbageCollection.js.map +1 -1
- package/dist/garbageCollectionConstants.d.ts +6 -3
- package/dist/garbageCollectionConstants.d.ts.map +1 -1
- package/dist/garbageCollectionConstants.js +7 -7
- package/dist/garbageCollectionConstants.js.map +1 -1
- package/dist/garbageCollectionTombstoneUtils.d.ts +13 -0
- package/dist/garbageCollectionTombstoneUtils.d.ts.map +1 -0
- package/dist/garbageCollectionTombstoneUtils.js +28 -0
- package/dist/garbageCollectionTombstoneUtils.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts +13 -1
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js +35 -1
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +25 -1
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/index.d.ts +2 -2
- package/dist/opLifecycle/index.d.ts.map +1 -1
- package/dist/opLifecycle/index.js +2 -1
- package/dist/opLifecycle/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts +1 -1
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +24 -10
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts +2 -1
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +30 -17
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts +34 -2
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +114 -5
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +5 -0
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +24 -14
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js +17 -2
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +0 -1
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/scheduleManager.d.ts +0 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +9 -20
- package/dist/scheduleManager.js.map +1 -1
- package/dist/summarizer.d.ts +0 -1
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +2 -1
- package/dist/summarizer.js.map +1 -1
- package/dist/summarizerTypes.d.ts +1 -0
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryFormat.d.ts.map +1 -1
- package/dist/summaryFormat.js +1 -2
- package/dist/summaryFormat.js.map +1 -1
- package/lib/batchTracker.d.ts +1 -2
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +44 -33
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +131 -98
- package/lib/blobManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +39 -8
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +115 -59
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts +1 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +5 -4
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStores.d.ts +9 -6
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +32 -26
- package/lib/dataStores.js.map +1 -1
- package/lib/garbageCollection.d.ts +41 -20
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +201 -147
- package/lib/garbageCollection.js.map +1 -1
- package/lib/garbageCollectionConstants.d.ts +6 -3
- package/lib/garbageCollectionConstants.d.ts.map +1 -1
- package/lib/garbageCollectionConstants.js +6 -6
- package/lib/garbageCollectionConstants.js.map +1 -1
- package/lib/garbageCollectionTombstoneUtils.d.ts +13 -0
- package/lib/garbageCollectionTombstoneUtils.d.ts.map +1 -0
- package/lib/garbageCollectionTombstoneUtils.js +24 -0
- package/lib/garbageCollectionTombstoneUtils.js.map +1 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/opLifecycle/batchManager.d.ts +13 -1
- package/lib/opLifecycle/batchManager.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js +35 -1
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +25 -1
- package/lib/opLifecycle/definitions.d.ts.map +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/opLifecycle/index.d.ts +2 -2
- package/lib/opLifecycle/index.d.ts.map +1 -1
- package/lib/opLifecycle/index.js +1 -1
- package/lib/opLifecycle/index.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts +1 -1
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js +24 -10
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts +2 -1
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js +30 -17
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts +34 -2
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +112 -4
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +5 -0
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +24 -14
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js +17 -2
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +0 -1
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/scheduleManager.d.ts +0 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +9 -20
- package/lib/scheduleManager.js.map +1 -1
- package/lib/summarizer.d.ts +0 -1
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +2 -1
- package/lib/summarizer.js.map +1 -1
- package/lib/summarizerTypes.d.ts +1 -0
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryFormat.d.ts.map +1 -1
- package/lib/summaryFormat.js +1 -2
- package/lib/summaryFormat.js.map +1 -1
- package/package.json +37 -19
- package/src/batchTracker.ts +1 -1
- package/src/blobManager.ts +146 -103
- package/src/containerRuntime.ts +166 -65
- package/src/dataStoreContext.ts +5 -5
- package/src/dataStores.ts +40 -30
- package/src/garbageCollection.ts +254 -183
- package/src/garbageCollectionConstants.ts +7 -6
- package/src/garbageCollectionTombstoneUtils.ts +31 -0
- package/src/index.ts +0 -5
- package/src/opLifecycle/batchManager.ts +59 -1
- package/src/opLifecycle/definitions.ts +27 -1
- package/src/opLifecycle/index.ts +2 -1
- package/src/opLifecycle/opCompressor.ts +29 -12
- package/src/opLifecycle/opDecompressor.ts +39 -18
- package/src/opLifecycle/opSplitter.ts +141 -7
- package/src/opLifecycle/outbox.ts +32 -16
- package/src/opLifecycle/remoteMessageProcessor.ts +19 -3
- package/src/packageVersion.ts +1 -1
- package/src/runningSummarizer.ts +0 -1
- package/src/scheduleManager.ts +19 -30
- package/src/summarizer.ts +1 -1
- package/src/summarizerTypes.ts +1 -0
- package/src/summaryFormat.ts +1 -2
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
export const
|
|
7
|
-
|
|
8
|
-
export const
|
|
9
|
-
// The key for tombstone blob in the GC tree in summary.
|
|
10
|
-
export const gcTombstoneBlobKey = "__tombstones";
|
|
5
|
+
/** The stable version of garbage collection in production. */
|
|
6
|
+
export const stableGCVersion = 1;
|
|
7
|
+
/** The current version of garbage collection. */
|
|
8
|
+
export const currentGCVersion = 2;
|
|
11
9
|
// Feature gate key to turn GC on / off.
|
|
12
10
|
export const runGCKey = "Fluid.GarbageCollection.RunGC";
|
|
13
11
|
// Feature gate key to turn GC sweep on / off.
|
|
@@ -24,6 +22,8 @@ export const disableSweepLogKey = "Fluid.GarbageCollection.DisableSweepLog";
|
|
|
24
22
|
export const disableTombstoneKey = "Fluid.GarbageCollection.DisableTombstone";
|
|
25
23
|
// Feature gate to enable throwing an error when tombstone object is used.
|
|
26
24
|
export const throwOnTombstoneUsageKey = "Fluid.GarbageCollection.ThrowOnTombstoneUsage";
|
|
25
|
+
// Feature gate to enable GC version upgrade.
|
|
26
|
+
export const gcVersionUpgradeToV2Key = "Fluid.GarbageCollection.GCVersionUpgradeToV2";
|
|
27
27
|
// One day in milliseconds.
|
|
28
28
|
export const oneDayMs = 1 * 24 * 60 * 60 * 1000;
|
|
29
29
|
export const defaultInactiveTimeoutMs = 7 * oneDayMs; // 7 days
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"garbageCollectionConstants.js","sourceRoot":"","sources":["../src/garbageCollectionConstants.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"garbageCollectionConstants.js","sourceRoot":"","sources":["../src/garbageCollectionConstants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAAc,CAAC,CAAC;AAC5C,iDAAiD;AACjD,MAAM,CAAC,MAAM,gBAAgB,GAAc,CAAC,CAAC;AAE7C,wCAAwC;AACxC,MAAM,CAAC,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AACxD,8CAA8C;AAC9C,MAAM,CAAC,MAAM,WAAW,GAAG,kCAAkC,CAAC;AAC9D,kDAAkD;AAClD,MAAM,CAAC,MAAM,aAAa,GAAG,oCAAoC,CAAC;AAClE,mEAAmE;AACnE,MAAM,CAAC,MAAM,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E,6EAA6E;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAG,sCAAsC,CAAC;AACtE,6CAA6C;AAC7C,MAAM,CAAC,MAAM,kBAAkB,GAAG,yCAAyC,CAAC;AAC5E,qHAAqH;AACrH,MAAM,CAAC,MAAM,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,wBAAwB,GAAG,+CAA+C,CAAC;AACxF,6CAA6C;AAC7C,MAAM,CAAC,MAAM,uBAAuB,GAAG,8CAA8C,CAAC;AAEtF,2BAA2B;AAC3B,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEhD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,SAAS;AAC/D,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,GAAG,QAAQ,CAAC,CAAC,UAAU","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { GCVersion } from \"./summaryFormat\";\n\n/** The stable version of garbage collection in production. */\nexport const stableGCVersion: GCVersion = 1;\n/** The current version of garbage collection. */\nexport const currentGCVersion: GCVersion = 2;\n\n// Feature gate key to turn GC on / off.\nexport const runGCKey = \"Fluid.GarbageCollection.RunGC\";\n// Feature gate key to turn GC sweep on / off.\nexport const runSweepKey = \"Fluid.GarbageCollection.RunSweep\";\n// Feature gate key to turn GC test mode on / off.\nexport const gcTestModeKey = \"Fluid.GarbageCollection.GCTestMode\";\n// Feature gate key to expire a session after a set period of time.\nexport const runSessionExpiryKey = \"Fluid.GarbageCollection.RunSessionExpiry\";\n// Feature gate key to write the gc blob as a handle if the data is the same.\nexport const trackGCStateKey = \"Fluid.GarbageCollection.TrackGCState\";\n// Feature gate key to turn GC sweep log off.\nexport const disableSweepLogKey = \"Fluid.GarbageCollection.DisableSweepLog\";\n// Feature gate key to disable the tombstone feature, i.e., tombstone information is not read / written into summary.\nexport const disableTombstoneKey = \"Fluid.GarbageCollection.DisableTombstone\";\n// Feature gate to enable throwing an error when tombstone object is used.\nexport const throwOnTombstoneUsageKey = \"Fluid.GarbageCollection.ThrowOnTombstoneUsage\";\n// Feature gate to enable GC version upgrade.\nexport const gcVersionUpgradeToV2Key = \"Fluid.GarbageCollection.GCVersionUpgradeToV2\";\n\n// One day in milliseconds.\nexport const oneDayMs = 1 * 24 * 60 * 60 * 1000;\n\nexport const defaultInactiveTimeoutMs = 7 * oneDayMs; // 7 days\nexport const defaultSessionExpiryDurationMs = 30 * oneDayMs; // 30 days\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { ITelemetryGenericEvent } from "@fluidframework/common-definitions";
|
|
6
|
+
import { MonitoringContext } from "@fluidframework/telemetry-utils";
|
|
7
|
+
/**
|
|
8
|
+
* Decides whether or not to send an error event or a generic event for gc tombstone scenarios
|
|
9
|
+
*
|
|
10
|
+
* Adds isSummarizerClient, packagePath, and error to telemetry properties.
|
|
11
|
+
*/
|
|
12
|
+
export declare function sendGCTombstoneEvent(mc: MonitoringContext, event: ITelemetryGenericEvent, isSummarizerClient: boolean, packagePath: readonly string[] | undefined, error?: any): void;
|
|
13
|
+
//# sourceMappingURL=garbageCollectionTombstoneUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"garbageCollectionTombstoneUtils.d.ts","sourceRoot":"","sources":["../src/garbageCollectionTombstoneUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAChC,EAAE,EAAE,iBAAiB,EACrB,KAAK,EAAE,sBAAsB,EAC7B,kBAAkB,EAAE,OAAO,EAC3B,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC1C,KAAK,CAAC,EAAE,GAAG,QAUd"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { packagePathToTelemetryProperty } from "@fluidframework/runtime-utils";
|
|
6
|
+
import { throwOnTombstoneUsageKey } from "./garbageCollectionConstants";
|
|
7
|
+
/**
|
|
8
|
+
* Decides whether or not to send an error event or a generic event for gc tombstone scenarios
|
|
9
|
+
*
|
|
10
|
+
* Adds isSummarizerClient, packagePath, and error to telemetry properties.
|
|
11
|
+
*/
|
|
12
|
+
export function sendGCTombstoneEvent(mc, event, isSummarizerClient, packagePath, error) {
|
|
13
|
+
var _a;
|
|
14
|
+
const throwOnTombstoneUsage = event.throwOnTombstoneUsage = (_a = mc.config.getBoolean(throwOnTombstoneUsageKey)) !== null && _a !== void 0 ? _a : false;
|
|
15
|
+
event.pkg = packagePathToTelemetryProperty(packagePath);
|
|
16
|
+
event.isSummarizerClient = isSummarizerClient;
|
|
17
|
+
if (throwOnTombstoneUsage) {
|
|
18
|
+
mc.logger.sendErrorEvent(event, error);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
mc.logger.sendTelemetryEvent(event, error);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=garbageCollectionTombstoneUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"garbageCollectionTombstoneUtils.js","sourceRoot":"","sources":["../src/garbageCollectionTombstoneUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAE/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAChC,EAAqB,EACrB,KAA6B,EAC7B,kBAA2B,EAC3B,WAA0C,EAC1C,KAAW;;IAEX,MAAM,qBAAqB,GAAG,KAAK,CAAC,qBAAqB,GAAG,MAAA,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,wBAAwB,CAAC,mCAAI,KAAK,CAAC;IACpH,KAAK,CAAC,GAAG,GAAG,8BAA8B,CAAC,WAAW,CAAC,CAAC;IACxD,KAAK,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC9C,IAAG,qBAAqB,EAAE;QACtB,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;KAC1C;SAAM;QACH,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;KAC9C;AACL,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryGenericEvent } from \"@fluidframework/common-definitions\";\nimport { packagePathToTelemetryProperty } from \"@fluidframework/runtime-utils\";\nimport { MonitoringContext } from \"@fluidframework/telemetry-utils\";\nimport { throwOnTombstoneUsageKey } from \"./garbageCollectionConstants\";\n\n/**\n * Decides whether or not to send an error event or a generic event for gc tombstone scenarios\n *\n * Adds isSummarizerClient, packagePath, and error to telemetry properties.\n */\nexport function sendGCTombstoneEvent(\n mc: MonitoringContext,\n event: ITelemetryGenericEvent,\n isSummarizerClient: boolean,\n packagePath: readonly string[] | undefined,\n error?: any,\n) {\n const throwOnTombstoneUsage = event.throwOnTombstoneUsage = mc.config.getBoolean(throwOnTombstoneUsageKey) ?? false;\n event.pkg = packagePathToTelemetryProperty(packagePath);\n event.isSummarizerClient = isSummarizerClient;\n if(throwOnTombstoneUsage) {\n mc.logger.sendErrorEvent(event, error);\n } else {\n mc.logger.sendTelemetryEvent(event, error);\n }\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
export { ContainerMessageType, ContainerRuntimeMessage, IGCRuntimeOptions, ISummaryRuntimeOptions, ISummaryBaseConfiguration, ISummaryConfigurationHeuristics, ISummaryConfigurationDisableSummarizer, ISummaryConfigurationDisableHeuristics, IContainerRuntimeOptions, IRootSummaryTreeWithStats, isRuntimeMessage, RuntimeMessage, agentSchedulerId, ContainerRuntime, RuntimeHeaders, ISummaryConfiguration, DefaultSummaryConfiguration, ICompressionRuntimeOptions, CompressionAlgorithms, } from "./containerRuntime";
|
|
6
6
|
export { FluidDataStoreRegistry } from "./dataStoreRegistry";
|
|
7
7
|
export { IGCStats, } from "./garbageCollection";
|
|
8
|
-
export { gcBlobPrefix, gcTombstoneBlobKey, gcTreeKey, } from "./garbageCollectionConstants";
|
|
9
8
|
export { IPendingFlush, IPendingLocalState, IPendingMessage, IPendingState, } from "./pendingStateManager";
|
|
10
9
|
export { Summarizer } from "./summarizer";
|
|
11
10
|
export { EnqueueSummarizeResult, IAckSummaryResult, IBaseSummarizeResult, IBroadcastSummaryResult, ICancellationToken, IConnectableRuntime, IEnqueueSummarizeOptions, IGenerateSummaryTreeResult, IGeneratedSummaryStats, INackSummaryResult, IOnDemandSummarizeOptions, IProvideSummarizer, IRefreshSummaryAckOptions, ISubmitSummaryOpResult, ISubmitSummaryOptions, ISummarizeOptions, ISummarizeResults, ISummarizer, ISummarizerEvents, ISummarizerInternalsProvider, ISummarizerRuntime, ISummarizingWarning, ISummaryCancellationToken, IUploadSummaryResult, SubmitSummaryResult, SummarizeResultPart, SummarizerStopReason, } from "./summarizerTypes";
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,+BAA+B,EAC/B,sCAAsC,EACtC,sCAAsC,EACtC,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,2BAA2B,EAC3B,0BAA0B,EAC1B,qBAAqB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACH,QAAQ,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,+BAA+B,EAC/B,sCAAsC,EACtC,sCAAsC,EACtC,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,2BAA2B,EAC3B,0BAA0B,EAC1B,qBAAqB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACH,QAAQ,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,aAAa,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACH,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,EAC1B,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,4BAA4B,EAC5B,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gCAAgC,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC9G,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { ContainerMessageType, isRuntimeMessage, RuntimeMessage, agentSchedulerId, ContainerRuntime, RuntimeHeaders, DefaultSummaryConfiguration, CompressionAlgorithms, } from "./containerRuntime";
|
|
6
6
|
export { FluidDataStoreRegistry } from "./dataStoreRegistry";
|
|
7
|
-
export { gcBlobPrefix, gcTombstoneBlobKey, gcTreeKey, } from "./garbageCollectionConstants";
|
|
8
7
|
export { Summarizer } from "./summarizer";
|
|
9
8
|
export { ISummarizer, } from "./summarizerTypes";
|
|
10
9
|
export { SummaryCollection, } from "./summaryCollection";
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,oBAAoB,EAUpB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EAEd,2BAA2B,EAE3B,qBAAqB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,oBAAoB,EAUpB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EAEd,2BAA2B,EAE3B,qBAAqB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAU7D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAkBH,WAAW,GAUd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAUH,iBAAiB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAoC,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC9G,OAAO,EAAc,oBAAoB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n ContainerMessageType,\n ContainerRuntimeMessage,\n IGCRuntimeOptions,\n ISummaryRuntimeOptions,\n ISummaryBaseConfiguration,\n ISummaryConfigurationHeuristics,\n ISummaryConfigurationDisableSummarizer,\n ISummaryConfigurationDisableHeuristics,\n IContainerRuntimeOptions,\n IRootSummaryTreeWithStats,\n isRuntimeMessage,\n RuntimeMessage,\n agentSchedulerId,\n ContainerRuntime,\n RuntimeHeaders,\n ISummaryConfiguration,\n DefaultSummaryConfiguration,\n ICompressionRuntimeOptions,\n CompressionAlgorithms,\n} from \"./containerRuntime\";\nexport { FluidDataStoreRegistry } from \"./dataStoreRegistry\";\nexport {\n IGCStats,\n} from \"./garbageCollection\";\nexport {\n IPendingFlush,\n IPendingLocalState,\n IPendingMessage,\n IPendingState,\n} from \"./pendingStateManager\";\nexport { Summarizer } from \"./summarizer\";\nexport {\n EnqueueSummarizeResult,\n IAckSummaryResult,\n IBaseSummarizeResult,\n IBroadcastSummaryResult,\n ICancellationToken,\n IConnectableRuntime,\n IEnqueueSummarizeOptions,\n IGenerateSummaryTreeResult,\n IGeneratedSummaryStats,\n INackSummaryResult,\n IOnDemandSummarizeOptions,\n IProvideSummarizer,\n IRefreshSummaryAckOptions,\n ISubmitSummaryOpResult,\n ISubmitSummaryOptions,\n ISummarizeOptions,\n ISummarizeResults,\n ISummarizer,\n ISummarizerEvents,\n ISummarizerInternalsProvider,\n ISummarizerRuntime,\n ISummarizingWarning,\n ISummaryCancellationToken,\n IUploadSummaryResult,\n SubmitSummaryResult,\n SummarizeResultPart,\n SummarizerStopReason,\n} from \"./summarizerTypes\";\nexport {\n IAckedSummary,\n IClientSummaryWatcher,\n ISummary,\n ISummaryCollectionOpEvents,\n ISummaryAckMessage,\n ISummaryNackMessage,\n ISummaryOpMessage,\n OpActionEventListener,\n OpActionEventName,\n SummaryCollection,\n} from \"./summaryCollection\";\nexport { ICancellableSummarizerController, neverCancelledSummaryToken } from \"./runWhileConnectedCoordinator\";\nexport { IChunkedOp, unpackRuntimeMessage } from \"./opLifecycle\";\n"]}
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
5
6
|
import { ICompressionRuntimeOptions } from "../containerRuntime";
|
|
6
7
|
import { BatchMessage, IBatch, IBatchCheckpoint } from "./definitions";
|
|
7
8
|
export interface IBatchManagerOptions {
|
|
9
|
+
readonly enableOpReentryCheck?: boolean;
|
|
8
10
|
readonly hardLimit: number;
|
|
9
11
|
readonly softLimit?: number;
|
|
10
12
|
readonly compressionOptions?: ICompressionRuntimeOptions;
|
|
@@ -14,11 +16,20 @@ export interface IBatchManagerOptions {
|
|
|
14
16
|
*/
|
|
15
17
|
export declare class BatchManager {
|
|
16
18
|
readonly options: IBatchManagerOptions;
|
|
19
|
+
private readonly logger;
|
|
17
20
|
private pendingBatch;
|
|
18
21
|
private batchContentSize;
|
|
22
|
+
/**
|
|
23
|
+
* Track the number of ops which were detected to have a mismatched
|
|
24
|
+
* reference sequence number, in order to self-throttle the telemetry events.
|
|
25
|
+
*
|
|
26
|
+
* This should be removed as part of ADO:2322
|
|
27
|
+
*/
|
|
28
|
+
private readonly maxMismatchedOpsToReport;
|
|
29
|
+
private mismatchedOpsReported;
|
|
19
30
|
get length(): number;
|
|
20
31
|
get contentSizeInBytes(): number;
|
|
21
|
-
constructor(options: IBatchManagerOptions);
|
|
32
|
+
constructor(options: IBatchManagerOptions, logger: ITelemetryLogger);
|
|
22
33
|
push(message: BatchMessage): boolean;
|
|
23
34
|
get empty(): boolean;
|
|
24
35
|
popBatch(): IBatch;
|
|
@@ -26,5 +37,6 @@ export declare class BatchManager {
|
|
|
26
37
|
* Capture the pending state at this point
|
|
27
38
|
*/
|
|
28
39
|
checkpoint(): IBatchCheckpoint;
|
|
40
|
+
private checkReferenceSequenceNumber;
|
|
29
41
|
}
|
|
30
42
|
//# sourceMappingURL=batchManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batchManager.d.ts","sourceRoot":"","sources":["../../src/opLifecycle/batchManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,0BAA0B,CAAC;CAC5D;AAED;;GAEG;AACH,qBAAa,YAAY;
|
|
1
|
+
{"version":3,"file":"batchManager.d.ts","sourceRoot":"","sources":["../../src/opLifecycle/batchManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAGtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,0BAA0B,CAAC;CAC5D;AAED;;GAEG;AACH,qBAAa,YAAY;aAkBD,OAAO,EAAE,oBAAoB;IAjBjD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IACxB,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,gBAAgB,CAAK;IAC7B;;;;;MAKE;IACF,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAK;IAC9C,OAAO,CAAC,qBAAqB,CAAK;IAGlC,IAAW,MAAM,WAAuC;IACxD,IAAW,kBAAkB,WAAoC;gBAG7C,OAAO,EAAE,oBAAoB,EAC7C,MAAM,EAAE,gBAAgB;IAKrB,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO;IAiC3C,IAAW,KAAK,YAA6C;IAEtD,QAAQ,IAAI,MAAM;IAYzB;;OAEG;IACI,UAAU,IAAI,gBAAgB;IAgBrC,OAAO,CAAC,4BAA4B;CAoCvC"}
|
|
@@ -2,19 +2,31 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { UsageError } from "@fluidframework/driver-utils";
|
|
6
|
+
import { ChildLogger } from "@fluidframework/telemetry-utils";
|
|
5
7
|
/**
|
|
6
8
|
* Helper class that manages partial batch & rollback.
|
|
7
9
|
*/
|
|
8
10
|
export class BatchManager {
|
|
9
|
-
constructor(options) {
|
|
11
|
+
constructor(options, logger) {
|
|
10
12
|
this.options = options;
|
|
11
13
|
this.pendingBatch = [];
|
|
12
14
|
this.batchContentSize = 0;
|
|
15
|
+
/**
|
|
16
|
+
* Track the number of ops which were detected to have a mismatched
|
|
17
|
+
* reference sequence number, in order to self-throttle the telemetry events.
|
|
18
|
+
*
|
|
19
|
+
* This should be removed as part of ADO:2322
|
|
20
|
+
*/
|
|
21
|
+
this.maxMismatchedOpsToReport = 5;
|
|
22
|
+
this.mismatchedOpsReported = 0;
|
|
23
|
+
this.logger = ChildLogger.create(logger, "BatchManager");
|
|
13
24
|
}
|
|
14
25
|
get length() { return this.pendingBatch.length; }
|
|
15
26
|
get contentSizeInBytes() { return this.batchContentSize; }
|
|
16
27
|
push(message) {
|
|
17
28
|
var _a, _b;
|
|
29
|
+
this.checkReferenceSequenceNumber(message);
|
|
18
30
|
const contentSize = this.batchContentSize + ((_b = (_a = message.contents) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0);
|
|
19
31
|
const opCount = this.pendingBatch.length;
|
|
20
32
|
// Attempt to estimate batch size, aka socket message size.
|
|
@@ -68,6 +80,28 @@ export class BatchManager {
|
|
|
68
80
|
},
|
|
69
81
|
};
|
|
70
82
|
}
|
|
83
|
+
checkReferenceSequenceNumber(message) {
|
|
84
|
+
if (this.pendingBatch.length === 0 || message.referenceSequenceNumber === this.pendingBatch[0].referenceSequenceNumber) {
|
|
85
|
+
// The reference sequence numbers are stable
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const telemetryProperties = {
|
|
89
|
+
referenceSequenceNumber: this.pendingBatch[0].referenceSequenceNumber,
|
|
90
|
+
messageReferenceSequenceNumber: message.referenceSequenceNumber,
|
|
91
|
+
type: message.deserializedContent.type,
|
|
92
|
+
length: this.pendingBatch.length,
|
|
93
|
+
enableOpReentryCheck: this.options.enableOpReentryCheck === true,
|
|
94
|
+
};
|
|
95
|
+
const error = new UsageError("Submission of an out of order message");
|
|
96
|
+
const eventName = "ReferenceSequenceNumberMismatch";
|
|
97
|
+
if (this.options.enableOpReentryCheck === true) {
|
|
98
|
+
this.logger.sendErrorEvent(Object.assign({ eventName }, telemetryProperties), error);
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
if (++this.mismatchedOpsReported <= this.maxMismatchedOpsToReport) {
|
|
102
|
+
this.logger.sendErrorEvent(Object.assign(Object.assign({ eventName }, telemetryProperties), { ops: this.mismatchedOpsReported, maxOps: this.maxMismatchedOpsToReport }), error);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
71
105
|
}
|
|
72
106
|
const addBatchMetadata = (batch) => {
|
|
73
107
|
if (batch.content.length > 1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batchManager.js","sourceRoot":"","sources":["../../src/opLifecycle/batchManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"batchManager.js","sourceRoot":"","sources":["../../src/opLifecycle/batchManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAW9D;;GAEG;AACH,MAAM,OAAO,YAAY;IAiBrB,YACoB,OAA6B,EAC7C,MAAwB;QADR,YAAO,GAAP,OAAO,CAAsB;QAhBzC,iBAAY,GAAmB,EAAE,CAAC;QAClC,qBAAgB,GAAG,CAAC,CAAC;QAC7B;;;;;UAKE;QACe,6BAAwB,GAAG,CAAC,CAAC;QACtC,0BAAqB,GAAG,CAAC,CAAC;QAU9B,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC7D,CAAC;IAR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CAAC;QACF,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,uCAAuC,CAAC,CAAC;QACtE,MAAM,SAAS,GAAG,iCAAiC,CAAC;QAEpD,IAAI,IAAI,CAAC,OAAO,CAAC,oBAAoB,KAAK,IAAI,EAAE;YAC5C,IAAI,CAAC,MAAM,CAAC,cAAc,iBACpB,SAAS,IAAK,mBAAmB,GACnC,KAAK,CACR,CAAC;YACF,MAAM,KAAK,CAAC;SACf;QAED,IAAI,EAAE,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,wBAAwB,EAAE;YAC/D,IAAI,CAAC,MAAM,CAAC,cAAc,+BAElB,SAAS,IACN,mBAAmB,KACtB,GAAG,EAAE,IAAI,CAAC,qBAAqB,EAC/B,MAAM,EAAE,IAAI,CAAC,wBAAwB,KAEzC,KAAK,CACR,CAAC;SACL;IACL,CAAC;CACJ;AAED,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAU,EAAE;IAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,mCAClB,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,KAC5B,KAAK,EAAE,IAAI,GACd,CAAC;QACF,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,mCACzC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,KACnD,KAAK,EAAE,KAAK,GACf,CAAC;KACL;IAED,OAAO,KAAK,CAAC;AACjB,CAAC,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 { UsageError } from \"@fluidframework/driver-utils\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { ICompressionRuntimeOptions } from \"../containerRuntime\";\nimport { BatchMessage, IBatch, IBatchCheckpoint } from \"./definitions\";\n\nexport interface IBatchManagerOptions {\n readonly enableOpReentryCheck?: boolean;\n readonly hardLimit: number;\n readonly softLimit?: number;\n readonly compressionOptions?: ICompressionRuntimeOptions;\n}\n\n/**\n * Helper class that manages partial batch & rollback.\n */\nexport class BatchManager {\n private readonly logger;\n private pendingBatch: BatchMessage[] = [];\n private batchContentSize = 0;\n /**\n * Track the number of ops which were detected to have a mismatched\n * reference sequence number, in order to self-throttle the telemetry events.\n *\n * This should be removed as part of ADO:2322\n */\n private readonly maxMismatchedOpsToReport = 5;\n private mismatchedOpsReported = 0;\n\n\n public get length() { return this.pendingBatch.length; }\n public get contentSizeInBytes() { return this.batchContentSize; }\n\n constructor(\n public readonly options: IBatchManagerOptions,\n logger: ITelemetryLogger,\n ) {\n this.logger = ChildLogger.create(logger, \"BatchManager\");\n }\n\n public push(message: BatchMessage): boolean {\n this.checkReferenceSequenceNumber(message);\n\n const contentSize = this.batchContentSize + (message.contents?.length ?? 0);\n const opCount = this.pendingBatch.length;\n\n // Attempt to estimate batch size, aka socket message size.\n // Each op has pretty large envelope, estimating to be 200 bytes.\n // Also content will be strigified, and that adds a lot of overhead due to a lot of escape characters.\n // Not taking it into account, as compression work should help there - compressed payload will be\n // initially stored as base64, and that requires only 2 extra escape characters.\n const socketMessageSize = contentSize + 200 * opCount;\n\n // If we were provided soft limit, check for exceeding it.\n // But only if we have any ops, as the intention here is to flush existing ops (on exceeding this limit)\n // and start over. That's not an option if we have no ops.\n // If compression is enabled, the soft and hard limit are ignored and the message will be pushed anyways.\n // Cases where the message is still too large will be handled by the maxConsecutiveReconnects path.\n if (this.options.softLimit !== undefined\n && this.length > 0\n && socketMessageSize >= this.options.softLimit) {\n return false;\n }\n\n if (socketMessageSize >= this.options.hardLimit) {\n return false;\n }\n\n this.batchContentSize = contentSize;\n this.pendingBatch.push(message);\n return true;\n }\n\n public get empty() { return this.pendingBatch.length === 0; }\n\n public popBatch(): IBatch {\n const batch: IBatch = {\n content: this.pendingBatch,\n contentSizeInBytes: this.batchContentSize,\n };\n\n this.pendingBatch = [];\n this.batchContentSize = 0;\n\n return addBatchMetadata(batch);\n }\n\n /**\n * Capture the pending state at this point\n */\n public checkpoint(): IBatchCheckpoint {\n const startPoint = this.pendingBatch.length;\n return {\n rollback: (process: (message: BatchMessage) => void) => {\n for (let i = this.pendingBatch.length; i > startPoint;) {\n i--;\n const message = this.pendingBatch[i];\n this.batchContentSize -= message.contents?.length ?? 0;\n process(message);\n }\n\n this.pendingBatch.length = startPoint;\n },\n };\n }\n\n private checkReferenceSequenceNumber(message: BatchMessage) {\n if (this.pendingBatch.length === 0 || message.referenceSequenceNumber === this.pendingBatch[0].referenceSequenceNumber) {\n // The reference sequence numbers are stable\n return;\n }\n\n const telemetryProperties = {\n referenceSequenceNumber: this.pendingBatch[0].referenceSequenceNumber,\n messageReferenceSequenceNumber: message.referenceSequenceNumber,\n type: message.deserializedContent.type,\n length: this.pendingBatch.length,\n enableOpReentryCheck: this.options.enableOpReentryCheck === true,\n };\n const error = new UsageError(\"Submission of an out of order message\");\n const eventName = \"ReferenceSequenceNumberMismatch\";\n\n if (this.options.enableOpReentryCheck === true) {\n this.logger.sendErrorEvent(\n { eventName, ...telemetryProperties },\n error,\n );\n throw error;\n }\n\n if (++this.mismatchedOpsReported <= this.maxMismatchedOpsToReport) {\n this.logger.sendErrorEvent(\n {\n eventName,\n ...telemetryProperties,\n ops: this.mismatchedOpsReported,\n maxOps: this.maxMismatchedOpsToReport,\n },\n error,\n );\n }\n }\n}\n\nconst addBatchMetadata = (batch: IBatch): IBatch => {\n if (batch.content.length > 1) {\n batch.content[0].metadata = {\n ...batch.content[0].metadata,\n batch: true\n };\n batch.content[batch.content.length - 1].metadata = {\n ...batch.content[batch.content.length - 1].metadata,\n batch: false\n };\n }\n\n return batch;\n};\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IBatchMessage } from "@fluidframework/container-definitions";
|
|
6
|
-
import { MessageType } from "@fluidframework/protocol-definitions";
|
|
6
|
+
import { ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { CompressionAlgorithms, ContainerMessageType, ContainerRuntimeMessage } from "..";
|
|
8
8
|
/**
|
|
9
9
|
* Batch message type used internally by the runtime
|
|
@@ -36,5 +36,29 @@ export interface IChunkedOp {
|
|
|
36
36
|
totalChunks: number;
|
|
37
37
|
contents: string;
|
|
38
38
|
originalType: MessageType | ContainerMessageType;
|
|
39
|
+
originalMetadata?: Record<string, unknown>;
|
|
40
|
+
originalCompression?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The state of remote message processing:
|
|
44
|
+
* `Processed` - the message can be considered processed
|
|
45
|
+
* `Skipped` - the message was ignored by the processor
|
|
46
|
+
* `Accepted` - the message was processed partially. Eventually, a message
|
|
47
|
+
* will make the processor return `Processed`.
|
|
48
|
+
*/
|
|
49
|
+
export declare type ProcessingState = "Processed" | "Skipped" | "Accepted";
|
|
50
|
+
/**
|
|
51
|
+
* Return type for functions which process remote messages
|
|
52
|
+
*/
|
|
53
|
+
export interface IMessageProcessingResult {
|
|
54
|
+
/**
|
|
55
|
+
* A shallow copy of the input message if processing happened, or
|
|
56
|
+
* the original message otherwise
|
|
57
|
+
*/
|
|
58
|
+
readonly message: ISequencedDocumentMessage;
|
|
59
|
+
/**
|
|
60
|
+
* Processing result of the input message.
|
|
61
|
+
*/
|
|
62
|
+
readonly state: ProcessingState;
|
|
39
63
|
}
|
|
40
64
|
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/opLifecycle/definitions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,E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AAM,WAAW,wBAAwB;IACrC;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,yBAAyB,CAAC;IAC5C;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;CACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/opLifecycle/definitions.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IBatchMessage } from \"@fluidframework/container-definitions\";\nimport { MessageType } from \"@fluidframework/protocol-definitions\";\nimport { CompressionAlgorithms, ContainerMessageType, ContainerRuntimeMessage } from \"..\";\n\n/**\n * Batch message type used internally by the runtime\n */\nexport type BatchMessage = IBatchMessage & {\n localOpMetadata: unknown;\n deserializedContent: ContainerRuntimeMessage;\n referenceSequenceNumber: number;\n compression?: CompressionAlgorithms;\n};\n\n/**\n * Batch interface used internally by the runtime.\n */\nexport interface IBatch {\n /**\n * Sum of the in-memory content sizes of all messages in the batch.\n * If the batch is compressed, this number reflects the post-compression size.\n */\n readonly contentSizeInBytes: number;\n /**\n * All the messages in the batch\n */\n readonly content: BatchMessage[];\n}\n\nexport interface IBatchCheckpoint {\n rollback: (action: (message: BatchMessage) => void) => void;\n}\n\nexport interface IChunkedOp {\n chunkId: number;\n totalChunks: number;\n contents: string;\n originalType: MessageType | ContainerMessageType;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/opLifecycle/definitions.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IBatchMessage } from \"@fluidframework/container-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { CompressionAlgorithms, ContainerMessageType, ContainerRuntimeMessage } from \"..\";\n\n/**\n * Batch message type used internally by the runtime\n */\nexport type BatchMessage = IBatchMessage & {\n localOpMetadata: unknown;\n deserializedContent: ContainerRuntimeMessage;\n referenceSequenceNumber: number;\n compression?: CompressionAlgorithms;\n};\n\n/**\n * Batch interface used internally by the runtime.\n */\nexport interface IBatch {\n /**\n * Sum of the in-memory content sizes of all messages in the batch.\n * If the batch is compressed, this number reflects the post-compression size.\n */\n readonly contentSizeInBytes: number;\n /**\n * All the messages in the batch\n */\n readonly content: BatchMessage[];\n}\n\nexport interface IBatchCheckpoint {\n rollback: (action: (message: BatchMessage) => void) => void;\n}\n\nexport interface IChunkedOp {\n chunkId: number;\n totalChunks: number;\n contents: string;\n originalType: MessageType | ContainerMessageType;\n originalMetadata?: Record<string, unknown>;\n originalCompression?: string;\n}\n\n/**\n * The state of remote message processing:\n * `Processed` - the message can be considered processed\n * `Skipped` - the message was ignored by the processor\n * `Accepted` - the message was processed partially. Eventually, a message\n * will make the processor return `Processed`.\n */\nexport type ProcessingState = \"Processed\" | \"Skipped\" | \"Accepted\";\n\n/**\n * Return type for functions which process remote messages\n */\nexport interface IMessageProcessingResult {\n /**\n * A shallow copy of the input message if processing happened, or\n * the original message otherwise\n */\n readonly message: ISequencedDocumentMessage;\n /**\n * Processing result of the input message.\n */\n readonly state: ProcessingState;\n}\n"]}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
export { BatchManager } from "./batchManager";
|
|
6
|
-
export { BatchMessage, IBatch, IBatchCheckpoint, IChunkedOp, } from "./definitions";
|
|
6
|
+
export { BatchMessage, IBatch, IBatchCheckpoint, IChunkedOp, IMessageProcessingResult, } from "./definitions";
|
|
7
7
|
export { Outbox } from "./outbox";
|
|
8
8
|
export { OpCompressor } from "./opCompressor";
|
|
9
9
|
export { OpDecompressor } from "./opDecompressor";
|
|
10
|
-
export { OpSplitter } from "./opSplitter";
|
|
10
|
+
export { OpSplitter, splitOp } from "./opSplitter";
|
|
11
11
|
export { RemoteMessageProcessor, unpackRuntimeMessage } from "./remoteMessageProcessor";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/opLifecycle/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACH,YAAY,EACZ,MAAM,EACN,gBAAgB,EAChB,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/opLifecycle/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACH,YAAY,EACZ,MAAM,EACN,gBAAgB,EAChB,UAAU,EACV,wBAAwB,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/lib/opLifecycle/index.js
CHANGED
|
@@ -6,6 +6,6 @@ export { BatchManager } from "./batchManager";
|
|
|
6
6
|
export { Outbox } from "./outbox";
|
|
7
7
|
export { OpCompressor } from "./opCompressor";
|
|
8
8
|
export { OpDecompressor } from "./opDecompressor";
|
|
9
|
-
export { OpSplitter } from "./opSplitter";
|
|
9
|
+
export { OpSplitter, splitOp } from "./opSplitter";
|
|
10
10
|
export { RemoteMessageProcessor, unpackRuntimeMessage } from "./remoteMessageProcessor";
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/opLifecycle/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/opLifecycle/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQ9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { BatchManager } from \"./batchManager\";\nexport {\n BatchMessage,\n IBatch,\n IBatchCheckpoint,\n IChunkedOp,\n IMessageProcessingResult,\n} from \"./definitions\";\nexport { Outbox } from \"./outbox\";\nexport { OpCompressor } from \"./opCompressor\";\nexport { OpDecompressor } from \"./opDecompressor\";\nexport { OpSplitter, splitOp } from \"./opSplitter\";\nexport { RemoteMessageProcessor, unpackRuntimeMessage } from \"./remoteMessageProcessor\";\n"]}
|
|
@@ -11,8 +11,8 @@ import { IBatch } from "./definitions";
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class OpCompressor {
|
|
13
13
|
private readonly logger;
|
|
14
|
-
private compressedBatchCount;
|
|
15
14
|
constructor(logger: ITelemetryLogger);
|
|
16
15
|
compressBatch(batch: IBatch): IBatch;
|
|
16
|
+
private serializeBatch;
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=opCompressor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opCompressor.d.ts","sourceRoot":"","sources":["../../src/opLifecycle/opCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"opCompressor.d.ts","sourceRoot":"","sources":["../../src/opLifecycle/opCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAMtE,OAAO,EAAE,MAAM,EAAgB,MAAM,eAAe,CAAC;AAErD;;;;GAIG;AACH,qBAAa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAEZ,MAAM,EAAE,gBAAgB;IAI7B,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAiC3C,OAAO,CAAC,cAAc;CAsBzB"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IsoBuffer } from "@fluidframework/common-utils";
|
|
6
|
+
import { UsageError } from "@fluidframework/container-utils";
|
|
6
7
|
import { ChildLogger } from "@fluidframework/telemetry-utils";
|
|
7
8
|
import { compress } from "lz4js";
|
|
8
9
|
import { CompressionAlgorithms } from "../containerRuntime";
|
|
@@ -13,22 +14,15 @@ import { CompressionAlgorithms } from "../containerRuntime";
|
|
|
13
14
|
*/
|
|
14
15
|
export class OpCompressor {
|
|
15
16
|
constructor(logger) {
|
|
16
|
-
this.compressedBatchCount = 0;
|
|
17
17
|
this.logger = ChildLogger.create(logger, "OpCompressor");
|
|
18
18
|
}
|
|
19
19
|
compressBatch(batch) {
|
|
20
|
-
const messages = [];
|
|
21
|
-
this.compressedBatchCount++;
|
|
22
|
-
const contentToCompress = [];
|
|
23
|
-
for (const message of batch.content) {
|
|
24
|
-
contentToCompress.push(message.deserializedContent);
|
|
25
|
-
}
|
|
26
20
|
const compressionStart = Date.now();
|
|
27
|
-
const contentsAsBuffer = new TextEncoder().encode(
|
|
21
|
+
const contentsAsBuffer = new TextEncoder().encode(this.serializeBatch(batch));
|
|
28
22
|
const compressedContents = compress(contentsAsBuffer);
|
|
29
23
|
const compressedContent = IsoBuffer.from(compressedContents).toString("base64");
|
|
30
24
|
const duration = Date.now() - compressionStart;
|
|
31
|
-
if (batch.contentSizeInBytes > 200000
|
|
25
|
+
if (batch.contentSizeInBytes > 200000) {
|
|
32
26
|
this.logger.sendPerformanceEvent({
|
|
33
27
|
eventName: "CompressedBatch",
|
|
34
28
|
duration,
|
|
@@ -36,7 +30,8 @@ export class OpCompressor {
|
|
|
36
30
|
sizeAfterCompression: compressedContent.length,
|
|
37
31
|
});
|
|
38
32
|
}
|
|
39
|
-
messages
|
|
33
|
+
const messages = [];
|
|
34
|
+
messages.push(Object.assign(Object.assign({}, batch.content[0]), { contents: JSON.stringify({ packedContents: compressedContent }), metadata: batch.content[0].metadata, compression: CompressionAlgorithms.lz4 }));
|
|
40
35
|
for (const message of batch.content.slice(1)) {
|
|
41
36
|
messages.push(Object.assign(Object.assign({}, message), { contents: undefined }));
|
|
42
37
|
}
|
|
@@ -45,5 +40,24 @@ export class OpCompressor {
|
|
|
45
40
|
content: messages,
|
|
46
41
|
};
|
|
47
42
|
}
|
|
43
|
+
serializeBatch(batch) {
|
|
44
|
+
try {
|
|
45
|
+
return JSON.stringify(batch.content.map((message) => message.deserializedContent));
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
if (e.message === "Invalid string length") {
|
|
49
|
+
// This is how JSON.stringify signals that
|
|
50
|
+
// the content size exceeds its capacity
|
|
51
|
+
const error = new UsageError("Payload too large");
|
|
52
|
+
this.logger.sendErrorEvent({
|
|
53
|
+
eventName: "BatchTooLarge",
|
|
54
|
+
size: batch.contentSizeInBytes,
|
|
55
|
+
length: batch.content.length,
|
|
56
|
+
}, error);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
throw e;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
48
62
|
}
|
|
49
63
|
//# sourceMappingURL=opCompressor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opCompressor.js","sourceRoot":"","sources":["../../src/opLifecycle/opCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"opCompressor.js","sourceRoot":"","sources":["../../src/opLifecycle/opCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAG5D;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAGrB,YAAY,MAAwB;QAChC,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC7D,CAAC;IAEM,aAAa,CAAC,KAAa;QAC9B,MAAM,gBAAgB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACpC,MAAM,gBAAgB,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9E,MAAM,kBAAkB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACtD,MAAM,iBAAiB,GAAG,SAAS,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,QAAQ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AC,mBAAmB,CAAC,CAAC;gBAClD,IAAI,CAAC,MAAM,CAAC,cAAc,CACtB;oBACI,SAAS,EAAE,eAAe;oBAC1B,IAAI,EAAE,KAAK,CAAC,kBAAkB;oBAC9B,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM;iBAC/B,EACD,KAAK,CACR,CAAC;gBACF,MAAM,KAAK,CAAC;aACf;YAED,MAAM,CAAC,CAAC;SACX;IACL,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 { IsoBuffer } from \"@fluidframework/common-utils\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { compress } from \"lz4js\";\nimport { CompressionAlgorithms } from \"../containerRuntime\";\nimport { IBatch, BatchMessage } from \"./definitions\";\n\n/**\n * Compresses batches of ops. It generates a single compressed op that contains\n * the contents of each op in the batch. It then submits empty ops for each original\n * op to reserve sequence numbers.\n */\nexport class OpCompressor {\n private readonly logger;\n\n constructor(logger: ITelemetryLogger) {\n this.logger = ChildLogger.create(logger, \"OpCompressor\");\n }\n\n public compressBatch(batch: IBatch): IBatch {\n const compressionStart = Date.now();\n const contentsAsBuffer = new TextEncoder().encode(this.serializeBatch(batch));\n const compressedContents = compress(contentsAsBuffer);\n const compressedContent = IsoBuffer.from(compressedContents).toString(\"base64\");\n const duration = Date.now() - compressionStart;\n\n if (batch.contentSizeInBytes > 200000) {\n this.logger.sendPerformanceEvent({\n eventName: \"CompressedBatch\",\n duration,\n sizeBeforeCompression: batch.contentSizeInBytes,\n sizeAfterCompression: compressedContent.length,\n });\n }\n\n const messages: BatchMessage[] = [];\n messages.push({\n ...batch.content[0], contents: JSON.stringify({ packedContents: compressedContent }),\n metadata: batch.content[0].metadata,\n compression: CompressionAlgorithms.lz4,\n });\n\n for (const message of batch.content.slice(1)) {\n messages.push({ ...message, contents: undefined });\n }\n\n return {\n contentSizeInBytes: compressedContent.length,\n content: messages,\n };\n }\n\n private serializeBatch(batch: IBatch): string {\n try {\n return JSON.stringify(batch.content.map((message) => message.deserializedContent))\n } catch (e: any) {\n if (e.message === \"Invalid string length\") {\n // This is how JSON.stringify signals that\n // the content size exceeds its capacity\n const error = new UsageError(\"Payload too large\");\n this.logger.sendErrorEvent(\n {\n eventName: \"BatchTooLarge\",\n size: batch.contentSizeInBytes,\n length: batch.content.length,\n },\n error,\n );\n throw error;\n }\n\n throw e;\n }\n }\n}\n"]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
6
|
+
import { IMessageProcessingResult } from "./definitions";
|
|
6
7
|
/**
|
|
7
8
|
* State machine that "unrolls" contents of compressed batches of ops after decompressing them.
|
|
8
9
|
* This class relies on some implicit contracts defined below:
|
|
@@ -15,6 +16,6 @@ export declare class OpDecompressor {
|
|
|
15
16
|
private activeBatch;
|
|
16
17
|
private rootMessageContents;
|
|
17
18
|
private processedCount;
|
|
18
|
-
processMessage(message: ISequencedDocumentMessage):
|
|
19
|
+
processMessage(message: ISequencedDocumentMessage): IMessageProcessingResult;
|
|
19
20
|
}
|
|
20
21
|
//# sourceMappingURL=opDecompressor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opDecompressor.d.ts","sourceRoot":"","sources":["../../src/opLifecycle/opDecompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"opDecompressor.d.ts","sourceRoot":"","sources":["../../src/opLifecycle/opDecompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAGjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAEzD;;;;;;;GAOG;AACH,qBAAa,cAAc;IACvB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,mBAAmB,CAAkB;IAC7C,OAAO,CAAC,cAAc,CAAK;IAEpB,cAAc,CAAC,OAAO,EAAE,yBAAyB,GAAG,wBAAwB;CAwEtF"}
|
|
@@ -19,13 +19,9 @@ export class OpDecompressor {
|
|
|
19
19
|
this.processedCount = 0;
|
|
20
20
|
}
|
|
21
21
|
processMessage(message) {
|
|
22
|
-
var _a, _b, _c, _d
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// to pick up protocol change. Eventually only the top level property should
|
|
26
|
-
// be used.
|
|
27
|
-
if (((_a = message.metadata) === null || _a === void 0 ? void 0 : _a.batch) === true
|
|
28
|
-
&& (((_b = message.metadata) === null || _b === void 0 ? void 0 : _b.compressed) || message.compression !== undefined)) {
|
|
22
|
+
var _a, _b, _c, _d;
|
|
23
|
+
assert(message.compression === undefined || message.compression === CompressionAlgorithms.lz4, 0x511 /* Only lz4 compression is supported */);
|
|
24
|
+
if (((_a = message.metadata) === null || _a === void 0 ? void 0 : _a.batch) === true && message.compression === CompressionAlgorithms.lz4) {
|
|
29
25
|
// Beginning of a compressed batch
|
|
30
26
|
assert(this.activeBatch === false, 0x4b8 /* shouldn't have multiple active batches */);
|
|
31
27
|
if (message.compression) {
|
|
@@ -38,31 +34,48 @@ export class OpDecompressor {
|
|
|
38
34
|
const intoString = Uint8ArrayToString(decompressedMessage);
|
|
39
35
|
const asObj = JSON.parse(intoString);
|
|
40
36
|
this.rootMessageContents = asObj;
|
|
41
|
-
return
|
|
37
|
+
return {
|
|
38
|
+
message: newMessage(message, this.rootMessageContents[this.processedCount++]),
|
|
39
|
+
state: "Accepted",
|
|
40
|
+
};
|
|
42
41
|
}
|
|
43
|
-
if (this.rootMessageContents !== undefined && ((
|
|
42
|
+
if (this.rootMessageContents !== undefined && ((_b = message.metadata) === null || _b === void 0 ? void 0 : _b.batch) === undefined && this.activeBatch) {
|
|
43
|
+
assert(message.contents === undefined, 0x512 /* Expecting empty message */);
|
|
44
44
|
// Continuation of compressed batch
|
|
45
|
-
return
|
|
45
|
+
return {
|
|
46
|
+
message: newMessage(message, this.rootMessageContents[this.processedCount++]),
|
|
47
|
+
state: "Accepted",
|
|
48
|
+
};
|
|
46
49
|
}
|
|
47
|
-
if (this.rootMessageContents !== undefined && ((
|
|
50
|
+
if (this.rootMessageContents !== undefined && ((_c = message.metadata) === null || _c === void 0 ? void 0 : _c.batch) === false) {
|
|
48
51
|
// End of compressed batch
|
|
49
|
-
const returnMessage =
|
|
52
|
+
const returnMessage = newMessage(message, this.rootMessageContents[this.processedCount++]);
|
|
50
53
|
this.activeBatch = false;
|
|
51
54
|
this.rootMessageContents = undefined;
|
|
52
55
|
this.processedCount = 0;
|
|
53
|
-
return
|
|
56
|
+
return {
|
|
57
|
+
message: returnMessage,
|
|
58
|
+
state: "Processed",
|
|
59
|
+
};
|
|
54
60
|
}
|
|
55
|
-
if (((
|
|
56
|
-
(((_f = message.metadata) === null || _f === void 0 ? void 0 : _f.compressed) || message.compression === CompressionAlgorithms.lz4)) {
|
|
61
|
+
if (((_d = message.metadata) === null || _d === void 0 ? void 0 : _d.batch) === undefined && message.compression === CompressionAlgorithms.lz4) {
|
|
57
62
|
// Single compressed message
|
|
58
63
|
assert(this.activeBatch === false, 0x4ba /* shouldn't receive compressed message in middle of a batch */);
|
|
59
64
|
const contents = IsoBuffer.from(message.contents.packedContents, "base64");
|
|
60
65
|
const decompressedMessage = decompress(contents);
|
|
61
66
|
const intoString = new TextDecoder().decode(decompressedMessage);
|
|
62
67
|
const asObj = JSON.parse(intoString);
|
|
63
|
-
return
|
|
68
|
+
return {
|
|
69
|
+
message: newMessage(message, asObj[0]),
|
|
70
|
+
state: "Processed",
|
|
71
|
+
};
|
|
64
72
|
}
|
|
65
|
-
return
|
|
73
|
+
return {
|
|
74
|
+
message,
|
|
75
|
+
state: "Skipped",
|
|
76
|
+
};
|
|
66
77
|
}
|
|
67
78
|
}
|
|
79
|
+
// We should not be mutating the input message nor its metadata
|
|
80
|
+
const newMessage = (originalMessage, contents) => (Object.assign(Object.assign({}, originalMessage), { contents, compression: undefined, metadata: Object.assign({}, originalMessage.metadata) }));
|
|
68
81
|
//# sourceMappingURL=opDecompressor.js.map
|