@fluidframework/container-runtime 2.0.0-internal.2.2.1 → 2.0.0-internal.2.3.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.
Files changed (195) hide show
  1. package/.eslintrc.js +19 -8
  2. package/dist/batchTracker.d.ts +1 -2
  3. package/dist/batchTracker.d.ts.map +1 -1
  4. package/dist/batchTracker.js.map +1 -1
  5. package/dist/blobManager.d.ts +45 -34
  6. package/dist/blobManager.d.ts.map +1 -1
  7. package/dist/blobManager.js +135 -102
  8. package/dist/blobManager.js.map +1 -1
  9. package/dist/containerRuntime.d.ts +54 -8
  10. package/dist/containerRuntime.d.ts.map +1 -1
  11. package/dist/containerRuntime.js +143 -72
  12. package/dist/containerRuntime.js.map +1 -1
  13. package/dist/dataStoreContext.d.ts +1 -1
  14. package/dist/dataStoreContext.d.ts.map +1 -1
  15. package/dist/dataStoreContext.js +6 -8
  16. package/dist/dataStoreContext.js.map +1 -1
  17. package/dist/dataStores.d.ts +12 -9
  18. package/dist/dataStores.d.ts.map +1 -1
  19. package/dist/dataStores.js +41 -35
  20. package/dist/dataStores.js.map +1 -1
  21. package/dist/garbageCollection.d.ts +41 -20
  22. package/dist/garbageCollection.d.ts.map +1 -1
  23. package/dist/garbageCollection.js +205 -150
  24. package/dist/garbageCollection.js.map +1 -1
  25. package/dist/garbageCollectionConstants.d.ts +7 -3
  26. package/dist/garbageCollectionConstants.d.ts.map +1 -1
  27. package/dist/garbageCollectionConstants.js +10 -8
  28. package/dist/garbageCollectionConstants.js.map +1 -1
  29. package/dist/garbageCollectionTombstoneUtils.d.ts +14 -0
  30. package/dist/garbageCollectionTombstoneUtils.d.ts.map +1 -0
  31. package/dist/garbageCollectionTombstoneUtils.js +23 -0
  32. package/dist/garbageCollectionTombstoneUtils.js.map +1 -0
  33. package/dist/index.d.ts +1 -2
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +3 -5
  36. package/dist/index.js.map +1 -1
  37. package/dist/opLifecycle/batchManager.d.ts +13 -1
  38. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  39. package/dist/opLifecycle/batchManager.js +35 -1
  40. package/dist/opLifecycle/batchManager.js.map +1 -1
  41. package/dist/opLifecycle/definitions.d.ts +25 -1
  42. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  43. package/dist/opLifecycle/definitions.js.map +1 -1
  44. package/dist/opLifecycle/index.d.ts +2 -2
  45. package/dist/opLifecycle/index.d.ts.map +1 -1
  46. package/dist/opLifecycle/index.js +2 -1
  47. package/dist/opLifecycle/index.js.map +1 -1
  48. package/dist/opLifecycle/opCompressor.d.ts +1 -1
  49. package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
  50. package/dist/opLifecycle/opCompressor.js +24 -10
  51. package/dist/opLifecycle/opCompressor.js.map +1 -1
  52. package/dist/opLifecycle/opDecompressor.d.ts +2 -1
  53. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
  54. package/dist/opLifecycle/opDecompressor.js +30 -17
  55. package/dist/opLifecycle/opDecompressor.js.map +1 -1
  56. package/dist/opLifecycle/opSplitter.d.ts +34 -2
  57. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  58. package/dist/opLifecycle/opSplitter.js +114 -5
  59. package/dist/opLifecycle/opSplitter.js.map +1 -1
  60. package/dist/opLifecycle/outbox.d.ts +5 -0
  61. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  62. package/dist/opLifecycle/outbox.js +24 -14
  63. package/dist/opLifecycle/outbox.js.map +1 -1
  64. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  65. package/dist/opLifecycle/remoteMessageProcessor.js +17 -2
  66. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  67. package/dist/packageVersion.d.ts +1 -1
  68. package/dist/packageVersion.js +1 -1
  69. package/dist/packageVersion.js.map +1 -1
  70. package/dist/runningSummarizer.d.ts.map +1 -1
  71. package/dist/runningSummarizer.js +0 -1
  72. package/dist/runningSummarizer.js.map +1 -1
  73. package/dist/scheduleManager.d.ts +0 -1
  74. package/dist/scheduleManager.d.ts.map +1 -1
  75. package/dist/scheduleManager.js +9 -20
  76. package/dist/scheduleManager.js.map +1 -1
  77. package/dist/summarizer.d.ts +0 -1
  78. package/dist/summarizer.d.ts.map +1 -1
  79. package/dist/summarizer.js +2 -1
  80. package/dist/summarizer.js.map +1 -1
  81. package/dist/summarizerTypes.d.ts +1 -0
  82. package/dist/summarizerTypes.d.ts.map +1 -1
  83. package/dist/summarizerTypes.js.map +1 -1
  84. package/dist/summaryFormat.d.ts.map +1 -1
  85. package/dist/summaryFormat.js +1 -2
  86. package/dist/summaryFormat.js.map +1 -1
  87. package/lib/batchTracker.d.ts +1 -2
  88. package/lib/batchTracker.d.ts.map +1 -1
  89. package/lib/batchTracker.js.map +1 -1
  90. package/lib/blobManager.d.ts +45 -34
  91. package/lib/blobManager.d.ts.map +1 -1
  92. package/lib/blobManager.js +137 -104
  93. package/lib/blobManager.js.map +1 -1
  94. package/lib/containerRuntime.d.ts +54 -8
  95. package/lib/containerRuntime.d.ts.map +1 -1
  96. package/lib/containerRuntime.js +140 -69
  97. package/lib/containerRuntime.js.map +1 -1
  98. package/lib/dataStoreContext.d.ts +1 -1
  99. package/lib/dataStoreContext.d.ts.map +1 -1
  100. package/lib/dataStoreContext.js +7 -9
  101. package/lib/dataStoreContext.js.map +1 -1
  102. package/lib/dataStores.d.ts +12 -9
  103. package/lib/dataStores.d.ts.map +1 -1
  104. package/lib/dataStores.js +44 -38
  105. package/lib/dataStores.js.map +1 -1
  106. package/lib/garbageCollection.d.ts +41 -20
  107. package/lib/garbageCollection.d.ts.map +1 -1
  108. package/lib/garbageCollection.js +201 -146
  109. package/lib/garbageCollection.js.map +1 -1
  110. package/lib/garbageCollectionConstants.d.ts +7 -3
  111. package/lib/garbageCollectionConstants.d.ts.map +1 -1
  112. package/lib/garbageCollectionConstants.js +9 -7
  113. package/lib/garbageCollectionConstants.js.map +1 -1
  114. package/lib/garbageCollectionTombstoneUtils.d.ts +14 -0
  115. package/lib/garbageCollectionTombstoneUtils.d.ts.map +1 -0
  116. package/lib/garbageCollectionTombstoneUtils.js +19 -0
  117. package/lib/garbageCollectionTombstoneUtils.js.map +1 -0
  118. package/lib/index.d.ts +1 -2
  119. package/lib/index.d.ts.map +1 -1
  120. package/lib/index.js +1 -2
  121. package/lib/index.js.map +1 -1
  122. package/lib/opLifecycle/batchManager.d.ts +13 -1
  123. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  124. package/lib/opLifecycle/batchManager.js +35 -1
  125. package/lib/opLifecycle/batchManager.js.map +1 -1
  126. package/lib/opLifecycle/definitions.d.ts +25 -1
  127. package/lib/opLifecycle/definitions.d.ts.map +1 -1
  128. package/lib/opLifecycle/definitions.js.map +1 -1
  129. package/lib/opLifecycle/index.d.ts +2 -2
  130. package/lib/opLifecycle/index.d.ts.map +1 -1
  131. package/lib/opLifecycle/index.js +1 -1
  132. package/lib/opLifecycle/index.js.map +1 -1
  133. package/lib/opLifecycle/opCompressor.d.ts +1 -1
  134. package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
  135. package/lib/opLifecycle/opCompressor.js +24 -10
  136. package/lib/opLifecycle/opCompressor.js.map +1 -1
  137. package/lib/opLifecycle/opDecompressor.d.ts +2 -1
  138. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
  139. package/lib/opLifecycle/opDecompressor.js +30 -17
  140. package/lib/opLifecycle/opDecompressor.js.map +1 -1
  141. package/lib/opLifecycle/opSplitter.d.ts +34 -2
  142. package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
  143. package/lib/opLifecycle/opSplitter.js +112 -4
  144. package/lib/opLifecycle/opSplitter.js.map +1 -1
  145. package/lib/opLifecycle/outbox.d.ts +5 -0
  146. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  147. package/lib/opLifecycle/outbox.js +24 -14
  148. package/lib/opLifecycle/outbox.js.map +1 -1
  149. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  150. package/lib/opLifecycle/remoteMessageProcessor.js +17 -2
  151. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  152. package/lib/packageVersion.d.ts +1 -1
  153. package/lib/packageVersion.js +1 -1
  154. package/lib/packageVersion.js.map +1 -1
  155. package/lib/runningSummarizer.d.ts.map +1 -1
  156. package/lib/runningSummarizer.js +0 -1
  157. package/lib/runningSummarizer.js.map +1 -1
  158. package/lib/scheduleManager.d.ts +0 -1
  159. package/lib/scheduleManager.d.ts.map +1 -1
  160. package/lib/scheduleManager.js +9 -20
  161. package/lib/scheduleManager.js.map +1 -1
  162. package/lib/summarizer.d.ts +0 -1
  163. package/lib/summarizer.d.ts.map +1 -1
  164. package/lib/summarizer.js +2 -1
  165. package/lib/summarizer.js.map +1 -1
  166. package/lib/summarizerTypes.d.ts +1 -0
  167. package/lib/summarizerTypes.d.ts.map +1 -1
  168. package/lib/summarizerTypes.js.map +1 -1
  169. package/lib/summaryFormat.d.ts.map +1 -1
  170. package/lib/summaryFormat.js +1 -2
  171. package/lib/summaryFormat.js.map +1 -1
  172. package/package.json +20 -19
  173. package/src/batchTracker.ts +1 -1
  174. package/src/blobManager.ts +159 -111
  175. package/src/containerRuntime.ts +202 -73
  176. package/src/dataStoreContext.ts +15 -16
  177. package/src/dataStores.ts +61 -45
  178. package/src/garbageCollection.ts +258 -183
  179. package/src/garbageCollectionConstants.ts +10 -7
  180. package/src/garbageCollectionTombstoneUtils.ts +28 -0
  181. package/src/index.ts +2 -5
  182. package/src/opLifecycle/batchManager.ts +59 -1
  183. package/src/opLifecycle/definitions.ts +27 -1
  184. package/src/opLifecycle/index.ts +2 -1
  185. package/src/opLifecycle/opCompressor.ts +29 -12
  186. package/src/opLifecycle/opDecompressor.ts +39 -18
  187. package/src/opLifecycle/opSplitter.ts +141 -7
  188. package/src/opLifecycle/outbox.ts +32 -16
  189. package/src/opLifecycle/remoteMessageProcessor.ts +19 -3
  190. package/src/packageVersion.ts +1 -1
  191. package/src/runningSummarizer.ts +0 -1
  192. package/src/scheduleManager.ts +19 -30
  193. package/src/summarizer.ts +1 -1
  194. package/src/summarizerTypes.ts +1 -0
  195. package/src/summaryFormat.ts +1 -2
