@fluidframework/id-compressor 2.0.0-dev-rc.1.0.0.224419
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 +27 -0
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +170 -0
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +4 -0
- package/api-report/id-compressor.api.md +139 -0
- package/dist/appendOnlySortedMap.cjs +318 -0
- package/dist/appendOnlySortedMap.cjs.map +1 -0
- package/dist/appendOnlySortedMap.d.ts +124 -0
- package/dist/appendOnlySortedMap.d.ts.map +1 -0
- package/dist/finalSpace.cjs +62 -0
- package/dist/finalSpace.cjs.map +1 -0
- package/dist/finalSpace.d.ts +29 -0
- package/dist/finalSpace.d.ts.map +1 -0
- package/dist/id-compressor-alpha.d.ts +320 -0
- package/dist/id-compressor-beta.d.ts +172 -0
- package/dist/id-compressor-public.d.ts +172 -0
- package/dist/id-compressor-untrimmed.d.ts +333 -0
- package/dist/idCompressor.cjs +502 -0
- package/dist/idCompressor.cjs.map +1 -0
- package/dist/idCompressor.d.ts +84 -0
- package/dist/idCompressor.d.ts.map +1 -0
- package/dist/identifiers.cjs +15 -0
- package/dist/identifiers.cjs.map +1 -0
- package/dist/identifiers.d.ts +32 -0
- package/dist/identifiers.d.ts.map +1 -0
- package/dist/index.cjs +20 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/packageVersion.cjs +12 -0
- package/dist/packageVersion.cjs.map +1 -0
- package/dist/packageVersion.d.ts +9 -0
- package/dist/packageVersion.d.ts.map +1 -0
- package/dist/persistanceUtilities.cjs +43 -0
- package/dist/persistanceUtilities.cjs.map +1 -0
- package/dist/persistanceUtilities.d.ts +22 -0
- package/dist/persistanceUtilities.d.ts.map +1 -0
- package/dist/sessionSpaceNormalizer.cjs +80 -0
- package/dist/sessionSpaceNormalizer.cjs.map +1 -0
- package/dist/sessionSpaceNormalizer.d.ts +46 -0
- package/dist/sessionSpaceNormalizer.d.ts.map +1 -0
- package/dist/sessions.cjs +305 -0
- package/dist/sessions.cjs.map +1 -0
- package/dist/sessions.d.ts +115 -0
- package/dist/sessions.d.ts.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types/idCompressor.cjs +7 -0
- package/dist/types/idCompressor.cjs.map +1 -0
- package/dist/types/idCompressor.d.ts +139 -0
- package/dist/types/idCompressor.d.ts.map +1 -0
- package/dist/types/identifiers.cjs +7 -0
- package/dist/types/identifiers.cjs.map +1 -0
- package/dist/types/identifiers.d.ts +40 -0
- package/dist/types/identifiers.d.ts.map +1 -0
- package/dist/types/index.cjs +7 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/persisted-types/0.0.1.cjs +7 -0
- package/dist/types/persisted-types/0.0.1.cjs.map +1 -0
- package/dist/types/persisted-types/0.0.1.d.ts +52 -0
- package/dist/types/persisted-types/0.0.1.d.ts.map +1 -0
- package/dist/types/persisted-types/index.cjs +7 -0
- package/dist/types/persisted-types/index.cjs.map +1 -0
- package/dist/types/persisted-types/index.d.ts +6 -0
- package/dist/types/persisted-types/index.d.ts.map +1 -0
- package/dist/utilities.cjs +170 -0
- package/dist/utilities.cjs.map +1 -0
- package/dist/utilities.d.ts +53 -0
- package/dist/utilities.d.ts.map +1 -0
- package/lib/appendOnlySortedMap.d.mts +124 -0
- package/lib/appendOnlySortedMap.d.mts.map +1 -0
- package/lib/appendOnlySortedMap.mjs +312 -0
- package/lib/appendOnlySortedMap.mjs.map +1 -0
- package/lib/finalSpace.d.mts +29 -0
- package/lib/finalSpace.d.mts.map +1 -0
- package/lib/finalSpace.mjs +58 -0
- package/lib/finalSpace.mjs.map +1 -0
- package/lib/id-compressor-alpha.d.mts +320 -0
- package/lib/id-compressor-beta.d.mts +172 -0
- package/lib/id-compressor-public.d.mts +172 -0
- package/lib/id-compressor-untrimmed.d.mts +333 -0
- package/lib/idCompressor.d.mts +84 -0
- package/lib/idCompressor.d.mts.map +1 -0
- package/lib/idCompressor.mjs +496 -0
- package/lib/idCompressor.mjs.map +1 -0
- package/lib/identifiers.d.mts +32 -0
- package/lib/identifiers.d.mts.map +1 -0
- package/lib/identifiers.mjs +11 -0
- package/lib/identifiers.mjs.map +1 -0
- package/lib/index.d.mts +8 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +7 -0
- package/lib/index.mjs.map +1 -0
- package/lib/packageVersion.d.mts +9 -0
- package/lib/packageVersion.d.mts.map +1 -0
- package/lib/packageVersion.mjs +9 -0
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/persistanceUtilities.d.mts +22 -0
- package/lib/persistanceUtilities.d.mts.map +1 -0
- package/lib/persistanceUtilities.mjs +34 -0
- package/lib/persistanceUtilities.mjs.map +1 -0
- package/lib/sessionSpaceNormalizer.d.mts +46 -0
- package/lib/sessionSpaceNormalizer.d.mts.map +1 -0
- package/lib/sessionSpaceNormalizer.mjs +76 -0
- package/lib/sessionSpaceNormalizer.mjs.map +1 -0
- package/lib/sessions.d.mts +115 -0
- package/lib/sessions.d.mts.map +1 -0
- package/lib/sessions.mjs +290 -0
- package/lib/sessions.mjs.map +1 -0
- package/lib/types/idCompressor.d.mts +139 -0
- package/lib/types/idCompressor.d.mts.map +1 -0
- package/lib/types/idCompressor.mjs +6 -0
- package/lib/types/idCompressor.mjs.map +1 -0
- package/lib/types/identifiers.d.mts +40 -0
- package/lib/types/identifiers.d.mts.map +1 -0
- package/lib/types/identifiers.mjs +6 -0
- package/lib/types/identifiers.mjs.map +1 -0
- package/lib/types/index.d.mts +8 -0
- package/lib/types/index.d.mts.map +1 -0
- package/lib/types/index.mjs +6 -0
- package/lib/types/index.mjs.map +1 -0
- package/lib/types/persisted-types/0.0.1.d.mts +52 -0
- package/lib/types/persisted-types/0.0.1.d.mts.map +1 -0
- package/lib/types/persisted-types/0.0.1.mjs +6 -0
- package/lib/types/persisted-types/0.0.1.mjs.map +1 -0
- package/lib/types/persisted-types/index.d.mts +6 -0
- package/lib/types/persisted-types/index.d.mts.map +1 -0
- package/lib/types/persisted-types/index.mjs +6 -0
- package/lib/types/persisted-types/index.mjs.map +1 -0
- package/lib/utilities.d.mts +53 -0
- package/lib/utilities.d.mts.map +1 -0
- package/lib/utilities.mjs +151 -0
- package/lib/utilities.mjs.map +1 -0
- package/package.json +114 -0
- package/prettier.config.cjs +8 -0
- package/src/appendOnlySortedMap.ts +366 -0
- package/src/finalSpace.ts +67 -0
- package/src/idCompressor.ts +685 -0
- package/src/identifiers.ts +42 -0
- package/src/index.ts +23 -0
- package/src/packageVersion.ts +9 -0
- package/src/persistanceUtilities.ts +58 -0
- package/src/sessionSpaceNormalizer.ts +83 -0
- package/src/sessions.ts +405 -0
- package/src/types/idCompressor.ts +155 -0
- package/src/types/identifiers.ts +39 -0
- package/src/types/index.ts +15 -0
- package/src/types/persisted-types/0.0.1.ts +58 -0
- package/src/types/persisted-types/README.md +3 -0
- package/src/types/persisted-types/index.ts +11 -0
- package/src/utilities.ts +191 -0
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +12 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
extends: [require.resolve("@fluidframework/eslint-config-fluid/minimal"), "prettier"],
|
|
8
|
+
parserOptions: {
|
|
9
|
+
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
"@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
|
+
},
|
|
17
|
+
overrides: [
|
|
18
|
+
{
|
|
19
|
+
// Rules only for test files
|
|
20
|
+
files: ["*.spec.ts", "src/test/**"],
|
|
21
|
+
rules: {
|
|
22
|
+
// Test files are run in node only so additional node libraries can be used.
|
|
23
|
+
"import/no-nodejs-modules": ["error", { allow: ["assert", "crypto", "events"] }],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
package/.mocharc.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
const getFluidTestMochaConfig = require("@fluidframework/mocha-test-setup/mocharc-common");
|
|
9
|
+
|
|
10
|
+
const packageDir = __dirname;
|
|
11
|
+
const config = getFluidTestMochaConfig(packageDir);
|
|
12
|
+
module.exports = config;
|
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# @fluidframework/id-compressor
|
|
2
|
+
|
|
3
|
+
A library which generates small number representations of arbitrary non-colliding Version 4 UUIDs ("stable IDs") across multiple sessions in a network. This scheme enables a distributed application to utilize the global uniqueness guarantees of UUIDs while maintaining the performance advantages of small integers.
|
|
4
|
+
|
|
5
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_INSTALLATION_SECTION:includeHeading=TRUE) -->
|
|
6
|
+
|
|
7
|
+
<!-- prettier-ignore-start -->
|
|
8
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
To get started, install the package by running the following command:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm i @fluidframework/id-compressor
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
<!-- prettier-ignore-end -->
|
|
19
|
+
|
|
20
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
21
|
+
|
|
22
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_DEPENDENCY_GUIDELINES_SECTION:includeHeading=TRUE) -->
|
|
23
|
+
|
|
24
|
+
<!-- prettier-ignore-start -->
|
|
25
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
26
|
+
|
|
27
|
+
## Using Fluid Framework libraries
|
|
28
|
+
|
|
29
|
+
When taking a dependency on a Fluid Framework library, we recommend using a `^` (caret) version range, such as `^1.3.4`.
|
|
30
|
+
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
31
|
+
library consumers should always prefer `^`.
|
|
32
|
+
|
|
33
|
+
Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
|
|
34
|
+
you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
|
|
35
|
+
Standard `^` and `~` ranges will not work as expected.
|
|
36
|
+
See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
|
|
37
|
+
package for more information including tools to convert between version schemes.
|
|
38
|
+
|
|
39
|
+
<!-- prettier-ignore-end -->
|
|
40
|
+
|
|
41
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
42
|
+
|
|
43
|
+
## Overview
|
|
44
|
+
|
|
45
|
+
The distributed ID allocation scheme allows clients to use, store, and reference small numbers that map to UUIDs rather than the UUIDs themselves. The primary benefits are improved memory efficiency and reduced storage size, as well as improved runtime performance when used as keys in collections.
|
|
46
|
+
|
|
47
|
+
The scheme requires a total order for ID allocation, so the allocator is designed to work within a service that provides centralized total order broadcast.
|
|
48
|
+
|
|
49
|
+
### Sessions
|
|
50
|
+
|
|
51
|
+
A session can be thought of as a unique identifier for a single allocator. Even if an allocator is taken offline, serialized to disk, and rehydrated back, it's considered the same session if it has the same session ID.
|
|
52
|
+
|
|
53
|
+
### Document
|
|
54
|
+
|
|
55
|
+
The set of IDs generated by all Sessions contributing to the same distributed collection (e.g. an individual collaborative document). Uniqueness of allocated IDs is limited to the document context (unless in their UUID form), and thus IDs in their compressed form are not portable between documents.
|
|
56
|
+
|
|
57
|
+
### Generation API
|
|
58
|
+
|
|
59
|
+
New IDs are generated via a synchronous API on the allocator. The API returns a small number representation of the UUID with the following guarantees:
|
|
60
|
+
|
|
61
|
+
- The ID can be synchronously converted into a full UUID at any time. This is required if global uniqueness (across documents) is needed.
|
|
62
|
+
- Prior to the service being notified of the ID's creation, it is unique within the scope of the session (i.e. the new ID will not collide with other IDs from the same allocator, but it can collide with IDs from a different allocator in the same network).
|
|
63
|
+
- After the service has been notified of the ID's creation and has determined a total ordering between all clients creating IDs, the ID will have a "final" form that is a small number representation that is unique across the [document](#document).
|
|
64
|
+
|
|
65
|
+
### ID Spaces
|
|
66
|
+
|
|
67
|
+
The allocation scheme separates the small-number IDs into two "spaces":
|
|
68
|
+
|
|
69
|
+
1. Session space: IDs are unique within the session scope, but are not guaranteed to be [document](#document) unique without the accompanying context of their session ID.
|
|
70
|
+
2. Op space: IDs are in their most final form, as unique as possible within the entire system. IDs that have been ordered by the central service ("finalized") are represented in their final form, while any other IDs that have not yet been finalized are left in their "session space" form.
|
|
71
|
+
|
|
72
|
+
Each of these spaces is represented by a discrete type. This allows for the direct encoding of an ID's uniqueness guarantees without contextual ambiguity. An ID can be "normalized" from one space to the other with a sychronous call.
|
|
73
|
+
|
|
74
|
+
### Usage Guidelines
|
|
75
|
+
|
|
76
|
+
When delivering Allocated IDs to application authors for use in place of V4 UUIDs, follow these guidelines:
|
|
77
|
+
|
|
78
|
+
- Expose only session space IDs to application authors. This means that application developers don't need to manage multiple ID spaces or worry about converting IDs between session space and op space. This simplifies the data management process and reduces the chances of errors or inconsistencies.
|
|
79
|
+
|
|
80
|
+
- **Note:** Session space IDs are only unique within the originating session (for most applications this will mean within each individual client's app instance, as it is rare to hold handles to more than one allocator). This constrains usage to scopes where IDs are unique; for instance, application developers should never persist these IDs and should instead be directed to convert them to stable IDs first.
|
|
81
|
+
|
|
82
|
+
- Use op space IDs for serialized forms, such as sending information over the wire or storing it in a file. Op space IDs are always generated in their _final_ form when possible, which imparts a performance benefit by reducing normalization work when a client receives a network operation or rehydrates an allocator.
|
|
83
|
+
- When serializing op space IDs, annotate the entire context (e.g., file or network operation) with the session ID. This is necessary because not all IDs in op space are in their final form. Any non-finalized IDs will still be in their session space form, unique only within that specific session. Annotating the entire context with the session ID ensures that recipients of the serialized data can correctly interpret and process the non-finalized IDs.
|
|
84
|
+
|
|
85
|
+
### Efficiency Properties
|
|
86
|
+
|
|
87
|
+
#### UUID Generation
|
|
88
|
+
|
|
89
|
+
The allocator generates UUIDs in non-random ways to reduce entropy, optimizing storage of data. A session begins with a random UUID, and subsequent IDs are allocated sequentially. UUIDs generated with this strategy are less likely to collide than fully random UUIDs, and this fact can be leveraged to compact the on-disk and in-memory representations of the allocator.
|
|
90
|
+
|
|
91
|
+
UUID generation is O(1).
|
|
92
|
+
|
|
93
|
+
#### Decompression/recompression
|
|
94
|
+
|
|
95
|
+
Converting an allocated ID into its UUID form (decompression) and the reverse (recompression) are both O(log<sub>n</sub>) in the number of IDs created by the originating session.
|
|
96
|
+
|
|
97
|
+
#### Clustering
|
|
98
|
+
|
|
99
|
+
The sequential allocation approach allows the system to implement a clustering scheme.
|
|
100
|
+
|
|
101
|
+
As allocators across the network create IDs, they reserve blocks of positive ID space (clusters) for that allocator. The positive integer space is sharded across different clients, and session space IDs are mapped into these clusters.
|
|
102
|
+
|
|
103
|
+
Clusters are efficient to store, requiring only two integers: the base positive integer in the cluster and the count of reserved IDs in that cluster.
|
|
104
|
+
|
|
105
|
+
#### Normalization
|
|
106
|
+
|
|
107
|
+
Normalization is O(log<sub>n</sub>) in the number of IDs created by the originating session, as it requires a simple binary search on the clusters owned by that session.
|
|
108
|
+
|
|
109
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_CONTRIBUTION_GUIDELINES_SECTION:includeHeading=TRUE) -->
|
|
110
|
+
|
|
111
|
+
<!-- prettier-ignore-start -->
|
|
112
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
113
|
+
|
|
114
|
+
## Contribution Guidelines
|
|
115
|
+
|
|
116
|
+
There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid.
|
|
117
|
+
|
|
118
|
+
- Participate in Q&A in our [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
|
|
119
|
+
- [Submit bugs](https://github.com/microsoft/FluidFramework/issues) and help us verify fixes as they are checked in.
|
|
120
|
+
- Review the [source code changes](https://github.com/microsoft/FluidFramework/pulls).
|
|
121
|
+
- [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md).
|
|
122
|
+
|
|
123
|
+
Detailed instructions for working in the repo can be found in the [Wiki](https://github.com/microsoft/FluidFramework/wiki).
|
|
124
|
+
|
|
125
|
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
|
126
|
+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
|
127
|
+
|
|
128
|
+
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
|
|
129
|
+
Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks).
|
|
130
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
131
|
+
|
|
132
|
+
<!-- prettier-ignore-end -->
|
|
133
|
+
|
|
134
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
135
|
+
|
|
136
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_HELP_SECTION:includeHeading=TRUE) -->
|
|
137
|
+
|
|
138
|
+
<!-- prettier-ignore-start -->
|
|
139
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
140
|
+
|
|
141
|
+
## Help
|
|
142
|
+
|
|
143
|
+
Not finding what you're looking for in this README? Check out our [GitHub
|
|
144
|
+
Wiki](https://github.com/microsoft/FluidFramework/wiki) or [fluidframework.com](https://fluidframework.com/docs/).
|
|
145
|
+
|
|
146
|
+
Still not finding what you're looking for? Please [file an
|
|
147
|
+
issue](https://github.com/microsoft/FluidFramework/wiki/Submitting-Bugs-and-Feature-Requests).
|
|
148
|
+
|
|
149
|
+
Thank you!
|
|
150
|
+
|
|
151
|
+
<!-- prettier-ignore-end -->
|
|
152
|
+
|
|
153
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
154
|
+
|
|
155
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_TRADEMARK_SECTION:includeHeading=TRUE) -->
|
|
156
|
+
|
|
157
|
+
<!-- prettier-ignore-start -->
|
|
158
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
159
|
+
|
|
160
|
+
## Trademark
|
|
161
|
+
|
|
162
|
+
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
|
|
163
|
+
|
|
164
|
+
Use of these trademarks or logos must follow Microsoft's [Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
165
|
+
|
|
166
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
167
|
+
|
|
168
|
+
<!-- prettier-ignore-end -->
|
|
169
|
+
|
|
170
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
## API Report File for "@fluidframework/id-compressor"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
8
|
+
|
|
9
|
+
// @internal
|
|
10
|
+
export function assertIsStableId(stableId: string): StableId;
|
|
11
|
+
|
|
12
|
+
// @alpha
|
|
13
|
+
export function createIdCompressor(logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore;
|
|
14
|
+
|
|
15
|
+
// @alpha
|
|
16
|
+
export function createIdCompressor(sessionId: SessionId, logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore;
|
|
17
|
+
|
|
18
|
+
// @alpha
|
|
19
|
+
export function createSessionId(): SessionId;
|
|
20
|
+
|
|
21
|
+
// @alpha
|
|
22
|
+
export function deserializeIdCompressor(serialized: SerializedIdCompressorWithOngoingSession): IIdCompressor & IIdCompressorCore;
|
|
23
|
+
|
|
24
|
+
// @alpha
|
|
25
|
+
export function deserializeIdCompressor(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId): IIdCompressor & IIdCompressorCore;
|
|
26
|
+
|
|
27
|
+
// @internal
|
|
28
|
+
export function generateStableId(): StableId;
|
|
29
|
+
|
|
30
|
+
// @alpha @deprecated
|
|
31
|
+
export class IdCompressor implements IIdCompressor, IIdCompressorCore {
|
|
32
|
+
// @deprecated (undocumented)
|
|
33
|
+
static create(logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore;
|
|
34
|
+
// @deprecated (undocumented)
|
|
35
|
+
static create(sessionId: SessionId, logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore;
|
|
36
|
+
// (undocumented)
|
|
37
|
+
decompress(id: SessionSpaceCompressedId): StableId;
|
|
38
|
+
// (undocumented)
|
|
39
|
+
static deserialize(serialized: SerializedIdCompressorWithOngoingSession): IdCompressor;
|
|
40
|
+
// (undocumented)
|
|
41
|
+
static deserialize(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId): IdCompressor;
|
|
42
|
+
// (undocumented)
|
|
43
|
+
equals(other: IdCompressor, includeLocalState: boolean): boolean;
|
|
44
|
+
// (undocumented)
|
|
45
|
+
finalizeCreationRange(range: IdCreationRange): void;
|
|
46
|
+
// (undocumented)
|
|
47
|
+
generateCompressedId(): SessionSpaceCompressedId;
|
|
48
|
+
// (undocumented)
|
|
49
|
+
readonly localSessionId: SessionId;
|
|
50
|
+
static readonly maxClusterSize: number;
|
|
51
|
+
// (undocumented)
|
|
52
|
+
normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;
|
|
53
|
+
// (undocumented)
|
|
54
|
+
normalizeToSessionSpace(id: OpSpaceCompressedId, originSessionId: SessionId): SessionSpaceCompressedId;
|
|
55
|
+
// (undocumented)
|
|
56
|
+
recompress(uncompressed: StableId): SessionSpaceCompressedId;
|
|
57
|
+
// (undocumented)
|
|
58
|
+
serialize(withSession: true): SerializedIdCompressorWithOngoingSession;
|
|
59
|
+
// (undocumented)
|
|
60
|
+
serialize(withSession: false): SerializedIdCompressorWithNoSession;
|
|
61
|
+
// (undocumented)
|
|
62
|
+
takeNextCreationRange(): IdCreationRange;
|
|
63
|
+
// (undocumented)
|
|
64
|
+
tryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// @alpha
|
|
68
|
+
export interface IdCreationRange {
|
|
69
|
+
// (undocumented)
|
|
70
|
+
readonly ids?: {
|
|
71
|
+
readonly firstGenCount: number;
|
|
72
|
+
readonly count: number;
|
|
73
|
+
readonly requestedClusterSize: number;
|
|
74
|
+
};
|
|
75
|
+
// (undocumented)
|
|
76
|
+
readonly sessionId: SessionId;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// @public
|
|
80
|
+
export interface IIdCompressor {
|
|
81
|
+
decompress(id: SessionSpaceCompressedId): StableId;
|
|
82
|
+
generateCompressedId(): SessionSpaceCompressedId;
|
|
83
|
+
// (undocumented)
|
|
84
|
+
localSessionId: SessionId;
|
|
85
|
+
normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;
|
|
86
|
+
normalizeToSessionSpace(id: OpSpaceCompressedId, originSessionId: SessionId): SessionSpaceCompressedId;
|
|
87
|
+
recompress(uncompressed: StableId): SessionSpaceCompressedId;
|
|
88
|
+
tryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// @alpha (undocumented)
|
|
92
|
+
export interface IIdCompressorCore {
|
|
93
|
+
finalizeCreationRange(range: IdCreationRange): void;
|
|
94
|
+
serialize(withSession: true): SerializedIdCompressorWithOngoingSession;
|
|
95
|
+
serialize(withSession: false): SerializedIdCompressorWithNoSession;
|
|
96
|
+
takeNextCreationRange(): IdCreationRange;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// @internal
|
|
100
|
+
export function isStableId(str: string): str is StableId;
|
|
101
|
+
|
|
102
|
+
// @public
|
|
103
|
+
export type OpSpaceCompressedId = number & {
|
|
104
|
+
readonly OpNormalized: "9209432d-a959-4df7-b2ad-767ead4dbcae";
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// @alpha
|
|
108
|
+
export type SerializedIdCompressor = string & {
|
|
109
|
+
readonly _serializedIdCompressor: "8c73c57c-1cf4-4278-8915-6444cb4f6af5";
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// @alpha
|
|
113
|
+
export type SerializedIdCompressorWithNoSession = SerializedIdCompressor & {
|
|
114
|
+
readonly _noLocalState: "3aa2e1e8-cc28-4ea7-bc1a-a11dc3f26dfb";
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// @alpha
|
|
118
|
+
export type SerializedIdCompressorWithOngoingSession = SerializedIdCompressor & {
|
|
119
|
+
readonly _hasLocalState: "1281acae-6d14-47e7-bc92-71c8ee0819cb";
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// @public
|
|
123
|
+
export type SessionId = StableId & {
|
|
124
|
+
readonly SessionId: "4498f850-e14e-4be9-8db0-89ec00997e58";
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// @public
|
|
128
|
+
export type SessionSpaceCompressedId = number & {
|
|
129
|
+
readonly SessionUnique: "cea55054-6b82-4cbf-ad19-1fa645ea3b3e";
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// @public
|
|
133
|
+
export type StableId = string & {
|
|
134
|
+
readonly StableId: "53172b0d-a3d5-41ea-bd75-b43839c97f5a";
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// (No @packageDocumentation comment for this package)
|
|
138
|
+
|
|
139
|
+
```
|