@fluidframework/id-compressor 3.3.0 → 3.5.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 +8 -0
- package/dist/idCompressor.d.ts +10 -17
- package/dist/idCompressor.d.ts.map +1 -1
- package/dist/idCompressor.js +68 -35
- package/dist/idCompressor.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/test/sharding.fuzz.spec.js.map +1 -1
- package/dist/test/sharding.spec.js.map +1 -1
- package/dist/test/types/validateIdCompressorPrevious.generated.js.map +1 -1
- package/dist/types/idCompressor.d.ts +110 -31
- package/dist/types/idCompressor.d.ts.map +1 -1
- package/dist/types/idCompressor.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/lib/idCompressor.d.ts +10 -17
- package/lib/idCompressor.d.ts.map +1 -1
- package/lib/idCompressor.js +69 -36
- package/lib/idCompressor.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/test/sharding.fuzz.spec.js.map +1 -1
- package/lib/test/sharding.spec.js.map +1 -1
- package/lib/test/types/validateIdCompressorPrevious.generated.js.map +1 -1
- package/lib/types/idCompressor.d.ts +110 -31
- package/lib/types/idCompressor.d.ts.map +1 -1
- package/lib/types/idCompressor.js.map +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js.map +1 -1
- package/package.json +9 -42
- package/src/idCompressor.ts +90 -42
- package/src/index.ts +10 -7
- package/src/packageVersion.ts +1 -1
- package/src/test/types/validateIdCompressorPrevious.generated.ts +1 -121
- package/src/types/idCompressor.ts +119 -31
- package/src/types/index.ts +3 -0
package/CHANGELOG.md
CHANGED
package/dist/idCompressor.d.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
5
|
+
import type { ITelemetryBaseLogger, Listenable } from "@fluidframework/core-interfaces";
|
|
6
6
|
import type { TelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
7
7
|
import type { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/legacy";
|
|
8
8
|
import { Sessions } from "./sessions.js";
|
|
9
|
-
import type { IIdCompressor, IIdCompressorCore, IdCreationRange, OpSpaceCompressedId, SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession, SessionId, SessionSpaceCompressedId, StableId, ShardSynchronizationToken } from "./types/index.js";
|
|
9
|
+
import type { IIdCompressor, IIdCompressorCore, IdCreationRange, OpSpaceCompressedId, SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession, SessionId, SessionSpaceCompressedId, StableId, ShardSynchronizationToken, SerializedIdCompressorShard, ParentShardSynchronizationToken, IdCompressorEvents } from "./types/index.js";
|
|
10
10
|
import { SerializationVersion } from "./types/index.js";
|
|
11
11
|
/**
|
|
12
12
|
* See {@link IIdCompressor} and {@link IIdCompressorCore}
|
|
@@ -19,6 +19,8 @@ export declare class IdCompressor implements IIdCompressor, IIdCompressorCore {
|
|
|
19
19
|
* This number also determines what features are available (e.g. sharding support starts at V3).
|
|
20
20
|
*/
|
|
21
21
|
private readonly writeVersion;
|
|
22
|
+
private readonly eventEmitter;
|
|
23
|
+
readonly events: Listenable<IdCompressorEvents>;
|
|
22
24
|
/**
|
|
23
25
|
* Max allowed initial cluster size.
|
|
24
26
|
*/
|
|
@@ -68,26 +70,17 @@ export declare class IdCompressor implements IIdCompressor, IIdCompressorCore {
|
|
|
68
70
|
* @param ghostSessionId - The session ID to start the ghost session with.
|
|
69
71
|
*/
|
|
70
72
|
startGhostSession(ghostSessionId: SessionId): void;
|
|
71
|
-
/**
|
|
72
|
-
* {@inheritdoc IIdCompressorCore.beginGhostSession}
|
|
73
|
-
*/
|
|
74
73
|
beginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void;
|
|
75
|
-
|
|
76
|
-
* {@inheritdoc IIdCompressorCore.shard}
|
|
77
|
-
*/
|
|
78
|
-
shard(newShardCount: number): SerializedIdCompressorWithOngoingSession[];
|
|
79
|
-
/**
|
|
80
|
-
* {@inheritdoc IIdCompressorCore.synchronizeWithShard}
|
|
81
|
-
*/
|
|
74
|
+
shard(newShardCount: number): SerializedIdCompressorShard[];
|
|
82
75
|
synchronizeWithShard(syncToken: ShardSynchronizationToken): void;
|
|
83
|
-
|
|
76
|
+
getChildShardSyncToken(childToken: ShardSynchronizationToken): ParentShardSynchronizationToken;
|
|
77
|
+
synchronizeWithParent(token: ParentShardSynchronizationToken): void;
|
|
84
78
|
/**
|
|
85
|
-
*
|
|
79
|
+
* Adds IDs through the next position in this shard's stride after the given generation count.
|
|
86
80
|
*/
|
|
81
|
+
private backfillToNextStridePosition;
|
|
82
|
+
private synchronizeChild;
|
|
87
83
|
disposeShard(): ShardSynchronizationToken | undefined;
|
|
88
|
-
/**
|
|
89
|
-
* {@inheritdoc IIdCompressorCore.getShardSyncToken}
|
|
90
|
-
*/
|
|
91
84
|
getShardSyncToken(): ShardSynchronizationToken | undefined;
|
|
92
85
|
/**
|
|
93
86
|
* Builds a token describing this shard's current progress.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idCompressor.d.ts","sourceRoot":"","sources":["../src/idCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,i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AAC;AA8BrC;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACtC,UAAU,EAAE,wCAAwC,EACpD,YAAY,EAAE,oBAAoB,EAClC,MAAM,CAAC,EAAE,mBAAmB,GAC1B,aAAa,GAAG,iBAAiB,CAAC;AACrC;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACtC,UAAU,EAAE,mCAAmC,EAC/C,YAAY,EAAE,SAAS,EACvB,YAAY,EAAE,oBAAoB,EAClC,MAAM,CAAC,EAAE,mBAAmB,GAC1B,aAAa,GAAG,iBAAiB,CAAC;AA8DrC;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACpC,UAAU,EAAE,aAAa,EACzB,WAAW,EAAE,IAAI,GACf,wCAAwC,CAAC;AAC5C;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACpC,UAAU,EAAE,aAAa,EACzB,WAAW,EAAE,KAAK,GAChB,mCAAmC,CAAC;AASvC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACrC,UAAU,EAAE,aAAa,GACvB,aAAa,GAAG,iBAAiB,CAMnC"}
|
package/dist/idCompressor.js
CHANGED
|
@@ -26,12 +26,25 @@ function rangeFinalizationError(expectedStart, actualStart) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
const MAX_STRIDE_LENGTH = 1000000;
|
|
29
|
+
/**
|
|
30
|
+
* Validates the generation count in a shard synchronization token.
|
|
31
|
+
*
|
|
32
|
+
* @param localGenCount - The number of positions filled, including backfilled positions.
|
|
33
|
+
* @throws {@link TypeError} if the count is not a nonnegative safe integer.
|
|
34
|
+
*/
|
|
35
|
+
function validateShardGenerationCount(localGenCount) {
|
|
36
|
+
if (!Number.isSafeInteger(localGenCount) || localGenCount < 0) {
|
|
37
|
+
throw new TypeError("Invalid shard synchronization token generation count.");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
29
40
|
/**
|
|
30
41
|
* See {@link IIdCompressor} and {@link IIdCompressorCore}
|
|
31
42
|
*/
|
|
32
43
|
class IdCompressor {
|
|
33
44
|
logger;
|
|
34
45
|
writeVersion;
|
|
46
|
+
eventEmitter = (0, client_utils_1.createEmitter)();
|
|
47
|
+
events = this.eventEmitter;
|
|
35
48
|
/**
|
|
36
49
|
* Max allowed initial cluster size.
|
|
37
50
|
*/
|
|
@@ -159,9 +172,6 @@ class IdCompressor {
|
|
|
159
172
|
(0, internal_1.assert)(!this.ongoingGhostSession, 0x8fe /* Ghost session already in progress. */);
|
|
160
173
|
this.ongoingGhostSession = { ghostSessionId };
|
|
161
174
|
}
|
|
162
|
-
/**
|
|
163
|
-
* {@inheritdoc IIdCompressorCore.beginGhostSession}
|
|
164
|
-
*/
|
|
165
175
|
beginGhostSession(ghostSessionId, ghostSessionCallback) {
|
|
166
176
|
if (this.shardingState) {
|
|
167
177
|
throw new Error("Cannot start a ghost session while sharded.");
|
|
@@ -174,9 +184,6 @@ class IdCompressor {
|
|
|
174
184
|
this.ongoingGhostSession = undefined;
|
|
175
185
|
}
|
|
176
186
|
}
|
|
177
|
-
/**
|
|
178
|
-
* {@inheritdoc IIdCompressorCore.shard}
|
|
179
|
-
*/
|
|
180
187
|
shard(newShardCount) {
|
|
181
188
|
if (!Number.isSafeInteger(newShardCount) || newShardCount <= 0) {
|
|
182
189
|
throw new Error("Shard count must be a positive safe integer");
|
|
@@ -230,13 +237,13 @@ class IdCompressor {
|
|
|
230
237
|
activeChildIds: new Set(),
|
|
231
238
|
shardId: childShardId,
|
|
232
239
|
};
|
|
233
|
-
shards.push(
|
|
240
|
+
shards.push({
|
|
241
|
+
serialized: child.serialize(true),
|
|
242
|
+
syncToken: child.makeShardToken(false),
|
|
243
|
+
});
|
|
234
244
|
}
|
|
235
245
|
return shards;
|
|
236
246
|
}
|
|
237
|
-
/**
|
|
238
|
-
* {@inheritdoc IIdCompressorCore.synchronizeWithShard}
|
|
239
|
-
*/
|
|
240
247
|
synchronizeWithShard(syncToken) {
|
|
241
248
|
const isNowLeaf = this.synchronizeChild(syncToken);
|
|
242
249
|
// A disposal token additionally reclaims the child's ID space. If reclaiming the last child
|
|
@@ -248,6 +255,47 @@ class IdCompressor {
|
|
|
248
255
|
}
|
|
249
256
|
}
|
|
250
257
|
}
|
|
258
|
+
getChildShardSyncToken(childToken) {
|
|
259
|
+
if (!this.shardingState?.activeChildIds.has(childToken.shardId)) {
|
|
260
|
+
throw new Error("Cannot get a synchronization token for an inactive child shard.");
|
|
261
|
+
}
|
|
262
|
+
const token = {
|
|
263
|
+
type: "parentIdSpaceShardSyncToken",
|
|
264
|
+
shardId: childToken.shardId,
|
|
265
|
+
localGenCount: this.localGenCount,
|
|
266
|
+
};
|
|
267
|
+
return token;
|
|
268
|
+
}
|
|
269
|
+
synchronizeWithParent(token) {
|
|
270
|
+
const state = this.shardingState;
|
|
271
|
+
if (token.type !== "parentIdSpaceShardSyncToken" ||
|
|
272
|
+
state?.shardId === undefined ||
|
|
273
|
+
state.shardId !== token.shardId) {
|
|
274
|
+
throw new Error("Invalid parent synchronization token for this child shard.");
|
|
275
|
+
}
|
|
276
|
+
validateShardGenerationCount(token.localGenCount);
|
|
277
|
+
if (token.localGenCount <= this.localGenCount) {
|
|
278
|
+
// A child can already be ahead through its own allocations. Its local range
|
|
279
|
+
// then includes the parent's IDs through this generation count.
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
this.backfillToNextStridePosition(token.localGenCount, state.currentStride);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Adds IDs through the next position in this shard's stride after the given generation count.
|
|
286
|
+
*/
|
|
287
|
+
backfillToNextStridePosition(targetGenCount, stride) {
|
|
288
|
+
if (targetGenCount <= this.localGenCount) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const count = Math.ceil((targetGenCount - this.localGenCount + 1) / stride) * stride;
|
|
292
|
+
const nextGenCount = this.localGenCount + count;
|
|
293
|
+
if (!Number.isSafeInteger(nextGenCount)) {
|
|
294
|
+
throw new TypeError("Shard progress exceeds the supported ID space.");
|
|
295
|
+
}
|
|
296
|
+
this.normalizer.addLocalRange(this.localGenCount + 1, count);
|
|
297
|
+
this.localGenCount = nextGenCount;
|
|
298
|
+
}
|
|
251
299
|
synchronizeChild(syncToken) {
|
|
252
300
|
const childDisposed = syncToken.disposed;
|
|
253
301
|
if (this.writeVersion < index_js_1.SerializationVersion.V3) {
|
|
@@ -262,33 +310,20 @@ class IdCompressor {
|
|
|
262
310
|
if (!activeChildIds.has(childShardId)) {
|
|
263
311
|
throw new Error(`Cannot synchronize with child with ID ${childShardId}: not in active children set`);
|
|
264
312
|
}
|
|
265
|
-
|
|
266
|
-
// child
|
|
313
|
+
validateShardGenerationCount(syncToken.localGenCount);
|
|
314
|
+
// A last-child disposal realigns on the original stride. Backfill before changing
|
|
315
|
+
// membership so invalid progress cannot accidentally reclaim the child.
|
|
316
|
+
const isLeaf = childDisposed && activeChildIds.size === 1;
|
|
317
|
+
this.backfillToNextStridePosition(syncToken.localGenCount, isLeaf ? originalStride : this.shardingState.currentStride);
|
|
318
|
+
// A plain synchronization leaves the child active so it can keep generating IDs.
|
|
267
319
|
if (childDisposed) {
|
|
268
320
|
activeChildIds.delete(childShardId);
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
this.shardingState.currentStride = originalStride;
|
|
273
|
-
}
|
|
274
|
-
// Read currentStride after the possible stride reset above, so that a leaf-making disposal
|
|
275
|
-
// realigns the parent on its original (reclaimed) stride rather than the wider sharded stride.
|
|
276
|
-
const { currentStride } = this.shardingState;
|
|
277
|
-
const childGenCount = syncToken.localGenCount;
|
|
278
|
-
// Realign parent to next position in its sequence if child is ahead
|
|
279
|
-
if (childGenCount > this.localGenCount) {
|
|
280
|
-
// Find next aligned position in parent's sequence after child's genCount
|
|
281
|
-
const distance = childGenCount - this.localGenCount + 1;
|
|
282
|
-
const steps = Math.ceil(distance / currentStride);
|
|
283
|
-
const count = steps * currentStride;
|
|
284
|
-
this.normalizer.addLocalRange(this.localGenCount + 1, count);
|
|
285
|
-
this.localGenCount += count;
|
|
321
|
+
if (isLeaf) {
|
|
322
|
+
this.shardingState.currentStride = originalStride;
|
|
323
|
+
}
|
|
286
324
|
}
|
|
287
325
|
return isLeaf;
|
|
288
326
|
}
|
|
289
|
-
/**
|
|
290
|
-
* {@inheritdoc IIdCompressorCore.dispose}
|
|
291
|
-
*/
|
|
292
327
|
disposeShard() {
|
|
293
328
|
if (this.shardingState === undefined) {
|
|
294
329
|
return undefined;
|
|
@@ -305,9 +340,6 @@ class IdCompressor {
|
|
|
305
340
|
makeCompressorUnusable(this);
|
|
306
341
|
return token;
|
|
307
342
|
}
|
|
308
|
-
/**
|
|
309
|
-
* {@inheritdoc IIdCompressorCore.getShardSyncToken}
|
|
310
|
-
*/
|
|
311
343
|
getShardSyncToken() {
|
|
312
344
|
if (this.shardingState === undefined) {
|
|
313
345
|
return undefined;
|
|
@@ -465,6 +497,7 @@ class IdCompressor {
|
|
|
465
497
|
this.telemetryLocalIdCount = 0;
|
|
466
498
|
}
|
|
467
499
|
(0, internal_1.assert)(!session.isEmpty(), 0x757 /* Empty sessions should not be created. */);
|
|
500
|
+
this.eventEmitter.emit("rangeFinalized", range);
|
|
468
501
|
}
|
|
469
502
|
addEmptyCluster(session, capacity) {
|
|
470
503
|
(0, internal_1.assert)(!this.ongoingGhostSession?.cluster, 0x8a8 /* IdCompressor should not be operated normally when in a ghost session */);
|