@@ -4,13 +4,11 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.defaultSessionExpiryDurationMs = exports.defaultInactiveTimeoutMs = exports.oneDayMs = exports.throwOnTombstoneUsageKey = exports.disableTombstoneKey = exports.disableSweepLogKey = exports.trackGCStateKey = exports.runSessionExpiryKey = exports.gcTestModeKey = exports.runSweepKey = exports.runGCKey = exports.gcTombstoneBlobKey = exports.gcBlobPrefix = exports.gcTreeKey = void 0;
8
- // The key for the GC tree in summary.
9
- exports.gcTreeKey = "gc";
10
- // They prefix for GC blobs in the GC tree in summary.
11
- exports.gcBlobPrefix = "__gc";
12
- // The key for tombstone blob in the GC tree in summary.
13
- exports.gcTombstoneBlobKey = "__tombstones";
7
+ exports.defaultSessionExpiryDurationMs = exports.defaultInactiveTimeoutMs = exports.oneDayMs = exports.gcVersionUpgradeToV2Key = exports.throwOnTombstoneUsageKey = exports.throwOnTombstoneLoadKey = exports.disableTombstoneKey = exports.disableSweepLogKey = exports.trackGCStateKey = exports.runSessionExpiryKey = exports.gcTestModeKey = exports.runSweepKey = exports.runGCKey = exports.currentGCVersion = exports.stableGCVersion = void 0;
8
+ /** The stable version of garbage collection in production. */
9
+ exports.stableGCVersion = 1;
10
+ /** The current version of garbage collection. */
11
+ exports.currentGCVersion = 2;
14
12
  // Feature gate key to turn GC on / off.
