@fluid-experimental/tree 1.3.3 → 1.3.4
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/dist/id-compressor/IdCompressor.d.ts.map +1 -1
- package/dist/id-compressor/IdCompressor.js +26 -18
- package/dist/id-compressor/IdCompressor.js.map +1 -1
- package/dist/id-compressor/SessionIdNormalizer.d.ts +31 -4
- package/dist/id-compressor/SessionIdNormalizer.d.ts.map +1 -1
- package/dist/id-compressor/SessionIdNormalizer.js +64 -18
- package/dist/id-compressor/SessionIdNormalizer.js.map +1 -1
- package/lib/id-compressor/IdCompressor.d.ts.map +1 -1
- package/lib/id-compressor/IdCompressor.js +26 -18
- package/lib/id-compressor/IdCompressor.js.map +1 -1
- package/lib/id-compressor/SessionIdNormalizer.d.ts +31 -4
- package/lib/id-compressor/SessionIdNormalizer.d.ts.map +1 -1
- package/lib/id-compressor/SessionIdNormalizer.js +64 -18
- package/lib/id-compressor/SessionIdNormalizer.js.map +1 -1
- package/lib/test/IdCompressor.tests.js +210 -87
- package/lib/test/IdCompressor.tests.js.map +1 -1
- package/lib/test/SessionIdNormalizer.tests.js +124 -46
- package/lib/test/SessionIdNormalizer.tests.js.map +1 -1
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts +17 -5
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts.map +1 -1
- package/lib/test/utilities/IdCompressorTestUtilities.js +60 -14
- package/lib/test/utilities/IdCompressorTestUtilities.js.map +1 -1
- package/package.json +17 -17
- package/src/id-compressor/IdCompressor.ts +28 -17
- package/src/id-compressor/SessionIdNormalizer.ts +72 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdCompressor.d.ts","sourceRoot":"","sources":["../../src/id-compressor/IdCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAetE,OAAO,EACN,iBAAiB,EACjB,iBAAiB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{
|
|
|
357
357
|
if (currentClusterExists) {
|
|
358
358
|
if (isLocal) {
|
|
359
359
|
const lastKnownFinal = (_c = this.sessionIdNormalizer.getLastFinalId()) !== null && _c !== void 0 ? _c : (0, Common_1.fail)('Cluster exists but normalizer does not have an entry for it.');
|
|
360
|
-
const
|
|
360
|
+
const lastAlignedFinalInCluster = (currentBaseFinalId +
|
|
361
361
|
Math.min(currentCluster.count + finalizeCount, currentCluster.capacity) -
|
|
362
362
|
1);
|
|
363
|
-
if (
|
|
364
|
-
eagerFinalIdCount =
|
|
365
|
-
this.sessionIdNormalizer.addFinalIds((lastKnownFinal + 1),
|
|
363
|
+
if (lastAlignedFinalInCluster > lastKnownFinal) {
|
|
364
|
+
eagerFinalIdCount = lastAlignedFinalInCluster - (lastKnownFinal + 1);
|
|
365
|
+
this.sessionIdNormalizer.addFinalIds((lastKnownFinal + 1), lastAlignedFinalInCluster, currentCluster);
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
initialClusterCount = currentCluster.count;
|
|
@@ -393,9 +393,17 @@ class IdCompressor {
|
|
|
393
393
|
// overflow = 2: ----
|
|
394
394
|
// localIdPivot^
|
|
395
395
|
// lastFinalizedFinal^
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
|
|
396
|
+
const newLastFinalizedFinal = (currentBaseFinalId +
|
|
397
|
+
currentCluster.count -
|
|
398
|
+
1);
|
|
399
|
+
(0, Common_1.assert)(session.lastFinalizedLocalId !== undefined, 'Cluster already exists for session but there is no finalized local ID');
|
|
400
|
+
const finalPivot = (newLastFinalizedFinal - overflow + 1);
|
|
401
|
+
// Inform the normalizer of all IDs that we now know will end up being finalized into this cluster, including the ones
|
|
402
|
+
// that were given out as locals (non-eager) because they exceeded the bounds of the current cluster before it was expanded.
|
|
403
|
+
// It is safe to associate the unfinalized locals with their future final IDs even before the ranges for those locals are
|
|
404
|
+
// actually finalized, because total order broadcast guarantees that any usage of those final IDs will be observed after
|
|
405
|
+
// the finalization of the ranges.
|
|
406
|
+
this.sessionIdNormalizer.registerFinalIdBlock(finalPivot, expansionAmount, currentCluster);
|
|
399
407
|
(_d = this.logger) === null || _d === void 0 ? void 0 : _d.sendTelemetryEvent({
|
|
400
408
|
eventName: 'IdCompressor:ClusterExpansion',
|
|
401
409
|
sessionId: this.localSessionId,
|
|
@@ -461,8 +469,7 @@ class IdCompressor {
|
|
|
461
469
|
clusterCapacity: newCapacity,
|
|
462
470
|
clusterCount: remainingCount,
|
|
463
471
|
});
|
|
464
|
-
|
|
465
|
-
this.sessionIdNormalizer.addFinalIds(newBaseFinalId, lastFinalizedFinal, newCluster);
|
|
472
|
+
this.sessionIdNormalizer.registerFinalIdBlock(newBaseFinalId, newCluster.capacity, newCluster);
|
|
466
473
|
}
|
|
467
474
|
this.checkClusterForCollision(newCluster);
|
|
468
475
|
this.clustersAndOverridesInversion.set((0, NumericUuid_1.stableIdFromNumericUuid)(newCluster.baseUuid), {
|
|
@@ -712,10 +719,10 @@ class IdCompressor {
|
|
|
712
719
|
let eagerFinalId;
|
|
713
720
|
let cluster;
|
|
714
721
|
if (currentClusterDetails !== undefined) {
|
|
715
|
-
const { clusterBase } = currentClusterDetails;
|
|
716
722
|
cluster = currentClusterDetails.cluster;
|
|
717
723
|
const lastFinalKnown = sessionIdNormalizer.getLastFinalId();
|
|
718
|
-
if (lastFinalKnown !== undefined &&
|
|
724
|
+
if (lastFinalKnown !== undefined &&
|
|
725
|
+
lastFinalKnown - currentClusterDetails.clusterBase + 1 < cluster.capacity) {
|
|
719
726
|
eagerFinalId = (lastFinalKnown + 1);
|
|
720
727
|
}
|
|
721
728
|
}
|
|
@@ -866,7 +873,7 @@ class IdCompressor {
|
|
|
866
873
|
* @returns the ID in op space.
|
|
867
874
|
*/
|
|
868
875
|
normalizeToOpSpace(id) {
|
|
869
|
-
var _a, _b;
|
|
876
|
+
var _a, _b, _c;
|
|
870
877
|
if (isFinalId(id)) {
|
|
871
878
|
return id;
|
|
872
879
|
}
|
|
@@ -886,15 +893,16 @@ class IdCompressor {
|
|
|
886
893
|
if (override !== undefined) {
|
|
887
894
|
const inversionKey = IdCompressor.createInversionKey(override);
|
|
888
895
|
const compressionMapping = (_a = this.clustersAndOverridesInversion.get(inversionKey)) !== null && _a !== void 0 ? _a : (0, Common_1.fail)('Bimap is malformed.');
|
|
889
|
-
|
|
896
|
+
return !IdCompressor.isClusterInfo(compressionMapping) &&
|
|
890
897
|
!IdCompressor.isUnfinalizedOverride(compressionMapping) &&
|
|
891
|
-
compressionMapping.associatedLocalId === id
|
|
892
|
-
|
|
893
|
-
|
|
898
|
+
compressionMapping.associatedLocalId === id
|
|
899
|
+
? compressionMapping.originalOverridingFinal
|
|
900
|
+
: id;
|
|
894
901
|
}
|
|
895
|
-
|
|
902
|
+
const possibleFinal = this.sessionIdNormalizer.getFinalId(id);
|
|
903
|
+
return (_b = possibleFinal === null || possibleFinal === void 0 ? void 0 : possibleFinal[0]) !== null && _b !== void 0 ? _b : id;
|
|
896
904
|
}
|
|
897
|
-
const [correspondingFinal, cluster] = (
|
|
905
|
+
const [correspondingFinal, cluster] = (_c = this.sessionIdNormalizer.getFinalId(id)) !== null && _c !== void 0 ? _c : (0, Common_1.fail)('Locally created cluster should be added to the map when allocated');
|
|
898
906
|
if (cluster.overrides) {
|
|
899
907
|
const override = cluster.overrides.get(correspondingFinal);
|
|
900
908
|
if (typeof override === 'object' && override.originalOverridingFinal !== undefined) {
|