@fluidframework/runtime-definitions 2.0.0-dev.4.1.0.148229 → 2.0.0-dev.4.3.0.157531
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 +14 -0
- package/README.md +37 -1
- package/dist/dataStoreContext.d.ts +2 -0
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/id-compressor/idCompressor.d.ts +154 -0
- package/dist/id-compressor/idCompressor.d.ts.map +1 -0
- package/dist/id-compressor/idCompressor.js +7 -0
- package/dist/id-compressor/idCompressor.js.map +1 -0
- package/dist/id-compressor/identifiers.d.ts +77 -0
- package/dist/id-compressor/identifiers.d.ts.map +1 -0
- package/dist/id-compressor/identifiers.js +7 -0
- package/dist/id-compressor/identifiers.js.map +1 -0
- package/dist/id-compressor/index.d.ts +8 -0
- package/dist/id-compressor/index.d.ts.map +1 -0
- package/dist/id-compressor/index.js +7 -0
- package/dist/id-compressor/index.js.map +1 -0
- package/dist/id-compressor/persisted-types/0.0.1.d.ts +162 -0
- package/dist/id-compressor/persisted-types/0.0.1.d.ts.map +1 -0
- package/dist/id-compressor/persisted-types/0.0.1.js +7 -0
- package/dist/id-compressor/persisted-types/0.0.1.js.map +1 -0
- package/dist/id-compressor/persisted-types/index.d.ts +6 -0
- package/dist/id-compressor/persisted-types/index.d.ts.map +1 -0
- package/dist/id-compressor/persisted-types/index.js +7 -0
- package/dist/id-compressor/persisted-types/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/dataStoreContext.ts +2 -0
- package/src/id-compressor/idCompressor.ts +179 -0
- package/src/id-compressor/identifiers.ts +83 -0
- package/src/id-compressor/index.ts +34 -0
- package/src/id-compressor/persisted-types/0.0.1.ts +191 -0
- package/src/id-compressor/persisted-types/README.md +3 -0
- package/src/id-compressor/persisted-types/index.ts +20 -0
- package/src/index.ts +26 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
FinalCompressedId,
|
|
8
|
+
LocalCompressedId,
|
|
9
|
+
OpSpaceCompressedId,
|
|
10
|
+
SessionId,
|
|
11
|
+
} from "../identifiers";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A serialized ID allocation session for an `IdCompressor`.
|
|
15
|
+
*/
|
|
16
|
+
export type SerializedSessionData = readonly [
|
|
17
|
+
/**
|
|
18
|
+
* The ID of the session.
|
|
19
|
+
*/
|
|
20
|
+
sessionId: SessionId,
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export type SerializedClusterOverrides = readonly [
|
|
24
|
+
/** The overridden final ID, represented as an index into the cluster's ID range */
|
|
25
|
+
overriddenFinalIndex: number, // A cluster with base UUID '...beef' and an `overriddenFinalIndex` of 3 would correspond to '...bef2'
|
|
26
|
+
/** The override string */
|
|
27
|
+
override: string,
|
|
28
|
+
/** The first ID that was finalized and associated with this override, set only if different than the `overriddenFinalIndex` */
|
|
29
|
+
overriddenId?: FinalCompressedId,
|
|
30
|
+
][];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A serialized final ID cluster.
|
|
34
|
+
*/
|
|
35
|
+
export type SerializedCluster = readonly [
|
|
36
|
+
/**
|
|
37
|
+
* Index into the serialized sessions array. Can be converted into a baseUuid via its order in `clusters`.
|
|
38
|
+
* If negative, then this cluster was created by the local session.
|
|
39
|
+
*/
|
|
40
|
+
sessionIndex: number,
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The capacity of the cluster.
|
|
44
|
+
*/
|
|
45
|
+
capacity: number,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The number of IDs in the cluster. Omitted if count === capacity.
|
|
49
|
+
* --OR--
|
|
50
|
+
* The overrides in this cluster. Omitted if no overrides exist in the cluster.
|
|
51
|
+
*/
|
|
52
|
+
countOrOverrides?: number | SerializedClusterOverrides,
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Overrides in this cluster. Omitted if no overrides exist in the cluster.
|
|
56
|
+
*/
|
|
57
|
+
overrides?: SerializedClusterOverrides,
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
export type SerializedLocalOverrides = readonly (readonly [LocalCompressedId, string])[];
|
|
61
|
+
|
|
62
|
+
export interface SerializedLocalState {
|
|
63
|
+
/**
|
|
64
|
+
* The total number of local IDs created by this session
|
|
65
|
+
*/
|
|
66
|
+
readonly localIdCount: number;
|
|
67
|
+
/**
|
|
68
|
+
* Overrides generated by this session. Omitted if no local overrides exist in the session.
|
|
69
|
+
*/
|
|
70
|
+
readonly overrides?: SerializedLocalOverrides;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The most recent local ID in a range returned by `takeNextCreationRange`.
|
|
74
|
+
*/
|
|
75
|
+
readonly lastTakenLocalId: LocalCompressedId | undefined;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Serialized table for normalizing IDs made by the local session.
|
|
79
|
+
*/
|
|
80
|
+
readonly sessionNormalizer: SerializedSessionIdNormalizer;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Serialized table for normalizing IDs made by the local session.
|
|
85
|
+
*/
|
|
86
|
+
export interface SerializedSessionIdNormalizer {
|
|
87
|
+
readonly nextLocalId: LocalCompressedId;
|
|
88
|
+
readonly localRanges: readonly (readonly [
|
|
89
|
+
firstLocal: LocalCompressedId,
|
|
90
|
+
lastLocal: LocalCompressedId,
|
|
91
|
+
finalRanges?: readonly (readonly [
|
|
92
|
+
alignedLocal: LocalCompressedId,
|
|
93
|
+
firstFinal: FinalCompressedId,
|
|
94
|
+
lastFinal: FinalCompressedId,
|
|
95
|
+
])[],
|
|
96
|
+
])[];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The minimal required contents of a serialized IdCompressor.
|
|
101
|
+
*/
|
|
102
|
+
export interface VersionedSerializedIdCompressor {
|
|
103
|
+
readonly _versionedSerializedIdCompressor: "8c73c57c-1cf4-4278-8915-6444cb4f6af5";
|
|
104
|
+
readonly version: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The serialized contents of an IdCompressor, suitable for persistence in a summary.
|
|
109
|
+
*/
|
|
110
|
+
export interface SerializedIdCompressor extends VersionedSerializedIdCompressor {
|
|
111
|
+
/** The cluster capacity of this compressor */
|
|
112
|
+
readonly clusterCapacity: number;
|
|
113
|
+
/** All sessions except the local session. */
|
|
114
|
+
readonly sessions: readonly SerializedSessionData[];
|
|
115
|
+
/** All clusters in the compressor in the order they were created. */
|
|
116
|
+
readonly clusters: readonly SerializedCluster[];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The serialized contents of an IdCompressor, suitable for persistence in a summary.
|
|
121
|
+
*/
|
|
122
|
+
export interface SerializedIdCompressorWithNoSession extends SerializedIdCompressor {
|
|
123
|
+
readonly _noLocalState: "3aa2e1e8-cc28-4ea7-bc1a-a11dc3f26dfb";
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The serialized contents of an IdCompressor, suitable for persistence in a summary.
|
|
128
|
+
*/
|
|
129
|
+
export interface SerializedIdCompressorWithOngoingSession extends SerializedIdCompressor {
|
|
130
|
+
readonly _hasLocalState: "1281acae-6d14-47e7-bc92-71c8ee0819cb";
|
|
131
|
+
/** The session ID of the local session, by index into `sessions`. */
|
|
132
|
+
readonly localSessionIndex: number;
|
|
133
|
+
/** This is only present if the local session made any IDs. */
|
|
134
|
+
readonly localState?: SerializedLocalState;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Data describing a range of session-local IDs (from a remote or local session).
|
|
139
|
+
*
|
|
140
|
+
* A range is composed of local IDs that were generated. Some of these may have overrides.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* Suppose an IdCompressor generated a sequence of local IDs as follows:
|
|
144
|
+
* ```
|
|
145
|
+
* compressor.generateLocalId()
|
|
146
|
+
* compressor.generateLocalId('0093cf29-9454-4034-8940-33b1077b41c3')
|
|
147
|
+
* compressor.generateLocalId()
|
|
148
|
+
* compressor.generateLocalId('0ed545f8-e97e-4dc1-acf9-c4a783258bdf')
|
|
149
|
+
* compressor.generateLocalId()
|
|
150
|
+
* compressor.generateLocalId()
|
|
151
|
+
* compressor.takeNextCreationRange()
|
|
152
|
+
* ```
|
|
153
|
+
* This would result in the following range:
|
|
154
|
+
* ```
|
|
155
|
+
* {
|
|
156
|
+
* first: localId1,
|
|
157
|
+
* last: localId6,
|
|
158
|
+
* overrides: [[localId2, '0093cf29-9454-4034-8940-33b1077b41c3'], [localId4, '0ed545f8-e97e-4dc1-acf9-c4a783258bdf']]
|
|
159
|
+
* }
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
export interface IdCreationRange {
|
|
163
|
+
readonly sessionId: SessionId;
|
|
164
|
+
readonly ids?: IdCreationRange.Ids;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export type UnackedLocalId = LocalCompressedId & OpSpaceCompressedId;
|
|
168
|
+
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
170
|
+
export namespace IdCreationRange {
|
|
171
|
+
export type Ids =
|
|
172
|
+
| {
|
|
173
|
+
readonly first: UnackedLocalId;
|
|
174
|
+
readonly last: UnackedLocalId;
|
|
175
|
+
}
|
|
176
|
+
| ({
|
|
177
|
+
readonly first?: UnackedLocalId;
|
|
178
|
+
readonly last?: UnackedLocalId;
|
|
179
|
+
} & HasOverrides);
|
|
180
|
+
|
|
181
|
+
export interface HasOverrides {
|
|
182
|
+
readonly overrides: Overrides;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export type Override = readonly [id: UnackedLocalId, override: string];
|
|
186
|
+
export type Overrides = readonly [Override, ...Override[]];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export type IdCreationRangeWithStashedState = IdCreationRange & {
|
|
190
|
+
stashedState: SerializedIdCompressorWithOngoingSession;
|
|
191
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
IdCreationRange,
|
|
8
|
+
SerializedCluster,
|
|
9
|
+
SerializedClusterOverrides,
|
|
10
|
+
SerializedIdCompressor,
|
|
11
|
+
SerializedIdCompressorWithNoSession,
|
|
12
|
+
SerializedIdCompressorWithOngoingSession,
|
|
13
|
+
SerializedLocalOverrides,
|
|
14
|
+
SerializedLocalState,
|
|
15
|
+
SerializedSessionData,
|
|
16
|
+
SerializedSessionIdNormalizer,
|
|
17
|
+
UnackedLocalId,
|
|
18
|
+
VersionedSerializedIdCompressor,
|
|
19
|
+
IdCreationRangeWithStashedState,
|
|
20
|
+
} from "./0.0.1";
|
package/src/index.ts
CHANGED
|
@@ -69,3 +69,29 @@ export {
|
|
|
69
69
|
SummarizeInternalFn,
|
|
70
70
|
totalBlobSizePropertyName,
|
|
71
71
|
} from "./summary";
|
|
72
|
+
export {
|
|
73
|
+
IIdCompressorCore,
|
|
74
|
+
IIdCompressor,
|
|
75
|
+
SerializedIdCompressor,
|
|
76
|
+
SerializedIdCompressorWithOngoingSession,
|
|
77
|
+
SerializedIdCompressorWithNoSession,
|
|
78
|
+
SessionSpaceCompressedId,
|
|
79
|
+
OpSpaceCompressedId,
|
|
80
|
+
SessionId,
|
|
81
|
+
FinalCompressedId,
|
|
82
|
+
StableId,
|
|
83
|
+
UuidString,
|
|
84
|
+
CompressedId,
|
|
85
|
+
SessionUnique,
|
|
86
|
+
LocalCompressedId,
|
|
87
|
+
IdCreationRange,
|
|
88
|
+
VersionedSerializedIdCompressor,
|
|
89
|
+
SerializedCluster,
|
|
90
|
+
SerializedSessionData,
|
|
91
|
+
SerializedLocalState,
|
|
92
|
+
SerializedClusterOverrides,
|
|
93
|
+
SerializedLocalOverrides,
|
|
94
|
+
SerializedSessionIdNormalizer,
|
|
95
|
+
UnackedLocalId,
|
|
96
|
+
IdCreationRangeWithStashedState,
|
|
97
|
+
} from "./id-compressor";
|