@fluidframework/id-compressor 2.0.0-rc.1.0.6 → 2.0.0-rc.2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{.eslintrc.js → .eslintrc.cjs} +5 -5
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +8 -0
- package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
- package/api-extractor-lint.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/id-compressor.api.md +5 -42
- package/dist/finalSpace.d.ts +2 -2
- package/dist/finalSpace.d.ts.map +1 -1
- package/dist/finalSpace.js +4 -4
- package/dist/finalSpace.js.map +1 -1
- package/dist/id-compressor-alpha.d.ts +117 -112
- package/dist/id-compressor-beta.d.ts +84 -77
- package/dist/id-compressor-public.d.ts +84 -77
- package/dist/id-compressor-untrimmed.d.ts +117 -112
- package/dist/idCompressor.d.ts +15 -19
- package/dist/idCompressor.d.ts.map +1 -1
- package/dist/idCompressor.js +107 -94
- package/dist/idCompressor.js.map +1 -1
- package/dist/identifiers.d.ts +1 -1
- package/dist/identifiers.d.ts.map +1 -1
- package/dist/identifiers.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -10
- package/dist/index.js.map +1 -1
- package/dist/package.json +3 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/persistanceUtilities.d.ts +1 -1
- package/dist/persistanceUtilities.d.ts.map +1 -1
- package/dist/persistanceUtilities.js.map +1 -1
- package/dist/sessionSpaceNormalizer.d.ts +2 -2
- package/dist/sessionSpaceNormalizer.d.ts.map +1 -1
- package/dist/sessionSpaceNormalizer.js +4 -4
- package/dist/sessionSpaceNormalizer.js.map +1 -1
- package/dist/sessions.d.ts +2 -2
- package/dist/sessions.d.ts.map +1 -1
- package/dist/sessions.js +12 -12
- package/dist/sessions.js.map +1 -1
- package/dist/test/appendOnlySortedMap.perf.spec.d.ts +6 -0
- package/dist/test/appendOnlySortedMap.perf.spec.d.ts.map +1 -0
- package/dist/test/appendOnlySortedMap.perf.spec.js.map +1 -0
- package/dist/test/appendOnlySortedMap.spec.d.ts +6 -0
- package/dist/test/appendOnlySortedMap.spec.d.ts.map +1 -0
- package/dist/test/appendOnlySortedMap.spec.js.map +1 -0
- package/dist/test/idCompressor.perf.spec.d.ts +6 -0
- package/dist/test/idCompressor.perf.spec.d.ts.map +1 -0
- package/dist/test/idCompressor.perf.spec.js.map +1 -0
- package/dist/test/idCompressor.spec.d.ts +6 -0
- package/dist/test/idCompressor.spec.d.ts.map +1 -0
- package/dist/test/idCompressor.spec.js.map +1 -0
- package/dist/test/idCompressorTestUtilities.d.ts +245 -0
- package/dist/test/idCompressorTestUtilities.d.ts.map +1 -0
- package/dist/test/idCompressorTestUtilities.js +589 -0
- package/dist/test/idCompressorTestUtilities.js.map +1 -0
- package/dist/test/index.d.ts +9 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +13 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/numericUuid.spec.d.ts +6 -0
- package/dist/test/numericUuid.spec.d.ts.map +1 -0
- package/dist/test/numericUuid.spec.js.map +1 -0
- package/dist/test/sessionSpaceNormalizer.spec.d.ts +6 -0
- package/dist/test/sessionSpaceNormalizer.spec.d.ts.map +1 -0
- package/dist/test/sessionSpaceNormalizer.spec.js.map +1 -0
- package/dist/test/snapshots/dirname.cjs +16 -0
- package/dist/test/snapshots/dirname.cjs.map +1 -0
- package/dist/test/snapshots/dirname.d.cts +6 -0
- package/dist/test/snapshots/dirname.d.cts.map +1 -0
- package/{lib/types/idCompressor.mjs → dist/test/snapshots/summary.spec.d.ts} +1 -1
- package/dist/test/snapshots/summary.spec.d.ts.map +1 -0
- package/dist/test/snapshots/summary.spec.js.map +1 -0
- package/dist/test/testCommon.d.ts +90 -0
- package/dist/test/testCommon.d.ts.map +1 -0
- package/dist/test/testCommon.js +90 -0
- package/dist/test/testCommon.js.map +1 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/types/idCompressor.d.ts +134 -67
- package/dist/types/idCompressor.d.ts.map +1 -1
- package/dist/types/idCompressor.js.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/persisted-types/0.0.1.d.ts +1 -1
- package/dist/types/persisted-types/0.0.1.d.ts.map +1 -1
- package/dist/types/persisted-types/0.0.1.js.map +1 -1
- package/dist/types/persisted-types/index.d.ts +1 -1
- package/dist/types/persisted-types/index.d.ts.map +1 -1
- package/dist/types/persisted-types/index.js.map +1 -1
- package/dist/utilities.d.ts +2 -2
- package/dist/utilities.d.ts.map +1 -1
- package/dist/utilities.js.map +1 -1
- package/lib/{appendOnlySortedMap.d.mts → appendOnlySortedMap.d.ts} +1 -1
- package/lib/appendOnlySortedMap.d.ts.map +1 -0
- package/lib/{appendOnlySortedMap.mjs → appendOnlySortedMap.js} +3 -1
- package/lib/appendOnlySortedMap.js.map +1 -0
- package/lib/{finalSpace.d.mts → finalSpace.d.ts} +3 -3
- package/lib/finalSpace.d.ts.map +1 -0
- package/lib/{finalSpace.mjs → finalSpace.js} +2 -2
- package/lib/finalSpace.js.map +1 -0
- package/lib/{id-compressor-alpha.d.mts → id-compressor-alpha.d.ts} +117 -112
- package/lib/id-compressor-beta.d.ts +179 -0
- package/lib/id-compressor-public.d.ts +179 -0
- package/lib/{id-compressor-untrimmed.d.mts → id-compressor-untrimmed.d.ts} +117 -112
- package/lib/{idCompressor.d.mts → idCompressor.d.ts} +16 -20
- package/lib/idCompressor.d.ts.map +1 -0
- package/lib/{idCompressor.mjs → idCompressor.js} +54 -41
- package/lib/idCompressor.js.map +1 -0
- package/lib/{identifiers.d.mts → identifiers.d.ts} +2 -2
- package/lib/identifiers.d.ts.map +1 -0
- package/lib/{identifiers.mjs → identifiers.js} +1 -1
- package/lib/identifiers.js.map +1 -0
- package/lib/{index.d.mts → index.d.ts} +7 -4
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -0
- package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
- package/lib/packageVersion.js.map +1 -0
- package/lib/{persistanceUtilities.d.mts → persistanceUtilities.d.ts} +2 -2
- package/lib/persistanceUtilities.d.ts.map +1 -0
- package/lib/{persistanceUtilities.mjs → persistanceUtilities.js} +1 -1
- package/lib/persistanceUtilities.js.map +1 -0
- package/lib/{sessionSpaceNormalizer.d.mts → sessionSpaceNormalizer.d.ts} +3 -3
- package/lib/sessionSpaceNormalizer.d.ts.map +1 -0
- package/lib/{sessionSpaceNormalizer.mjs → sessionSpaceNormalizer.js} +3 -3
- package/lib/sessionSpaceNormalizer.js.map +1 -0
- package/lib/{sessions.d.mts → sessions.d.ts} +3 -3
- package/lib/sessions.d.ts.map +1 -0
- package/lib/{sessions.mjs → sessions.js} +2 -2
- package/lib/sessions.js.map +1 -0
- package/lib/test/appendOnlySortedMap.perf.spec.d.ts +6 -0
- package/lib/test/appendOnlySortedMap.perf.spec.d.ts.map +1 -0
- package/lib/test/appendOnlySortedMap.perf.spec.js +49 -0
- package/lib/test/appendOnlySortedMap.perf.spec.js.map +1 -0
- package/lib/test/appendOnlySortedMap.spec.d.ts +6 -0
- package/lib/test/appendOnlySortedMap.spec.d.ts.map +1 -0
- package/lib/test/appendOnlySortedMap.spec.js +166 -0
- package/lib/test/appendOnlySortedMap.spec.js.map +1 -0
- package/lib/test/idCompressor.perf.spec.d.ts +6 -0
- package/lib/test/idCompressor.perf.spec.d.ts.map +1 -0
- package/lib/test/idCompressor.perf.spec.js +281 -0
- package/lib/test/idCompressor.perf.spec.js.map +1 -0
- package/lib/test/idCompressor.spec.d.ts +6 -0
- package/lib/test/idCompressor.spec.d.ts.map +1 -0
- package/lib/test/idCompressor.spec.js +953 -0
- package/lib/test/idCompressor.spec.js.map +1 -0
- package/lib/test/idCompressorTestUtilities.d.ts +245 -0
- package/lib/test/idCompressorTestUtilities.d.ts.map +1 -0
- package/lib/test/idCompressorTestUtilities.js +576 -0
- package/lib/test/idCompressorTestUtilities.js.map +1 -0
- package/lib/test/index.d.ts +9 -0
- package/lib/test/index.d.ts.map +1 -0
- package/lib/test/index.js +9 -0
- package/lib/test/index.js.map +1 -0
- package/lib/test/numericUuid.spec.d.ts +6 -0
- package/lib/test/numericUuid.spec.d.ts.map +1 -0
- package/lib/test/numericUuid.spec.js +74 -0
- package/lib/test/numericUuid.spec.js.map +1 -0
- package/lib/test/sessionSpaceNormalizer.spec.d.ts +6 -0
- package/lib/test/sessionSpaceNormalizer.spec.d.ts.map +1 -0
- package/lib/test/sessionSpaceNormalizer.spec.js +43 -0
- package/lib/test/sessionSpaceNormalizer.spec.js.map +1 -0
- package/lib/test/snapshots/dirname.cjs +16 -0
- package/lib/test/snapshots/dirname.cjs.map +1 -0
- package/lib/test/snapshots/dirname.d.cts +6 -0
- package/lib/test/snapshots/dirname.d.cts.map +1 -0
- package/lib/test/snapshots/summary.spec.d.ts +6 -0
- package/lib/test/snapshots/summary.spec.d.ts.map +1 -0
- package/lib/test/snapshots/summary.spec.js +127 -0
- package/lib/test/snapshots/summary.spec.js.map +1 -0
- package/lib/test/testCommon.d.ts +90 -0
- package/lib/test/testCommon.d.ts.map +1 -0
- package/lib/test/testCommon.js +80 -0
- package/lib/test/testCommon.js.map +1 -0
- package/lib/types/{idCompressor.d.mts → idCompressor.d.ts} +135 -68
- package/lib/types/idCompressor.d.ts.map +1 -0
- package/lib/types/{identifiers.mjs → idCompressor.js} +1 -1
- package/lib/types/idCompressor.js.map +1 -0
- package/lib/types/{identifiers.d.mts → identifiers.d.ts} +1 -1
- package/lib/types/identifiers.d.ts.map +1 -0
- package/lib/types/identifiers.js +6 -0
- package/lib/types/identifiers.js.map +1 -0
- package/lib/types/{index.d.mts → index.d.ts} +4 -4
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/{persisted-types/0.0.1.mjs → index.js} +1 -1
- package/lib/types/index.js.map +1 -0
- package/lib/types/persisted-types/{0.0.1.d.mts → 0.0.1.d.ts} +2 -2
- package/lib/types/persisted-types/0.0.1.d.ts.map +1 -0
- package/lib/types/persisted-types/{index.mjs → 0.0.1.js} +1 -1
- package/lib/types/persisted-types/0.0.1.js.map +1 -0
- package/lib/types/persisted-types/{index.d.mts → index.d.ts} +2 -2
- package/lib/types/persisted-types/index.d.ts.map +1 -0
- package/lib/types/{index.mjs → persisted-types/index.js} +1 -1
- package/lib/types/persisted-types/index.js.map +1 -0
- package/lib/{utilities.d.mts → utilities.d.ts} +3 -3
- package/lib/utilities.d.ts.map +1 -0
- package/lib/{utilities.mjs → utilities.js} +2 -1
- package/lib/utilities.js.map +1 -0
- package/package.json +87 -21
- package/src/finalSpace.ts +2 -2
- package/src/idCompressor.ts +75 -59
- package/src/identifiers.ts +1 -1
- package/src/index.ts +3 -3
- package/src/packageVersion.ts +1 -1
- package/src/persistanceUtilities.ts +1 -1
- package/src/sessionSpaceNormalizer.ts +3 -3
- package/src/sessions.ts +3 -3
- package/src/test/idCompressorTestUtilities.ts +921 -0
- package/src/test/index.ts +10 -0
- package/src/test/snapshots/dirname.cts +13 -0
- package/src/test/snapshots/files/compressor-with-finalized-range-from-one-client +1 -0
- package/src/test/snapshots/files/compressor-with-finalized-range-from-one-client-client2 +1 -0
- package/src/test/snapshots/files/compressors-with-finalized-ranges-from-two-clients +1 -0
- package/src/test/snapshots/files/compressors-with-finalized-ranges-from-two-clients-client2 +1 -0
- package/src/test/snapshots/files/empty-compressor-summary +1 -0
- package/src/test/snapshots/files/expansion-semantics +1 -0
- package/src/test/snapshots/files/expansion-semantics-client2 +1 -0
- package/src/test/testCommon.ts +143 -0
- package/src/test/tsconfig.cjs.json +12 -0
- package/src/test/tsconfig.json +20 -0
- package/src/types/idCompressor.ts +147 -72
- package/src/types/index.ts +8 -3
- package/src/types/persisted-types/0.0.1.ts +1 -1
- package/src/types/persisted-types/index.ts +1 -1
- package/src/utilities.ts +2 -2
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- package/lib/appendOnlySortedMap.d.mts.map +0 -1
- package/lib/appendOnlySortedMap.mjs.map +0 -1
- package/lib/finalSpace.d.mts.map +0 -1
- package/lib/finalSpace.mjs.map +0 -1
- package/lib/id-compressor-beta.d.mts +0 -172
- package/lib/id-compressor-public.d.mts +0 -172
- package/lib/idCompressor.d.mts.map +0 -1
- package/lib/idCompressor.mjs.map +0 -1
- package/lib/identifiers.d.mts.map +0 -1
- package/lib/identifiers.mjs.map +0 -1
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs +0 -7
- package/lib/index.mjs.map +0 -1
- package/lib/packageVersion.d.mts.map +0 -1
- package/lib/packageVersion.mjs.map +0 -1
- package/lib/persistanceUtilities.d.mts.map +0 -1
- package/lib/persistanceUtilities.mjs.map +0 -1
- package/lib/sessionSpaceNormalizer.d.mts.map +0 -1
- package/lib/sessionSpaceNormalizer.mjs.map +0 -1
- package/lib/sessions.d.mts.map +0 -1
- package/lib/sessions.mjs.map +0 -1
- package/lib/types/idCompressor.d.mts.map +0 -1
- package/lib/types/idCompressor.mjs.map +0 -1
- package/lib/types/identifiers.d.mts.map +0 -1
- package/lib/types/identifiers.mjs.map +0 -1
- package/lib/types/index.d.mts.map +0 -1
- package/lib/types/index.mjs.map +0 -1
- package/lib/types/persisted-types/0.0.1.d.mts.map +0 -1
- package/lib/types/persisted-types/0.0.1.mjs.map +0 -1
- package/lib/types/persisted-types/index.d.mts.map +0 -1
- package/lib/types/persisted-types/index.mjs.map +0 -1
- package/lib/utilities.d.mts.map +0 -1
- package/lib/utilities.mjs.map +0 -1
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
|
-
extends: [
|
|
7
|
+
extends: [
|
|
8
|
+
require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"),
|
|
9
|
+
"prettier",
|
|
10
|
+
],
|
|
8
11
|
parserOptions: {
|
|
9
12
|
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
10
13
|
},
|
|
11
14
|
rules: {
|
|
12
15
|
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
13
|
-
|
|
14
|
-
// This library is used in the browser, so we don't want dependencies on most node libraries.
|
|
15
|
-
"import/no-nodejs-modules": ["error", { allow: ["events"] }],
|
|
16
16
|
},
|
|
17
17
|
overrides: [
|
|
18
18
|
{
|
|
@@ -20,7 +20,7 @@ module.exports = {
|
|
|
20
20
|
files: ["*.spec.ts", "src/test/**"],
|
|
21
21
|
rules: {
|
|
22
22
|
// Test files are run in node only so additional node libraries can be used.
|
|
23
|
-
"import/no-nodejs-modules": ["error", { allow: ["assert", "crypto"
|
|
23
|
+
"import/no-nodejs-modules": ["error", { allow: ["assert", "crypto"] }],
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
],
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const getFluidTestMochaConfig = require("@
|
|
8
|
+
const getFluidTestMochaConfig = require("@fluid-internal/mocha-test-setup/mocharc-common");
|
|
9
9
|
|
|
10
10
|
const packageDir = __dirname;
|
|
11
11
|
const config = getFluidTestMochaConfig(packageDir);
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @fluidframework/id-compressor
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.2.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- id-compressor: Deprecated ID compressor class has been removed from the public API. ([#19054](https://github.com/microsoft/FluidFramework/issues/19054)) [46a05617b2](https://github.com/microsoft/FluidFramework/commits/46a05617b2a42bf2763e49e4ccddd3ee8df9c05d)
|
|
8
|
+
|
|
9
|
+
This change should be a no-op for consumers, as there were already better static creation/deserialization functions for use and compressor types are generally unused outside the runtime.
|
|
10
|
+
|
|
3
11
|
## 2.0.0-rc.1.0.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../common/build/build-common/api-extractor-base
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-base.cjs.primary.json",
|
|
4
|
+
// CJS is actually secondary; so, no report.
|
|
5
|
+
"apiReport": {
|
|
6
|
+
"enabled": false
|
|
7
|
+
}
|
|
4
8
|
}
|
package/api-extractor-lint.json
CHANGED
package/api-extractor.json
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
7
|
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
8
|
+
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
8
9
|
|
|
9
10
|
// @internal
|
|
10
11
|
export function assertIsStableId(stableId: string): StableId;
|
|
@@ -19,52 +20,14 @@ export function createIdCompressor(sessionId: SessionId, logger?: ITelemetryBase
|
|
|
19
20
|
export function createSessionId(): SessionId;
|
|
20
21
|
|
|
21
22
|
// @alpha
|
|
22
|
-
export function deserializeIdCompressor(serialized: SerializedIdCompressorWithOngoingSession): IIdCompressor & IIdCompressorCore;
|
|
23
|
+
export function deserializeIdCompressor(serialized: SerializedIdCompressorWithOngoingSession, logger?: ITelemetryLoggerExt): IIdCompressor & IIdCompressorCore;
|
|
23
24
|
|
|
24
25
|
// @alpha
|
|
25
|
-
export function deserializeIdCompressor(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId): IIdCompressor & IIdCompressorCore;
|
|
26
|
+
export function deserializeIdCompressor(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId, logger?: ITelemetryLoggerExt): IIdCompressor & IIdCompressorCore;
|
|
26
27
|
|
|
27
28
|
// @internal
|
|
28
29
|
export function generateStableId(): StableId;
|
|
29
30
|
|
|
30
|
-
// @alpha @deprecated
|
|
31
|
-
export class IdCompressor implements IIdCompressor, IIdCompressorCore {
|
|
32
|
-
beginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void;
|
|
33
|
-
// @deprecated (undocumented)
|
|
34
|
-
static create(logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore;
|
|
35
|
-
// @deprecated (undocumented)
|
|
36
|
-
static create(sessionId: SessionId, logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore;
|
|
37
|
-
// (undocumented)
|
|
38
|
-
decompress(id: SessionSpaceCompressedId): StableId;
|
|
39
|
-
// (undocumented)
|
|
40
|
-
static deserialize(serialized: SerializedIdCompressorWithOngoingSession): IdCompressor;
|
|
41
|
-
// (undocumented)
|
|
42
|
-
static deserialize(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId): IdCompressor;
|
|
43
|
-
// (undocumented)
|
|
44
|
-
equals(other: IdCompressor, includeLocalState: boolean): boolean;
|
|
45
|
-
// (undocumented)
|
|
46
|
-
finalizeCreationRange(range: IdCreationRange): void;
|
|
47
|
-
// (undocumented)
|
|
48
|
-
generateCompressedId(): SessionSpaceCompressedId;
|
|
49
|
-
// (undocumented)
|
|
50
|
-
readonly localSessionId: SessionId;
|
|
51
|
-
static readonly maxClusterSize: number;
|
|
52
|
-
// (undocumented)
|
|
53
|
-
normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;
|
|
54
|
-
// (undocumented)
|
|
55
|
-
normalizeToSessionSpace(id: OpSpaceCompressedId, originSessionId: SessionId): SessionSpaceCompressedId;
|
|
56
|
-
// (undocumented)
|
|
57
|
-
recompress(uncompressed: StableId): SessionSpaceCompressedId;
|
|
58
|
-
// (undocumented)
|
|
59
|
-
serialize(withSession: true): SerializedIdCompressorWithOngoingSession;
|
|
60
|
-
// (undocumented)
|
|
61
|
-
serialize(withSession: false): SerializedIdCompressorWithNoSession;
|
|
62
|
-
// (undocumented)
|
|
63
|
-
takeNextCreationRange(): IdCreationRange;
|
|
64
|
-
// (undocumented)
|
|
65
|
-
tryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
31
|
// @alpha
|
|
69
32
|
export interface IdCreationRange {
|
|
70
33
|
// (undocumented)
|
|
@@ -81,7 +44,7 @@ export interface IdCreationRange {
|
|
|
81
44
|
export interface IIdCompressor {
|
|
82
45
|
decompress(id: SessionSpaceCompressedId): StableId;
|
|
83
46
|
generateCompressedId(): SessionSpaceCompressedId;
|
|
84
|
-
|
|
47
|
+
generateDocumentUniqueId(): (SessionSpaceCompressedId & OpSpaceCompressedId) | StableId;
|
|
85
48
|
localSessionId: SessionId;
|
|
86
49
|
normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;
|
|
87
50
|
normalizeToSessionSpace(id: OpSpaceCompressedId, originSessionId: SessionId): SessionSpaceCompressedId;
|
|
@@ -89,7 +52,7 @@ export interface IIdCompressor {
|
|
|
89
52
|
tryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;
|
|
90
53
|
}
|
|
91
54
|
|
|
92
|
-
// @alpha
|
|
55
|
+
// @alpha
|
|
93
56
|
export interface IIdCompressorCore {
|
|
94
57
|
beginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): any;
|
|
95
58
|
finalizeCreationRange(range: IdCreationRange): void;
|
package/dist/finalSpace.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IdCluster } from "./sessions";
|
|
6
|
-
import { FinalCompressedId } from "./identifiers";
|
|
5
|
+
import { IdCluster } from "./sessions.js";
|
|
6
|
+
import { FinalCompressedId } from "./identifiers.js";
|
|
7
7
|
/**
|
|
8
8
|
* All IDs that have been finalized (acked), grouped into clusters sorted by their base final IDs.
|
|
9
9
|
* These clusters span the positive integer space and are not sparse, meaning a cluster's base final
|
package/dist/finalSpace.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finalSpace.d.ts","sourceRoot":"","sources":["../src/finalSpace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAyD,MAAM,
|
|
1
|
+
{"version":3,"file":"finalSpace.d.ts","sourceRoot":"","sources":["../src/finalSpace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAyD,MAAM,eAAe,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;GAIG;AACH,qBAAa,UAAU;IACtB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;IAE/C,IAAW,QAAQ,IAAI,SAAS,SAAS,EAAE,CAE1C;IAEM,cAAc,IAAI,SAAS,GAAG,SAAS;IAIvC,UAAU,CAAC,UAAU,EAAE,SAAS;IAWvC;;;OAGG;IACI,mBAAmB,IAAI,iBAAiB;IAO/C;;;OAGG;IACI,mBAAmB,IAAI,iBAAiB;IAOxC,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO;CAQzC"}
|
package/dist/finalSpace.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.FinalSpace = void 0;
|
|
8
8
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
9
|
-
const
|
|
9
|
+
const sessions_js_1 = require("./sessions.js");
|
|
10
10
|
/**
|
|
11
11
|
* All IDs that have been finalized (acked), grouped into clusters sorted by their base final IDs.
|
|
12
12
|
* These clusters span the positive integer space and are not sparse, meaning a cluster's base final
|
|
@@ -37,7 +37,7 @@ class FinalSpace {
|
|
|
37
37
|
const lastCluster = this.getLastCluster();
|
|
38
38
|
return lastCluster === undefined
|
|
39
39
|
? 0
|
|
40
|
-
: ((0,
|
|
40
|
+
: ((0, sessions_js_1.lastFinalizedFinal)(lastCluster) + 1);
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* @returns the upper bound (exclusive) of allocated IDs in final space, i.e. one greater than the last final ID in the last cluster.
|
|
@@ -47,11 +47,11 @@ class FinalSpace {
|
|
|
47
47
|
const lastCluster = this.getLastCluster();
|
|
48
48
|
return lastCluster === undefined
|
|
49
49
|
? 0
|
|
50
|
-
: ((0,
|
|
50
|
+
: ((0, sessions_js_1.lastAllocatedFinal)(lastCluster) + 1);
|
|
51
51
|
}
|
|
52
52
|
equals(other) {
|
|
53
53
|
for (let i = 0; i < this.clusterList.length; i++) {
|
|
54
|
-
if (!(0,
|
|
54
|
+
if (!(0, sessions_js_1.clustersEqual)(this.clusterList[i], other.clusterList[i])) {
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
57
57
|
}
|
package/dist/finalSpace.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finalSpace.js","sourceRoot":"","sources":["../src/finalSpace.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AACpD
|
|
1
|
+
{"version":3,"file":"finalSpace.js","sourceRoot":"","sources":["../src/finalSpace.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AACpD,+CAAiG;AAGjG;;;;GAIG;AACH,MAAa,UAAU;IAAvB;QACkB,gBAAW,GAAgB,EAAE,CAAC;IAmDhD,CAAC;IAjDA,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAEM,cAAc;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IAEM,UAAU,CAAC,UAAqB;QACtC,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC1C,IAAA,mBAAM,EACL,WAAW,KAAK,SAAS;YACxB,qEAAqE;YACrE,UAAU,CAAC,WAAW,KAAK,WAAW,CAAC,WAAW,GAAG,WAAW,CAAC,QAAQ,EAC1E,KAAK,CAAC,oDAAoD,CAC1D,CAAC;QACF,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;IAED;;;OAGG;IACI,mBAAmB;QACzB,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC1C,OAAO,WAAW,KAAK,SAAS;YAC/B,CAAC,CAAE,CAAuB;YAC1B,CAAC,CAAE,CAAE,IAAA,gCAAkB,EAAC,WAAW,CAAY,GAAG,CAAC,CAAuB,CAAC;IAC7E,CAAC;IAED;;;OAGG;IACI,mBAAmB;QACzB,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC1C,OAAO,WAAW,KAAK,SAAS;YAC/B,CAAC,CAAE,CAAuB;YAC1B,CAAC,CAAE,CAAE,IAAA,gCAAkB,EAAC,WAAW,CAAY,GAAG,CAAC,CAAuB,CAAC;IAC7E,CAAC;IAEM,MAAM,CAAC,KAAiB;QAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACjD,IAAI,CAAC,IAAA,2BAAa,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC9D,OAAO,KAAK,CAAC;aACb;SACD;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC;IAC7D,CAAC;CACD;AApDD,gCAoDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IdCluster, clustersEqual, lastAllocatedFinal, lastFinalizedFinal } from \"./sessions.js\";\nimport { FinalCompressedId } from \"./identifiers.js\";\n\n/**\n * All IDs that have been finalized (acked), grouped into clusters sorted by their base final IDs.\n * These clusters span the positive integer space and are not sparse, meaning a cluster's base final\n * ID will always be one greater than the last final ID in the previous cluster (or 0 if there is not one).\n */\nexport class FinalSpace {\n\tprivate readonly clusterList: IdCluster[] = [];\n\n\tpublic get clusters(): readonly IdCluster[] {\n\t\treturn this.clusterList;\n\t}\n\n\tpublic getLastCluster(): IdCluster | undefined {\n\t\treturn this.clusterList[this.clusterList.length - 1];\n\t}\n\n\tpublic addCluster(newCluster: IdCluster) {\n\t\tconst lastCluster = this.getLastCluster();\n\t\tassert(\n\t\t\tlastCluster === undefined ||\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n\t\t\t\tnewCluster.baseFinalId === lastCluster.baseFinalId + lastCluster.capacity,\n\t\t\t0x753 /* Cluster insert to final_space is out of order. */,\n\t\t);\n\t\tthis.clusterList.push(newCluster);\n\t}\n\n\t/**\n\t * @returns the upper bound (exclusive) of finalized IDs in final space, i.e. one greater than the last final ID in the last cluster.\n\t * Note: this does not include allocated but unfinalized space in clusters.\n\t */\n\tpublic getFinalizedIdLimit(): FinalCompressedId {\n\t\tconst lastCluster = this.getLastCluster();\n\t\treturn lastCluster === undefined\n\t\t\t? (0 as FinalCompressedId)\n\t\t\t: (((lastFinalizedFinal(lastCluster) as number) + 1) as FinalCompressedId);\n\t}\n\n\t/**\n\t * @returns the upper bound (exclusive) of allocated IDs in final space, i.e. one greater than the last final ID in the last cluster.\n\t * Note: this does includes all allocated IDs in clusters.\n\t */\n\tpublic getAllocatedIdLimit(): FinalCompressedId {\n\t\tconst lastCluster = this.getLastCluster();\n\t\treturn lastCluster === undefined\n\t\t\t? (0 as FinalCompressedId)\n\t\t\t: (((lastAllocatedFinal(lastCluster) as number) + 1) as FinalCompressedId);\n\t}\n\n\tpublic equals(other: FinalSpace): boolean {\n\t\tfor (let i = 0; i < this.clusterList.length; i++) {\n\t\t\tif (!clustersEqual(this.clusterList[i], other.clusterList[i])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn this.clusterList.length === other.clusterList.length;\n\t}\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
2
3
|
|
|
3
4
|
/* Excluded from this release type: assertIsStableId */
|
|
4
5
|
|
|
@@ -25,79 +26,16 @@ export declare function createSessionId(): SessionId;
|
|
|
25
26
|
* Deserializes the supplied state into an ID compressor.
|
|
26
27
|
* @alpha
|
|
27
28
|
*/
|
|
28
|
-
export declare function deserializeIdCompressor(serialized: SerializedIdCompressorWithOngoingSession): IIdCompressor & IIdCompressorCore;
|
|
29
|
+
export declare function deserializeIdCompressor(serialized: SerializedIdCompressorWithOngoingSession, logger?: ITelemetryLoggerExt): IIdCompressor & IIdCompressorCore;
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Deserializes the supplied state into an ID compressor.
|
|
32
33
|
* @alpha
|
|
33
34
|
*/
|
|
34
|
-
export declare function deserializeIdCompressor(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId): IIdCompressor & IIdCompressorCore;
|
|
35
|
+
export declare function deserializeIdCompressor(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId, logger?: ITelemetryLoggerExt): IIdCompressor & IIdCompressorCore;
|
|
35
36
|
|
|
36
37
|
/* Excluded from this release type: generateStableId */
|
|
37
38
|
|
|
38
|
-
/**
|
|
39
|
-
* See {@link IIdCompressor} and {@link IIdCompressorCore}
|
|
40
|
-
*
|
|
41
|
-
* @alpha
|
|
42
|
-
*
|
|
43
|
-
* @deprecated Not intended for public use and will be removed from the public API in the future.
|
|
44
|
-
* Use `createIdCompressor` instead.
|
|
45
|
-
*/
|
|
46
|
-
export declare class IdCompressor implements IIdCompressor, IIdCompressorCore {
|
|
47
|
-
private readonly logger?;
|
|
48
|
-
/**
|
|
49
|
-
* Max allowed initial cluster size.
|
|
50
|
-
*/
|
|
51
|
-
static readonly maxClusterSize: number;
|
|
52
|
-
readonly localSessionId: SessionId;
|
|
53
|
-
private readonly localSession;
|
|
54
|
-
private readonly normalizer;
|
|
55
|
-
private localGenCount;
|
|
56
|
-
private nextRangeBaseGenCount;
|
|
57
|
-
private readonly sessions;
|
|
58
|
-
private readonly finalSpace;
|
|
59
|
-
/**
|
|
60
|
-
* Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.
|
|
61
|
-
* Eventually, this can be adjusted dynamically to have cluster reservation policies that
|
|
62
|
-
* optimize the number of eager finals.
|
|
63
|
-
* It is not readonly as it is accessed by tests for clear-box testing.
|
|
64
|
-
*/
|
|
65
|
-
private nextRequestedClusterSize;
|
|
66
|
-
private telemetryLocalIdCount;
|
|
67
|
-
private telemetryEagerFinalIdCount;
|
|
68
|
-
private ongoingGhostSession?;
|
|
69
|
-
private constructor();
|
|
70
|
-
/**
|
|
71
|
-
* @deprecated Use `createIdCompressor` instead.
|
|
72
|
-
*/
|
|
73
|
-
static create(logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore;
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated Use `createIdCompressor` instead.
|
|
76
|
-
*/
|
|
77
|
-
static create(sessionId: SessionId, logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore;
|
|
78
|
-
generateCompressedId(): SessionSpaceCompressedId;
|
|
79
|
-
/**
|
|
80
|
-
* {@inheritdoc IIdCompressorCore.beginGhostSession}
|
|
81
|
-
*/
|
|
82
|
-
beginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void;
|
|
83
|
-
private generateNextLocalId;
|
|
84
|
-
takeNextCreationRange(): IdCreationRange;
|
|
85
|
-
private static assertValidRange;
|
|
86
|
-
finalizeCreationRange(range: IdCreationRange): void;
|
|
87
|
-
private addEmptyCluster;
|
|
88
|
-
normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;
|
|
89
|
-
normalizeToSessionSpace(id: OpSpaceCompressedId, originSessionId: SessionId): SessionSpaceCompressedId;
|
|
90
|
-
decompress(id: SessionSpaceCompressedId): StableId;
|
|
91
|
-
recompress(uncompressed: StableId): SessionSpaceCompressedId;
|
|
92
|
-
tryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;
|
|
93
|
-
serialize(withSession: true): SerializedIdCompressorWithOngoingSession;
|
|
94
|
-
serialize(withSession: false): SerializedIdCompressorWithNoSession;
|
|
95
|
-
static deserialize(serialized: SerializedIdCompressorWithOngoingSession): IdCompressor;
|
|
96
|
-
static deserialize(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId): IdCompressor;
|
|
97
|
-
private static deserialize2_0;
|
|
98
|
-
equals(other: IdCompressor, includeLocalState: boolean): boolean;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
39
|
/**
|
|
102
40
|
* Data describing a range of session-local IDs (from a remote or local session).
|
|
103
41
|
*
|
|
@@ -124,6 +62,120 @@ export declare interface IdCreationRange {
|
|
|
124
62
|
};
|
|
125
63
|
}
|
|
126
64
|
|
|
65
|
+
/**
|
|
66
|
+
* A distributed UUID generator and compressor.
|
|
67
|
+
* `IdCompressor` offers the ability to generate arbitrary non-colliding v4 UUIDs, called stable IDs, while compressing them into small integers
|
|
68
|
+
* for efficient storage and transmission. It also provides the ability to decompress these integers back into their original UUIDs.
|
|
69
|
+
*
|
|
70
|
+
* The compressor is designed to be used in a distributed environment, where multiple clients may be generating IDs concurrently.
|
|
71
|
+
* IDs generated by a compressor, via calls to `generateCompressedId`, are created in the compressor's "local" session.
|
|
72
|
+
* These IDs are unique within the session, but may not be unique across sessions. In the context of Fluid, the scope of a session
|
|
73
|
+
* is the same as the scope of a container. This means that anytime IDs are transferred between sessions, they must be translated
|
|
74
|
+
* through a process called "normalization":
|
|
75
|
+
* - The scope of a local session (in which local IDs are unique) is called the "session space" of the client.
|
|
76
|
+
* - The context of persisted state (in Fluid, this is the context of ops and summaries) is called "op space".
|
|
77
|
+
* - `SessionSpaceCompressedId`s, generated via calls to `generateCompressedId`, should NEVER be serialized directly.
|
|
78
|
+
* In Fluid, this means they should not be included in ops or summaries.
|
|
79
|
+
* - Before serialization, IDs must be normalized to op space to ensure they are interpretable by other clients.
|
|
80
|
+
* - Upon receipt, IDs should be normalized back to session space before use.
|
|
81
|
+
*
|
|
82
|
+
* Example Usage:
|
|
83
|
+
*
|
|
84
|
+
* ### Client A (Sender)
|
|
85
|
+
*
|
|
86
|
+
* ```typescript
|
|
87
|
+
* // Generate several local IDs
|
|
88
|
+
* const localId1 = idCompressor.generateCompressedId();
|
|
89
|
+
* const localId2 = idCompressor.generateCompressedId();
|
|
90
|
+
* const localId3 = idCompressor.generateCompressedId();
|
|
91
|
+
*
|
|
92
|
+
* // Normalize these IDs to op space for inclusion in a message
|
|
93
|
+
* const opSpaceId1 = idCompressor.normalizeToOpSpace(localId1);
|
|
94
|
+
* const opSpaceId2 = idCompressor.normalizeToOpSpace(localId2);
|
|
95
|
+
* const opSpaceId3 = idCompressor.normalizeToOpSpace(localId3);
|
|
96
|
+
*
|
|
97
|
+
* // Create and send a message containing these op space IDs along with the sender's session ID
|
|
98
|
+
* // In Fluid, this would be an op or summary
|
|
99
|
+
* const message = {
|
|
100
|
+
* sessionID: idCompressor.localSessionId,
|
|
101
|
+
* ids: [opSpaceId1, opSpaceId2, opSpaceId3]
|
|
102
|
+
* };
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* ### Client B (Receiver)
|
|
106
|
+
*
|
|
107
|
+
* ```typescript
|
|
108
|
+
* // Receive the message from Client A
|
|
109
|
+
* const receivedMessage = ...; // In Fluid, this would be an op or summary
|
|
110
|
+
*
|
|
111
|
+
* // Normalize the received IDs back to session space, utilizing the sender's session ID
|
|
112
|
+
* const sessionSpaceId1 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[0], receivedMessage.sessionID);
|
|
113
|
+
* const sessionSpaceId2 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[1], receivedMessage.sessionID);
|
|
114
|
+
* const sessionSpaceId3 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[2], receivedMessage.sessionID);
|
|
115
|
+
* ```
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
118
|
+
export declare interface IIdCompressor {
|
|
119
|
+
/**
|
|
120
|
+
* The local session ID.
|
|
121
|
+
*/
|
|
122
|
+
localSessionId: SessionId;
|
|
123
|
+
/**
|
|
124
|
+
* Generates a new compressed ID.
|
|
125
|
+
* The returned ID is in session space and should not be serialized directly. See `IIdCompressor` for more details.
|
|
126
|
+
* @returns A new local ID in session space.
|
|
127
|
+
*/
|
|
128
|
+
generateCompressedId(): SessionSpaceCompressedId;
|
|
129
|
+
/**
|
|
130
|
+
* Generates a new ID that is guaranteed to be unique across all sessions known to this compressor without the need for any
|
|
131
|
+
* normalization. The returned ID is not guaranteed to be a compressed ID (small number); it may be a stable ID (UUID string).
|
|
132
|
+
* In Fluid, the likelihood of generating the bulkier stable ID is dictated by network conditions and is highly probably in
|
|
133
|
+
* scenarios such as offline. This is still useful for use cases where simplicity is more important than performance and
|
|
134
|
+
* this approach will often be superior to generating a UUID.
|
|
135
|
+
* If small numbers are a requirement, `generateCompressedId` and normalization should be used instead.
|
|
136
|
+
* See `IIdCompressor` for more details.
|
|
137
|
+
* @returns A new local ID in session space.
|
|
138
|
+
*/
|
|
139
|
+
generateDocumentUniqueId(): (SessionSpaceCompressedId & OpSpaceCompressedId) | StableId;
|
|
140
|
+
/**
|
|
141
|
+
* Normalizes a session space ID into op space.
|
|
142
|
+
* The returned ID is in op space and can be safely serialized. However, it should be normalized back to session space before use.
|
|
143
|
+
* See `IIdCompressor` for more details.
|
|
144
|
+
* @param id - The local ID to normalize.
|
|
145
|
+
* @returns The ID in op space.
|
|
146
|
+
*/
|
|
147
|
+
normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;
|
|
148
|
+
/**
|
|
149
|
+
* Normalizes an ID into session space.
|
|
150
|
+
* @param id - The ID to normalize.
|
|
151
|
+
* @param originSessionId - The session from which `id` originated. This should be the ID of the client that normalized `id` to op space.
|
|
152
|
+
* This means that it may not be the client that created `id` in the first place, but rather the client that serialized it.
|
|
153
|
+
* This is an important distinction in the case of a reference, where a client might refer to an ID created by another client.
|
|
154
|
+
* @returns The session-space ID in the local session corresponding to `id`.
|
|
155
|
+
*/
|
|
156
|
+
normalizeToSessionSpace(id: OpSpaceCompressedId, originSessionId: SessionId): SessionSpaceCompressedId;
|
|
157
|
+
/**
|
|
158
|
+
* Decompresses a previously compressed ID into a UUID.
|
|
159
|
+
* @param id - The compressed ID to be decompressed.
|
|
160
|
+
* @returns The UUID associated with the compressed ID.
|
|
161
|
+
* @throws If the ID was not generated by any session known to this compressor.
|
|
162
|
+
*/
|
|
163
|
+
decompress(id: SessionSpaceCompressedId): StableId;
|
|
164
|
+
/**
|
|
165
|
+
* Recompresses a UUID.
|
|
166
|
+
* @param uncompressed - The UUID to recompress.
|
|
167
|
+
* @returns The `CompressedId` associated with `uncompressed`.
|
|
168
|
+
* @throws If the UUID was not generated by any session known to this compressor.
|
|
169
|
+
*/
|
|
170
|
+
recompress(uncompressed: StableId): SessionSpaceCompressedId;
|
|
171
|
+
/**
|
|
172
|
+
* Attempts to recompress a UUID.
|
|
173
|
+
* @param uncompressed - The UUID to recompress.
|
|
174
|
+
* @returns The `CompressedId` associated with `uncompressed` or undefined if the UUID was not generated by any session known to this compressor.
|
|
175
|
+
*/
|
|
176
|
+
tryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;
|
|
177
|
+
}
|
|
178
|
+
|
|
127
179
|
/**
|
|
128
180
|
* A distributed UUID generator and compressor.
|
|
129
181
|
*
|
|
@@ -184,53 +236,6 @@ export declare interface IdCreationRange {
|
|
|
184
236
|
*
|
|
185
237
|
* These two spaces naturally define a rule: consumers of compressed IDs should use session-space IDs, but serialized forms such as ops
|
|
186
238
|
* should use op-space IDs.
|
|
187
|
-
* @public
|
|
188
|
-
*/
|
|
189
|
-
export declare interface IIdCompressor {
|
|
190
|
-
localSessionId: SessionId;
|
|
191
|
-
/**
|
|
192
|
-
* Generates a new compressed ID or returns an existing one.
|
|
193
|
-
* This should ONLY be called to generate IDs for local operations.
|
|
194
|
-
* @returns A new local ID in session space.
|
|
195
|
-
*/
|
|
196
|
-
generateCompressedId(): SessionSpaceCompressedId;
|
|
197
|
-
/**
|
|
198
|
-
* Normalizes a session space ID into op space.
|
|
199
|
-
* @param id - the local ID to normalize.
|
|
200
|
-
* @returns the ID in op space.
|
|
201
|
-
*/
|
|
202
|
-
normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;
|
|
203
|
-
/**
|
|
204
|
-
* Normalizes an ID into session space.
|
|
205
|
-
* @param id - the ID to normalize. If it is a local ID, it is assumed to have been created by the session corresponding
|
|
206
|
-
* to `sessionId`.
|
|
207
|
-
* @param originSessionId - the session from which `id` originated
|
|
208
|
-
* @returns the session-space ID corresponding to `id`, which might not have been a final ID if the client that created it had not yet
|
|
209
|
-
* finalized it. This can occur when a client references an ID during the window of time in which it is waiting to receive the ordered
|
|
210
|
-
* range that contained it from the server.
|
|
211
|
-
*/
|
|
212
|
-
normalizeToSessionSpace(id: OpSpaceCompressedId, originSessionId: SessionId): SessionSpaceCompressedId;
|
|
213
|
-
/**
|
|
214
|
-
* Decompresses a previously compressed ID into a UUID.
|
|
215
|
-
* @param id - the compressed ID to be decompressed.
|
|
216
|
-
* @returns the UUID associated with the compressed ID. Fails if the ID was not generated by this compressor.
|
|
217
|
-
*/
|
|
218
|
-
decompress(id: SessionSpaceCompressedId): StableId;
|
|
219
|
-
/**
|
|
220
|
-
* Recompresses a UUID.
|
|
221
|
-
* @param uncompressed - the UUID to recompress.
|
|
222
|
-
* @returns the `CompressedId` associated with `uncompressed`. Fails if it has not been previously compressed by this compressor.
|
|
223
|
-
*/
|
|
224
|
-
recompress(uncompressed: StableId): SessionSpaceCompressedId;
|
|
225
|
-
/**
|
|
226
|
-
* Attempts to recompresses a UUID.
|
|
227
|
-
* @param uncompressed - the UUID to recompress,
|
|
228
|
-
* @returns the `CompressedId` associated with `uncompressed` or undefined if it has not been previously compressed by this compressor.
|
|
229
|
-
*/
|
|
230
|
-
tryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
239
|
* @alpha
|
|
235
240
|
*/
|
|
236
241
|
export declare interface IIdCompressorCore {
|