@fluidframework/container-runtime 2.33.0-333010 → 2.33.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/CHANGELOG.md +4 -0
- package/api-report/container-runtime.legacy.alpha.api.md +71 -67
- package/container-runtime.test-files.tar +0 -0
- package/dist/blobManager/blobManager.d.ts +7 -4
- package/dist/blobManager/blobManager.d.ts.map +1 -1
- package/dist/blobManager/blobManager.js +38 -12
- package/dist/blobManager/blobManager.js.map +1 -1
- package/dist/channelCollection.d.ts +4 -0
- package/dist/channelCollection.d.ts.map +1 -1
- package/dist/channelCollection.js +24 -0
- package/dist/channelCollection.js.map +1 -1
- package/dist/compatUtils.d.ts +74 -0
- package/dist/compatUtils.d.ts.map +1 -0
- package/dist/compatUtils.js +151 -0
- package/dist/compatUtils.js.map +1 -0
- package/dist/compressionDefinitions.d.ts +39 -0
- package/dist/compressionDefinitions.d.ts.map +1 -0
- package/dist/compressionDefinitions.js +30 -0
- package/dist/compressionDefinitions.js.map +1 -0
- package/dist/containerRuntime.d.ts +78 -52
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +141 -54
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +3 -0
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +122 -66
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/deltaManagerProxies.d.ts +55 -12
- package/dist/deltaManagerProxies.d.ts.map +1 -1
- package/dist/deltaManagerProxies.js +63 -55
- package/dist/deltaManagerProxies.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +2 -0
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +1 -0
- package/dist/opLifecycle/batchManager.d.ts +1 -1
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js +4 -1
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +35 -4
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/index.d.ts +1 -1
- package/dist/opLifecycle/index.d.ts.map +1 -1
- package/dist/opLifecycle/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.js +2 -2
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +3 -3
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opGroupingManager.d.ts +2 -2
- package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/dist/opLifecycle/opGroupingManager.js +1 -2
- package/dist/opLifecycle/opGroupingManager.js.map +1 -1
- package/dist/opLifecycle/opSerialization.d.ts +3 -1
- package/dist/opLifecycle/opSerialization.d.ts.map +1 -1
- package/dist/opLifecycle/opSerialization.js +4 -2
- package/dist/opLifecycle/opSerialization.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +6 -3
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +46 -20
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +36 -7
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +83 -16
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/runtimeLayerCompatState.d.ts.map +1 -1
- package/dist/runtimeLayerCompatState.js +1 -1
- package/dist/runtimeLayerCompatState.js.map +1 -1
- package/dist/summary/documentSchema.d.ts +1 -0
- package/dist/summary/documentSchema.d.ts.map +1 -1
- package/dist/summary/documentSchema.js +2 -0
- package/dist/summary/documentSchema.js.map +1 -1
- package/lib/blobManager/blobManager.d.ts +7 -4
- package/lib/blobManager/blobManager.d.ts.map +1 -1
- package/lib/blobManager/blobManager.js +38 -12
- package/lib/blobManager/blobManager.js.map +1 -1
- package/lib/channelCollection.d.ts +4 -0
- package/lib/channelCollection.d.ts.map +1 -1
- package/lib/channelCollection.js +24 -0
- package/lib/channelCollection.js.map +1 -1
- package/lib/compatUtils.d.ts +74 -0
- package/lib/compatUtils.d.ts.map +1 -0
- package/lib/compatUtils.js +142 -0
- package/lib/compatUtils.js.map +1 -0
- package/lib/compressionDefinitions.d.ts +39 -0
- package/lib/compressionDefinitions.d.ts.map +1 -0
- package/lib/compressionDefinitions.js +27 -0
- package/lib/compressionDefinitions.js.map +1 -0
- package/lib/containerRuntime.d.ts +78 -52
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +143 -56
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts +3 -0
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +57 -1
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/deltaManagerProxies.d.ts +55 -12
- package/lib/deltaManagerProxies.d.ts.map +1 -1
- package/lib/deltaManagerProxies.js +63 -55
- package/lib/deltaManagerProxies.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +2 -0
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +1 -0
- package/lib/opLifecycle/batchManager.d.ts +1 -1
- package/lib/opLifecycle/batchManager.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js +4 -1
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +35 -4
- package/lib/opLifecycle/definitions.d.ts.map +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/opLifecycle/index.d.ts +1 -1
- package/lib/opLifecycle/index.d.ts.map +1 -1
- package/lib/opLifecycle/index.js.map +1 -1
- package/lib/opLifecycle/opCompressor.js +1 -1
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.js +1 -1
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opGroupingManager.d.ts +2 -2
- package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/lib/opLifecycle/opGroupingManager.js +1 -2
- package/lib/opLifecycle/opGroupingManager.js.map +1 -1
- package/lib/opLifecycle/opSerialization.d.ts +3 -1
- package/lib/opLifecycle/opSerialization.d.ts.map +1 -1
- package/lib/opLifecycle/opSerialization.js +4 -2
- package/lib/opLifecycle/opSerialization.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +6 -3
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +46 -20
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts +36 -7
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +84 -17
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/runtimeLayerCompatState.d.ts.map +1 -1
- package/lib/runtimeLayerCompatState.js +2 -2
- package/lib/runtimeLayerCompatState.js.map +1 -1
- package/lib/summary/documentSchema.d.ts +1 -0
- package/lib/summary/documentSchema.d.ts.map +1 -1
- package/lib/summary/documentSchema.js +2 -0
- package/lib/summary/documentSchema.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +21 -20
- package/src/blobManager/blobManager.ts +48 -15
- package/src/channelCollection.ts +27 -0
- package/src/compatUtils.ts +211 -0
- package/src/compressionDefinitions.ts +47 -0
- package/src/containerRuntime.ts +259 -108
- package/src/dataStoreContext.ts +82 -2
- package/src/deltaManagerProxies.ts +132 -70
- package/src/gc/gcDefinitions.ts +2 -0
- package/src/index.ts +5 -3
- package/src/opLifecycle/batchManager.ts +5 -4
- package/src/opLifecycle/definitions.ts +34 -4
- package/src/opLifecycle/index.ts +1 -0
- package/src/opLifecycle/opCompressor.ts +1 -1
- package/src/opLifecycle/opDecompressor.ts +1 -1
- package/src/opLifecycle/opGroupingManager.ts +7 -5
- package/src/opLifecycle/opSerialization.ts +6 -2
- package/src/opLifecycle/outbox.ts +65 -30
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +135 -21
- package/src/runtimeLayerCompatState.ts +5 -2
- package/src/summary/documentSchema.ts +3 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { FlushMode } from "@fluidframework/runtime-definitions/internal";
|
|
7
|
+
// The semver package documents and encourages these imports for users that only need some of the semver functionality.
|
|
8
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
9
|
+
import semverGte from "semver/functions/gte.js";
|
|
10
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
11
|
+
import semverLte from "semver/functions/lte.js";
|
|
12
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
13
|
+
import semverValid from "semver/functions/valid.js";
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
disabledCompressionConfig,
|
|
17
|
+
enabledCompressionConfig,
|
|
18
|
+
} from "./compressionDefinitions.js";
|
|
19
|
+
import type { ContainerRuntimeOptionsInternal } from "./containerRuntime.js";
|
|
20
|
+
import { pkgVersion } from "./packageVersion.js";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Our policy is to support N/N-1 compatibility by default, where N is the most
|
|
24
|
+
* recent public major release of the runtime.
|
|
25
|
+
* Therefore, if the customer does not provide a compatibility mode, we will
|
|
26
|
+
* default to use N-1.
|
|
27
|
+
*
|
|
28
|
+
* However, this is not consistent with today's behavior. Some options (i.e.
|
|
29
|
+
* batching, compression) are enabled by default despite not being compatible
|
|
30
|
+
* with 1.x clients. Since the policy was introduced during 2.x's lifespan,
|
|
31
|
+
* N/N-1 compatibility by **default** will be in effect starting with 3.0.
|
|
32
|
+
* Importantly though, N/N-2 compatibility is still guaranteed with the proper
|
|
33
|
+
* configurations set.
|
|
34
|
+
*
|
|
35
|
+
* Further to distinguish unspecified `compatibilityVersion` from a specified
|
|
36
|
+
* version and allow `enableExplicitSchemaControl` to default to `true` for
|
|
37
|
+
* any 2.0.0+ version, we will use a special value of `2.0.0-defaults`, which
|
|
38
|
+
* is semantically less than 2.0.0.
|
|
39
|
+
*/
|
|
40
|
+
export const defaultCompatibilityVersion = "2.0.0-defaults" as const;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* String in a valid semver format specifying bottom of a minor version
|
|
44
|
+
* or special "defaults" prerelease of a major.
|
|
45
|
+
* @remarks Only 2.0.0-defaults is expected, but index signatures cannot be a
|
|
46
|
+
* literal; so, just allow any major -defaults prerelease.
|
|
47
|
+
*/
|
|
48
|
+
export type MinimumMinorSemanticVersion = `${bigint}.${bigint}.0` | `${bigint}.0.0-defaults`;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* String in a valid semver format of a specific version at least specifying minor.
|
|
52
|
+
*/
|
|
53
|
+
export type SemanticVersion =
|
|
54
|
+
| `${bigint}.${bigint}.${bigint}`
|
|
55
|
+
| `${bigint}.${bigint}.${bigint}-${string}`;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Generic type for runtimeOptionsAffectingDocSchemaConfigMap
|
|
59
|
+
*/
|
|
60
|
+
export type ConfigMap<T extends Record<string, unknown>> = {
|
|
61
|
+
[K in keyof T]-?: {
|
|
62
|
+
[version: MinimumMinorSemanticVersion]: T[K];
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Subset of the {@link ContainerRuntimeOptionsInternal} properties which
|
|
68
|
+
* affect {@link IDocumentSchemaFeatures}.
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* When a new option is added to {@link ContainerRuntimeOptionsInternal}, we
|
|
72
|
+
* must consider if it changes the DocumentSchema. If so, then a corresponding
|
|
73
|
+
* entry must be added to {@link runtimeOptionsAffectingDocSchemaConfigMap}
|
|
74
|
+
* below. If not, then it must be omitted from this type.
|
|
75
|
+
*
|
|
76
|
+
* Note: `Omit` is used instead of `Pick` to ensure that all new options are
|
|
77
|
+
* included in this type by default. If any new properties are added to
|
|
78
|
+
* {@link ContainerRuntimeOptionsInternal}, they will be included in this
|
|
79
|
+
* type unless explicitly omitted. This will prevent us from forgetting to
|
|
80
|
+
* account for any new properties in the future.
|
|
81
|
+
*/
|
|
82
|
+
export type RuntimeOptionsAffectingDocSchema = Omit<
|
|
83
|
+
ContainerRuntimeOptionsInternal,
|
|
84
|
+
| "chunkSizeInBytes"
|
|
85
|
+
| "maxBatchSizeInBytes"
|
|
86
|
+
| "loadSequenceNumberVerification"
|
|
87
|
+
| "summaryOptions"
|
|
88
|
+
>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Mapping of RuntimeOptionsAffectingDocSchema to their compatibility related configs.
|
|
92
|
+
*
|
|
93
|
+
* Each key in this map corresponds to a property in RuntimeOptionsAffectingDocSchema. The value is an object that maps SemanticVersions
|
|
94
|
+
* to the appropriate default value for that property to supporting that SemanticVersion. If clients running SemanticVersion X are able to understand
|
|
95
|
+
* the format changes introduced by the property, then the default value for that SemanticVersion will enable the feature associated with the property.
|
|
96
|
+
* Otherwise, the feature will be disabled.
|
|
97
|
+
*
|
|
98
|
+
* For example if the compatibilityVersion is a 1.x version (i.e. "1.5.0"), then the default value for `enableGroupedBatching` will be false since 1.x
|
|
99
|
+
* clients do not understand the document format when batching is enabled. If the compatibilityVersion is a 2.x client (i.e. "2.0.0" or later), then the
|
|
100
|
+
* default value for `enableGroupedBatching` will be true because clients running 2.0 or later will be able to understand the format changes associated
|
|
101
|
+
* with the batching feature.
|
|
102
|
+
*/
|
|
103
|
+
const runtimeOptionsAffectingDocSchemaConfigMap = {
|
|
104
|
+
enableGroupedBatching: {
|
|
105
|
+
"1.0.0": false,
|
|
106
|
+
"2.0.0-defaults": true,
|
|
107
|
+
} as const,
|
|
108
|
+
compressionOptions: {
|
|
109
|
+
"1.0.0": disabledCompressionConfig,
|
|
110
|
+
"2.0.0-defaults": enabledCompressionConfig,
|
|
111
|
+
} as const,
|
|
112
|
+
enableRuntimeIdCompressor: {
|
|
113
|
+
// For IdCompressorMode, `undefined` represents a logical state (off).
|
|
114
|
+
// However, to satisfy the Required<> constraint while
|
|
115
|
+
// `exactOptionalPropertyTypes` is `false` (TODO: AB#8215), we need
|
|
116
|
+
// to have it defined, so we trick the type checker here.
|
|
117
|
+
"1.0.0": undefined,
|
|
118
|
+
// We do not yet want to enable idCompressor by default since it will
|
|
119
|
+
// increase bundle sizes, and not all customers will benefit from it.
|
|
120
|
+
// Therefore, we will require customers to explicitly enable it. We
|
|
121
|
+
// are keeping it as a DocSchema affecting option for now as this may
|
|
122
|
+
// change in the future.
|
|
123
|
+
} as const,
|
|
124
|
+
explicitSchemaControl: {
|
|
125
|
+
"1.0.0": false,
|
|
126
|
+
// This option's intention is to prevent 1.x clients from joining sessions
|
|
127
|
+
// when enabled. This is set to true when the compatibility version is set
|
|
128
|
+
// to >=2.0.0 (explicitly). This is different than other 2.0 defaults
|
|
129
|
+
// because it was not enabled by default prior to the implementation of
|
|
130
|
+
// `compatibilityVersion`.
|
|
131
|
+
// `defaultCompatibilityVersion` is set to "2.0.0-defaults" which "2.0.0"
|
|
132
|
+
// does not satisfy to avoiding enabling this option by default as of
|
|
133
|
+
// `compatibilityVersion` introduction, which could be unexpected.
|
|
134
|
+
// Only enable as a default when `compatibilityVersion` is specified at
|
|
135
|
+
// 2.0.0+.
|
|
136
|
+
"2.0.0": true,
|
|
137
|
+
} as const,
|
|
138
|
+
flushMode: {
|
|
139
|
+
// Note: 1.x clients are compatible with TurnBased flushing, but here we elect to remain on Immediate flush mode
|
|
140
|
+
// as a work-around for inability to send batches larger than 1Mb. Immediate flushing keeps batches smaller as
|
|
141
|
+
// fewer messages will be included per flush.
|
|
142
|
+
"1.0.0": FlushMode.Immediate,
|
|
143
|
+
"2.0.0-defaults": FlushMode.TurnBased,
|
|
144
|
+
} as const,
|
|
145
|
+
gcOptions: {
|
|
146
|
+
"1.0.0": {},
|
|
147
|
+
// Although sweep is supported in 2.x, it is disabled by default until compatibilityVersion>=3.0.0 to be extra safe.
|
|
148
|
+
"3.0.0": { enableGCSweep: true },
|
|
149
|
+
} as const,
|
|
150
|
+
createBlobPayloadPending: {
|
|
151
|
+
// This feature is new and disabled by default. In the future we will enable it by default, but we have not
|
|
152
|
+
// closed on the version where that will happen yet. Probably a .10 release since blob functionality is not
|
|
153
|
+
// exposed on the `@public` API surface.
|
|
154
|
+
"1.0.0": undefined,
|
|
155
|
+
} as const,
|
|
156
|
+
} as const satisfies ConfigMap<RuntimeOptionsAffectingDocSchema>;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Returns the default RuntimeOptionsAffectingDocSchema configuration for a given compatibility version.
|
|
160
|
+
*/
|
|
161
|
+
export function getCompatibilityVersionDefaults(
|
|
162
|
+
compatibilityVersion: SemanticVersion,
|
|
163
|
+
): RuntimeOptionsAffectingDocSchema {
|
|
164
|
+
return getConfigsForCompatMode(
|
|
165
|
+
compatibilityVersion,
|
|
166
|
+
runtimeOptionsAffectingDocSchemaConfigMap,
|
|
167
|
+
// This is a bad cast away from Partial that getConfigsForCompatMode provides.
|
|
168
|
+
// ConfigMap should be restructured to provide RuntimeOptionsAffectingDocSchema guarantee.
|
|
169
|
+
) as RuntimeOptionsAffectingDocSchema;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Returns a default configuration given compatibility version and configuration version map.
|
|
174
|
+
*/
|
|
175
|
+
export function getConfigsForCompatMode<T extends Record<SemanticVersion, unknown>>(
|
|
176
|
+
compatibilityVersion: SemanticVersion,
|
|
177
|
+
configMap: ConfigMap<T>,
|
|
178
|
+
): Partial<T> {
|
|
179
|
+
const defaultConfigs: Partial<T> = {};
|
|
180
|
+
// Iterate over configMap to get default values for each option.
|
|
181
|
+
for (const key of Object.keys(configMap)) {
|
|
182
|
+
const config = configMap[key as keyof T];
|
|
183
|
+
// Sort the versions in ascending order so we can short circuit the loop.
|
|
184
|
+
const versions = Object.keys(config).sort((a, b) => (semverGte(b, a) ? -1 : 1));
|
|
185
|
+
// For each config, we iterate over the keys and check if compatibilityVersion is greater than or equal to the version.
|
|
186
|
+
// If so, we set it as the default value for the option. At the end of the loop we should have the most recent default
|
|
187
|
+
// value that is compatible with the version specified as the compatibilityVersion.
|
|
188
|
+
for (const version of versions) {
|
|
189
|
+
if (semverGte(compatibilityVersion, version)) {
|
|
190
|
+
defaultConfigs[key] = config[version as MinimumMinorSemanticVersion];
|
|
191
|
+
} else {
|
|
192
|
+
// If the compatibility mode is less than the version, we break out of the loop since we don't need to check
|
|
193
|
+
// any later versions.
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return defaultConfigs;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Checks if the compatibility version is valid.
|
|
203
|
+
* A valid compatibility version is a string that is a valid semver version and is less than or equal to the current package version.
|
|
204
|
+
*/
|
|
205
|
+
export function isValidCompatVersion(compatibilityVersion: SemanticVersion): boolean {
|
|
206
|
+
return (
|
|
207
|
+
compatibilityVersion !== undefined &&
|
|
208
|
+
semverValid(compatibilityVersion) !== null &&
|
|
209
|
+
semverLte(compatibilityVersion, pkgVersion)
|
|
210
|
+
);
|
|
211
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Available compression algorithms for op compression.
|
|
8
|
+
* @legacy
|
|
9
|
+
* @alpha
|
|
10
|
+
*/
|
|
11
|
+
export enum CompressionAlgorithms {
|
|
12
|
+
lz4 = "lz4",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Options for op compression.
|
|
17
|
+
* @legacy
|
|
18
|
+
* @alpha
|
|
19
|
+
*/
|
|
20
|
+
export interface ICompressionRuntimeOptions {
|
|
21
|
+
/**
|
|
22
|
+
* The value the batch's content size must exceed for the batch to be compressed.
|
|
23
|
+
* By default the value is 600 * 1024 = 614400 bytes. If the value is set to `Infinity`, compression will be disabled.
|
|
24
|
+
*/
|
|
25
|
+
readonly minimumBatchSizeInBytes: number;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The compression algorithm that will be used to compress the op.
|
|
29
|
+
* By default the value is `lz4` which is the only compression algorithm currently supported.
|
|
30
|
+
*/
|
|
31
|
+
readonly compressionAlgorithm: CompressionAlgorithms;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @legacy
|
|
36
|
+
* @alpha
|
|
37
|
+
*/
|
|
38
|
+
export const disabledCompressionConfig: ICompressionRuntimeOptions = {
|
|
39
|
+
minimumBatchSizeInBytes: Number.POSITIVE_INFINITY,
|
|
40
|
+
compressionAlgorithm: CompressionAlgorithms.lz4,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const enabledCompressionConfig = {
|
|
44
|
+
// Batches with content size exceeding this value will be compressed
|
|
45
|
+
minimumBatchSizeInBytes: 614400,
|
|
46
|
+
compressionAlgorithm: CompressionAlgorithms.lz4,
|
|
47
|
+
} as const satisfies ICompressionRuntimeOptions;
|