15
13
  exports.runGCKey = "Fluid.GarbageCollection.RunGC";
16
14
  // Feature gate key to turn GC sweep on / off.
@@ -25,8 +23,12 @@ exports.trackGCStateKey = "Fluid.GarbageCollection.TrackGCState";
25
23
  exports.disableSweepLogKey = "Fluid.GarbageCollection.DisableSweepLog";
26
24
  // Feature gate key to disable the tombstone feature, i.e., tombstone information is not read / written into summary.
27
25
  exports.disableTombstoneKey = "Fluid.GarbageCollection.DisableTombstone";
28
- // Feature gate to enable throwing an error when tombstone object is used.
26
+ // Feature gate to enable throwing an error when tombstone object is loaded (requested).
27
+ exports.throwOnTombstoneLoadKey = "Fluid.GarbageCollection.ThrowOnTombstoneLoad";
28
+ // Feature gate to enable throwing an error when tombstone object is used (e.g. outgoing or incoming ops).
29
29
  exports.throwOnTombstoneUsageKey = "Fluid.GarbageCollection.ThrowOnTombstoneUsage";
30
+ // Feature gate to enable GC version upgrade.
31
+ exports.gcVersionUpgradeToV2Key = "Fluid.GarbageCollection.GCVersionUpgradeToV2";
30
32
  // One day in milliseconds.
31
33
  exports.oneDayMs = 1 * 24 * 60 * 60 * 1000;
32
34
  exports.defaultInactiveTimeoutMs = 7 * exports.oneDayMs; // 7 days
@@ -1 +1 @@
1
- {"version":3,"file":"garbageCollectionConstants.js","sourceRoot":"","sources":["../src/garbageCollectionConstants.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,sCAAsC;AACzB,QAAA,SAAS,GAAG,IAAI,CAAC;AAC9B,sDAAsD;AACzC,QAAA,YAAY,GAAG,MAAM,CAAC;AACnC,wDAAwD;AAC3C,QAAA,kBAAkB,GAAG,cAAc,CAAC;AAEjD,wCAAwC;AAC3B,QAAA,QAAQ,GAAG,+BAA+B,CAAC;AACxD,8CAA8C;AACjC,QAAA,WAAW,GAAG,kCAAkC,CAAC;AAC9D,kDAAkD;AACrC,QAAA,aAAa,GAAG,oCAAoC,CAAC;AAClE,mEAAmE;AACtD,QAAA,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E,6EAA6E;AAChE,QAAA,eAAe,GAAG,sCAAsC,CAAC;AACtE,6CAA6C;AAChC,QAAA,kBAAkB,GAAG,yCAAyC,CAAC;AAC5E,qHAAqH;AACxG,QAAA,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E,0EAA0E;AAC7D,QAAA,wBAAwB,GAAG,+CAA+C,CAAC;AAExF,2BAA2B;AACd,QAAA,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC,QAAA,wBAAwB,GAAG,CAAC,GAAG,gBAAQ,CAAC,CAAC,SAAS;AAClD,QAAA,8BAA8B,GAAG,EAAE,GAAG,gBAAQ,CAAC,CAAC,UAAU","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n\n// The key for the GC tree in summary.\nexport const gcTreeKey = \"gc\";\n// They prefix for GC blobs in the GC tree in summary.\nexport const gcBlobPrefix = \"__gc\";\n// The key for tombstone blob in the GC tree in summary.\nexport const gcTombstoneBlobKey = \"__tombstones\";\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\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"]}
1
+ {"version":3,"file":"garbageCollectionConstants.js","sourceRoot":"","sources":["../src/garbageCollectionConstants.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,8DAA8D;AACjD,QAAA,eAAe,GAAc,CAAC,CAAC;AAC5C,iDAAiD;AACpC,QAAA,gBAAgB,GAAc,CAAC,CAAC;AAE7C,wCAAwC;AAC3B,QAAA,QAAQ,GAAG,+BAA+B,CAAC;AACxD,8CAA8C;AACjC,QAAA,WAAW,GAAG,kCAAkC,CAAC;AAC9D,kDAAkD;AACrC,QAAA,aAAa,GAAG,oCAAoC,CAAC;AAClE,mEAAmE;AACtD,QAAA,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E,6EAA6E;AAChE,QAAA,eAAe,GAAG,sCAAsC,CAAC;AACtE,6CAA6C;AAChC,QAAA,kBAAkB,GAAG,yCAAyC,CAAC;AAC5E,qHAAqH;AACxG,QAAA,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E,wFAAwF;AAC3E,QAAA,uBAAuB,GAAG,8CAA8C,CAAC;AACtF,0GAA0G;AAC7F,QAAA,wBAAwB,GAAG,+CAA+C,CAAC;AACxF,6CAA6C;AAChC,QAAA,uBAAuB,GAAG,8CAA8C,CAAC;AAEtF,2BAA2B;AACd,QAAA,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC,QAAA,wBAAwB,GAAG,CAAC,GAAG,gBAAQ,CAAC,CAAC,SAAS;AAClD,QAAA,8BAA8B,GAAG,EAAE,GAAG,gBAAQ,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 loaded (requested).\nexport const throwOnTombstoneLoadKey = \"Fluid.GarbageCollection.ThrowOnTombstoneLoad\";\n// Feature gate to enable throwing an error when tombstone object is used (e.g. outgoing or incoming ops).\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,14 @@
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
+ * Consolidates info / logic for logging when we encounter a Tombstone
9
+ */
10
+ export declare function sendGCTombstoneEvent(mc: MonitoringContext, event: ITelemetryGenericEvent & {
11
+ category: "error" | "generic";
12
+ isSummarizerClient: boolean;
13
+ }, packagePath: readonly string[] | undefined, error?: unknown): void;
14
+ //# 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;;GAEG;AACH,wBAAgB,oBAAoB,CAChC,EAAE,EAAE,iBAAiB,EACrB,KAAK,EAAE,sBAAsB,GAAG;IAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,kBAAkB,EAAE,OAAO,CAAA;CAAE,EAC9F,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC1C,KAAK,CAAC,EAAE,OAAO,QAUlB"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.sendGCTombstoneEvent = void 0;
8
+ const runtime_utils_1 = require("@fluidframework/runtime-utils");
9
+ const garbageCollectionConstants_1 = require("./garbageCollectionConstants");
10
+ /**
11
+ * Consolidates info / logic for logging when we encounter a Tombstone
12
+ */
13
+ function sendGCTombstoneEvent(mc, event, packagePath, error) {
14
+ event.pkg = (0, runtime_utils_1.packagePathToTelemetryProperty)(packagePath);
15
+ event.tombstoneFlags = JSON.stringify({
16
+ DisableTombstone: mc.config.getBoolean(garbageCollectionConstants_1.disableTombstoneKey),
17
+ ThrowOnTombstoneUsage: mc.config.getBoolean(garbageCollectionConstants_1.throwOnTombstoneUsageKey),
18
+ ThrowOnTombstoneLoad: mc.config.getBoolean(garbageCollectionConstants_1.throwOnTombstoneLoadKey),
19
+ });
20
+ mc.logger.sendTelemetryEvent(event, error);
21
+ }
22
+ exports.sendGCTombstoneEvent = sendGCTombstoneEvent;
23
+ //# sourceMappingURL=garbageCollectionTombstoneUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"garbageCollectionTombstoneUtils.js","sourceRoot":"","sources":["../src/garbageCollectionTombstoneUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,iEAA+E;AAE/E,6EAAsH;AAEtH;;GAEG;AACH,SAAgB,oBAAoB,CAChC,EAAqB,EACrB,KAA8F,EAC9F,WAA0C,EAC1C,KAAe;IAEf,KAAK,CAAC,GAAG,GAAG,IAAA,8CAA8B,EAAC,WAAW,CAAC,CAAC;IACxD,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;QAClC,gBAAgB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,gDAAmB,CAAC;QAC3D,qBAAqB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,qDAAwB,CAAC;QACrE,oBAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,oDAAuB,CAAC;KACtE,CAAC,CAAC;IAEH,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAdD,oDAcC","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 { disableTombstoneKey, throwOnTombstoneLoadKey, throwOnTombstoneUsageKey } from \"./garbageCollectionConstants\";\n\n/**\n * Consolidates info / logic for logging when we encounter a Tombstone\n */\nexport function sendGCTombstoneEvent(\n mc: MonitoringContext,\n event: ITelemetryGenericEvent & { category: \"error\" | \"generic\", isSummarizerClient: boolean },\n packagePath: readonly string[] | undefined,\n error?: unknown,\n) {\n event.pkg = packagePathToTelemetryProperty(packagePath);\n event.tombstoneFlags = JSON.stringify({\n DisableTombstone: mc.config.getBoolean(disableTombstoneKey),\n ThrowOnTombstoneUsage: mc.config.getBoolean(throwOnTombstoneUsageKey),\n ThrowOnTombstoneLoad: mc.config.getBoolean(throwOnTombstoneLoadKey),\n });\n\n mc.logger.sendTelemetryEvent(event, error);\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -2,10 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { ContainerMessageType, ContainerRuntimeMessage, IGCRuntimeOptions, ISummaryRuntimeOptions, ISummaryBaseConfiguration, ISummaryConfigurationHeuristics, ISummaryConfigurationDisableSummarizer, ISummaryConfigurationDisableHeuristics, IContainerRuntimeOptions, IRootSummaryTreeWithStats, isRuntimeMessage, RuntimeMessage, agentSchedulerId, ContainerRuntime, RuntimeHeaders, ISummaryConfiguration, DefaultSummaryConfiguration, ICompressionRuntimeOptions, CompressionAlgorithms, } from "./containerRuntime";
5
+ export { ContainerMessageType, ContainerRuntimeMessage, IGCRuntimeOptions, ISummaryRuntimeOptions, ISummaryBaseConfiguration, ISummaryConfigurationHeuristics, ISummaryConfigurationDisableSummarizer, ISummaryConfigurationDisableHeuristics, IContainerRuntimeOptions, IRootSummaryTreeWithStats, isRuntimeMessage, RuntimeMessage, agentSchedulerId, ContainerRuntime, RuntimeHeaders, AllowTombstoneRequestHeaderKey, TombstoneResponseHeaderKey, 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";
@@ -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,YAAY,EACZ,kBAAkB,EAClB,SAAS,GACZ,MAAM,8BAA8B,CAAC;AACtC,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"}
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,8BAA8B,EAC9B,0BAA0B,EAC1B,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/dist/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.unpackRuntimeMessage = exports.neverCancelledSummaryToken = exports.SummaryCollection = exports.ISummarizer = exports.Summarizer = exports.gcTreeKey = exports.gcTombstoneBlobKey = exports.gcBlobPrefix = exports.FluidDataStoreRegistry = exports.CompressionAlgorithms = exports.DefaultSummaryConfiguration = exports.RuntimeHeaders = exports.ContainerRuntime = exports.agentSchedulerId = exports.RuntimeMessage = exports.isRuntimeMessage = exports.ContainerMessageType = void 0;
7
+ exports.unpackRuntimeMessage = exports.neverCancelledSummaryToken = exports.SummaryCollection = exports.ISummarizer = exports.Summarizer = exports.FluidDataStoreRegistry = exports.CompressionAlgorithms = exports.DefaultSummaryConfiguration = exports.TombstoneResponseHeaderKey = exports.AllowTombstoneRequestHeaderKey = exports.RuntimeHeaders = exports.ContainerRuntime = exports.agentSchedulerId = exports.RuntimeMessage = exports.isRuntimeMessage = exports.ContainerMessageType = void 0;
8
8
  var containerRuntime_1 = require("./containerRuntime");
9
9
  Object.defineProperty(exports, "ContainerMessageType", { enumerable: true, get: function () { return containerRuntime_1.ContainerMessageType; } });
10
10
  Object.defineProperty(exports, "isRuntimeMessage", { enumerable: true, get: function () { return containerRuntime_1.isRuntimeMessage; } });
@@ -12,14 +12,12 @@ Object.defineProperty(exports, "RuntimeMessage", { enumerable: true, get: functi
12
12
  Object.defineProperty(exports, "agentSchedulerId", { enumerable: true, get: function () { return containerRuntime_1.agentSchedulerId; } });
13
13
  Object.defineProperty(exports, "ContainerRuntime", { enumerable: true, get: function () { return containerRuntime_1.ContainerRuntime; } });
14
14
  Object.defineProperty(exports, "RuntimeHeaders", { enumerable: true, get: function () { return containerRuntime_1.RuntimeHeaders; } });
15
+ Object.defineProperty(exports, "AllowTombstoneRequestHeaderKey", { enumerable: true, get: function () { return containerRuntime_1.AllowTombstoneRequestHeaderKey; } });
16
+ Object.defineProperty(exports, "TombstoneResponseHeaderKey", { enumerable: true, get: function () { return containerRuntime_1.TombstoneResponseHeaderKey; } });
15
17
  Object.defineProperty(exports, "DefaultSummaryConfiguration", { enumerable: true, get: function () { return containerRuntime_1.DefaultSummaryConfiguration; } });
16
18
  Object.defineProperty(exports, "CompressionAlgorithms", { enumerable: true, get: function () { return containerRuntime_1.CompressionAlgorithms; } });
17
19
  var dataStoreRegistry_1 = require("./dataStoreRegistry");
18
20
  Object.defineProperty(exports, "FluidDataStoreRegistry", { enumerable: true, get: function () { return dataStoreRegistry_1.FluidDataStoreRegistry; } });
19
- var garbageCollectionConstants_1 = require("./garbageCollectionConstants");
20
- Object.defineProperty(exports, "gcBlobPrefix", { enumerable: true, get: function () { return garbageCollectionConstants_1.gcBlobPrefix; } });
21
- Object.defineProperty(exports, "gcTombstoneBlobKey", { enumerable: true, get: function () { return garbageCollectionConstants_1.gcTombstoneBlobKey; } });
22
- Object.defineProperty(exports, "gcTreeKey", { enumerable: true, get: function () { return garbageCollectionConstants_1.gcTreeKey; } });
23
21
  var summarizer_1 = require("./summarizer");
24
22
  Object.defineProperty(exports, "Summarizer", { enumerable: true, get: function () { return summarizer_1.Summarizer; } });
25
23
  var summarizerTypes_1 = require("./summarizerTypes");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAoB4B;AAnBxB,wHAAA,oBAAoB,OAAA;AAUpB,oHAAA,gBAAgB,OAAA;AAChB,kHAAA,cAAc,OAAA;AACd,oHAAA,gBAAgB,OAAA;AAChB,oHAAA,gBAAgB,OAAA;AAChB,kHAAA,cAAc,OAAA;AAEd,+HAAA,2BAA2B,OAAA;AAE3B,yHAAA,qBAAqB,OAAA;AAEzB,yDAA6D;AAApD,2HAAA,sBAAsB,OAAA;AAI/B,2EAIsC;AAHlC,0HAAA,YAAY,OAAA;AACZ,gIAAA,kBAAkB,OAAA;AAClB,uHAAA,SAAS,OAAA;AAQb,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,qDA4B2B;AAVvB,8GAAA,WAAW,OAAA;AAWf,yDAW6B;AADzB,sHAAA,iBAAiB,OAAA;AAErB,+EAA8G;AAAnE,0IAAA,0BAA0B,OAAA;AACrE,6CAAiE;AAA5C,mHAAA,oBAAoB,OAAA","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 gcBlobPrefix,\n gcTombstoneBlobKey,\n gcTreeKey,\n} from \"./garbageCollectionConstants\";\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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAsB4B;AArBxB,wHAAA,oBAAoB,OAAA;AAUpB,oHAAA,gBAAgB,OAAA;AAChB,kHAAA,cAAc,OAAA;AACd,oHAAA,gBAAgB,OAAA;AAChB,oHAAA,gBAAgB,OAAA;AAChB,kHAAA,cAAc,OAAA;AACd,kIAAA,8BAA8B,OAAA;AAC9B,8HAAA,0BAA0B,OAAA;AAE1B,+HAAA,2BAA2B,OAAA;AAE3B,yHAAA,qBAAqB,OAAA;AAEzB,yDAA6D;AAApD,2HAAA,sBAAsB,OAAA;AAU/B,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,qDA4B2B;AAVvB,8GAAA,WAAW,OAAA;AAWf,yDAW6B;AADzB,sHAAA,iBAAiB,OAAA;AAErB,+EAA8G;AAAnE,0IAAA,0BAA0B,OAAA;AACrE,6CAAiE;AAA5C,mHAAA,oBAAoB,OAAA","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 AllowTombstoneRequestHeaderKey,\n TombstoneResponseHeaderKey,\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;aAOO,OAAO,EAAE,oBAAoB;IANzD,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,gBAAgB,CAAK;IAE7B,IAAW,MAAM,WAAuC;IACxD,IAAW,kBAAkB,WAAoC;gBAErC,OAAO,EAAE,oBAAoB;IAElD,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO;IA+B3C,IAAW,KAAK,YAA6C;IAEtD,QAAQ,IAAI,MAAM;IAYzB;;OAEG;IACI,UAAU,IAAI,gBAAgB;CAexC"}
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"}
@@ -5,19 +5,31 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.BatchManager = void 0;
8
+ const driver_utils_1 = require("@fluidframework/driver-utils");
9
+ const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
8
10
  /**
9
11
  * Helper class that manages partial batch & rollback.
10
12
  */
11
13
  class BatchManager {
12
- constructor(options) {
14
+ constructor(options, logger) {
13
15
  this.options = options;
14
16
  this.pendingBatch = [];
15
17
  this.batchContentSize = 0;
18
+ /**
19
+ * Track the number of ops which were detected to have a mismatched
20
+ * reference sequence number, in order to self-throttle the telemetry events.
21
+ *
22
+ * This should be removed as part of ADO:2322
23
+ */
24
+ this.maxMismatchedOpsToReport = 5;
25
+ this.mismatchedOpsReported = 0;
26
+ this.logger = telemetry_utils_1.ChildLogger.create(logger, "BatchManager");
16
27
  }
17
28
  get length() { return this.pendingBatch.length; }
18
29
  get contentSizeInBytes() { return this.batchContentSize; }
19
30
  push(message) {
20
31
  var _a, _b;
32
+ this.checkReferenceSequenceNumber(message);
21
33
  const contentSize = this.batchContentSize + ((_b = (_a = message.contents) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0);
22
34
  const opCount = this.pendingBatch.length;
23
35
  // Attempt to estimate batch size, aka socket message size.
@@ -71,6 +83,28 @@ class BatchManager {
71
83
  },
72
84
  };
73
85
  }
86
+ checkReferenceSequenceNumber(message) {
87
+ if (this.pendingBatch.length === 0 || message.referenceSequenceNumber === this.pendingBatch[0].referenceSequenceNumber) {
88
+ // The reference sequence numbers are stable
89
+ return;
90
+ }
91
+ const telemetryProperties = {
92
+ referenceSequenceNumber: this.pendingBatch[0].referenceSequenceNumber,
93
+ messageReferenceSequenceNumber: message.referenceSequenceNumber,
94
+ type: message.deserializedContent.type,
95
+ length: this.pendingBatch.length,
96
+ enableOpReentryCheck: this.options.enableOpReentryCheck === true,
97
+ };
98
+ const error = new driver_utils_1.UsageError("Submission of an out of order message");
99
+ const eventName = "ReferenceSequenceNumberMismatch";
100
+ if (this.options.enableOpReentryCheck === true) {
101
+ this.logger.sendErrorEvent(Object.assign({ eventName }, telemetryProperties), error);
102
+ throw error;
103
+ }
104
+ if (++this.mismatchedOpsReported <= this.maxMismatchedOpsToReport) {
105
+ this.logger.sendErrorEvent(Object.assign(Object.assign({ eventName }, telemetryProperties), { ops: this.mismatchedOpsReported, maxOps: this.maxMismatchedOpsToReport }), error);
106
+ }
107
+ }
74
108
  }
75
109
  exports.BatchManager = BatchManager;
76
110
  const addBatchMetadata = (batch) => {
@@ -1 +1 @@
1
- {"version":3,"file":"batchManager.js","sourceRoot":"","sources":["../../src/opLifecycle/batchManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH;;GAEG;AACH,MAAa,YAAY;IAOrB,YAA4B,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;QANjD,iBAAY,GAAmB,EAAE,CAAC;QAClC,qBAAgB,GAAG,CAAC,CAAC;IAKgC,CAAC;IAH9D,IAAW,MAAM,KAAK,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IACxD,IAAW,kBAAkB,KAAK,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAI1D,IAAI,CAAC,OAAqB;;QAC7B,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,GAAG,CAAC,MAAA,MAAA,OAAO,CAAC,QAAQ,0CAAE,MAAM,mCAAI,CAAC,CAAC,CAAC;QAC5E,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;QAEzC,2DAA2D;QAC3D,iEAAiE;QACjE,sGAAsG;QACtG,iGAAiG;QACjG,gFAAgF;QAChF,MAAM,iBAAiB,GAAG,WAAW,GAAG,GAAG,GAAG,OAAO,CAAC;QAEtD,0DAA0D;QAC1D,wGAAwG;QACxG,0DAA0D;QAC1D,yGAAyG;QACzG,mGAAmG;QACnG,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,KAAK,SAAS;eACjC,IAAI,CAAC,MAAM,GAAG,CAAC;eACf,iBAAiB,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EA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AC,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 { ICompressionRuntimeOptions } from \"../containerRuntime\";\nimport { BatchMessage, IBatch, IBatchCheckpoint } from \"./definitions\";\n\nexport interface IBatchManagerOptions {\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 pendingBatch: BatchMessage[] = [];\n private batchContentSize = 0;\n\n public get length() { return this.pendingBatch.length; }\n public get contentSizeInBytes() { return this.batchContentSize; }\n\n constructor(public readonly options: IBatchManagerOptions) { }\n\n public push(message: BatchMessage): boolean {\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\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"]}
1
+ {"version":3,"file":"batchManager.js","sourceRoot":"","sources":["../../src/opLifecycle/batchManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAA0D;AAC1D,qEAA8D;AAW9D;;GAEG;AACH,MAAa,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,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["/*!\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,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,uBAAuB,EA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C,kBAAkB,EAAE,MAAM,CAAC;IACpC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,KAAK,IAAI,CAAC;CAC/D;AAED,MAAM,WAAW,UAAU;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,WAAW,GAAG,oBAAoB,CAAC;IACjD,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;GAMG;AACH,oBAAY,eAAe,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;AAEnE;;GAEG;AACH,MAAM,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,GACb,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,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
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"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.unpackRuntimeMessage = exports.RemoteMessageProcessor = exports.OpSplitter = exports.OpDecompressor = exports.OpCompressor = exports.Outbox = exports.BatchManager = void 0;
7
+ exports.unpackRuntimeMessage = exports.RemoteMessageProcessor = exports.splitOp = exports.OpSplitter = exports.OpDecompressor = exports.OpCompressor = exports.Outbox = exports.BatchManager = void 0;
8
8
  var batchManager_1 = require("./batchManager");
9
9
  Object.defineProperty(exports, "BatchManager", { enumerable: true, get: function () { return batchManager_1.BatchManager; } });
10
10
  var outbox_1 = require("./outbox");
@@ -15,6 +15,7 @@ var opDecompressor_1 = require("./opDecompressor");
15
15
  Object.defineProperty(exports, "OpDecompressor", { enumerable: true, get: function () { return opDecompressor_1.OpDecompressor; } });
16
16
  var opSplitter_1 = require("./opSplitter");
17
17
  Object.defineProperty(exports, "OpSplitter", { enumerable: true, get: function () { return opSplitter_1.OpSplitter; } });
18
+ Object.defineProperty(exports, "splitOp", { enumerable: true, get: function () { return opSplitter_1.splitOp; } });
18
19
  var remoteMessageProcessor_1 = require("./remoteMessageProcessor");
19
20
  Object.defineProperty(exports, "RemoteMessageProcessor", { enumerable: true, get: function () { return remoteMessageProcessor_1.RemoteMessageProcessor; } });
20
21
  Object.defineProperty(exports, "unpackRuntimeMessage", { enumerable: true, get: function () { return remoteMessageProcessor_1.unpackRuntimeMessage; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/opLifecycle/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAOrB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,mEAAwF;AAA/E,gIAAA,sBAAsB,OAAA;AAAE,8HAAA,oBAAoB,OAAA","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} from \"./definitions\";\nexport { Outbox } from \"./outbox\";\nexport { OpCompressor } from \"./opCompressor\";\nexport { OpDecompressor } from \"./opDecompressor\";\nexport { OpSplitter } from \"./opSplitter\";\nexport { RemoteMessageProcessor, unpackRuntimeMessage } from \"./remoteMessageProcessor\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/opLifecycle/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAQrB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,2CAAmD;AAA1C,wGAAA,UAAU,OAAA;AAAE,qGAAA,OAAO,OAAA;AAC5B,mEAAwF;AAA/E,gIAAA,sBAAsB,OAAA;AAAE,8HAAA,oBAAoB,OAAA","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;AAKtE,OAAO,EAAE,MAAM,EAAgB,MAAM,eAAe,CAAC;AAErD;;;;GAIG;AACH,qBAAa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IACxB,OAAO,CAAC,oBAAoB,CAAK;gBAErB,MAAM,EAAE,gBAAgB;IAI7B,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAsC9C"}
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"}
@@ -6,6 +6,7 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.OpCompressor = void 0;
8
8
  const common_utils_1 = require("@fluidframework/common-utils");
9
+ const container_utils_1 = require("@fluidframework/container-utils");
9
10
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
10
11
  const lz4js_1 = require("lz4js");
11
12
  const containerRuntime_1 = require("../containerRuntime");
@@ -16,22 +17,15 @@ const containerRuntime_1 = require("../containerRuntime");
16
17
  */
17
18
  class OpCompressor {
18
19
  constructor(logger) {
19
- this.compressedBatchCount = 0;
20
20
  this.logger = telemetry_utils_1.ChildLogger.create(logger, "OpCompressor");
21
21
  }
22
22
  compressBatch(batch) {
23
- const messages = [];
24
- this.compressedBatchCount++;
25
- const contentToCompress = [];
26
- for (const message of batch.content) {
27
- contentToCompress.push(message.deserializedContent);
28
- }
29
23
  const compressionStart = Date.now();
30
- const contentsAsBuffer = new TextEncoder().encode(JSON.stringify(contentToCompress));
24
+ const contentsAsBuffer = new TextEncoder().encode(this.serializeBatch(batch));
31
25
  const compressedContents = (0, lz4js_1.compress)(contentsAsBuffer);
32
26
  const compressedContent = common_utils_1.IsoBuffer.from(compressedContents).toString("base64");
33
27
  const duration = Date.now() - compressionStart;
34
- if (batch.contentSizeInBytes > 200000 || this.compressedBatchCount % 25) {
28
+ if (batch.contentSizeInBytes > 200000) {
35
29
  this.logger.sendPerformanceEvent({
36
30
  eventName: "CompressedBatch",
37
31
  duration,
@@ -39,7 +33,8 @@ class OpCompressor {
39
33
  sizeAfterCompression: compressedContent.length,
40
34
  });
41
35
  }
42
- messages.push(Object.assign(Object.assign({}, batch.content[0]), { contents: JSON.stringify({ packedContents: compressedContent }), metadata: Object.assign(Object.assign({}, batch.content[0].metadata), { compressed: true }), compression: containerRuntime_1.CompressionAlgorithms.lz4 }));
36
+ const messages = [];
37
+ messages.push(Object.assign(Object.assign({}, batch.content[0]), { contents: JSON.stringify({ packedContents: compressedContent }), metadata: batch.content[0].metadata, compression: containerRuntime_1.CompressionAlgorithms.lz4 }));
43
38
  for (const message of batch.content.slice(1)) {
44
39
  messages.push(Object.assign(Object.assign({}, message), { contents: undefined }));
45
40
  }
@@ -48,6 +43,25 @@ class OpCompressor {
48
43
  content: messages,
49
44
  };
50
45
  }
46
+ serializeBatch(batch) {
47
+ try {
48
+ return JSON.stringify(batch.content.map((message) => message.deserializedContent));
49
+ }
50
+ catch (e) {
51
+ if (e.message === "Invalid string length") {
52
+ // This is how JSON.stringify signals that
53
+ // the content size exceeds its capacity
54
+ const error = new container_utils_1.UsageError("Payload too large");
55
+ this.logger.sendErrorEvent({
56
+ eventName: "BatchTooLarge",
57
+ size: batch.contentSizeInBytes,
58
+ length: batch.content.length,
59
+ }, error);
60
+ throw error;
61
+ }
62
+ throw e;
63
+ }
64
+ }
51
65
  }
52
66
  exports.OpCompressor = OpCompressor;
53
67
  //# sourceMappingURL=opCompressor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"opCompressor.js","sourceRoot":"","sources":["../../src/opLifecycle/opCompressor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAyD;AACzD,qEAA8D;AAC9D,iCAAiC;AACjC,0DAAqF;AAGrF;;;;GAIG;AACH,MAAa,YAAY;IAIrB,YAAY,MAAwB;QAF5B,yBAAoB,GAAG,CAAC,CAAC;QAG7B,IAAI,CAAC,MAAM,GAAG,6BAAW,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC7D,CAAC;IAEM,aAAa,CAAC,KAAa;QAC9B,MAAM,QAAQ,GAAmB,EAAE,CAAC;QACpC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,MAAM,iBAAiB,GAA8B,EAAE,CAAC;QACxD,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE;YACjC,iBAAiB,CAAC,IAAI,CAAC,OAA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AAC,MAAM;YAC5C,OAAO,EAAE,QAAQ;SACpB,CAAC;IACN,CAAC;CACJ;AA9CD,oCA8CC","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 { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { compress } from \"lz4js\";\nimport { CompressionAlgorithms, ContainerRuntimeMessage } 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 private compressedBatchCount = 0;\n\n constructor(logger: ITelemetryLogger) {\n this.logger = ChildLogger.create(logger, \"OpCompressor\");\n }\n\n public compressBatch(batch: IBatch): IBatch {\n const messages: BatchMessage[] = [];\n this.compressedBatchCount++;\n const contentToCompress: ContainerRuntimeMessage[] = [];\n for (const message of batch.content) {\n contentToCompress.push(message.deserializedContent);\n }\n\n const compressionStart = Date.now();\n const contentsAsBuffer = new TextEncoder().encode(JSON.stringify(contentToCompress));\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 || this.compressedBatchCount % 25) {\n this.logger.sendPerformanceEvent({\n eventName: \"CompressedBatch\",\n duration,\n sizeBeforeCompression: batch.contentSizeInBytes,\n sizeAfterCompression: compressedContent.length,\n });\n }\n\n messages.push({\n ...batch.content[0], contents: JSON.stringify({ packedContents: compressedContent }),\n metadata: { ...batch.content[0].metadata, compressed: true },\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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C,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,EACnC,WAAW,EAAE,wCAAqB,CAAC,GAAG,IACxC,CAAC;QAEH,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YAC1C,QAAQ,CAAC,IAAI,iCAAM,OAAO,KAAE,QAAQ,EAAE,SAAS,IAAG,CAAC;SACtD;QAED,OAAO;YACH,kBAAkB,EAAE,iBAAiB,CAAC,MAAM;YAC5C,OAAO,EAAE,QAAQ;SACpB,CAAC;IACN,CAAC;IAEO,cAAc,CAAC,KAAa;QAChC,IAAI;YACA,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAA;SACrF;QAAC,OAAO,CAAM,EAAE;YACb,IAAI,CAAC,CAAC,OAAO,KAAK,uBAAuB,EAAE;gBACvC,0CAA0C;gBAC1C,wCAAwC;gBACxC,MAAM,KAAK,GAAG,IAAI,4BAAU,CAAC,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;AA9DD,oCA8DC","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): 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;AAIjF;;;;;;;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,yBAAyB;CA4DvF"}
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"}