@fluidframework/id-compressor
Advanced tools
@@ -8,6 +8,6 @@ ## Beta API Report File for "@fluidframework/id-compressor" | ||
| // @beta @legacy | ||
| export function createIdCompressor(logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore; | ||
| export function createIdCompressor(logger?: ITelemetryBaseLogger): IIdCompressor; | ||
| // @beta @legacy | ||
| export function createIdCompressor(sessionId: SessionId, logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore; | ||
| export function createIdCompressor(sessionId: SessionId, logger?: ITelemetryBaseLogger): IIdCompressor; | ||
@@ -18,6 +18,6 @@ // @beta @legacy | ||
| // @beta @legacy | ||
| export function deserializeIdCompressor(serialized: SerializedIdCompressorWithOngoingSession, logger?: ITelemetryLoggerExt): IIdCompressor & IIdCompressorCore; | ||
| export function deserializeIdCompressor(serialized: SerializedIdCompressorWithOngoingSession, logger?: ITelemetryLoggerExt): IIdCompressor; | ||
| // @beta @legacy | ||
| export function deserializeIdCompressor(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId, logger?: ITelemetryLoggerExt): IIdCompressor & IIdCompressorCore; | ||
| export function deserializeIdCompressor(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId, logger?: ITelemetryLoggerExt): IIdCompressor; | ||
@@ -49,13 +49,2 @@ // @beta @legacy | ||
| // @beta @deprecated @legacy | ||
| export interface IIdCompressorCore { | ||
| beginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void; | ||
| finalizeCreationRange(range: IdCreationRange): void; | ||
| resetUnfinalizedCreationRange(): void; | ||
| serialize(withSession: true): SerializedIdCompressorWithOngoingSession; | ||
| serialize(withSession: false): SerializedIdCompressorWithNoSession; | ||
| takeNextCreationRange(): IdCreationRange; | ||
| takeUnfinalizedCreationRange(): IdCreationRange; | ||
| } | ||
| // @public | ||
@@ -62,0 +51,0 @@ export type OpSpaceCompressedId = number & { |
+24
-0
| # @fluidframework/id-compressor | ||
| ## 2.100.0 | ||
| ### Minor Changes | ||
| - Node 22 is now the minimum supported Node.js version ([#27116](https://github.com/microsoft/FluidFramework/pull/27116)) [e8214d29663](https://github.com/microsoft/FluidFramework/commit/e8214d29663f5ee98d737daed82506a25d8de8d0) | ||
| All Fluid Framework client packages now require Node.js 22 or later. This aligns with the standing Node upgrade policy as Node 20 reaches end-of-life on April 30, 2026. | ||
| - Remove IIdCompressorCore from legacy API surface ([#27146](https://github.com/microsoft/FluidFramework/pull/27146)) [a0d3a13888a](https://github.com/microsoft/FluidFramework/commit/a0d3a13888ae9020e1a4231f4c3ff810b6aaac19) | ||
| The `IIdCompressorCore` interface has been removed from the `@legacy` API surface and is now `@internal`. | ||
| This was previously deprecated in 2.92.0. | ||
| The return types of `createIdCompressor` and `deserializeIdCompressor` have been narrowed from `IIdCompressor & IIdCompressorCore` to `IIdCompressor`. | ||
| #### Migration | ||
| - **`serialize()`**: | ||
| Use the `serializeIdCompressor(compressor, withSession)` free function instead of calling `compressor.serialize(withSession)` directly. | ||
| - **`takeNextCreationRange()`, `takeUnfinalizedCreationRange()`, `finalizeCreationRange()`, `beginGhostSession()`**: | ||
| These are internal runtime operations that should not be called by external consumers. | ||
| If you depend on these APIs, please file an issue on the FluidFramework repository describing your use case. | ||
| - **Return types of `createIdCompressor` / `deserializeIdCompressor`**: | ||
| Type your variables as `IIdCompressor` rather than `IIdCompressor & IIdCompressorCore`. | ||
| ## 2.93.0 | ||
@@ -4,0 +28,0 @@ |
+13
-36
@@ -6,3 +6,4 @@ /*! | ||
| import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces"; | ||
| import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal"; | ||
| import type { TelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal"; | ||
| import type { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/legacy"; | ||
| import { type Index } from "./persistanceUtilities.js"; | ||
@@ -43,3 +44,3 @@ import { Sessions } from "./sessions.js"; | ||
| private ongoingGhostSession?; | ||
| constructor(localSessionIdOrDeserialized: SessionId | Sessions, logger: ITelemetryLoggerExt | undefined); | ||
| constructor(localSessionIdOrDeserialized: SessionId | Sessions, logger: TelemetryLoggerExt | undefined); | ||
| generateCompressedId(): SessionSpaceCompressedId; | ||
@@ -73,3 +74,3 @@ generateDocumentUniqueId(): (SessionSpaceCompressedId & OpSpaceCompressedId) | StableId; | ||
| serialized: SerializedIdCompressorWithOngoingSession; | ||
| logger?: ITelemetryLoggerExt | undefined; | ||
| logger?: TelemetryLoggerExt | undefined; | ||
| newSessionId?: never; | ||
@@ -79,5 +80,5 @@ } | { | ||
| newSessionId: SessionId; | ||
| logger?: ITelemetryLoggerExt | undefined; | ||
| logger?: TelemetryLoggerExt | undefined; | ||
| }): IdCompressor; | ||
| static deserialize2_0(index: Index, sessionId: SessionId | undefined, logger: ITelemetryLoggerExt | undefined): IdCompressor; | ||
| static deserialize2_0(index: Index, sessionId: SessionId | undefined, logger: TelemetryLoggerExt | undefined): IdCompressor; | ||
| equals(other: IdCompressor, includeLocalState: boolean): boolean; | ||
@@ -88,11 +89,5 @@ } | ||
| * | ||
| * @remarks | ||
| * The returned compressor previously also implemented {@link IIdCompressorCore}, but that | ||
| * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return | ||
| * type in a future release. Consumers should type variables as {@link IIdCompressor} and | ||
| * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly. | ||
| * | ||
| * @legacy @beta | ||
| */ | ||
| export declare function createIdCompressor(logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore; | ||
| export declare function createIdCompressor(logger?: ITelemetryBaseLogger): IIdCompressor; | ||
| /** | ||
@@ -102,35 +97,17 @@ * Create a new {@link IIdCompressor}. | ||
| * | ||
| * @remarks | ||
| * The returned compressor previously also implemented {@link IIdCompressorCore}, but that | ||
| * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return | ||
| * type in a future release. Consumers should type variables as {@link IIdCompressor} and | ||
| * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly. | ||
| * | ||
| * @legacy @beta | ||
| */ | ||
| export declare function createIdCompressor(sessionId: SessionId, logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore; | ||
| export declare function createIdCompressor(sessionId: SessionId, logger?: ITelemetryBaseLogger): IIdCompressor; | ||
| /** | ||
| * Deserializes the supplied state into an ID compressor. | ||
| * | ||
| * @remarks | ||
| * The returned compressor previously also implemented {@link IIdCompressorCore}, but that | ||
| * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return | ||
| * type in a future release. Consumers should type variables as {@link IIdCompressor} and | ||
| * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly. | ||
| * | ||
| * @legacy @beta | ||
| */ | ||
| export declare function deserializeIdCompressor(serialized: SerializedIdCompressorWithOngoingSession, logger?: ITelemetryLoggerExt): IIdCompressor & IIdCompressorCore; | ||
| export declare function deserializeIdCompressor(serialized: SerializedIdCompressorWithOngoingSession, logger?: ITelemetryLoggerExt): IIdCompressor; | ||
| /** | ||
| * Deserializes the supplied state into an ID compressor. | ||
| * | ||
| * @remarks | ||
| * The returned compressor previously also implemented {@link IIdCompressorCore}, but that | ||
| * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return | ||
| * type in a future release. Consumers should type variables as {@link IIdCompressor} and | ||
| * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly. | ||
| * | ||
| * @legacy @beta | ||
| */ | ||
| export declare function deserializeIdCompressor(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId, logger?: ITelemetryLoggerExt): IIdCompressor & IIdCompressorCore; | ||
| export declare function deserializeIdCompressor(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId, logger?: ITelemetryLoggerExt): IIdCompressor; | ||
| /** | ||
@@ -158,5 +135,5 @@ * Serializes an ID compressor. | ||
| * always implement both {@link IIdCompressor} and {@link IIdCompressorCore}, but their | ||
| * return types will be narrowed to {@link IIdCompressor} to keep {@link IIdCompressorCore} | ||
| * out of the `@legacy` API surface. Internal consumers that need access to core | ||
| * compressor operations (serialization, range management, etc.) should use this function. | ||
| * public return type is narrowed to {@link IIdCompressor}. Internal consumers that | ||
| * need access to core compressor operations (serialization, range management, etc.) | ||
| * use this function to recover the {@link IIdCompressorCore} surface. | ||
| * | ||
@@ -163,0 +140,0 @@ * @param compressor - A compressor created by `createIdCompressor` or |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"idCompressor.d.ts","sourceRoot":"","sources":["../src/idCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,OAAO,EACN,KAAK,mBAAmB,EAGxB,MAAM,0CAA0C,CAAC;AASlD,OAAO,EACN,KAAK,KAAK,EAOV,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAGN,QAAQ,EAKR,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACX,aAAa,EAEb,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EAEnB,mCAAmC,EACnC,wCAAwC,EACxC,SAAS,EACT,wBAAwB,EACxB,QAAQ,EACR,MAAM,kBAAkB,CAAC;AAwB1B;;GAEG;AAEH,qBAAa,YAAa,YAAW,aAAa,EAAE,iBAAiB;IAmDnE,OAAO,CAAC,QAAQ,CAAC,MAAM;IAlDxB;;OAEG;IACH,gBAAuB,cAAc,SAAW;IAIhD,SAAgB,cAAc,EAAE,SAAS,CAAC;IAC1C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgC;IAE3D,OAAO,CAAC,aAAa,CAAK;IAM1B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB,CAAK;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAM/C;;;;;OAKG;IAEH,OAAO,CAAC,wBAAwB,CAAe;IAE/C,OAAO,CAAC,qBAA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M,CAAC,cAAc,CACpB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,MAAM,EAAE,kBAAkB,GAAG,SAAS,GACpC,YAAY;IA8DR,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,OAAO,GAAG,OAAO;CAgBvE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,aAAa,CAAC;AACjF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,SAAS,EACpB,MAAM,CAAC,EAAE,oBAAoB,GAC3B,aAAa,CAAC;AAyBjB;;;;GAIG;AACH,wBAAgB,uBAAuB,CACtC,UAAU,EAAE,wCAAwC,EACpD,MAAM,CAAC,EAAE,mBAAmB,GAC1B,aAAa,CAAC;AACjB;;;;GAIG;AACH,wBAAgB,uBAAuB,CACtC,UAAU,EAAE,mCAAmC,EAC/C,YAAY,EAAE,SAAS,EACvB,MAAM,CAAC,EAAE,mBAAmB,GAC1B,aAAa,CAAC;AAwBjB;;;;;;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"} |
@@ -31,3 +31,2 @@ "use strict"; | ||
| */ | ||
| // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API | ||
| class IdCompressor { | ||
@@ -576,3 +575,3 @@ // #endregion | ||
| serialized: serialized, | ||
| logger: loggerOrUndefined, | ||
| logger: (0, internal_2.extractTelemetryLoggerExt)(loggerOrUndefined), | ||
| newSessionId: sessionIdOrLogger, | ||
@@ -584,3 +583,3 @@ }); | ||
| serialized: serialized, | ||
| logger: sessionIdOrLogger, | ||
| logger: (0, internal_2.extractTelemetryLoggerExt)(sessionIdOrLogger), | ||
| }); | ||
@@ -600,5 +599,5 @@ } | ||
| * always implement both {@link IIdCompressor} and {@link IIdCompressorCore}, but their | ||
| * return types will be narrowed to {@link IIdCompressor} to keep {@link IIdCompressorCore} | ||
| * out of the `@legacy` API surface. Internal consumers that need access to core | ||
| * compressor operations (serialization, range management, etc.) should use this function. | ||
| * public return type is narrowed to {@link IIdCompressor}. Internal consumers that | ||
| * need access to core compressor operations (serialization, range management, etc.) | ||
| * use this function to recover the {@link IIdCompressorCore} surface. | ||
| * | ||
@@ -612,3 +611,2 @@ * @param compressor - A compressor created by `createIdCompressor` or | ||
| (0, internal_1.assert)("serialize" in compressor, 0xced /* Expected compressor to implement IIdCompressorCore */); | ||
| // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API | ||
| return compressor; | ||
@@ -615,0 +613,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"idCompressor.js","sourceRoot":"","sources":["../src/idCompressor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8E;AAE9E,kEAA6D;AAC7D,uEAIkD;AAElD,mDAA6C;AAC7C,qDAK0B;AAC1B,uEAQmC;AACnC,2EAAqE;AACrE,+CAQuB;AAcvB,iDAQwB;AAExB;;;GAGG;AACH,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEhC,SAAS,sBAAsB,CAAC,aAAqB,EAAE,WAAmB;IACzE,OAAO,IAAI,uBAAY,CAAC,+BAA+B,EAAE;QACxD,aAAa;QACb,WAAW;KACX,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,qHAAqH;AACrH,MAAa,YAAY;IA+CxB,aAAa;IAEb,YACC,4BAAkD,EACjC,MAAuC;QAAvC,WAAM,GAAN,MAAM,CA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CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAND,sDAMC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,sBAAsB,CACrC,UAAyB;IAGzB,IAAA,iBAAM,EACL,WAAW,IAAI,UAAU,EACzB,KAAK,CAAC,wDAAwD,CAC9D,CAAC;IACF,qHAAqH;IACrH,OAAO,UAA+C,CAAC;AACxD,CAAC;AAVD,wDAUC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tLoggingError,\n\tcreateChildLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { FinalSpace } from \"./finalSpace.js\";\nimport {\n\ttype FinalCompressedId,\n\ttype LocalCompressedId,\n\ttype NumericUuid,\n\tisFinalId,\n} from \"./identifiers.js\";\nimport {\n\ttype Index,\n\treadBoolean,\n\treadNumber,\n\treadNumericUuid,\n\twriteBoolean,\n\twriteNumber,\n\twriteNumericUuid,\n} from \"./persistanceUtilities.js\";\nimport { SessionSpaceNormalizer } from \"./sessionSpaceNormalizer.js\";\nimport {\n\ttype IdCluster,\n\tSession,\n\tSessions,\n\tgetAlignedFinal,\n\tgetAlignedLocal,\n\tlastFinalizedFinal,\n\tlastFinalizedLocal,\n} from \"./sessions.js\";\nimport type {\n\tIIdCompressor,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n\tIIdCompressorCore,\n\tIdCreationRange,\n\tOpSpaceCompressedId,\n\tSerializedIdCompressor,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"./types/index.js\";\nimport {\n\tcreateSessionId,\n\tgenCountFromLocalId,\n\tlocalIdFromGenCount,\n\tnumericUuidFromStableId,\n\toffsetNumericUuid,\n\tstableIdFromNumericUuid,\n\tsubtractNumericUuids,\n} from \"./utilities.js\";\n\n/**\n * The version of IdCompressor that is currently persisted.\n * This should not be changed without careful consideration to compatibility.\n */\nconst currentWrittenVersion = 2;\n\nfunction rangeFinalizationError(expectedStart: number, actualStart: number): LoggingError {\n\treturn new LoggingError(\"Ranges finalized out of order\", {\n\t\texpectedStart,\n\t\tactualStart,\n\t});\n}\n\n/**\n * See {@link IIdCompressor} and {@link IIdCompressorCore}\n */\n// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\nexport class IdCompressor implements IIdCompressor, IIdCompressorCore {\n\t/**\n\t * Max allowed initial cluster size.\n\t */\n\tpublic static readonly maxClusterSize = 2 ** 20;\n\n\t// #region Local state\n\n\tpublic readonly localSessionId: SessionId;\n\tprivate readonly localSession: Session;\n\tprivate readonly normalizer = new SessionSpaceNormalizer();\n\t// The number of IDs generated by the local session\n\tprivate localGenCount = 0;\n\n\t// #endregion\n\n\t// #region Final state\n\n\t/**\n\t * The gen count to be annotated on the range returned by the next call to `takeNextCreationRange`.\n\t * This is advanced to `generatedIdCount` + 1 each time it is called.\n\t * On the other hand, when `resetUnfinalizedCreationRange` is called,\n\t * this is moved back to the start of the unfinalized range, to ensure those IDs are included in the next range.\n\t */\n\tprivate nextRangeBaseGenCount = 1;\n\tprivate readonly sessions = new Sessions();\n\tprivate readonly finalSpace = new FinalSpace();\n\n\t// #endregion\n\n\t// #region Ephemeral state\n\n\t/**\n\t * Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.\n\t * Eventually, this can be adjusted dynamically to have cluster reservation policies that\n\t * optimize the number of eager finals.\n\t * It is not readonly as it is accessed by tests for clear-box testing.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/prefer-readonly\n\tprivate nextRequestedClusterSize: number = 512;\n\t// The number of local IDs generated since the last telemetry was sent.\n\tprivate telemetryLocalIdCount = 0;\n\t// The number of eager final IDs generated since the last telemetry was sent.\n\tprivate telemetryEagerFinalIdCount = 0;\n\t// The ongoing ghost session, if one exists.\n\tprivate ongoingGhostSession?: { cluster?: IdCluster; ghostSessionId: SessionId } | undefined;\n\n\t// #endregion\n\n\tpublic constructor(\n\t\tlocalSessionIdOrDeserialized: SessionId | Sessions,\n\t\tprivate readonly logger: ITelemetryLoggerExt | undefined,\n\t) {\n\t\tif (typeof localSessionIdOrDeserialized === \"string\") {\n\t\t\tthis.localSessionId = localSessionIdOrDeserialized;\n\t\t\tthis.localSession = this.sessions.getOrCreate(localSessionIdOrDeserialized);\n\t\t} else {\n\t\t\t// Deserialize case\n\t\t\tthis.sessions = localSessionIdOrDeserialized;\n\t\t\t// As policy, the first session is always the local session. Preserve this invariant\n\t\t\t// during deserialization.\n\t\t\tconst firstSession = localSessionIdOrDeserialized.sessions().next();\n\t\t\tassert(!firstSession.done, 0x754 /* First session must be present. */);\n\t\t\tthis.localSession = firstSession.value;\n\t\t\tthis.localSessionId = stableIdFromNumericUuid(\n\t\t\t\tthis.localSession.sessionUuid,\n\t\t\t) as SessionId;\n\t\t}\n\t}\n\n\tpublic generateCompressedId(): SessionSpaceCompressedId {\n\t\t// This ghost session code inside this block should not be changed without a version bump (it is performed at a consensus point)\n\t\tif (this.ongoingGhostSession) {\n\t\t\tif (this.ongoingGhostSession.cluster === undefined) {\n\t\t\t\tthis.ongoingGhostSession.cluster = this.addEmptyCluster(\n\t\t\t\t\tthis.sessions.getOrCreate(this.ongoingGhostSession.ghostSessionId),\n\t\t\t\t\t1,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.ongoingGhostSession.cluster.capacity++;\n\t\t\t}\n\t\t\tthis.ongoingGhostSession.cluster.count++;\n\t\t\treturn lastFinalizedFinal(\n\t\t\t\tthis.ongoingGhostSession.cluster,\n\t\t\t) as unknown as SessionSpaceCompressedId;\n\t\t} else {\n\t\t\tthis.localGenCount++;\n\t\t\tconst lastCluster = this.localSession.getLastCluster();\n\t\t\tif (lastCluster === undefined) {\n\t\t\t\tthis.telemetryLocalIdCount++;\n\t\t\t\treturn this.generateNextLocalId();\n\t\t\t}\n\n\t\t\t// If there exists a cluster of final IDs already claimed by the local session that still has room in it,\n\t\t\t// it is known prior to range sequencing what a local ID's corresponding final ID will be.\n\t\t\t// In this case, it is safe to return the final ID immediately. This is guaranteed to be safe because\n\t\t\t// any op that the local session sends that contains one of those final IDs are guaranteed to arrive to\n\t\t\t// collaborators *after* the one containing the creation range.\n\t\t\tconst clusterOffset = this.localGenCount - genCountFromLocalId(lastCluster.baseLocalId);\n\t\t\tif (lastCluster.capacity > clusterOffset) {\n\t\t\t\tthis.telemetryEagerFinalIdCount++;\n\t\t\t\t// Space in the cluster: eager final\n\t\t\t\treturn ((lastCluster.baseFinalId as number) +\n\t\t\t\t\tclusterOffset) as SessionSpaceCompressedId;\n\t\t\t}\n\t\t\t// No space in the cluster, return next local\n\t\t\tthis.telemetryLocalIdCount++;\n\t\t\treturn this.generateNextLocalId();\n\t\t}\n\t}\n\n\tpublic generateDocumentUniqueId():\n\t\t| (SessionSpaceCompressedId & OpSpaceCompressedId)\n\t\t| StableId {\n\t\tconst id = this.generateCompressedId();\n\t\treturn isFinalId(id) ? id : this.decompress(id);\n\t}\n\n\t/**\n\t * Starts a ghost session. Only exposed for test purposes (this class is not exported from the package).\n\t * @param ghostSessionId - The session ID to start the ghost session with.\n\t */\n\tpublic startGhostSession(ghostSessionId: SessionId): void {\n\t\tassert(!this.ongoingGhostSession, 0x8fe /* Ghost session already in progress. */);\n\t\tthis.ongoingGhostSession = { ghostSessionId };\n\t}\n\n\t/**\n\t * {@inheritdoc IIdCompressorCore.beginGhostSession}\n\t */\n\tpublic beginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void {\n\t\tthis.startGhostSession(ghostSessionId);\n\t\ttry {\n\t\t\tghostSessionCallback();\n\t\t} finally {\n\t\t\tthis.ongoingGhostSession = undefined;\n\t\t}\n\t}\n\n\tprivate generateNextLocalId(): LocalCompressedId {\n\t\t// Must tell the normalizer that we generated a local ID\n\t\tthis.normalizer.addLocalRange(this.localGenCount, 1);\n\t\treturn localIdFromGenCount(this.localGenCount);\n\t}\n\n\tpublic takeNextCreationRange(): IdCreationRange {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0x8a6 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\tconst count = this.localGenCount - (this.nextRangeBaseGenCount - 1);\n\t\tif (count === 0) {\n\t\t\treturn {\n\t\t\t\tsessionId: this.localSessionId,\n\t\t\t};\n\t\t}\n\t\tconst range: IdCreationRange = {\n\t\t\tsessionId: this.localSessionId,\n\t\t\tids: {\n\t\t\t\tfirstGenCount: this.nextRangeBaseGenCount,\n\t\t\t\tcount,\n\t\t\t\trequestedClusterSize: this.nextRequestedClusterSize,\n\t\t\t\tlocalIdRanges: this.normalizer.getRangesBetween(\n\t\t\t\t\tthis.nextRangeBaseGenCount,\n\t\t\t\t\tthis.localGenCount,\n\t\t\t\t),\n\t\t\t},\n\t\t};\n\t\treturn this.updateToRange(range);\n\t}\n\n\tpublic takeUnfinalizedCreationRange(): IdCreationRange {\n\t\tthis.resetUnfinalizedCreationRange();\n\t\treturn this.takeNextCreationRange();\n\t}\n\n\tpublic resetUnfinalizedCreationRange(): void {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0xcec /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\n\t\tconst lastLocalCluster = this.localSession.getLastCluster();\n\t\tthis.nextRangeBaseGenCount =\n\t\t\tlastLocalCluster === undefined\n\t\t\t\t? 1\n\t\t\t\t: genCountFromLocalId(\n\t\t\t\t\t\t(lastLocalCluster.baseLocalId - lastLocalCluster.count) as LocalCompressedId,\n\t\t\t\t\t);\n\t}\n\n\tprivate updateToRange(range: IdCreationRange): IdCreationRange {\n\t\tthis.nextRangeBaseGenCount = this.localGenCount + 1;\n\t\treturn IdCompressor.assertValidRange(range);\n\t}\n\n\tprivate static assertValidRange(range: IdCreationRange): IdCreationRange {\n\t\tif (range.ids === undefined) {\n\t\t\treturn range;\n\t\t}\n\t\tconst { count, requestedClusterSize } = range.ids;\n\t\tassert(count > 0, 0x755 /* Malformed ID Range. */);\n\t\tassert(requestedClusterSize > 0, 0x876 /* Clusters must have a positive capacity. */);\n\t\tassert(\n\t\t\trequestedClusterSize <= IdCompressor.maxClusterSize,\n\t\t\t0x877 /* Clusters must not exceed max cluster size. */,\n\t\t);\n\t\treturn range;\n\t}\n\n\tpublic finalizeCreationRange(range: IdCreationRange): void {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0x8a7 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\t// Check if the range has IDs\n\t\tif (range.ids === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tIdCompressor.assertValidRange(range);\n\t\tconst { sessionId, ids } = range;\n\t\tconst { count, firstGenCount, requestedClusterSize } = ids;\n\t\tconst session = this.sessions.getOrCreate(sessionId);\n\t\tconst isLocal = session === this.localSession;\n\t\tconst rangeBaseLocal = localIdFromGenCount(firstGenCount);\n\t\tlet lastCluster = session.getLastCluster();\n\t\tif (lastCluster === undefined) {\n\t\t\t// This is the first cluster in the session space\n\t\t\tif (rangeBaseLocal !== -1) {\n\t\t\t\tthrow rangeFinalizationError(-1, rangeBaseLocal);\n\t\t\t}\n\t\t\tlastCluster = this.addEmptyCluster(session, requestedClusterSize + count);\n\t\t\tif (isLocal) {\n\t\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\t\teventName: \"RuntimeIdCompressor:FirstCluster\",\n\t\t\t\t\tsessionId: this.localSessionId,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tconst remainingCapacity = lastCluster.capacity - lastCluster.count;\n\t\tif (lastCluster.baseLocalId - lastCluster.count !== rangeBaseLocal) {\n\t\t\tthrow rangeFinalizationError(\n\t\t\t\tlastCluster.baseLocalId - lastCluster.count,\n\t\t\t\trangeBaseLocal,\n\t\t\t);\n\t\t}\n\n\t\tif (remainingCapacity >= count) {\n\t\t\t// The current range fits in the existing cluster\n\t\t\tlastCluster.count += count;\n\t\t} else {\n\t\t\tconst overflow = count - remainingCapacity;\n\t\t\tconst newClaimedFinalCount = overflow + requestedClusterSize;\n\t\t\tif (lastCluster === this.finalSpace.getLastCluster()) {\n\t\t\t\t// The last cluster in the sessions chain is the last cluster globally, so it can be expanded.\n\t\t\t\tlastCluster.capacity += newClaimedFinalCount;\n\t\t\t\tlastCluster.count += count;\n\t\t\t\tassert(\n\t\t\t\t\t!this.sessions.clusterCollides(lastCluster),\n\t\t\t\t\t0x756 /* Cluster collision detected. */,\n\t\t\t\t);\n\t\t\t\tif (isLocal) {\n\t\t\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"RuntimeIdCompressor:ClusterExpansion\",\n\t\t\t\t\t\tsessionId: this.localSessionId,\n\t\t\t\t\t\tpreviousCapacity: lastCluster.capacity - newClaimedFinalCount,\n\t\t\t\t\t\tnewCapacity: lastCluster.capacity,\n\t\t\t\t\t\toverflow,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// The last cluster in the sessions chain is *not* the last cluster globally. Fill and overflow to new.\n\t\t\t\tlastCluster.count = lastCluster.capacity;\n\t\t\t\tconst newCluster = this.addEmptyCluster(session, newClaimedFinalCount);\n\t\t\t\tnewCluster.count += overflow;\n\t\t\t\tif (isLocal) {\n\t\t\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"RuntimeIdCompressor:NewCluster\",\n\t\t\t\t\t\tsessionId: this.localSessionId,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (isLocal) {\n\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\teventName: \"RuntimeIdCompressor:IdCompressorStatus\",\n\t\t\t\teagerFinalIdCount: this.telemetryEagerFinalIdCount,\n\t\t\t\tlocalIdCount: this.telemetryLocalIdCount,\n\t\t\t\tsessionId: this.localSessionId,\n\t\t\t});\n\t\t\tthis.telemetryEagerFinalIdCount = 0;\n\t\t\tthis.telemetryLocalIdCount = 0;\n\t\t}\n\n\t\tassert(!session.isEmpty(), 0x757 /* Empty sessions should not be created. */);\n\t}\n\n\tprivate addEmptyCluster(session: Session, capacity: number): IdCluster {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession?.cluster,\n\t\t\t0x8a8 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\tconst newCluster = session.addNewCluster(\n\t\t\tthis.finalSpace.getAllocatedIdLimit(),\n\t\t\tcapacity,\n\t\t\t0,\n\t\t);\n\t\tassert(\n\t\t\t!this.sessions.clusterCollides(newCluster),\n\t\t\t0x758 /* Cluster collision detected. */,\n\t\t);\n\t\tthis.finalSpace.addCluster(newCluster);\n\t\treturn newCluster;\n\t}\n\n\tpublic normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId {\n\t\tif (isFinalId(id)) {\n\t\t\treturn id;\n\t\t} else {\n\t\t\tconst local = id as unknown as LocalCompressedId;\n\t\t\tif (!this.normalizer.contains(local)) {\n\t\t\t\tthrow new Error(\"Invalid ID to normalize.\");\n\t\t\t}\n\t\t\tconst finalForm = this.localSession.tryConvertToFinal(local, true);\n\t\t\treturn finalForm === undefined\n\t\t\t\t? (local as unknown as OpSpaceCompressedId)\n\t\t\t\t: (finalForm as OpSpaceCompressedId);\n\t\t}\n\t}\n\n\tpublic normalizeToSessionSpace(\n\t\tid: OpSpaceCompressedId,\n\t\toriginSessionId: SessionId,\n\t): SessionSpaceCompressedId {\n\t\tif (isFinalId(id)) {\n\t\t\tconst containingCluster = this.localSession.getClusterByAllocatedFinal(id);\n\t\t\tif (containingCluster === undefined) {\n\t\t\t\t// Does not exist in local cluster chain\n\t\t\t\tif (id >= this.finalSpace.getFinalizedIdLimit()) {\n\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t}\n\t\t\t\treturn id as unknown as SessionSpaceCompressedId;\n\t\t\t} else {\n\t\t\t\tconst alignedLocal = getAlignedLocal(containingCluster, id);\n\t\t\t\tif (this.normalizer.contains(alignedLocal)) {\n\t\t\t\t\treturn alignedLocal;\n\t\t\t\t} else {\n\t\t\t\t\tif (genCountFromLocalId(alignedLocal) > this.localGenCount) {\n\t\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t\t}\n\t\t\t\t\treturn id as unknown as SessionSpaceCompressedId;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst localToNormalize = id as unknown as LocalCompressedId;\n\t\t\tif (originSessionId === this.localSessionId) {\n\t\t\t\tif (this.normalizer.contains(localToNormalize)) {\n\t\t\t\t\treturn localToNormalize;\n\t\t\t\t} else {\n\t\t\t\t\t// We never generated this local ID, so fail\n\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// LocalId from a remote session\n\t\t\t\tconst remoteSession = this.sessions.get(originSessionId);\n\t\t\t\tif (remoteSession === undefined) {\n\t\t\t\t\tthrow new Error(\"No IDs have ever been finalized by the supplied session.\");\n\t\t\t\t}\n\t\t\t\tconst correspondingFinal = remoteSession.tryConvertToFinal(localToNormalize, false);\n\t\t\t\tif (correspondingFinal === undefined) {\n\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t}\n\t\t\t\treturn correspondingFinal as unknown as SessionSpaceCompressedId;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic decompress(id: SessionSpaceCompressedId): StableId {\n\t\tif (isFinalId(id)) {\n\t\t\tconst containingCluster = Session.getContainingCluster(id, this.finalSpace.clusters);\n\t\t\tif (containingCluster === undefined) {\n\t\t\t\tthrow new Error(\"Unknown ID\");\n\t\t\t}\n\t\t\tconst alignedLocal = getAlignedLocal(containingCluster, id);\n\t\t\tconst alignedGenCount = genCountFromLocalId(alignedLocal);\n\t\t\tconst lastFinalizedGenCount = genCountFromLocalId(lastFinalizedLocal(containingCluster));\n\t\t\tif (alignedGenCount > lastFinalizedGenCount) {\n\t\t\t\t// should be an eager final id generated by the local session\n\t\t\t\tif (containingCluster.session === this.localSession) {\n\t\t\t\t\tassert(!this.normalizer.contains(alignedLocal), 0x759 /* Normalizer out of sync. */);\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"Unknown ID\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn stableIdFromNumericUuid(\n\t\t\t\toffsetNumericUuid(containingCluster.session.sessionUuid, alignedGenCount - 1),\n\t\t\t);\n\t\t} else {\n\t\t\tconst localToDecompress = id as unknown as LocalCompressedId;\n\t\t\tif (!this.normalizer.contains(localToDecompress)) {\n\t\t\t\tthrow new Error(\"Unknown ID\");\n\t\t\t}\n\t\t\treturn stableIdFromNumericUuid(\n\t\t\t\toffsetNumericUuid(\n\t\t\t\t\tthis.localSession.sessionUuid,\n\t\t\t\t\tgenCountFromLocalId(localToDecompress) - 1,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic recompress(uncompressed: StableId): SessionSpaceCompressedId {\n\t\tconst recompressed = this.tryRecompress(uncompressed);\n\t\tif (recompressed === undefined) {\n\t\t\tthrow new Error(\"Could not recompress.\");\n\t\t}\n\t\treturn recompressed;\n\t}\n\n\tpublic tryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined {\n\t\tconst match = this.sessions.getContainingCluster(uncompressed);\n\t\tif (match === undefined) {\n\t\t\tconst numericUncompressed = numericUuidFromStableId(uncompressed);\n\t\t\tconst offset = subtractNumericUuids(numericUncompressed, this.localSession.sessionUuid);\n\t\t\tif (offset < Number.MAX_SAFE_INTEGER) {\n\t\t\t\tconst genCountEquivalent = Number(offset) + 1;\n\t\t\t\tconst localEquivalent = localIdFromGenCount(genCountEquivalent);\n\t\t\t\tif (this.normalizer.contains(localEquivalent)) {\n\t\t\t\t\treturn localEquivalent;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst [containingCluster, alignedLocal] = match;\n\t\t\tif (containingCluster.session === this.localSession) {\n\t\t\t\t// Local session\n\t\t\t\tif (this.normalizer.contains(alignedLocal)) {\n\t\t\t\t\treturn alignedLocal;\n\t\t\t\t} else {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tgenCountFromLocalId(alignedLocal) <= this.localGenCount,\n\t\t\t\t\t\t0x75a /* Clusters out of sync. */,\n\t\t\t\t\t);\n\t\t\t\t\t// Id is an eager final\n\t\t\t\t\treturn getAlignedFinal(containingCluster, alignedLocal) as\n\t\t\t\t\t\t| SessionSpaceCompressedId\n\t\t\t\t\t\t| undefined;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Not the local session\n\t\t\t\treturn genCountFromLocalId(alignedLocal) >= lastFinalizedLocal(containingCluster)\n\t\t\t\t\t? (getAlignedFinal(containingCluster, alignedLocal) as\n\t\t\t\t\t\t\t| SessionSpaceCompressedId\n\t\t\t\t\t\t\t| undefined)\n\t\t\t\t\t: undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic serialize(withSession: true): SerializedIdCompressorWithOngoingSession;\n\tpublic serialize(withSession: false): SerializedIdCompressorWithNoSession;\n\tpublic serialize(hasLocalState: boolean): SerializedIdCompressor {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0x8a9 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\tconst { normalizer, finalSpace, sessions, localGenCount, logger, nextRangeBaseGenCount } =\n\t\t\tthis;\n\t\tconst sessionIndexMap = new Map<Session, number>();\n\t\tlet sessionIndex = 0;\n\t\tfor (const session of sessions.sessions()) {\n\t\t\t// Filter empty sessions to prevent them accumulating in the serialized state\n\t\t\tif (!session.isEmpty() || hasLocalState) {\n\t\t\t\tsessionIndexMap.set(session, sessionIndex);\n\t\t\t\tsessionIndex++;\n\t\t\t}\n\t\t}\n\t\tconst localStateSize = hasLocalState\n\t\t\t? 1 + // generated ID count\n\t\t\t\t1 + // next range base genCount\n\t\t\t\t1 + // count of normalizer pairs\n\t\t\t\tnormalizer.idRanges.size * 2 // pairs\n\t\t\t: 0;\n\t\t// Layout size, in 8 byte increments\n\t\tconst totalSize =\n\t\t\t1 + // version\n\t\t\t1 + // hasLocalState\n\t\t\t1 + // session count\n\t\t\t1 + // cluster count\n\t\t\tsessionIndexMap.size * 2 + // session IDs\n\t\t\tfinalSpace.clusters.length * 3 + // clusters: (sessionIndex, capacity, count)[]\n\t\t\tlocalStateSize; // local state, if present\n\n\t\tconst serializedFloat = new Float64Array(totalSize);\n\t\tconst serializedUint = new BigUint64Array(serializedFloat.buffer);\n\t\tlet index = 0;\n\t\tindex = writeNumber(serializedFloat, index, currentWrittenVersion);\n\t\tindex = writeBoolean(serializedFloat, index, hasLocalState);\n\t\tindex = writeNumber(serializedFloat, index, sessionIndexMap.size);\n\t\tindex = writeNumber(serializedFloat, index, finalSpace.clusters.length);\n\n\t\tfor (const [session] of sessionIndexMap.entries()) {\n\t\t\tindex = writeNumericUuid(serializedUint, index, session.sessionUuid);\n\t\t}\n\n\t\tfor (const cluster of finalSpace.clusters) {\n\t\t\tindex = writeNumber(\n\t\t\t\tserializedFloat,\n\t\t\t\tindex,\n\t\t\t\tsessionIndexMap.get(cluster.session) as number,\n\t\t\t);\n\t\t\tindex = writeNumber(serializedFloat, index, cluster.capacity);\n\t\t\tindex = writeNumber(serializedFloat, index, cluster.count);\n\t\t}\n\n\t\tif (hasLocalState) {\n\t\t\tindex = writeNumber(serializedFloat, index, localGenCount);\n\t\t\tindex = writeNumber(serializedFloat, index, nextRangeBaseGenCount);\n\t\t\tindex = writeNumber(serializedFloat, index, normalizer.idRanges.size);\n\t\t\tfor (const [leadingGenCount, count] of normalizer.idRanges.entries()) {\n\t\t\t\tindex = writeNumber(serializedFloat, index, leadingGenCount);\n\t\t\t\tindex = writeNumber(serializedFloat, index, count);\n\t\t\t}\n\t\t}\n\n\t\tassert(index === totalSize, 0x75b /* Serialized size was incorrectly calculated. */);\n\t\tlogger?.sendTelemetryEvent({\n\t\t\teventName: \"RuntimeIdCompressor:SerializedIdCompressorSize\",\n\t\t\tsize: serializedFloat.byteLength,\n\t\t\tclusterCount: finalSpace.clusters.length,\n\t\t\tsessionCount: sessionIndexMap.size,\n\t\t});\n\n\t\treturn bufferToString(serializedFloat.buffer, \"base64\") as SerializedIdCompressor;\n\t}\n\n\tpublic static deserialize(\n\t\tparams:\n\t\t\t| {\n\t\t\t\t\tserialized: SerializedIdCompressorWithOngoingSession;\n\t\t\t\t\tlogger?: ITelemetryLoggerExt | undefined;\n\t\t\t\t\tnewSessionId?: never;\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\tserialized: SerializedIdCompressorWithNoSession;\n\t\t\t\t\tnewSessionId: SessionId;\n\t\t\t\t\tlogger?: ITelemetryLoggerExt | undefined;\n\t\t\t },\n\t): IdCompressor {\n\t\tconst { serialized, newSessionId, logger } = params;\n\t\tconst buffer = stringToBuffer(serialized, \"base64\");\n\t\tconst index: Index = {\n\t\t\tindex: 0,\n\t\t\tbufferFloat: new Float64Array(buffer),\n\t\t\tbufferUint: new BigUint64Array(buffer),\n\t\t};\n\t\tconst version = readNumber(index);\n\t\tswitch (version) {\n\t\t\tcase 1: {\n\t\t\t\tthrow new Error(\"IdCompressor version 1.0 is no longer supported.\");\n\t\t\t}\n\t\t\tcase 2: {\n\t\t\t\treturn IdCompressor.deserialize2_0(index, newSessionId, logger);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(\"Unknown IdCompressor serialized version.\");\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic deserialize2_0(\n\t\tindex: Index,\n\t\tsessionId: SessionId | undefined,\n\t\tlogger: ITelemetryLoggerExt | undefined,\n\t): IdCompressor {\n\t\tconst hasLocalState = readBoolean(index);\n\t\tconst sessionCount = readNumber(index);\n\t\tconst clusterCount = readNumber(index);\n\n\t\t// Sessions\n\t\tlet sessionOffset = 0;\n\t\tconst sessions: [NumericUuid, Session][] = [];\n\t\tif (hasLocalState) {\n\t\t\tassert(\n\t\t\t\tsessionId === undefined,\n\t\t\t\t0x75e /* Local state should not exist in serialized form. */,\n\t\t\t);\n\t\t} else {\n\t\t\t// If !hasLocalState, there won't be a serialized local session ID so insert one at the beginning\n\t\t\tassert(sessionId !== undefined, 0x75d /* Local session ID is undefined. */);\n\t\t\tconst localSessionNumeric = numericUuidFromStableId(sessionId);\n\t\t\tsessions.push([localSessionNumeric, new Session(localSessionNumeric)]);\n\t\t\tsessionOffset = 1;\n\t\t}\n\n\t\tfor (let i = 0; i < sessionCount; i++) {\n\t\t\tconst numeric = readNumericUuid(index);\n\t\t\tsessions.push([numeric, new Session(numeric)]);\n\t\t}\n\n\t\tconst compressor = new IdCompressor(new Sessions(sessions), logger);\n\n\t\t// Clusters\n\t\tlet baseFinalId = 0;\n\t\tfor (let i = 0; i < clusterCount; i++) {\n\t\t\tconst sessionIndex = readNumber(index);\n\t\t\tconst sessionArray = sessions[sessionIndex + sessionOffset];\n\t\t\tassert(\n\t\t\t\tsessionArray !== undefined,\n\t\t\t\t0x9d8 /* sessionArray is undefined in IdCompressor.deserialize2_0 */,\n\t\t\t);\n\t\t\tconst session = sessionArray[1];\n\t\t\tconst capacity = readNumber(index);\n\t\t\tconst count = readNumber(index);\n\t\t\tconst cluster = session.addNewCluster(baseFinalId as FinalCompressedId, capacity, count);\n\t\t\tcompressor.finalSpace.addCluster(cluster);\n\t\t\tbaseFinalId += capacity;\n\t\t}\n\n\t\t// Local state\n\t\tif (hasLocalState) {\n\t\t\tcompressor.localGenCount = readNumber(index);\n\t\t\tcompressor.nextRangeBaseGenCount = readNumber(index);\n\t\t\tconst normalizerCount = readNumber(index);\n\t\t\tfor (let i = 0; i < normalizerCount; i++) {\n\t\t\t\tcompressor.normalizer.addLocalRange(readNumber(index), readNumber(index));\n\t\t\t}\n\t\t}\n\n\t\tassert(\n\t\t\tindex.index === index.bufferFloat.length,\n\t\t\t0x75f /* Failed to read entire serialized compressor. */,\n\t\t);\n\t\treturn compressor;\n\t}\n\n\tpublic equals(other: IdCompressor, includeLocalState: boolean): boolean {\n\t\tif (\n\t\t\tincludeLocalState &&\n\t\t\t(this.localSessionId !== other.localSessionId ||\n\t\t\t\t!this.localSession.equals(other.localSession) ||\n\t\t\t\t!this.normalizer.equals(other.normalizer) ||\n\t\t\t\tthis.nextRangeBaseGenCount !== other.nextRangeBaseGenCount ||\n\t\t\t\tthis.localGenCount !== other.localGenCount)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\tthis.sessions.equals(other.sessions, includeLocalState) &&\n\t\t\tthis.finalSpace.equals(other.finalSpace)\n\t\t);\n\t}\n}\n\n/**\n * Create a new {@link IIdCompressor}.\n *\n * @remarks\n * The returned compressor previously also implemented {@link IIdCompressorCore}, but that\n * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return\n * type in a future release. Consumers should type variables as {@link IIdCompressor} and\n * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly.\n *\n * @legacy @beta\n */\nexport function createIdCompressor(\n\tlogger?: ITelemetryBaseLogger,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n): IIdCompressor & IIdCompressorCore;\n/**\n * Create a new {@link IIdCompressor}.\n * @param sessionId - The seed ID for the compressor.\n *\n * @remarks\n * The returned compressor previously also implemented {@link IIdCompressorCore}, but that\n * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return\n * type in a future release. Consumers should type variables as {@link IIdCompressor} and\n * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly.\n *\n * @legacy @beta\n */\nexport function createIdCompressor(\n\tsessionId: SessionId,\n\tlogger?: ITelemetryBaseLogger,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n): IIdCompressor & IIdCompressorCore;\nexport function createIdCompressor(\n\tsessionIdOrLogger?: SessionId | ITelemetryBaseLogger,\n\tloggerOrUndefined?: ITelemetryBaseLogger,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n): IIdCompressor & IIdCompressorCore {\n\tlet localSessionId: SessionId;\n\tlet logger: ITelemetryBaseLogger | undefined;\n\tif (sessionIdOrLogger === undefined) {\n\t\tlocalSessionId = createSessionId();\n\t} else {\n\t\tif (typeof sessionIdOrLogger === \"string\") {\n\t\t\tlocalSessionId = sessionIdOrLogger;\n\t\t\tlogger = loggerOrUndefined;\n\t\t} else {\n\t\t\tlocalSessionId = createSessionId();\n\t\t\tlogger = sessionIdOrLogger;\n\t\t}\n\t}\n\tconst compressor = new IdCompressor(\n\t\tlocalSessionId,\n\t\tlogger === undefined ? undefined : createChildLogger({ logger }),\n\t);\n\treturn compressor;\n}\n\n/**\n * Deserializes the supplied state into an ID compressor.\n *\n * @remarks\n * The returned compressor previously also implemented {@link IIdCompressorCore}, but that\n * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return\n * type in a future release. Consumers should type variables as {@link IIdCompressor} and\n * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly.\n *\n * @legacy @beta\n */\nexport function deserializeIdCompressor(\n\tserialized: SerializedIdCompressorWithOngoingSession,\n\tlogger?: ITelemetryLoggerExt,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n): IIdCompressor & IIdCompressorCore;\n/**\n * Deserializes the supplied state into an ID compressor.\n *\n * @remarks\n * The returned compressor previously also implemented {@link IIdCompressorCore}, but that\n * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return\n * type in a future release. Consumers should type variables as {@link IIdCompressor} and\n * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly.\n *\n * @legacy @beta\n */\nexport function deserializeIdCompressor(\n\tserialized: SerializedIdCompressorWithNoSession,\n\tnewSessionId: SessionId,\n\tlogger?: ITelemetryLoggerExt,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n): IIdCompressor & IIdCompressorCore;\nexport function deserializeIdCompressor(\n\tserialized: SerializedIdCompressor | SerializedIdCompressorWithNoSession,\n\tsessionIdOrLogger: SessionId | ITelemetryLoggerExt | undefined,\n\tloggerOrUndefined?: ITelemetryLoggerExt,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n): IIdCompressor & IIdCompressorCore {\n\tif (typeof sessionIdOrLogger === \"string\") {\n\t\treturn IdCompressor.deserialize({\n\t\t\tserialized: serialized as SerializedIdCompressorWithNoSession,\n\t\t\tlogger: loggerOrUndefined,\n\t\t\tnewSessionId: sessionIdOrLogger,\n\t\t});\n\t}\n\n\tassert(\n\t\tloggerOrUndefined === undefined,\n\t\t0xc2d /* logger would be in sessionIdOrLogger in this codepath */,\n\t);\n\treturn IdCompressor.deserialize({\n\t\tserialized: serialized as SerializedIdCompressorWithOngoingSession,\n\t\tlogger: sessionIdOrLogger,\n\t});\n}\n\n/**\n * Serializes an ID compressor.\n * @param compressor - The compressor to serialize.\n * @param withSession - If true, the serialized state will include local session\n * state (for stashing). If false, only finalized state is included (for summaries).\n * @legacy @beta\n */\nexport function serializeIdCompressor(\n\tcompressor: IIdCompressor,\n\twithSession: true,\n): SerializedIdCompressorWithOngoingSession;\n/**\n * Serializes an ID compressor.\n * @param compressor - The compressor to serialize.\n * @param withSession - If true, the serialized state will include local session\n * state (for stashing). If false, only finalized state is included (for summaries).\n * @legacy @beta\n */\nexport function serializeIdCompressor(\n\tcompressor: IIdCompressor,\n\twithSession: false,\n): SerializedIdCompressorWithNoSession;\nexport function serializeIdCompressor(\n\tcompressor: IIdCompressor,\n\twithSession: boolean,\n): SerializedIdCompressorWithOngoingSession | SerializedIdCompressorWithNoSession {\n\tconst core = toIdCompressorWithCore(compressor);\n\treturn withSession ? core.serialize(true) : core.serialize(false);\n}\n\n/**\n * Casts an {@link IIdCompressor} to include {@link IIdCompressorCore}.\n *\n * @remarks\n * Compressors returned by `createIdCompressor` and `deserializeIdCompressor`\n * always implement both {@link IIdCompressor} and {@link IIdCompressorCore}, but their\n * return types will be narrowed to {@link IIdCompressor} to keep {@link IIdCompressorCore}\n * out of the `@legacy` API surface. Internal consumers that need access to core\n * compressor operations (serialization, range management, etc.) should use this function.\n *\n * @param compressor - A compressor created by `createIdCompressor` or\n * `deserializeIdCompressor`.\n * @returns The same compressor, typed to include {@link IIdCompressorCore}.\n * @internal\n */\nexport function toIdCompressorWithCore(\n\tcompressor: IIdCompressor,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n): IIdCompressor & IIdCompressorCore {\n\tassert(\n\t\t\"serialize\" in compressor,\n\t\t0xced /* Expected compressor to implement IIdCompressorCore */,\n\t);\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n\treturn compressor as IIdCompressor & IIdCompressorCore;\n}\n"]} | ||
| {"version":3,"file":"idCompressor.js","sourceRoot":"","sources":["../src/idCompressor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8E;AAE9E,kEAA6D;AAE7D,uEAIkD;AAIlD,mDAA6C;AAC7C,qDAK0B;AAC1B,uEAQmC;AACnC,2EAAqE;AACrE,+CAQuB;AAavB,iDAQwB;AAExB;;;GAGG;AACH,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEhC,SAAS,sBAAsB,CAAC,aAAqB,EAAE,WAAmB;IACzE,OAAO,IAAI,uBAAY,CAAC,+BAA+B,EAAE;QACxD,aAAa;QACb,WAAW;KACX,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAa,YAAY;IA+CxB,aAAa;IAEb,YACC,4BAA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EpB,MAAM,IAAI,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAChD,OAAO,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAND,sDAMC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,sBAAsB,CACrC,UAAyB;IAEzB,IAAA,iBAAM,EACL,WAAW,IAAI,UAAU,EACzB,KAAK,CAAC,wDAAwD,CAC9D,CAAC;IACF,OAAO,UAA+C,CAAC;AACxD,CAAC;AARD,wDAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { TelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\nimport {\n\tLoggingError,\n\tcreateChildLogger,\n\textractTelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n// eslint-disable-next-line import-x/no-internal-modules -- Needed to avoid specialized /internal ITelemetryLoggerExt\nimport type { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/legacy\";\n\nimport { FinalSpace } from \"./finalSpace.js\";\nimport {\n\ttype FinalCompressedId,\n\ttype LocalCompressedId,\n\ttype NumericUuid,\n\tisFinalId,\n} from \"./identifiers.js\";\nimport {\n\ttype Index,\n\treadBoolean,\n\treadNumber,\n\treadNumericUuid,\n\twriteBoolean,\n\twriteNumber,\n\twriteNumericUuid,\n} from \"./persistanceUtilities.js\";\nimport { SessionSpaceNormalizer } from \"./sessionSpaceNormalizer.js\";\nimport {\n\ttype IdCluster,\n\tSession,\n\tSessions,\n\tgetAlignedFinal,\n\tgetAlignedLocal,\n\tlastFinalizedFinal,\n\tlastFinalizedLocal,\n} from \"./sessions.js\";\nimport type {\n\tIIdCompressor,\n\tIIdCompressorCore,\n\tIdCreationRange,\n\tOpSpaceCompressedId,\n\tSerializedIdCompressor,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"./types/index.js\";\nimport {\n\tcreateSessionId,\n\tgenCountFromLocalId,\n\tlocalIdFromGenCount,\n\tnumericUuidFromStableId,\n\toffsetNumericUuid,\n\tstableIdFromNumericUuid,\n\tsubtractNumericUuids,\n} from \"./utilities.js\";\n\n/**\n * The version of IdCompressor that is currently persisted.\n * This should not be changed without careful consideration to compatibility.\n */\nconst currentWrittenVersion = 2;\n\nfunction rangeFinalizationError(expectedStart: number, actualStart: number): LoggingError {\n\treturn new LoggingError(\"Ranges finalized out of order\", {\n\t\texpectedStart,\n\t\tactualStart,\n\t});\n}\n\n/**\n * See {@link IIdCompressor} and {@link IIdCompressorCore}\n */\nexport class IdCompressor implements IIdCompressor, IIdCompressorCore {\n\t/**\n\t * Max allowed initial cluster size.\n\t */\n\tpublic static readonly maxClusterSize = 2 ** 20;\n\n\t// #region Local state\n\n\tpublic readonly localSessionId: SessionId;\n\tprivate readonly localSession: Session;\n\tprivate readonly normalizer = new SessionSpaceNormalizer();\n\t// The number of IDs generated by the local session\n\tprivate localGenCount = 0;\n\n\t// #endregion\n\n\t// #region Final state\n\n\t/**\n\t * The gen count to be annotated on the range returned by the next call to `takeNextCreationRange`.\n\t * This is advanced to `generatedIdCount` + 1 each time it is called.\n\t * On the other hand, when `resetUnfinalizedCreationRange` is called,\n\t * this is moved back to the start of the unfinalized range, to ensure those IDs are included in the next range.\n\t */\n\tprivate nextRangeBaseGenCount = 1;\n\tprivate readonly sessions = new Sessions();\n\tprivate readonly finalSpace = new FinalSpace();\n\n\t// #endregion\n\n\t// #region Ephemeral state\n\n\t/**\n\t * Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.\n\t * Eventually, this can be adjusted dynamically to have cluster reservation policies that\n\t * optimize the number of eager finals.\n\t * It is not readonly as it is accessed by tests for clear-box testing.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/prefer-readonly\n\tprivate nextRequestedClusterSize: number = 512;\n\t// The number of local IDs generated since the last telemetry was sent.\n\tprivate telemetryLocalIdCount = 0;\n\t// The number of eager final IDs generated since the last telemetry was sent.\n\tprivate telemetryEagerFinalIdCount = 0;\n\t// The ongoing ghost session, if one exists.\n\tprivate ongoingGhostSession?: { cluster?: IdCluster; ghostSessionId: SessionId } | undefined;\n\n\t// #endregion\n\n\tpublic constructor(\n\t\tlocalSessionIdOrDeserialized: SessionId | Sessions,\n\t\tprivate readonly logger: TelemetryLoggerExt | undefined,\n\t) {\n\t\tif (typeof localSessionIdOrDeserialized === \"string\") {\n\t\t\tthis.localSessionId = localSessionIdOrDeserialized;\n\t\t\tthis.localSession = this.sessions.getOrCreate(localSessionIdOrDeserialized);\n\t\t} else {\n\t\t\t// Deserialize case\n\t\t\tthis.sessions = localSessionIdOrDeserialized;\n\t\t\t// As policy, the first session is always the local session. Preserve this invariant\n\t\t\t// during deserialization.\n\t\t\tconst firstSession = localSessionIdOrDeserialized.sessions().next();\n\t\t\tassert(!firstSession.done, 0x754 /* First session must be present. */);\n\t\t\tthis.localSession = firstSession.value;\n\t\t\tthis.localSessionId = stableIdFromNumericUuid(\n\t\t\t\tthis.localSession.sessionUuid,\n\t\t\t) as SessionId;\n\t\t}\n\t}\n\n\tpublic generateCompressedId(): SessionSpaceCompressedId {\n\t\t// This ghost session code inside this block should not be changed without a version bump (it is performed at a consensus point)\n\t\tif (this.ongoingGhostSession) {\n\t\t\tif (this.ongoingGhostSession.cluster === undefined) {\n\t\t\t\tthis.ongoingGhostSession.cluster = this.addEmptyCluster(\n\t\t\t\t\tthis.sessions.getOrCreate(this.ongoingGhostSession.ghostSessionId),\n\t\t\t\t\t1,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.ongoingGhostSession.cluster.capacity++;\n\t\t\t}\n\t\t\tthis.ongoingGhostSession.cluster.count++;\n\t\t\treturn lastFinalizedFinal(\n\t\t\t\tthis.ongoingGhostSession.cluster,\n\t\t\t) as unknown as SessionSpaceCompressedId;\n\t\t} else {\n\t\t\tthis.localGenCount++;\n\t\t\tconst lastCluster = this.localSession.getLastCluster();\n\t\t\tif (lastCluster === undefined) {\n\t\t\t\tthis.telemetryLocalIdCount++;\n\t\t\t\treturn this.generateNextLocalId();\n\t\t\t}\n\n\t\t\t// If there exists a cluster of final IDs already claimed by the local session that still has room in it,\n\t\t\t// it is known prior to range sequencing what a local ID's corresponding final ID will be.\n\t\t\t// In this case, it is safe to return the final ID immediately. This is guaranteed to be safe because\n\t\t\t// any op that the local session sends that contains one of those final IDs are guaranteed to arrive to\n\t\t\t// collaborators *after* the one containing the creation range.\n\t\t\tconst clusterOffset = this.localGenCount - genCountFromLocalId(lastCluster.baseLocalId);\n\t\t\tif (lastCluster.capacity > clusterOffset) {\n\t\t\t\tthis.telemetryEagerFinalIdCount++;\n\t\t\t\t// Space in the cluster: eager final\n\t\t\t\treturn ((lastCluster.baseFinalId as number) +\n\t\t\t\t\tclusterOffset) as SessionSpaceCompressedId;\n\t\t\t}\n\t\t\t// No space in the cluster, return next local\n\t\t\tthis.telemetryLocalIdCount++;\n\t\t\treturn this.generateNextLocalId();\n\t\t}\n\t}\n\n\tpublic generateDocumentUniqueId():\n\t\t| (SessionSpaceCompressedId & OpSpaceCompressedId)\n\t\t| StableId {\n\t\tconst id = this.generateCompressedId();\n\t\treturn isFinalId(id) ? id : this.decompress(id);\n\t}\n\n\t/**\n\t * Starts a ghost session. Only exposed for test purposes (this class is not exported from the package).\n\t * @param ghostSessionId - The session ID to start the ghost session with.\n\t */\n\tpublic startGhostSession(ghostSessionId: SessionId): void {\n\t\tassert(!this.ongoingGhostSession, 0x8fe /* Ghost session already in progress. */);\n\t\tthis.ongoingGhostSession = { ghostSessionId };\n\t}\n\n\t/**\n\t * {@inheritdoc IIdCompressorCore.beginGhostSession}\n\t */\n\tpublic beginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void {\n\t\tthis.startGhostSession(ghostSessionId);\n\t\ttry {\n\t\t\tghostSessionCallback();\n\t\t} finally {\n\t\t\tthis.ongoingGhostSession = undefined;\n\t\t}\n\t}\n\n\tprivate generateNextLocalId(): LocalCompressedId {\n\t\t// Must tell the normalizer that we generated a local ID\n\t\tthis.normalizer.addLocalRange(this.localGenCount, 1);\n\t\treturn localIdFromGenCount(this.localGenCount);\n\t}\n\n\tpublic takeNextCreationRange(): IdCreationRange {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0x8a6 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\tconst count = this.localGenCount - (this.nextRangeBaseGenCount - 1);\n\t\tif (count === 0) {\n\t\t\treturn {\n\t\t\t\tsessionId: this.localSessionId,\n\t\t\t};\n\t\t}\n\t\tconst range: IdCreationRange = {\n\t\t\tsessionId: this.localSessionId,\n\t\t\tids: {\n\t\t\t\tfirstGenCount: this.nextRangeBaseGenCount,\n\t\t\t\tcount,\n\t\t\t\trequestedClusterSize: this.nextRequestedClusterSize,\n\t\t\t\tlocalIdRanges: this.normalizer.getRangesBetween(\n\t\t\t\t\tthis.nextRangeBaseGenCount,\n\t\t\t\t\tthis.localGenCount,\n\t\t\t\t),\n\t\t\t},\n\t\t};\n\t\treturn this.updateToRange(range);\n\t}\n\n\tpublic takeUnfinalizedCreationRange(): IdCreationRange {\n\t\tthis.resetUnfinalizedCreationRange();\n\t\treturn this.takeNextCreationRange();\n\t}\n\n\tpublic resetUnfinalizedCreationRange(): void {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0xcec /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\n\t\tconst lastLocalCluster = this.localSession.getLastCluster();\n\t\tthis.nextRangeBaseGenCount =\n\t\t\tlastLocalCluster === undefined\n\t\t\t\t? 1\n\t\t\t\t: genCountFromLocalId(\n\t\t\t\t\t\t(lastLocalCluster.baseLocalId - lastLocalCluster.count) as LocalCompressedId,\n\t\t\t\t\t);\n\t}\n\n\tprivate updateToRange(range: IdCreationRange): IdCreationRange {\n\t\tthis.nextRangeBaseGenCount = this.localGenCount + 1;\n\t\treturn IdCompressor.assertValidRange(range);\n\t}\n\n\tprivate static assertValidRange(range: IdCreationRange): IdCreationRange {\n\t\tif (range.ids === undefined) {\n\t\t\treturn range;\n\t\t}\n\t\tconst { count, requestedClusterSize } = range.ids;\n\t\tassert(count > 0, 0x755 /* Malformed ID Range. */);\n\t\tassert(requestedClusterSize > 0, 0x876 /* Clusters must have a positive capacity. */);\n\t\tassert(\n\t\t\trequestedClusterSize <= IdCompressor.maxClusterSize,\n\t\t\t0x877 /* Clusters must not exceed max cluster size. */,\n\t\t);\n\t\treturn range;\n\t}\n\n\tpublic finalizeCreationRange(range: IdCreationRange): void {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0x8a7 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\t// Check if the range has IDs\n\t\tif (range.ids === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tIdCompressor.assertValidRange(range);\n\t\tconst { sessionId, ids } = range;\n\t\tconst { count, firstGenCount, requestedClusterSize } = ids;\n\t\tconst session = this.sessions.getOrCreate(sessionId);\n\t\tconst isLocal = session === this.localSession;\n\t\tconst rangeBaseLocal = localIdFromGenCount(firstGenCount);\n\t\tlet lastCluster = session.getLastCluster();\n\t\tif (lastCluster === undefined) {\n\t\t\t// This is the first cluster in the session space\n\t\t\tif (rangeBaseLocal !== -1) {\n\t\t\t\tthrow rangeFinalizationError(-1, rangeBaseLocal);\n\t\t\t}\n\t\t\tlastCluster = this.addEmptyCluster(session, requestedClusterSize + count);\n\t\t\tif (isLocal) {\n\t\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\t\teventName: \"RuntimeIdCompressor:FirstCluster\",\n\t\t\t\t\tsessionId: this.localSessionId,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tconst remainingCapacity = lastCluster.capacity - lastCluster.count;\n\t\tif (lastCluster.baseLocalId - lastCluster.count !== rangeBaseLocal) {\n\t\t\tthrow rangeFinalizationError(\n\t\t\t\tlastCluster.baseLocalId - lastCluster.count,\n\t\t\t\trangeBaseLocal,\n\t\t\t);\n\t\t}\n\n\t\tif (remainingCapacity >= count) {\n\t\t\t// The current range fits in the existing cluster\n\t\t\tlastCluster.count += count;\n\t\t} else {\n\t\t\tconst overflow = count - remainingCapacity;\n\t\t\tconst newClaimedFinalCount = overflow + requestedClusterSize;\n\t\t\tif (lastCluster === this.finalSpace.getLastCluster()) {\n\t\t\t\t// The last cluster in the sessions chain is the last cluster globally, so it can be expanded.\n\t\t\t\tlastCluster.capacity += newClaimedFinalCount;\n\t\t\t\tlastCluster.count += count;\n\t\t\t\tassert(\n\t\t\t\t\t!this.sessions.clusterCollides(lastCluster),\n\t\t\t\t\t0x756 /* Cluster collision detected. */,\n\t\t\t\t);\n\t\t\t\tif (isLocal) {\n\t\t\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"RuntimeIdCompressor:ClusterExpansion\",\n\t\t\t\t\t\tsessionId: this.localSessionId,\n\t\t\t\t\t\tpreviousCapacity: lastCluster.capacity - newClaimedFinalCount,\n\t\t\t\t\t\tnewCapacity: lastCluster.capacity,\n\t\t\t\t\t\toverflow,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// The last cluster in the sessions chain is *not* the last cluster globally. Fill and overflow to new.\n\t\t\t\tlastCluster.count = lastCluster.capacity;\n\t\t\t\tconst newCluster = this.addEmptyCluster(session, newClaimedFinalCount);\n\t\t\t\tnewCluster.count += overflow;\n\t\t\t\tif (isLocal) {\n\t\t\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"RuntimeIdCompressor:NewCluster\",\n\t\t\t\t\t\tsessionId: this.localSessionId,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (isLocal) {\n\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\teventName: \"RuntimeIdCompressor:IdCompressorStatus\",\n\t\t\t\teagerFinalIdCount: this.telemetryEagerFinalIdCount,\n\t\t\t\tlocalIdCount: this.telemetryLocalIdCount,\n\t\t\t\tsessionId: this.localSessionId,\n\t\t\t});\n\t\t\tthis.telemetryEagerFinalIdCount = 0;\n\t\t\tthis.telemetryLocalIdCount = 0;\n\t\t}\n\n\t\tassert(!session.isEmpty(), 0x757 /* Empty sessions should not be created. */);\n\t}\n\n\tprivate addEmptyCluster(session: Session, capacity: number): IdCluster {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession?.cluster,\n\t\t\t0x8a8 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\tconst newCluster = session.addNewCluster(\n\t\t\tthis.finalSpace.getAllocatedIdLimit(),\n\t\t\tcapacity,\n\t\t\t0,\n\t\t);\n\t\tassert(\n\t\t\t!this.sessions.clusterCollides(newCluster),\n\t\t\t0x758 /* Cluster collision detected. */,\n\t\t);\n\t\tthis.finalSpace.addCluster(newCluster);\n\t\treturn newCluster;\n\t}\n\n\tpublic normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId {\n\t\tif (isFinalId(id)) {\n\t\t\treturn id;\n\t\t} else {\n\t\t\tconst local = id as unknown as LocalCompressedId;\n\t\t\tif (!this.normalizer.contains(local)) {\n\t\t\t\tthrow new Error(\"Invalid ID to normalize.\");\n\t\t\t}\n\t\t\tconst finalForm = this.localSession.tryConvertToFinal(local, true);\n\t\t\treturn finalForm === undefined\n\t\t\t\t? (local as unknown as OpSpaceCompressedId)\n\t\t\t\t: (finalForm as OpSpaceCompressedId);\n\t\t}\n\t}\n\n\tpublic normalizeToSessionSpace(\n\t\tid: OpSpaceCompressedId,\n\t\toriginSessionId: SessionId,\n\t): SessionSpaceCompressedId {\n\t\tif (isFinalId(id)) {\n\t\t\tconst containingCluster = this.localSession.getClusterByAllocatedFinal(id);\n\t\t\tif (containingCluster === undefined) {\n\t\t\t\t// Does not exist in local cluster chain\n\t\t\t\tif (id >= this.finalSpace.getFinalizedIdLimit()) {\n\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t}\n\t\t\t\treturn id as unknown as SessionSpaceCompressedId;\n\t\t\t} else {\n\t\t\t\tconst alignedLocal = getAlignedLocal(containingCluster, id);\n\t\t\t\tif (this.normalizer.contains(alignedLocal)) {\n\t\t\t\t\treturn alignedLocal;\n\t\t\t\t} else {\n\t\t\t\t\tif (genCountFromLocalId(alignedLocal) > this.localGenCount) {\n\t\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t\t}\n\t\t\t\t\treturn id as unknown as SessionSpaceCompressedId;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst localToNormalize = id as unknown as LocalCompressedId;\n\t\t\tif (originSessionId === this.localSessionId) {\n\t\t\t\tif (this.normalizer.contains(localToNormalize)) {\n\t\t\t\t\treturn localToNormalize;\n\t\t\t\t} else {\n\t\t\t\t\t// We never generated this local ID, so fail\n\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// LocalId from a remote session\n\t\t\t\tconst remoteSession = this.sessions.get(originSessionId);\n\t\t\t\tif (remoteSession === undefined) {\n\t\t\t\t\tthrow new Error(\"No IDs have ever been finalized by the supplied session.\");\n\t\t\t\t}\n\t\t\t\tconst correspondingFinal = remoteSession.tryConvertToFinal(localToNormalize, false);\n\t\t\t\tif (correspondingFinal === undefined) {\n\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t}\n\t\t\t\treturn correspondingFinal as unknown as SessionSpaceCompressedId;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic decompress(id: SessionSpaceCompressedId): StableId {\n\t\tif (isFinalId(id)) {\n\t\t\tconst containingCluster = Session.getContainingCluster(id, this.finalSpace.clusters);\n\t\t\tif (containingCluster === undefined) {\n\t\t\t\tthrow new Error(\"Unknown ID\");\n\t\t\t}\n\t\t\tconst alignedLocal = getAlignedLocal(containingCluster, id);\n\t\t\tconst alignedGenCount = genCountFromLocalId(alignedLocal);\n\t\t\tconst lastFinalizedGenCount = genCountFromLocalId(lastFinalizedLocal(containingCluster));\n\t\t\tif (alignedGenCount > lastFinalizedGenCount) {\n\t\t\t\t// should be an eager final id generated by the local session\n\t\t\t\tif (containingCluster.session === this.localSession) {\n\t\t\t\t\tassert(!this.normalizer.contains(alignedLocal), 0x759 /* Normalizer out of sync. */);\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"Unknown ID\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn stableIdFromNumericUuid(\n\t\t\t\toffsetNumericUuid(containingCluster.session.sessionUuid, alignedGenCount - 1),\n\t\t\t);\n\t\t} else {\n\t\t\tconst localToDecompress = id as unknown as LocalCompressedId;\n\t\t\tif (!this.normalizer.contains(localToDecompress)) {\n\t\t\t\tthrow new Error(\"Unknown ID\");\n\t\t\t}\n\t\t\treturn stableIdFromNumericUuid(\n\t\t\t\toffsetNumericUuid(\n\t\t\t\t\tthis.localSession.sessionUuid,\n\t\t\t\t\tgenCountFromLocalId(localToDecompress) - 1,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic recompress(uncompressed: StableId): SessionSpaceCompressedId {\n\t\tconst recompressed = this.tryRecompress(uncompressed);\n\t\tif (recompressed === undefined) {\n\t\t\tthrow new Error(\"Could not recompress.\");\n\t\t}\n\t\treturn recompressed;\n\t}\n\n\tpublic tryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined {\n\t\tconst match = this.sessions.getContainingCluster(uncompressed);\n\t\tif (match === undefined) {\n\t\t\tconst numericUncompressed = numericUuidFromStableId(uncompressed);\n\t\t\tconst offset = subtractNumericUuids(numericUncompressed, this.localSession.sessionUuid);\n\t\t\tif (offset < Number.MAX_SAFE_INTEGER) {\n\t\t\t\tconst genCountEquivalent = Number(offset) + 1;\n\t\t\t\tconst localEquivalent = localIdFromGenCount(genCountEquivalent);\n\t\t\t\tif (this.normalizer.contains(localEquivalent)) {\n\t\t\t\t\treturn localEquivalent;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst [containingCluster, alignedLocal] = match;\n\t\t\tif (containingCluster.session === this.localSession) {\n\t\t\t\t// Local session\n\t\t\t\tif (this.normalizer.contains(alignedLocal)) {\n\t\t\t\t\treturn alignedLocal;\n\t\t\t\t} else {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tgenCountFromLocalId(alignedLocal) <= this.localGenCount,\n\t\t\t\t\t\t0x75a /* Clusters out of sync. */,\n\t\t\t\t\t);\n\t\t\t\t\t// Id is an eager final\n\t\t\t\t\treturn getAlignedFinal(containingCluster, alignedLocal) as\n\t\t\t\t\t\t| SessionSpaceCompressedId\n\t\t\t\t\t\t| undefined;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Not the local session\n\t\t\t\treturn genCountFromLocalId(alignedLocal) >= lastFinalizedLocal(containingCluster)\n\t\t\t\t\t? (getAlignedFinal(containingCluster, alignedLocal) as\n\t\t\t\t\t\t\t| SessionSpaceCompressedId\n\t\t\t\t\t\t\t| undefined)\n\t\t\t\t\t: undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic serialize(withSession: true): SerializedIdCompressorWithOngoingSession;\n\tpublic serialize(withSession: false): SerializedIdCompressorWithNoSession;\n\tpublic serialize(hasLocalState: boolean): SerializedIdCompressor {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0x8a9 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\tconst { normalizer, finalSpace, sessions, localGenCount, logger, nextRangeBaseGenCount } =\n\t\t\tthis;\n\t\tconst sessionIndexMap = new Map<Session, number>();\n\t\tlet sessionIndex = 0;\n\t\tfor (const session of sessions.sessions()) {\n\t\t\t// Filter empty sessions to prevent them accumulating in the serialized state\n\t\t\tif (!session.isEmpty() || hasLocalState) {\n\t\t\t\tsessionIndexMap.set(session, sessionIndex);\n\t\t\t\tsessionIndex++;\n\t\t\t}\n\t\t}\n\t\tconst localStateSize = hasLocalState\n\t\t\t? 1 + // generated ID count\n\t\t\t\t1 + // next range base genCount\n\t\t\t\t1 + // count of normalizer pairs\n\t\t\t\tnormalizer.idRanges.size * 2 // pairs\n\t\t\t: 0;\n\t\t// Layout size, in 8 byte increments\n\t\tconst totalSize =\n\t\t\t1 + // version\n\t\t\t1 + // hasLocalState\n\t\t\t1 + // session count\n\t\t\t1 + // cluster count\n\t\t\tsessionIndexMap.size * 2 + // session IDs\n\t\t\tfinalSpace.clusters.length * 3 + // clusters: (sessionIndex, capacity, count)[]\n\t\t\tlocalStateSize; // local state, if present\n\n\t\tconst serializedFloat = new Float64Array(totalSize);\n\t\tconst serializedUint = new BigUint64Array(serializedFloat.buffer);\n\t\tlet index = 0;\n\t\tindex = writeNumber(serializedFloat, index, currentWrittenVersion);\n\t\tindex = writeBoolean(serializedFloat, index, hasLocalState);\n\t\tindex = writeNumber(serializedFloat, index, sessionIndexMap.size);\n\t\tindex = writeNumber(serializedFloat, index, finalSpace.clusters.length);\n\n\t\tfor (const [session] of sessionIndexMap.entries()) {\n\t\t\tindex = writeNumericUuid(serializedUint, index, session.sessionUuid);\n\t\t}\n\n\t\tfor (const cluster of finalSpace.clusters) {\n\t\t\tindex = writeNumber(\n\t\t\t\tserializedFloat,\n\t\t\t\tindex,\n\t\t\t\tsessionIndexMap.get(cluster.session) as number,\n\t\t\t);\n\t\t\tindex = writeNumber(serializedFloat, index, cluster.capacity);\n\t\t\tindex = writeNumber(serializedFloat, index, cluster.count);\n\t\t}\n\n\t\tif (hasLocalState) {\n\t\t\tindex = writeNumber(serializedFloat, index, localGenCount);\n\t\t\tindex = writeNumber(serializedFloat, index, nextRangeBaseGenCount);\n\t\t\tindex = writeNumber(serializedFloat, index, normalizer.idRanges.size);\n\t\t\tfor (const [leadingGenCount, count] of normalizer.idRanges.entries()) {\n\t\t\t\tindex = writeNumber(serializedFloat, index, leadingGenCount);\n\t\t\t\tindex = writeNumber(serializedFloat, index, count);\n\t\t\t}\n\t\t}\n\n\t\tassert(index === totalSize, 0x75b /* Serialized size was incorrectly calculated. */);\n\t\tlogger?.sendTelemetryEvent({\n\t\t\teventName: \"RuntimeIdCompressor:SerializedIdCompressorSize\",\n\t\t\tsize: serializedFloat.byteLength,\n\t\t\tclusterCount: finalSpace.clusters.length,\n\t\t\tsessionCount: sessionIndexMap.size,\n\t\t});\n\n\t\treturn bufferToString(serializedFloat.buffer, \"base64\") as SerializedIdCompressor;\n\t}\n\n\tpublic static deserialize(\n\t\tparams:\n\t\t\t| {\n\t\t\t\t\tserialized: SerializedIdCompressorWithOngoingSession;\n\t\t\t\t\tlogger?: TelemetryLoggerExt | undefined;\n\t\t\t\t\tnewSessionId?: never;\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\tserialized: SerializedIdCompressorWithNoSession;\n\t\t\t\t\tnewSessionId: SessionId;\n\t\t\t\t\tlogger?: TelemetryLoggerExt | undefined;\n\t\t\t },\n\t): IdCompressor {\n\t\tconst { serialized, newSessionId, logger } = params;\n\t\tconst buffer = stringToBuffer(serialized, \"base64\");\n\t\tconst index: Index = {\n\t\t\tindex: 0,\n\t\t\tbufferFloat: new Float64Array(buffer),\n\t\t\tbufferUint: new BigUint64Array(buffer),\n\t\t};\n\t\tconst version = readNumber(index);\n\t\tswitch (version) {\n\t\t\tcase 1: {\n\t\t\t\tthrow new Error(\"IdCompressor version 1.0 is no longer supported.\");\n\t\t\t}\n\t\t\tcase 2: {\n\t\t\t\treturn IdCompressor.deserialize2_0(index, newSessionId, logger);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(\"Unknown IdCompressor serialized version.\");\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic deserialize2_0(\n\t\tindex: Index,\n\t\tsessionId: SessionId | undefined,\n\t\tlogger: TelemetryLoggerExt | undefined,\n\t): IdCompressor {\n\t\tconst hasLocalState = readBoolean(index);\n\t\tconst sessionCount = readNumber(index);\n\t\tconst clusterCount = readNumber(index);\n\n\t\t// Sessions\n\t\tlet sessionOffset = 0;\n\t\tconst sessions: [NumericUuid, Session][] = [];\n\t\tif (hasLocalState) {\n\t\t\tassert(\n\t\t\t\tsessionId === undefined,\n\t\t\t\t0x75e /* Local state should not exist in serialized form. */,\n\t\t\t);\n\t\t} else {\n\t\t\t// If !hasLocalState, there won't be a serialized local session ID so insert one at the beginning\n\t\t\tassert(sessionId !== undefined, 0x75d /* Local session ID is undefined. */);\n\t\t\tconst localSessionNumeric = numericUuidFromStableId(sessionId);\n\t\t\tsessions.push([localSessionNumeric, new Session(localSessionNumeric)]);\n\t\t\tsessionOffset = 1;\n\t\t}\n\n\t\tfor (let i = 0; i < sessionCount; i++) {\n\t\t\tconst numeric = readNumericUuid(index);\n\t\t\tsessions.push([numeric, new Session(numeric)]);\n\t\t}\n\n\t\tconst compressor = new IdCompressor(new Sessions(sessions), logger);\n\n\t\t// Clusters\n\t\tlet baseFinalId = 0;\n\t\tfor (let i = 0; i < clusterCount; i++) {\n\t\t\tconst sessionIndex = readNumber(index);\n\t\t\tconst sessionArray = sessions[sessionIndex + sessionOffset];\n\t\t\tassert(\n\t\t\t\tsessionArray !== undefined,\n\t\t\t\t0x9d8 /* sessionArray is undefined in IdCompressor.deserialize2_0 */,\n\t\t\t);\n\t\t\tconst session = sessionArray[1];\n\t\t\tconst capacity = readNumber(index);\n\t\t\tconst count = readNumber(index);\n\t\t\tconst cluster = session.addNewCluster(baseFinalId as FinalCompressedId, capacity, count);\n\t\t\tcompressor.finalSpace.addCluster(cluster);\n\t\t\tbaseFinalId += capacity;\n\t\t}\n\n\t\t// Local state\n\t\tif (hasLocalState) {\n\t\t\tcompressor.localGenCount = readNumber(index);\n\t\t\tcompressor.nextRangeBaseGenCount = readNumber(index);\n\t\t\tconst normalizerCount = readNumber(index);\n\t\t\tfor (let i = 0; i < normalizerCount; i++) {\n\t\t\t\tcompressor.normalizer.addLocalRange(readNumber(index), readNumber(index));\n\t\t\t}\n\t\t}\n\n\t\tassert(\n\t\t\tindex.index === index.bufferFloat.length,\n\t\t\t0x75f /* Failed to read entire serialized compressor. */,\n\t\t);\n\t\treturn compressor;\n\t}\n\n\tpublic equals(other: IdCompressor, includeLocalState: boolean): boolean {\n\t\tif (\n\t\t\tincludeLocalState &&\n\t\t\t(this.localSessionId !== other.localSessionId ||\n\t\t\t\t!this.localSession.equals(other.localSession) ||\n\t\t\t\t!this.normalizer.equals(other.normalizer) ||\n\t\t\t\tthis.nextRangeBaseGenCount !== other.nextRangeBaseGenCount ||\n\t\t\t\tthis.localGenCount !== other.localGenCount)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\tthis.sessions.equals(other.sessions, includeLocalState) &&\n\t\t\tthis.finalSpace.equals(other.finalSpace)\n\t\t);\n\t}\n}\n\n/**\n * Create a new {@link IIdCompressor}.\n *\n * @legacy @beta\n */\nexport function createIdCompressor(logger?: ITelemetryBaseLogger): IIdCompressor;\n/**\n * Create a new {@link IIdCompressor}.\n * @param sessionId - The seed ID for the compressor.\n *\n * @legacy @beta\n */\nexport function createIdCompressor(\n\tsessionId: SessionId,\n\tlogger?: ITelemetryBaseLogger,\n): IIdCompressor;\nexport function createIdCompressor(\n\tsessionIdOrLogger?: SessionId | ITelemetryBaseLogger,\n\tloggerOrUndefined?: ITelemetryBaseLogger,\n): IIdCompressor & IIdCompressorCore {\n\tlet localSessionId: SessionId;\n\tlet logger: ITelemetryBaseLogger | undefined;\n\tif (sessionIdOrLogger === undefined) {\n\t\tlocalSessionId = createSessionId();\n\t} else {\n\t\tif (typeof sessionIdOrLogger === \"string\") {\n\t\t\tlocalSessionId = sessionIdOrLogger;\n\t\t\tlogger = loggerOrUndefined;\n\t\t} else {\n\t\t\tlocalSessionId = createSessionId();\n\t\t\tlogger = sessionIdOrLogger;\n\t\t}\n\t}\n\tconst compressor = new IdCompressor(\n\t\tlocalSessionId,\n\t\tlogger === undefined ? undefined : createChildLogger({ logger }),\n\t);\n\treturn compressor;\n}\n\n/**\n * Deserializes the supplied state into an ID compressor.\n *\n * @legacy @beta\n */\nexport function deserializeIdCompressor(\n\tserialized: SerializedIdCompressorWithOngoingSession,\n\tlogger?: ITelemetryLoggerExt,\n): IIdCompressor;\n/**\n * Deserializes the supplied state into an ID compressor.\n *\n * @legacy @beta\n */\nexport function deserializeIdCompressor(\n\tserialized: SerializedIdCompressorWithNoSession,\n\tnewSessionId: SessionId,\n\tlogger?: ITelemetryLoggerExt,\n): IIdCompressor;\nexport function deserializeIdCompressor(\n\tserialized: SerializedIdCompressor | SerializedIdCompressorWithNoSession,\n\tsessionIdOrLogger: SessionId | ITelemetryLoggerExt | undefined,\n\tloggerOrUndefined?: ITelemetryLoggerExt,\n): IIdCompressor & IIdCompressorCore {\n\tif (typeof sessionIdOrLogger === \"string\") {\n\t\treturn IdCompressor.deserialize({\n\t\t\tserialized: serialized as SerializedIdCompressorWithNoSession,\n\t\t\tlogger: extractTelemetryLoggerExt<{ PossiblyUndefined: true }>(loggerOrUndefined),\n\t\t\tnewSessionId: sessionIdOrLogger,\n\t\t});\n\t}\n\n\tassert(\n\t\tloggerOrUndefined === undefined,\n\t\t0xc2d /* logger would be in sessionIdOrLogger in this codepath */,\n\t);\n\treturn IdCompressor.deserialize({\n\t\tserialized: serialized as SerializedIdCompressorWithOngoingSession,\n\t\tlogger: extractTelemetryLoggerExt<{ PossiblyUndefined: true }>(sessionIdOrLogger),\n\t});\n}\n\n/**\n * Serializes an ID compressor.\n * @param compressor - The compressor to serialize.\n * @param withSession - If true, the serialized state will include local session\n * state (for stashing). If false, only finalized state is included (for summaries).\n * @legacy @beta\n */\nexport function serializeIdCompressor(\n\tcompressor: IIdCompressor,\n\twithSession: true,\n): SerializedIdCompressorWithOngoingSession;\n/**\n * Serializes an ID compressor.\n * @param compressor - The compressor to serialize.\n * @param withSession - If true, the serialized state will include local session\n * state (for stashing). If false, only finalized state is included (for summaries).\n * @legacy @beta\n */\nexport function serializeIdCompressor(\n\tcompressor: IIdCompressor,\n\twithSession: false,\n): SerializedIdCompressorWithNoSession;\nexport function serializeIdCompressor(\n\tcompressor: IIdCompressor,\n\twithSession: boolean,\n): SerializedIdCompressorWithOngoingSession | SerializedIdCompressorWithNoSession {\n\tconst core = toIdCompressorWithCore(compressor);\n\treturn withSession ? core.serialize(true) : core.serialize(false);\n}\n\n/**\n * Casts an {@link IIdCompressor} to include {@link IIdCompressorCore}.\n *\n * @remarks\n * Compressors returned by `createIdCompressor` and `deserializeIdCompressor`\n * always implement both {@link IIdCompressor} and {@link IIdCompressorCore}, but their\n * public return type is narrowed to {@link IIdCompressor}. Internal consumers that\n * need access to core compressor operations (serialization, range management, etc.)\n * use this function to recover the {@link IIdCompressorCore} surface.\n *\n * @param compressor - A compressor created by `createIdCompressor` or\n * `deserializeIdCompressor`.\n * @returns The same compressor, typed to include {@link IIdCompressorCore}.\n * @internal\n */\nexport function toIdCompressorWithCore(\n\tcompressor: IIdCompressor,\n): IIdCompressor & IIdCompressorCore {\n\tassert(\n\t\t\"serialize\" in compressor,\n\t\t0xced /* Expected compressor to implement IIdCompressorCore */,\n\t);\n\treturn compressor as IIdCompressor & IIdCompressorCore;\n}\n"]} |
+0
-1
@@ -21,3 +21,2 @@ /*! | ||
| // #region @legacyBeta APIs | ||
| IIdCompressorCore, | ||
| IdCreationRange, | ||
@@ -24,0 +23,0 @@ SerializedIdCompressor, |
@@ -8,3 +8,3 @@ /*! | ||
| export declare const pkgName = "@fluidframework/id-compressor"; | ||
| export declare const pkgVersion = "2.93.0"; | ||
| export declare const pkgVersion = "2.100.0"; | ||
| //# sourceMappingURL=packageVersion.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,WAAW,CAAC"} | ||
| {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,YAAY,CAAC"} |
@@ -11,3 +11,3 @@ "use strict"; | ||
| exports.pkgName = "@fluidframework/id-compressor"; | ||
| exports.pkgVersion = "2.93.0"; | ||
| exports.pkgVersion = "2.100.0"; | ||
| //# sourceMappingURL=packageVersion.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,+BAA+B,CAAC;AAC1C,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/id-compressor\";\nexport const pkgVersion = \"2.93.0\";\n"]} | ||
| {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,+BAA+B,CAAC;AAC1C,QAAA,UAAU,GAAG,SAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/id-compressor\";\nexport const pkgVersion = \"2.100.0\";\n"]} |
@@ -1,1 +0,1 @@ |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,IAAI;QACJ,KAAK,EAAE,cAAc;QACrB,MAAM;QACN,WAAW,EAAE,GAAG,EAAE;YACjB,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QACxD,CAAC;KACD,CAAC,CAAC;IAEH,IAAA,qBAAS,EAAC;QACT,IAAI;QACJ,KAAK,EAAE,wBAAwB;QAC/B,MAAM;QACN,WAAW,EAAE,GAAG,EAAE;YACjB,GAAG,CAAC,kBAAkB,CAAC,UAAU,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QACvE,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACzC,yBAAyB,CAAC,GAAG,EAAE,CAAC,IAAI,4CAAmB,CAAC,mCAAoB,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type IRandom, makeRandom } from \"@fluid-private/stochastic-test-utils\";\nimport { BenchmarkType, benchmark } from \"@fluid-tools/benchmark\";\n\nimport { AppendOnlySortedMap } from \"../appendOnlySortedMap.js\";\nimport { compareFiniteNumbers } from \"../utilities.js\";\n\nfunction runAppendOnlyMapPerfTests(\n\tmapBuilder: () => AppendOnlySortedMap<number, number>,\n): void {\n\tconst type = BenchmarkType.Measurement;\n\tlet map: AppendOnlySortedMap<number, number>;\n\tlet rand: IRandom;\n\tconst keyChoices: number[] = [];\n\tlet localChoice = 0;\n\tconst before = (): void => {\n\t\trand = makeRandom(42);\n\t\tmap = mapBuilder();\n\t\tlet curKey = 0;\n\t\tfor (let i = 0; i < 100000; i++) {\n\t\t\tmap.append(curKey, rand.integer(0, Number.MAX_SAFE_INTEGER));\n\t\t\tcurKey += rand.integer(1, 10);\n\t\t}\n\t\tconst keys = [...map.keys()];\n\t\tfor (let i = 0; i < map.size; i++) {\n\t\t\tkeyChoices.push(keys[rand.integer(0, map.size - 1)]);\n\t\t}\n\t\tlocalChoice = 0;\n\t};\n\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `lookup a key`,\n\t\tbefore,\n\t\tbenchmarkFn: () => {\n\t\t\tmap.get(keyChoices[localChoice++ % keyChoices.length]);\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `lookup a pair or lower`,\n\t\tbefore,\n\t\tbenchmarkFn: () => {\n\t\t\tmap.getPairOrNextLower(keyChoices[localChoice++ % keyChoices.length]);\n\t\t},\n\t});\n}\n\ndescribe(\"AppendOnlySortedMap Perf\", () => {\n\trunAppendOnlyMapPerfTests(() => new AppendOnlySortedMap(compareFiniteNumbers));\n});\n"]} | ||
| {"version":3,"file":"appendOnlySortedMap.perf.spec.js","sourceRoot":"","sources":["../../src/test/appendOnlySortedMap.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,gFAAkE;AAClE,sDAAwE;AAExE,sEAAgE;AAChE,kDAAuD;AAEvD,SAAS,yBAAyB,CACjC,UAAqD;IAErD,MAAM,KAAK,GAAG,GAAuE,EAAE;QACtF,MAAM,IAAI,GAAG,IAAA,kCAAU,EAAC,EAAE,CAAC,CAAC;QAC5B,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;QACzB,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACjC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC;YAC7D,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM,UAAU,GAAa,EAAE,CAAC;QAChC,MAAM,IAAI,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CAAC;KACF,CAAC,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACzC,yBAAyB,CAAC,GAAG,EAAE,CAAC,IAAI,4CAAmB,CAAC,mCAAoB,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { makeRandom } from \"@fluid-private/stochastic-test-utils\";\nimport { benchmarkDuration, benchmarkIt } from \"@fluid-tools/benchmark\";\n\nimport { AppendOnlySortedMap } from \"../appendOnlySortedMap.js\";\nimport { compareFiniteNumbers } from \"../utilities.js\";\n\nfunction runAppendOnlyMapPerfTests(\n\tmapBuilder: () => AppendOnlySortedMap<number, number>,\n): void {\n\tconst setup = (): { map: AppendOnlySortedMap<number, number>; keyChoices: number[] } => {\n\t\tconst rand = makeRandom(42);\n\t\tconst map = mapBuilder();\n\t\tlet curKey = 0;\n\t\tfor (let i = 0; i < 100000; i++) {\n\t\t\tmap.append(curKey, rand.integer(0, Number.MAX_SAFE_INTEGER));\n\t\t\tcurKey += rand.integer(1, 10);\n\t\t}\n\t\tconst keyChoices: number[] = [];\n\t\tconst keys = [...map.keys()];\n\t\tfor (let i = 0; i < map.size; i++) {\n\t\t\tkeyChoices.push(keys[rand.integer(0, map.size - 1)]);\n\t\t}\n\t\treturn { map, keyChoices };\n\t};\n\n\tbenchmarkIt({\n\t\ttitle: `lookup a key`,\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tconst { map, keyChoices } = setup();\n\t\t\t\tlet choice = 0;\n\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\tmap.get(keyChoices[choice++ % keyChoices.length]);\n\t\t\t\t});\n\t\t\t},\n\t\t}),\n\t});\n\n\tbenchmarkIt({\n\t\ttitle: `lookup a pair or lower`,\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tconst { map, keyChoices } = setup();\n\t\t\t\tlet choice = 0;\n\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\tmap.getPairOrNextLower(keyChoices[choice++ % keyChoices.length]);\n\t\t\t\t});\n\t\t\t},\n\t\t}),\n\t});\n}\n\ndescribe(\"AppendOnlySortedMap Perf\", () => {\n\trunAppendOnlyMapPerfTests(() => new AppendOnlySortedMap(compareFiniteNumbers));\n});\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"idCompressor.perf.spec.js","sourceRoot":"","sources":["../../src/test/idCompressor.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,6DAA6D;AAE7D,gFAA4D;AAC5D,sDAAkE;AAClE,kEAA6D;AAE7D,wDAAkD;AASlD,kDAAkD;AAElD,iFAQwC;AACxC,mDAMyB;AAEzB,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAEnC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAClC,MAAM,IAAI,GAAG,yBAAa,CAAC,WAAW,CAAC;IACvC,MAAM,WAAW,GAAG,qCAAM,CAAC,OAAO,CAAC;IACnC,MAAM,YAAY,GAAG,qCAAM,CAAC,OAAO,CAAC;IACpC,IAAI,cAA4B,CAAC;IAEjC,SAAS,gBAAgB,CACxB,WAAmB,EACnB,kBAA2B,EAC3B,gBAAyB;QAEzB,MAAM,WAAW,GAAG,IAAI,sDAAuB,CAAC,WAAW,CAAC,CAAC;QAC7D,MAAM,cAAc,GAAG,WAAW,GAAG,CAAC,CAAC;QACvC,MAAM,SAAS,GAAG,IAAA,4BAAI,EACrB,IAAI,EACJ,IAAA,8CAAe,EAAC;YACf,gBAAgB,EAAE,IAAI;YACtB,cAAc;YACd,yBAAyB,EAAE,GAAG;SAC9B,CAAC,CACF,CAAC;QACF,IAAA,iDAAkB,EACjB,SAAS,EACT,WAAW,EACX,IAAI,CAAC,CAAC,EACN,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAA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gB,CAAC,sBAAsB,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;gBACvD,CAAC;YACF,CAAC;YACD,WAAW,EAAE,GAAG,EAAE;gBACjB,cAAe,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAClC,CAAC;SACD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,iBAAiB,CAAC,CAAC,YAAY,EAAE,EAAE;QAClC,IAAI,UAAgD,CAAC;QACrD,MAAM,uBAAuB,GAAG,IAAA,8BAAe,GAAE,CAAC;QAClD,IAAA,qBAAS,EAAC;YACT,IAAI;YACJ,KAAK,EAAE,gCACN,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAClC,GAAG;YACH,MAAM,EAAE,GAAG,EAAE;gBACZ,IAAI,YAAY,EAAE,CAAC;oBAClB,cAAc,GAAG,IAAA,kDAAmB,EAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC;gBACzE,CAAC;qBAAM,CAAC;oBACP,gBAAgB,CAAC,sBAAsB,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;gBACvD,CAAC;gBACD,UAAU,GAAG,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC9C,CAAC;YACD,WAAW,EAAE,GAAG,EAAE;gBACjB,8BAAY,CAAC,WAAW,CAAC;oBACxB,UAAU;oBACV,YAAY,EAAE,uBAAuB;iBACrC,CAAC,CAAC;YACJ,CAAC;SACD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { take } from \"@fluid-private/stochastic-test-utils\";\nimport { BenchmarkType, benchmark } from \"@fluid-tools/benchmark\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { IdCompressor } from \"../idCompressor.js\";\nimport type {\n\tIdCreationRange,\n\tOpSpaceCompressedId,\n\tSerializedIdCompressorWithNoSession,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"../index.js\";\nimport { createSessionId } from \"../utilities.js\";\n\nimport {\n\tClient,\n\tDestinationClient,\n\tIdCompressorTestNetwork,\n\tbuildHugeCompressor,\n\tmakeOpGenerator,\n\tperformFuzzActions,\n\tsessionIds,\n} from \"./idCompressorTestUtilities.js\";\nimport {\n\ttype FinalCompressedId,\n\ttype LocalCompressedId,\n\tfail,\n\tisFinalId,\n\tisLocalId,\n} from \"./testCommon.js\";\n\nconst initialClusterCapacity = 512;\n\ndescribe(\"IdCompressor Perf\", () => {\n\tconst type = BenchmarkType.Measurement;\n\tconst localClient = Client.Client1;\n\tconst remoteClient = Client.Client2;\n\tlet perfCompressor: IdCompressor;\n\n\tfunction setupCompressors(\n\t\tclusterSize: number,\n\t\tlocalClientCanEdit: boolean,\n\t\tsynchronizeAtEnd: boolean,\n\t): IdCompressorTestNetwork {\n\t\tconst perfNetwork = new IdCompressorTestNetwork(clusterSize);\n\t\tconst maxClusterSize = clusterSize * 2;\n\t\tconst generator = take(\n\t\t\t1000,\n\t\t\tmakeOpGenerator({\n\t\t\t\tvalidateInterval: 2000,\n\t\t\t\tmaxClusterSize,\n\t\t\t\toutsideAllocationFraction: 0.9,\n\t\t\t}),\n\t\t);\n\t\tperformFuzzActions(\n\t\t\tgenerator,\n\t\t\tperfNetwork,\n\t\t\tMath.E,\n\t\t\tlocalClientCanEdit ? undefined : localClient,\n\t\t\tsynchronizeAtEnd,\n\t\t);\n\t\tperfCompressor = perfNetwork.getCompressorUnsafeNoProxy(localClient);\n\t\treturn perfNetwork;\n\t}\n\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: false,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): LocalCompressedId;\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: true,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): FinalCompressedId & SessionSpaceCompressedId;\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: boolean,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): SessionSpaceCompressedId;\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: boolean,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): SessionSpaceCompressedId {\n\t\tconst log = network.getIdLog(client);\n\t\tfor (let i = log.length - 1; i > 0; i--) {\n\t\t\tconst { id, originatingClient } = log[i];\n\t\t\tif (\n\t\t\t\toriginatingClient === client &&\n\t\t\t\t((eagerFinal && isFinalId(id)) || (!eagerFinal && isLocalId(id)))\n\t\t\t) {\n\t\t\t\tassert(eagerFinal === isFinalId(id), \"Not local/final as requested.\");\n\t\t\t\treturn id;\n\t\t\t}\n\t\t}\n\t\tfail(\"no ID found in log\");\n\t}\n\n\tfunction benchmarkWithFlag(creator: (flag: boolean) => void): void {\n\t\tfor (const flag of [true, false]) {\n\t\t\tcreator(flag);\n\t\t}\n\t}\n\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `allocate local ID`,\n\t\tbefore: () => {\n\t\t\tsetupCompressors(initialClusterCapacity, true, true);\n\t\t},\n\t\tbenchmarkFn: () => {\n\t\t\tperfCompressor!.generateCompressedId();\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype,\n\t\ttitle: \"take an ID creation range\",\n\t\tbefore: () => {\n\t\t\tsetupCompressors(initialClusterCapacity, true, true);\n\t\t},\n\t\tbenchmarkFn: () => {\n\t\t\tperfCompressor!.generateCompressedId();\n\t\t\tperfCompressor!.takeNextCreationRange();\n\t\t},\n\t});\n\n\tfor (const clusterSize of [1, 10, 500, 1000]) {\n\t\tconst numIds = 7;\n\t\tconst session1 = \"8150a099-5302-4672-b5f3-7a4492b59418\" as SessionId;\n\t\tconst session2 = \"f2ded886-92da-4248-967b-eb96ee04cf51\" as SessionId;\n\t\tlet session: SessionId = session1;\n\t\tlet nextFirstFinalizedGenCount1 = 1;\n\t\tlet nextFirstFinalizedGenCount2 = 1;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `finalize a range of IDs (cluster size = ${clusterSize})`,\n\t\t\tbefore: () => {\n\t\t\t\tsetupCompressors(clusterSize, false, true);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\t// Create a range with as minimal overhead as possible, as we'd like for this code to not exist\n\t\t\t\t// in the timing loop at all (but benchmark forces us to do so)\n\t\t\t\tconst isFirstClient = session === session1;\n\t\t\t\tconst firstGenCount = isFirstClient\n\t\t\t\t\t? nextFirstFinalizedGenCount1\n\t\t\t\t\t: nextFirstFinalizedGenCount2;\n\t\t\t\tconst range: IdCreationRange = {\n\t\t\t\t\tsessionId: session,\n\t\t\t\t\tids: {\n\t\t\t\t\t\tfirstGenCount,\n\t\t\t\t\t\tcount: numIds,\n\t\t\t\t\t\trequestedClusterSize: initialClusterCapacity,\n\t\t\t\t\t\tlocalIdRanges: [], // no need to populate, as session is remote and compressor would ignore in production\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tperfCompressor!.finalizeCreationRange(range);\n\n\t\t\t\tconst lastGenCount = firstGenCount + numIds;\n\t\t\t\tif (isFirstClient) {\n\t\t\t\t\tnextFirstFinalizedGenCount1 = lastGenCount;\n\t\t\t\t} else {\n\t\t\t\t\tnextFirstFinalizedGenCount2 = lastGenCount;\n\t\t\t\t}\n\t\t\t\t// Alternate clients to sidestep optimization that packs them all into last cluster\n\t\t\t\tsession = isFirstClient ? session1 : session2;\n\t\t\t},\n\t\t});\n\t}\n\n\tbenchmarkWithFlag((isLocal) => {\n\t\tconst remoteSessionId = sessionIds.get(remoteClient);\n\t\tlet opSpaceId!: OpSpaceCompressedId;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `normalize a ${\n\t\t\t\tisLocal ? \"local\" : \"final\"\n\t\t\t} ID from a remote session to session space`,\n\t\t\tbefore: () => {\n\t\t\t\tconst network = setupCompressors(initialClusterCapacity, true, true);\n\t\t\t\tconst remoteSession = getIdMadeBy(remoteClient, false, network);\n\t\t\t\topSpaceId = (\n\t\t\t\t\tisLocal\n\t\t\t\t\t\t? remoteSession\n\t\t\t\t\t\t: network.getCompressor(remoteClient).normalizeToOpSpace(remoteSession)\n\t\t\t\t) as OpSpaceCompressedId;\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.normalizeToSessionSpace(opSpaceId, remoteSessionId);\n\t\t\t},\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((eagerFinal) => {\n\t\tlet id!: OpSpaceCompressedId & FinalCompressedId;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `normalize a final ID corresponding to a ${\n\t\t\t\teagerFinal ? \"eager final\" : \"local\"\n\t\t\t} ID from op space to the local session`,\n\t\t\tbefore: () => {\n\t\t\t\tconst network = setupCompressors(initialClusterCapacity, true, true);\n\t\t\t\tconst opId = perfCompressor.normalizeToOpSpace(\n\t\t\t\t\tgetIdMadeBy(localClient, eagerFinal, network),\n\t\t\t\t);\n\t\t\t\tassert(isFinalId(opId), \"Must be final\");\n\t\t\t\tid = opId;\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.normalizeToSessionSpace(id, perfCompressor.localSessionId);\n\t\t\t},\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((isLocalOriginator) => {\n\t\tconst remoteSessionId = sessionIds.get(remoteClient);\n\t\tlet opSpaceId!: OpSpaceCompressedId;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `normalize a final ID from a ${\n\t\t\t\tisLocalOriginator ? \"local\" : \"remote\"\n\t\t\t} session to a small session space (common case)`,\n\t\t\tbefore: () => {\n\t\t\t\tconst network = setupCompressors(initialClusterCapacity, false, true);\n\t\t\t\t// Ensure the local session has several different clusters\n\t\t\t\tfor (let clusterCount = 0; clusterCount < 5; clusterCount++) {\n\t\t\t\t\tnetwork.allocateAndSendIds(\n\t\t\t\t\t\tlocalClient,\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\t\t\tperfCompressor[\"nextRequestedClusterSize\"],\n\t\t\t\t\t);\n\t\t\t\t\tnetwork.allocateAndSendIds(\n\t\t\t\t\t\tremoteClient,\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\t\t\tperfCompressor[\"nextRequestedClusterSize\"] * 2,\n\t\t\t\t\t);\n\t\t\t\t\tnetwork.deliverOperations(DestinationClient.All);\n\t\t\t\t}\n\t\t\t\tconst client = isLocalOriginator ? localClient : remoteClient;\n\t\t\t\tconst idFromSession = getIdMadeBy(client, true, network);\n\t\t\t\topSpaceId = network.getCompressor(client).normalizeToOpSpace(idFromSession);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.normalizeToSessionSpace(opSpaceId, remoteSessionId);\n\t\t\t},\n\t\t});\n\t});\n\n\tlet unackedLocalId!: LocalCompressedId;\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `normalize an unacked local ID from the local session to op space`,\n\t\tbefore: () => {\n\t\t\tconst network = setupCompressors(initialClusterCapacity, true, false);\n\t\t\t// Ensure no eager finals\n\t\t\tnetwork.allocateAndSendIds(\n\t\t\t\tlocalClient,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\tnetwork.getCompressor(localClient)[\"nextRequestedClusterSize\"] * 2 + 1,\n\t\t\t);\n\t\t\tunackedLocalId = getIdMadeBy(localClient, false, network);\n\t\t\tassert(\n\t\t\t\tperfCompressor.normalizeToOpSpace(unackedLocalId) === (unackedLocalId as number),\n\t\t\t\t\"Local was acked.\",\n\t\t\t);\n\t\t},\n\t\tbenchmarkFn: () => {\n\t\t\tperfCompressor!.normalizeToOpSpace(unackedLocalId);\n\t\t},\n\t});\n\n\tbenchmarkWithFlag((eagerFinal) => {\n\t\tlet id!: SessionSpaceCompressedId;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `normalize an acked ${\n\t\t\t\teagerFinal ? \"eager final\" : \"local\"\n\t\t\t} ID from the local session to op space`,\n\t\t\tbefore: () => {\n\t\t\t\tconst network = setupCompressors(initialClusterCapacity, true, true);\n\t\t\t\tid = getIdMadeBy(localClient, eagerFinal, network);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.normalizeToOpSpace(id);\n\t\t\t},\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((local) => {\n\t\tlet finalIdToDecompress!: SessionSpaceCompressedId & FinalCompressedId;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `decompress a final ID from a ${\n\t\t\t\tlocal ? \"local\" : \"remote\"\n\t\t\t} client into a stable ID`,\n\t\t\tbefore: () => {\n\t\t\t\tconst network = setupCompressors(initialClusterCapacity, true, true);\n\t\t\t\tfinalIdToDecompress = getIdMadeBy(local ? localClient : remoteClient, true, network);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.decompress(finalIdToDecompress);\n\t\t\t},\n\t\t});\n\t});\n\n\tlet localIdToDecompress!: LocalCompressedId;\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `decompress a local ID into a stable ID`,\n\t\tbefore: () => {\n\t\t\tconst network = setupCompressors(initialClusterCapacity, true, true);\n\t\t\tlocalIdToDecompress = getIdMadeBy(localClient, false, network);\n\t\t},\n\t\tbenchmarkFn: () => {\n\t\t\tperfCompressor!.decompress(localIdToDecompress);\n\t\t},\n\t});\n\n\tbenchmarkWithFlag((eagerFinal) => {\n\t\tlet stableToCompress!: StableId;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `recompress a stable ID to a ${eagerFinal ? \"local\" : \"final\"} ID`,\n\t\t\tbefore: () => {\n\t\t\t\tconst network = setupCompressors(initialClusterCapacity, true, true);\n\t\t\t\tstableToCompress = perfCompressor.decompress(\n\t\t\t\t\tgetIdMadeBy(localClient, eagerFinal, network),\n\t\t\t\t);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.recompress(stableToCompress);\n\t\t\t},\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((manySessions) => {\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `serialize an IdCompressor (${manySessions ? \"many sessions\" : \"many clusters\"})`,\n\t\t\tbefore: () => {\n\t\t\t\tif (manySessions) {\n\t\t\t\t\tperfCompressor = buildHugeCompressor(undefined, initialClusterCapacity);\n\t\t\t\t} else {\n\t\t\t\t\tsetupCompressors(initialClusterCapacity, false, true);\n\t\t\t\t}\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.serialize(false);\n\t\t\t},\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((manySessions) => {\n\t\tlet serialized!: SerializedIdCompressorWithNoSession;\n\t\tconst overrideRemoteSessionId = createSessionId();\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `deserialize an IdCompressor (${\n\t\t\t\tmanySessions ? \"many sessions\" : \"many clusters\"\n\t\t\t})`,\n\t\t\tbefore: () => {\n\t\t\t\tif (manySessions) {\n\t\t\t\t\tperfCompressor = buildHugeCompressor(undefined, initialClusterCapacity);\n\t\t\t\t} else {\n\t\t\t\t\tsetupCompressors(initialClusterCapacity, false, true);\n\t\t\t\t}\n\t\t\t\tserialized = perfCompressor.serialize(false);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tIdCompressor.deserialize({\n\t\t\t\t\tserialized,\n\t\t\t\t\tnewSessionId: overrideRemoteSessionId,\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t});\n});\n"]} | ||
| {"version":3,"file":"idCompressor.perf.spec.js","sourceRoot":"","sources":["../../src/test/idCompressor.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,gFAA4D;AAC5D,sDAAwE;AACxE,kEAA6D;AAE7D,wDAAkD;AAQlD,kDAA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AAC,CAAC,CAAC,eAClC,GAAG;YACH,GAAG,IAAA,6BAAiB,EAAC;gBACpB,iBAAiB,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;oBAClC,MAAM,cAAc,GAAG,YAAY;wBAClC,CAAC,CAAC,IAAA,kDAAmB,EAAC,SAAS,EAAE,sBAAsB,CAAC;wBACxD,CAAC,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,cAAc,CAAC;oBACxE,MAAM,UAAU,GACf,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;oBACjC,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE;wBACzB,8BAAY,CAAC,WAAW,CAAC;4BACxB,UAAU;4BACV,YAAY,EAAE,uBAAuB;yBACrC,CAAC,CAAC;oBACJ,CAAC,CAAC,CAAC;gBACJ,CAAC;aACD,CAAC;SACF,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { take } from \"@fluid-private/stochastic-test-utils\";\nimport { benchmarkDuration, benchmarkIt } from \"@fluid-tools/benchmark\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { IdCompressor } from \"../idCompressor.js\";\nimport type {\n\tIdCreationRange,\n\tOpSpaceCompressedId,\n\tSerializedIdCompressorWithNoSession,\n\tSessionId,\n\tSessionSpaceCompressedId,\n} from \"../index.js\";\nimport { createSessionId } from \"../utilities.js\";\n\nimport {\n\tClient,\n\tDestinationClient,\n\tIdCompressorTestNetwork,\n\tbuildHugeCompressor,\n\tmakeOpGenerator,\n\tperformFuzzActions,\n\tsessionIds,\n} from \"./idCompressorTestUtilities.js\";\nimport {\n\ttype FinalCompressedId,\n\ttype LocalCompressedId,\n\tfail,\n\tisFinalId,\n\tisLocalId,\n} from \"./testCommon.js\";\n\nconst initialClusterCapacity = 512;\n\ndescribe(\"IdCompressor Perf\", () => {\n\tconst localClient = Client.Client1;\n\tconst remoteClient = Client.Client2;\n\n\tfunction setupCompressors(\n\t\tclusterSize: number,\n\t\tlocalClientCanEdit: boolean,\n\t\tsynchronizeAtEnd: boolean,\n\t): { network: IdCompressorTestNetwork; perfCompressor: IdCompressor } {\n\t\tconst perfNetwork = new IdCompressorTestNetwork(clusterSize);\n\t\tconst maxClusterSize = clusterSize * 2;\n\t\tconst generator = take(\n\t\t\t1000,\n\t\t\tmakeOpGenerator({\n\t\t\t\tvalidateInterval: 2000,\n\t\t\t\tmaxClusterSize,\n\t\t\t\toutsideAllocationFraction: 0.9,\n\t\t\t}),\n\t\t);\n\t\tperformFuzzActions(\n\t\t\tgenerator,\n\t\t\tperfNetwork,\n\t\t\tMath.E,\n\t\t\tlocalClientCanEdit ? undefined : localClient,\n\t\t\tsynchronizeAtEnd,\n\t\t);\n\t\tconst perfCompressor = perfNetwork.getCompressorUnsafeNoProxy(localClient);\n\t\treturn { network: perfNetwork, perfCompressor };\n\t}\n\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: false,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): LocalCompressedId;\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: true,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): FinalCompressedId & SessionSpaceCompressedId;\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: boolean,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): SessionSpaceCompressedId;\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: boolean,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): SessionSpaceCompressedId {\n\t\tconst log = network.getIdLog(client);\n\t\tfor (let i = log.length - 1; i > 0; i--) {\n\t\t\tconst { id, originatingClient } = log[i];\n\t\t\tif (\n\t\t\t\toriginatingClient === client &&\n\t\t\t\t((eagerFinal && isFinalId(id)) || (!eagerFinal && isLocalId(id)))\n\t\t\t) {\n\t\t\t\tassert(eagerFinal === isFinalId(id), \"Not local/final as requested.\");\n\t\t\t\treturn id;\n\t\t\t}\n\t\t}\n\t\tfail(\"no ID found in log\");\n\t}\n\n\tfunction benchmarkWithFlag(creator: (flag: boolean) => void): void {\n\t\tfor (const flag of [true, false]) {\n\t\t\tcreator(flag);\n\t\t}\n\t}\n\n\tbenchmarkIt({\n\t\ttitle: `allocate local ID`,\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tconst { perfCompressor } = setupCompressors(initialClusterCapacity, true, true);\n\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\tperfCompressor.generateCompressedId();\n\t\t\t\t});\n\t\t\t},\n\t\t}),\n\t});\n\n\tbenchmarkIt({\n\t\ttitle: \"take an ID creation range\",\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tconst { perfCompressor } = setupCompressors(initialClusterCapacity, true, true);\n\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\tperfCompressor.generateCompressedId();\n\t\t\t\t\tperfCompressor.takeNextCreationRange();\n\t\t\t\t});\n\t\t\t},\n\t\t}),\n\t});\n\n\tfor (const clusterSize of [1, 10, 500, 1000]) {\n\t\tconst numIds = 7;\n\t\tconst session1 = \"8150a099-5302-4672-b5f3-7a4492b59418\" as SessionId;\n\t\tconst session2 = \"f2ded886-92da-4248-967b-eb96ee04cf51\" as SessionId;\n\t\tbenchmarkIt({\n\t\t\ttitle: `finalize a range of IDs (cluster size = ${clusterSize})`,\n\t\t\t...benchmarkDuration({\n\t\t\t\t// Force batch size of 1\n\t\t\t\tminBatchDurationSeconds: 0,\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst { perfCompressor } = setupCompressors(clusterSize, false, true);\n\t\t\t\t\tlet session: SessionId = session1;\n\t\t\t\t\tlet nextFirstFinalizedGenCount1 = 1;\n\t\t\t\t\tlet nextFirstFinalizedGenCount2 = 1;\n\t\t\t\t\tlet duration: number;\n\t\t\t\t\tdo {\n\t\t\t\t\t\t// Create a range with as minimal overhead as possible\n\t\t\t\t\t\tconst isFirstClient = session === session1;\n\t\t\t\t\t\tconst firstGenCount = isFirstClient\n\t\t\t\t\t\t\t? nextFirstFinalizedGenCount1\n\t\t\t\t\t\t\t: nextFirstFinalizedGenCount2;\n\t\t\t\t\t\tconst range: IdCreationRange = {\n\t\t\t\t\t\t\tsessionId: session,\n\t\t\t\t\t\t\tids: {\n\t\t\t\t\t\t\t\tfirstGenCount,\n\t\t\t\t\t\t\t\tcount: numIds,\n\t\t\t\t\t\t\t\trequestedClusterSize: initialClusterCapacity,\n\t\t\t\t\t\t\t\tlocalIdRanges: [], // no need to populate, as session is remote and compressor would ignore in production\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst start = state.timer.now();\n\t\t\t\t\t\tperfCompressor.finalizeCreationRange(range);\n\t\t\t\t\t\tconst end = state.timer.now();\n\t\t\t\t\t\tduration = state.timer.toSeconds(start, end);\n\n\t\t\t\t\t\tconst lastGenCount = firstGenCount + numIds;\n\t\t\t\t\t\tif (isFirstClient) {\n\t\t\t\t\t\t\tnextFirstFinalizedGenCount1 = lastGenCount;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnextFirstFinalizedGenCount2 = lastGenCount;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Alternate clients to sidestep optimization that packs them all into last cluster\n\t\t\t\t\t\tsession = isFirstClient ? session1 : session2;\n\t\t\t\t\t} while (state.recordBatch(duration));\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t}\n\n\tbenchmarkWithFlag((isLocal) => {\n\t\tconst remoteSessionId = sessionIds.get(remoteClient);\n\t\tbenchmarkIt({\n\t\t\ttitle: `normalize a ${\n\t\t\t\tisLocal ? \"local\" : \"final\"\n\t\t\t} ID from a remote session to session space`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tconst remoteSession = getIdMadeBy(remoteClient, false, network);\n\t\t\t\t\tconst opSpaceId = (\n\t\t\t\t\t\tisLocal\n\t\t\t\t\t\t\t? remoteSession\n\t\t\t\t\t\t\t: network.getCompressor(remoteClient).normalizeToOpSpace(remoteSession)\n\t\t\t\t\t) as OpSpaceCompressedId;\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tperfCompressor.normalizeToSessionSpace(opSpaceId, remoteSessionId);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((eagerFinal) => {\n\t\tbenchmarkIt({\n\t\t\ttitle: `normalize a final ID corresponding to a ${\n\t\t\t\teagerFinal ? \"eager final\" : \"local\"\n\t\t\t} ID from op space to the local session`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tconst opId = perfCompressor.normalizeToOpSpace(\n\t\t\t\t\t\tgetIdMadeBy(localClient, eagerFinal, network),\n\t\t\t\t\t);\n\t\t\t\t\tassert(isFinalId(opId), \"Must be final\");\n\t\t\t\t\tconst id = opId as OpSpaceCompressedId & FinalCompressedId;\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tperfCompressor.normalizeToSessionSpace(id, perfCompressor.localSessionId);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((isLocalOriginator) => {\n\t\tconst remoteSessionId = sessionIds.get(remoteClient);\n\t\tbenchmarkIt({\n\t\t\ttitle: `normalize a final ID from a ${\n\t\t\t\tisLocalOriginator ? \"local\" : \"remote\"\n\t\t\t} session to a small session space (common case)`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\t// Ensure the local session has several different clusters\n\t\t\t\t\tfor (let clusterCount = 0; clusterCount < 5; clusterCount++) {\n\t\t\t\t\t\tnetwork.allocateAndSendIds(\n\t\t\t\t\t\t\tlocalClient,\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\t\t\t\tperfCompressor[\"nextRequestedClusterSize\"],\n\t\t\t\t\t\t);\n\t\t\t\t\t\tnetwork.allocateAndSendIds(\n\t\t\t\t\t\t\tremoteClient,\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\t\t\t\tperfCompressor[\"nextRequestedClusterSize\"] * 2,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tnetwork.deliverOperations(DestinationClient.All);\n\t\t\t\t\t}\n\t\t\t\t\tconst client = isLocalOriginator ? localClient : remoteClient;\n\t\t\t\t\tconst idFromSession = getIdMadeBy(client, true, network);\n\t\t\t\t\tconst opSpaceId = network.getCompressor(client).normalizeToOpSpace(idFromSession);\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tperfCompressor.normalizeToSessionSpace(opSpaceId, remoteSessionId);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n\n\tbenchmarkIt({\n\t\ttitle: `normalize an unacked local ID from the local session to op space`,\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\ttrue,\n\t\t\t\t\tfalse,\n\t\t\t\t);\n\t\t\t\t// Ensure no eager finals\n\t\t\t\tnetwork.allocateAndSendIds(\n\t\t\t\t\tlocalClient,\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\t\tnetwork.getCompressor(localClient)[\"nextRequestedClusterSize\"] * 2 + 1,\n\t\t\t\t);\n\t\t\t\tconst unackedLocalId = getIdMadeBy(localClient, false, network);\n\t\t\t\tassert(\n\t\t\t\t\tperfCompressor.normalizeToOpSpace(unackedLocalId) === (unackedLocalId as number),\n\t\t\t\t\t\"Local was acked.\",\n\t\t\t\t);\n\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\tperfCompressor.normalizeToOpSpace(unackedLocalId);\n\t\t\t\t});\n\t\t\t},\n\t\t}),\n\t});\n\n\tbenchmarkWithFlag((eagerFinal) => {\n\t\tbenchmarkIt({\n\t\t\ttitle: `normalize an acked ${\n\t\t\t\teagerFinal ? \"eager final\" : \"local\"\n\t\t\t} ID from the local session to op space`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tconst id = getIdMadeBy(localClient, eagerFinal, network);\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tperfCompressor.normalizeToOpSpace(id);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((local) => {\n\t\tbenchmarkIt({\n\t\t\ttitle: `decompress a final ID from a ${\n\t\t\t\tlocal ? \"local\" : \"remote\"\n\t\t\t} client into a stable ID`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tconst finalIdToDecompress = getIdMadeBy(\n\t\t\t\t\t\tlocal ? localClient : remoteClient,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tnetwork,\n\t\t\t\t\t);\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tperfCompressor.decompress(finalIdToDecompress);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n\n\tbenchmarkIt({\n\t\ttitle: `decompress a local ID into a stable ID`,\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\ttrue,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\tconst localIdToDecompress = getIdMadeBy(localClient, false, network);\n\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\tperfCompressor.decompress(localIdToDecompress);\n\t\t\t\t});\n\t\t\t},\n\t\t}),\n\t});\n\n\tbenchmarkWithFlag((eagerFinal) => {\n\t\tbenchmarkIt({\n\t\t\ttitle: `recompress a stable ID to a ${eagerFinal ? \"local\" : \"final\"} ID`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tconst stableToCompress = perfCompressor.decompress(\n\t\t\t\t\t\tgetIdMadeBy(localClient, eagerFinal, network),\n\t\t\t\t\t);\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tperfCompressor.recompress(stableToCompress);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((manySessions) => {\n\t\tbenchmarkIt({\n\t\t\ttitle: `serialize an IdCompressor (${manySessions ? \"many sessions\" : \"many clusters\"})`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst perfCompressor = manySessions\n\t\t\t\t\t\t? buildHugeCompressor(undefined, initialClusterCapacity)\n\t\t\t\t\t\t: setupCompressors(initialClusterCapacity, false, true).perfCompressor;\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tperfCompressor.serialize(false);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((manySessions) => {\n\t\tconst overrideRemoteSessionId = createSessionId();\n\t\tbenchmarkIt({\n\t\t\ttitle: `deserialize an IdCompressor (${\n\t\t\t\tmanySessions ? \"many sessions\" : \"many clusters\"\n\t\t\t})`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst perfCompressor = manySessions\n\t\t\t\t\t\t? buildHugeCompressor(undefined, initialClusterCapacity)\n\t\t\t\t\t\t: setupCompressors(initialClusterCapacity, false, true).perfCompressor;\n\t\t\t\t\tconst serialized: SerializedIdCompressorWithNoSession =\n\t\t\t\t\t\tperfCompressor.serialize(false);\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tIdCompressor.deserialize({\n\t\t\t\t\t\t\tserialized,\n\t\t\t\t\t\t\tnewSessionId: overrideRemoteSessionId,\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n});\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"idCompressorTestUtilities.d.ts","sourceRoot":"","sources":["../../src/test/idCompressorTestUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,iBAA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Z,UAAU,aAAc,SAAQ,iBAAiB;IAChD,OAAO,EAAE,uBAAuB,CAAC;IACjC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACzC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACnC;AAQD,wBAAgB,eAAe,CAC9B,OAAO,EAAE,yBAAyB,GAChC,SAAS,CAAC,SAAS,EAAE,aAAa,CAAC,CA4FrC;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,aAAa,CAAC,EAC9C,OAAO,EAAE,uBAAuB,EAChC,IAAI,EAAE,MAAM,EACZ,cAAc,CAAC,EAAE,MAAM,EACvB,gBAAgB,GAAE,OAAc,EAChC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,EACtD,QAAQ,CAAC,EAAE,QAAQ,GACjB,IAAI,CA0DN;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,UAAU,EAAE,YAAY,EACxB,KAAK,EAAE,MAAM,GACX,wBAAwB,EAAE,CAM5B;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,CAChD,MAAM,CAAC,EAAE,oBAAoB,GAC3B,aAAa,GAAG,iBAAiB,CAAC;AACrC;;;GAGG;AACH,wBAAgB,iCAAiC,CAChD,SAAS,EAAE,SAAS,EACpB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,IAAI,CAAC,EAAE,MAAM,GACX,aAAa,GAAG,iBAAiB,CAAC"} | ||
| {"version":3,"file":"idCompressorTestUtilities.d.ts","sourceRoot":"","sources":["../../src/test/idCompressorTestUtilities.ts"],"names":[],"mappings":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essionId); | ||
| return compressor; | ||
| return (0, index_js_1.toIdCompressorWithCore)(compressor); | ||
| } | ||
| exports.createAlwaysFinalizedIdCompressor = createAlwaysFinalizedIdCompressor; | ||
| //# sourceMappingURL=idCompressorTestUtilities.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"idCompressorTestUtilities.js","sourceRoot":"","sources":["../../src/test/idCompressorTestUtilities.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6CAA+C;AAE/C,gFAU8C;AAG9C,wDAAkD;AAClD,0CAWqB;AACrB,4EAAsE;AACtE,kDAA0F;AAE1F,mDAQyB;AASzB;;GAEG;AACH,IAAY,MAIX;AAJD,WAAY,MAAM;IACjB,6BAAmB,CAAA;IACnB,6BAAmB,CAAA;IACnB,6BAAmB,CAAA;AACpB,CAAC,EAJW,MAAM,sBAAN,MAAM,QAIjB;AAED;;GAEG;AACH,IAAY,UAEX;AAFD,WAAY,UAAU;IACrB,yBAAW,CAAA;AACZ,CAAC,EAFW,UAAU,0BAAV,UAAU,QAErB;AAED;;GAEG;AACH,IAAY,aAEX;AAFD,WAAY,aAAa;IACxB,kCAAiB,CAAA;AAClB,CAAC,EAFW,aAAa,6BAAb,aAAa,QAExB;AAOY,QAAA,iBAAiB,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,aAAa,EAAE,CAAC;AAMpD,QAAA,iBAAiB,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,UAAU,EAAE,CAAC;AAE9D,kEAAkE;AAClE,MAAa,iBAAiB;IAC7B;;OAEG;IACI,MAAM,CAAC,gBAAgB,CAC7B,MAAc,EACd,eAAe,GAAG,CAAC,EACnB,MAA6B;QAE7B,OAAO,iBAAiB,CAAC,2BAA2B,CACnD,kBAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EACtB,eAAe,EACf,MAAM,CACN,CAAC;IACH,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,2BAA2B,CACxC,SAAoB,EACpB,eAAe,GAAG,CAA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AAC,SAAS,CAAC,CAAC;IAC1D,OAAO,UAAU,CAAC;AACnB,CAAC;AAnBD,8EAmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport {\n\ttype BaseFuzzTestState,\n\ttype Generator,\n\ttype SaveInfo,\n\tcreateWeightedGenerator,\n\tinterleave,\n\tmakeRandom,\n\tperformFuzzActions as performFuzzActionsBase,\n\trepeat,\n\ttake,\n} from \"@fluid-private/stochastic-test-utils\";\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\n\nimport { IdCompressor } from \"../idCompressor.js\";\nimport {\n\ttype IIdCompressor,\n\ttype IIdCompressorCore,\n\ttype IdCreationRange,\n\ttype OpSpaceCompressedId,\n\ttype SerializedIdCompressorWithNoSession,\n\ttype SerializedIdCompressorWithOngoingSession,\n\ttype SessionId,\n\ttype SessionSpaceCompressedId,\n\ttype StableId,\n\tcreateIdCompressor,\n} from \"../index.js\";\nimport { SessionSpaceNormalizer } from \"../sessionSpaceNormalizer.js\";\nimport { assertIsSessionId, createSessionId, localIdFromGenCount } from \"../utilities.js\";\n\nimport {\n\ttype FinalCompressedId,\n\ttype ReadonlyIdCompressor,\n\tfail,\n\tgetOrCreate,\n\tincrementStableId,\n\tisFinalId,\n\tisLocalId,\n} from \"./testCommon.js\";\n\n/**\n * A readonly `Map` which is known to contain a value for every possible key\n */\nexport interface ClosedMap<K, V> extends Omit<Map<K, V>, \"delete\" | \"clear\"> {\n\tget(key: K): V;\n}\n\n/**\n * Identifies a compressor in a network\n */\nexport enum Client {\n\tClient1 = \"Client1\",\n\tClient2 = \"Client2\",\n\tClient3 = \"Client3\",\n}\n\n/**\n * Identifies categories of compressors\n */\nexport enum MetaClient {\n\tAll = \"All\",\n}\n\n/**\n * Identifies a compressor inside the network but outside the three specially tracked clients.\n */\nexport enum OutsideClient {\n\tRemote = \"Remote\",\n}\n\n/**\n * Used to attribute actions to clients in a distributed collaboration session.\n * `Local` implies a local and unsequenced operation. All others imply sequenced operations.\n */\nexport type OriginatingClient = Client | OutsideClient;\nexport const OriginatingClient = { ...Client, ...OutsideClient };\n\n/**\n * Identifies a compressor to which to send an operation\n */\nexport type DestinationClient = Client | MetaClient;\nexport const DestinationClient = { ...Client, ...MetaClient };\n\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class\nexport class CompressorFactory {\n\t/**\n\t * Creates a new compressor with the supplied cluster capacity.\n\t */\n\tpublic static createCompressor(\n\t\tclient: Client,\n\t\tclusterCapacity = 5,\n\t\tlogger?: ITelemetryBaseLogger,\n\t): IdCompressor {\n\t\treturn CompressorFactory.createCompressorWithSession(\n\t\t\tsessionIds.get(client),\n\t\t\tclusterCapacity,\n\t\t\tlogger,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new compressor with the supplied cluster capacity.\n\t */\n\tpublic static createCompressorWithSession(\n\t\tsessionId: SessionId,\n\t\tclusterCapacity = 5,\n\t\tlogger?: ITelemetryBaseLogger,\n\t): IdCompressor {\n\t\tconst compressor = createIdCompressor(sessionId, logger) as IdCompressor;\n\t\tmodifyClusterSize(compressor, clusterCapacity);\n\t\treturn compressor;\n\t}\n}\n\n/**\n * Modify the requested cluster size of the provided compressor.\n * @remarks\n * This is useful for testing purposes for a few reasons:\n * - Id compressor bugs are often related to edge cases that occur on cluster boundaries\n * - Smaller cluster sizes can enable writing tests without for loops generating \"ids until a new cluster is created\"\n */\nexport function modifyClusterSize(compressor: IIdCompressor, newClusterSize: number): void {\n\tverifyCompressorLike(compressor);\n\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\tcompressor[\"nextRequestedClusterSize\"] = newClusterSize;\n}\n\n/**\n * Returns the current cluster size of the compressor.\n * @privateRemarks\n * This is useful in writing tests to avoid having to hardcode the (currently constant) cluster size.\n */\nexport function getClusterSize(compressor: ReadonlyIdCompressor): number {\n\tverifyCompressorLike(compressor);\n\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\treturn compressor[\"nextRequestedClusterSize\"] as number;\n}\n\nfunction verifyCompressorLike(compressor: ReadonlyIdCompressor | IIdCompressor): void {\n\tassert(\n\t\t// Some IdCompressor tests wrap underlying compressors with proxies--allow this for now.\n\t\t// Because of id-compressor's dynamic import in container-runtime, instanceof checks for IdCompressor\n\t\t// also won't necessarily work nicely. Get a small amount of validation that this function should work\n\t\t// as intended by at least verifying the property name exists.\n\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\ttypeof compressor[\"nextRequestedClusterSize\"] === \"number\",\n\t);\n}\n\n/**\n * Utility for building a huge compressor.\n * Build via the compressor factory.\n */\nexport function buildHugeCompressor(\n\tnumSessions = 10000,\n\tcapacity = 10,\n\tnumClustersPerSession = 3,\n): IdCompressor {\n\tconst compressor = CompressorFactory.createCompressorWithSession(\n\t\tcreateSessionId(),\n\t\tcapacity,\n\t);\n\tconst sessions: SessionId[] = [];\n\tfor (let i = 0; i < numSessions; i++) {\n\t\tsessions.push(createSessionId());\n\t}\n\tfor (let i = 0; i < numSessions * numClustersPerSession; i++) {\n\t\tconst sessionId = sessions[i % numSessions];\n\t\tif (Math.random() > 0.1) {\n\t\t\tfor (let j = 0; j < Math.round(capacity / 2); j++) {\n\t\t\t\tcompressor.generateCompressedId();\n\t\t\t}\n\t\t\tcompressor.finalizeCreationRange(compressor.takeNextCreationRange());\n\t\t}\n\t\tcompressor.finalizeCreationRange({\n\t\t\tsessionId,\n\t\t\tids: {\n\t\t\t\tfirstGenCount: Math.floor(i / numSessions) * capacity + 1,\n\t\t\t\tcount: capacity,\n\t\t\t\trequestedClusterSize: capacity,\n\t\t\t\tlocalIdRanges: [], // remote session, can safely ignore in tests\n\t\t\t},\n\t\t});\n\t}\n\treturn compressor;\n}\n\n/**\n * A closed map from NamedClient to T.\n */\nexport type ClientMap<T> = ClosedMap<Client, T>;\n\nfunction makeSessionIds(): ClientMap<SessionId> {\n\tconst stableIds = new Map<Client, SessionId>();\n\tconst clients = Object.values(Client);\n\tfor (let i = 0; i < clients.length; i++) {\n\t\t// Place session uuids roughly in the middle of uuid space to increase odds of encountering interesting\n\t\t// orderings in sorted collections\n\t\tconst sessionId = assertIsSessionId(`88888888-8888-4888-b${i}88-888888888888`);\n\t\tstableIds.set(clients[i], sessionId);\n\t}\n\treturn stableIds as ClientMap<SessionId>;\n}\n\n/**\n * An array of session ID strings corresponding to all non-local `Client` entries.\n */\nexport const sessionIds = makeSessionIds();\n\n/**\n * Information about a generated ID in a network to be validated by tests\n */\nexport interface TestIdData {\n\treadonly id: SessionSpaceCompressedId;\n\treadonly originatingClient: OriginatingClient;\n\treadonly sessionId: SessionId;\n\treadonly isSequenced: boolean;\n}\n\n/**\n * Simulates a network of ID compressors.\n * Not suitable for performance testing.\n */\nexport class IdCompressorTestNetwork {\n\t/**\n\t * The compressors used in this network\n\t */\n\tprivate readonly compressors: ClientMap<IdCompressor>;\n\t/**\n\t * The log of operations seen by the server so far. Append-only.\n\t */\n\tprivate readonly serverOperations: [\n\t\tcreationRange: IdCreationRange,\n\t\topSpaceIds: OpSpaceCompressedId[],\n\t\tclientFrom: OriginatingClient,\n\t\tsessionIdFrom: SessionId,\n\t][] = [];\n\t/**\n\t * An index into `serverOperations` for each client which represents how many operations have been delivered to that client\n\t */\n\tprivate readonly clientProgress: ClientMap<number>;\n\t/**\n\t * All ids (local and sequenced) that a client has created or received, in order.\n\t */\n\tprivate readonly idLogs: ClientMap<TestIdData[]>;\n\t/**\n\t * All ids that a client has received from the server, in order.\n\t */\n\tprivate readonly sequencedIdLogs: ClientMap<TestIdData[]>;\n\n\tpublic constructor(public readonly initialClusterSize = 5) {\n\t\tconst compressors = new Map<Client, IdCompressor>();\n\t\tconst clientProgress = new Map<Client, number>();\n\t\tconst clientIds = new Map<Client, TestIdData[]>();\n\t\tconst clientSequencedIds = new Map<Client, TestIdData[]>();\n\t\tfor (const client of Object.values(Client)) {\n\t\t\tconst compressor = CompressorFactory.createCompressor(client, initialClusterSize);\n\t\t\tcompressors.set(client, compressor);\n\t\t\tclientProgress.set(client, 0);\n\t\t\tclientIds.set(client, []);\n\t\t\tclientSequencedIds.set(client, []);\n\t\t}\n\t\tthis.compressors = compressors as ClientMap<IdCompressor>;\n\t\tthis.clientProgress = clientProgress as ClientMap<number>;\n\t\tthis.idLogs = clientIds as ClientMap<TestIdData[]>;\n\t\tthis.sequencedIdLogs = clientSequencedIds as ClientMap<TestIdData[]>;\n\t}\n\n\t/**\n\t * Returns the number of undelivered operations for the given client that are in flight in the network.\n\t */\n\tpublic getPendingOperations(destination: Client): number {\n\t\treturn this.serverOperations.length - this.clientProgress.get(destination);\n\t}\n\n\t/**\n\t * Returns an immutable handle to a compressor in the network.\n\t */\n\tpublic getCompressor(client: Client): ReadonlyIdCompressor {\n\t\tconst compressors = this.compressors;\n\t\tconst handler = {\n\t\t\tget<P extends keyof IdCompressor>(_: unknown, property: P): IdCompressor[P] {\n\t\t\t\treturn compressors.get(client)[property];\n\t\t\t},\n\t\t\tset<P extends keyof IdCompressor>(\n\t\t\t\t_: unknown,\n\t\t\t\tproperty: P,\n\t\t\t\tvalue: IdCompressor[P],\n\t\t\t): boolean {\n\t\t\t\tcompressors.get(client)[property] = value;\n\t\t\t\treturn true;\n\t\t\t},\n\t\t};\n\t\treturn new Proxy<IdCompressor>({} as unknown as IdCompressor, handler);\n\t}\n\n\t/**\n\t * Returns a mutable handle to a compressor in the network. Use of mutation methods will break the network invariants and\n\t * should only be used if the network will not be used again.\n\t */\n\tpublic getCompressorUnsafe(client: Client): IdCompressor {\n\t\treturn this.getCompressor(client) as IdCompressor;\n\t}\n\n\t/**\n\t * Returns a mutable handle to a compressor in the network. Use of mutation methods will break the network invariants and\n\t * should only be used if the network will not be used again. Additionally, the returned compressor will be invalidated/unusable\n\t * if any network operations cause it to be regenerated (serialization/deserialization, etc.).\n\t */\n\tpublic getCompressorUnsafeNoProxy(client: Client): IdCompressor {\n\t\treturn this.compressors.get(client);\n\t}\n\n\t/**\n\t * Returns data for all IDs created and received by this client, including ack's of their own (i.e. their own IDs will appear twice)\n\t */\n\tpublic getIdLog(client: Client): readonly TestIdData[] {\n\t\treturn this.idLogs.get(client);\n\t}\n\n\t/**\n\t * Returns data for all IDs received by this client, including ack's of their own.\n\t */\n\tpublic getSequencedIdLog(client: Client): readonly TestIdData[] {\n\t\treturn this.sequencedIdLogs.get(client);\n\t}\n\n\t/**\n\t * Get all compressors for the given destination\n\t */\n\tpublic getTargetCompressors(clientTo: DestinationClient): [Client, IdCompressor][] {\n\t\treturn clientTo === MetaClient.All\n\t\t\t? [...this.compressors.entries()]\n\t\t\t: ([[clientTo, this.getCompressor(clientTo)]] as [Client, IdCompressor][]);\n\t}\n\n\t/**\n\t * Changes the capacity request amount for a client. It will take effect immediately.\n\t */\n\tpublic changeCapacity(client: Client, newClusterCapacity: number): void {\n\t\tmodifyClusterSize(this.compressors.get(client), newClusterCapacity);\n\t}\n\n\tprivate addNewId(\n\t\tclient: Client,\n\t\tid: SessionSpaceCompressedId,\n\t\toriginatingClient: OriginatingClient,\n\t\tsessionIdFrom: SessionId,\n\t\tisSequenced: boolean,\n\t): void {\n\t\tconst idData = {\n\t\t\tid,\n\t\t\toriginatingClient,\n\t\t\tsessionId: sessionIdFrom,\n\t\t\tisSequenced,\n\t\t};\n\t\tconst clientIds = this.idLogs.get(client);\n\t\tclientIds.push(idData);\n\t\tif (isSequenced) {\n\t\t\tconst sequencedIds = this.sequencedIdLogs.get(client);\n\t\t\tsequencedIds.push(idData);\n\t\t}\n\t}\n\n\t/**\n\t * Allocates a new range of local IDs and enqueues them for future delivery via a `testIdDelivery` action.\n\t * Calls to this method determine the total order of delivery, regardless of when `deliverOperations` is called.\n\t */\n\tpublic allocateAndSendIds(clientFrom: Client, numIds: number): OpSpaceCompressedId[] {\n\t\treturn this.allocateAndSendIdsFromRemoteClient(\n\t\t\tclientFrom,\n\t\t\tsessionIds.get(clientFrom),\n\t\t\tnumIds,\n\t\t);\n\t}\n\n\t/**\n\t * Same contract as `allocateAndSendIds`, but the originating client will be a client with the supplied sessionId.\n\t */\n\tpublic allocateAndSendIdsFromRemoteClient(\n\t\tclientFrom: OriginatingClient,\n\t\tsessionIdFrom: SessionId,\n\t\tnumIds: number,\n\t): OpSpaceCompressedId[] {\n\t\tassert(numIds > 0, \"Must allocate a non-zero number of IDs\");\n\t\tif (clientFrom === OriginatingClient.Remote) {\n\t\t\tconst range: IdCreationRange = {\n\t\t\t\tsessionId: sessionIdFrom,\n\t\t\t\tids: {\n\t\t\t\t\tfirstGenCount: 1,\n\t\t\t\t\tcount: numIds,\n\t\t\t\t\trequestedClusterSize: getClusterSize(this.getCompressor(Client.Client1)),\n\t\t\t\t\tlocalIdRanges: [], // remote session, can safely ignore in tests\n\t\t\t\t},\n\t\t\t};\n\t\t\tconst opSpaceIds: OpSpaceCompressedId[] = [];\n\t\t\tfor (let i = 0; i < numIds; i++) {\n\t\t\t\topSpaceIds.push(-(i + 1) as OpSpaceCompressedId);\n\t\t\t}\n\t\t\tthis.serverOperations.push([range, opSpaceIds, clientFrom, sessionIdFrom]);\n\t\t\treturn opSpaceIds;\n\t\t} else {\n\t\t\tassert(sessionIdFrom === sessionIds.get(clientFrom));\n\t\t\tconst compressor = this.compressors.get(clientFrom);\n\t\t\tconst sessionSpaceIds = generateCompressedIds(compressor, numIds);\n\t\t\tfor (let i = 0; i < numIds; i++) {\n\t\t\t\tthis.addNewId(clientFrom, sessionSpaceIds[i], clientFrom, sessionIdFrom, false);\n\t\t\t}\n\t\t\tconst opSpaceIds = sessionSpaceIds.map((id) => compressor.normalizeToOpSpace(id));\n\t\t\tconst creationRange = compressor.takeNextCreationRange();\n\t\t\tthis.serverOperations.push([creationRange, opSpaceIds, clientFrom, sessionIdFrom]);\n\t\t\treturn opSpaceIds;\n\t\t}\n\t}\n\n\t/**\n\t * Delivers all undelivered ID ranges from the server to the target clients.\n\t */\n\tpublic deliverOperations(clientTakingDelivery: Client, opsToDeliver?: number): void;\n\n\t/**\n\t * Delivers all undelivered ID ranges from the server to the target clients.\n\t */\n\tpublic deliverOperations(clientTakingDelivery: DestinationClient): void;\n\n\t/**\n\t * Delivers all undelivered ID ranges from the server to the target clients.\n\t */\n\tpublic deliverOperations(\n\t\tclientTakingDelivery: DestinationClient,\n\t\topsToDeliver?: number,\n\t): void {\n\t\tlet opIndexBound: number;\n\t\tif (clientTakingDelivery === DestinationClient.All) {\n\t\t\tassert(opsToDeliver === undefined);\n\t\t\topIndexBound = this.serverOperations.length;\n\t\t} else {\n\t\t\topIndexBound =\n\t\t\t\topsToDeliver === undefined\n\t\t\t\t\t? this.serverOperations.length\n\t\t\t\t\t: this.clientProgress.get(clientTakingDelivery) + opsToDeliver;\n\t\t}\n\t\tfor (const [clientTo, compressorTo] of this.getTargetCompressors(clientTakingDelivery)) {\n\t\t\tfor (let i = this.clientProgress.get(clientTo); i < opIndexBound; i++) {\n\t\t\t\tconst [range, opSpaceIds, clientFrom, sessionIdFrom] = this.serverOperations[i];\n\t\t\t\tcompressorTo.finalizeCreationRange(range);\n\n\t\t\t\tconst ids = range.ids;\n\t\t\t\tif (ids !== undefined) {\n\t\t\t\t\tfor (const id of opSpaceIds) {\n\t\t\t\t\t\tconst sessionSpaceId = compressorTo.normalizeToSessionSpace(id, range.sessionId);\n\t\t\t\t\t\tthis.addNewId(clientTo, sessionSpaceId, clientFrom, sessionIdFrom, true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.clientProgress.set(clientTo, opIndexBound);\n\t\t}\n\t}\n\n\t/**\n\t * Simulate a client disconnecting (and serializing), then reconnecting (and deserializing)\n\t */\n\tpublic goOfflineThenResume(client: Client): void {\n\t\tconst compressor = this.compressors.get(client);\n\t\tconst [_, resumedCompressor] = roundtrip(compressor, true);\n\t\tthis.compressors.set(client, resumedCompressor);\n\t}\n\n\t/**\n\t * Ensure general validity of the network state. Useful for calling periodically or at the end of test scenarios.\n\t */\n\tpublic assertNetworkState(): void {\n\t\tconst sequencedLogs = Object.values(Client).map(\n\t\t\t(client) => [this.compressors.get(client), this.getSequencedIdLog(client)] as const,\n\t\t);\n\n\t\tconst getLocalIdsInRange = (\n\t\t\trange: IdCreationRange,\n\t\t\topSpaceIds?: OpSpaceCompressedId[],\n\t\t): Set<SessionSpaceCompressedId> => {\n\t\t\tconst localIdsInCreationRange = new Set<SessionSpaceCompressedId>();\n\t\t\tconst ids = range.ids;\n\t\t\tif (ids !== undefined) {\n\t\t\t\tconst { firstGenCount, localIdRanges } = ids;\n\t\t\t\tfor (const [genCount, count] of localIdRanges) {\n\t\t\t\t\tfor (let g = genCount; g < genCount + count; g++) {\n\t\t\t\t\t\tconst local = localIdFromGenCount(g);\n\t\t\t\t\t\tif (opSpaceIds) {\n\t\t\t\t\t\t\tassert.strictEqual(opSpaceIds[g - firstGenCount], local);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlocalIdsInCreationRange.add(local);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn localIdsInCreationRange;\n\t\t};\n\n\t\t// Ensure creation ranges for clients we track contain the correct local ID ranges\n\t\tfor (const [range, opSpaceIds, clientFrom] of this.serverOperations) {\n\t\t\tif (clientFrom !== OriginatingClient.Remote) {\n\t\t\t\tconst localIdsInCreationRange = getLocalIdsInRange(range, opSpaceIds);\n\t\t\t\tlet localCount = 0;\n\t\t\t\tfor (const id of opSpaceIds) {\n\t\t\t\t\tif (isLocalId(id)) {\n\t\t\t\t\t\tlocalCount++;\n\t\t\t\t\t\tassert(localIdsInCreationRange.has(id), \"Local ID not in creation range\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\tlocalCount,\n\t\t\t\t\tlocalIdsInCreationRange.size,\n\t\t\t\t\t\"Local ID count mismatch\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst undeliveredRanges = new Map<Client, IdCreationRange[]>();\n\t\tfor (const [client, progress] of this.clientProgress.entries()) {\n\t\t\tconst ranges = this.serverOperations\n\t\t\t\t.slice(progress)\n\t\t\t\t.filter((op) => op[2] === client)\n\t\t\t\t.map(([range]) => range);\n\t\t\tundeliveredRanges.set(client, ranges);\n\t\t}\n\t\tfor (const [client, ranges] of undeliveredRanges.entries()) {\n\t\t\tconst compressor = this.compressors.get(client);\n\t\t\tlet firstGenCount: number | undefined;\n\t\t\tlet totalCount = 0;\n\t\t\tconst unionedLocalRanges = new SessionSpaceNormalizer();\n\t\t\tfor (const range of ranges) {\n\t\t\t\tassert(range.sessionId === compressor.localSessionId);\n\t\t\t\tif (range.ids !== undefined) {\n\t\t\t\t\t// initialize firstGenCount if not set\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy\n\t\t\t\t\tif (firstGenCount === undefined) {\n\t\t\t\t\t\tfirstGenCount = range.ids.firstGenCount;\n\t\t\t\t\t}\n\t\t\t\t\ttotalCount += range.ids.count;\n\t\t\t\t\tfor (const [genCount, count] of range.ids.localIdRanges) {\n\t\t\t\t\t\tunionedLocalRanges.addLocalRange(genCount, count);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst retakenRange = compressor.takeUnfinalizedCreationRange();\n\t\t\tif (retakenRange.ids === undefined) {\n\t\t\t\tassert.strictEqual(totalCount, 0);\n\t\t\t\tassert.strictEqual(unionedLocalRanges.idRanges.size, 0);\n\t\t\t} else {\n\t\t\t\tconst retakenLocalIds = new SessionSpaceNormalizer();\n\t\t\t\tfor (const [genCount, count] of retakenRange.ids.localIdRanges) {\n\t\t\t\t\tretakenLocalIds.addLocalRange(genCount, count);\n\t\t\t\t}\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\tretakenLocalIds.equals(unionedLocalRanges),\n\t\t\t\t\ttrue,\n\t\t\t\t\t\"Local ID ranges mismatch\",\n\t\t\t\t);\n\t\t\t\tassert.strictEqual(retakenRange.ids.count, totalCount, \"Count mismatch\");\n\t\t\t\tassert.strictEqual(retakenRange.ids.firstGenCount, firstGenCount, \"Count mismatch\");\n\t\t\t}\n\t\t}\n\n\t\t// First, ensure all clients each generated a unique ID for each of their own calls to generate.\n\t\tfor (const [compressor, ids] of sequencedLogs) {\n\t\t\tconst allUuids = new Set<StableId | string>();\n\t\t\tfor (const idData of ids) {\n\t\t\t\tconst uuid = compressor.decompress(idData.id);\n\t\t\t\tassert.strictEqual(!allUuids.has(uuid), true, \"Duplicate UUID generated.\");\n\t\t\t\tallUuids.add(uuid);\n\t\t\t}\n\t\t}\n\n\t\tconst maxLogLength = sequencedLogs\n\t\t\t.map(([_, data]) => data.length)\n\t\t\t// eslint-disable-next-line unicorn/no-array-reduce\n\t\t\t.reduce((p, n) => Math.max(p, n));\n\n\t\tfunction getNextLogWithEntryAt(logsIndex: number, entryIndex: number): number | undefined {\n\t\t\tfor (let i = logsIndex; i < sequencedLogs.length; i++) {\n\t\t\t\tconst log = sequencedLogs[i];\n\t\t\t\tif (log[1].length > entryIndex) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst uuids = new Set<StableId>();\n\t\tconst finalIds = new Set<FinalCompressedId>();\n\t\tconst idIndicesAggregator = new Map<SessionId, number>();\n\n\t\tfunction* getIdLogEntries(\n\t\t\tcolumnIndex: number,\n\t\t): Iterable<\n\t\t\t[\n\t\t\t\tcurrent: [compressor: IdCompressor, idData: TestIdData],\n\t\t\t\tnext?: [compressor: IdCompressor, idData: TestIdData],\n\t\t\t]\n\t\t> {\n\t\t\tlet current = getNextLogWithEntryAt(0, columnIndex);\n\t\t\twhile (current !== undefined) {\n\t\t\t\tconst next = getNextLogWithEntryAt(current + 1, columnIndex);\n\t\t\t\tconst [compressor, log] = sequencedLogs[current];\n\t\t\t\tif (next === undefined) {\n\t\t\t\t\tyield [[compressor, log[columnIndex]]];\n\t\t\t\t} else {\n\t\t\t\t\tconst [compressorNext, logNext] = sequencedLogs[next];\n\t\t\t\t\tyield [\n\t\t\t\t\t\t[compressor, log[columnIndex]],\n\t\t\t\t\t\t[compressorNext, logNext[columnIndex]],\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\t\tcurrent = next;\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < maxLogLength; i++) {\n\t\t\tlet idCreatorCount = 0;\n\t\t\tlet originatingSession: SessionId | undefined;\n\t\t\tfor (const [current, next] of getIdLogEntries(i)) {\n\t\t\t\tconst [compressorA, idDataA] = current;\n\t\t\t\tconst sessionSpaceIdA = idDataA.id;\n\t\t\t\tconst idIndex = getOrCreate(idIndicesAggregator, idDataA.sessionId, () => 0);\n\t\t\t\toriginatingSession ??= idDataA.sessionId;\n\t\t\t\tassert(\n\t\t\t\t\tidDataA.sessionId === originatingSession,\n\t\t\t\t\t\"Test infra gave wrong originating client to TestIdData\",\n\t\t\t\t);\n\n\t\t\t\t// Only one client should have this ID as local in its session space, as only one client could have created this ID\n\t\t\t\tif (isLocalId(sessionSpaceIdA)) {\n\t\t\t\t\tif (originatingSession !== OriginatingClient.Remote) {\n\t\t\t\t\t\tassert.strictEqual(\n\t\t\t\t\t\t\tidDataA.sessionId,\n\t\t\t\t\t\t\tthis.compressors.get(idDataA.originatingClient as Client).localSessionId,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tidCreatorCount++;\n\t\t\t\t}\n\n\t\t\t\tconst uuidASessionSpace = compressorA.decompress(sessionSpaceIdA);\n\t\t\t\tassert.strictEqual(uuidASessionSpace, incrementStableId(idDataA.sessionId, idIndex));\n\t\t\t\tassert.strictEqual(compressorA.recompress(uuidASessionSpace), sessionSpaceIdA);\n\t\t\t\tuuids.add(uuidASessionSpace);\n\t\t\t\tconst opSpaceIdA = compressorA.normalizeToOpSpace(sessionSpaceIdA);\n\t\t\t\tif (!isFinalId(opSpaceIdA)) {\n\t\t\t\t\tfail(\"IDs should have been finalized.\");\n\t\t\t\t}\n\t\t\t\tconst reNormalizedIdA = compressorA.normalizeToSessionSpace(\n\t\t\t\t\topSpaceIdA,\n\t\t\t\t\tcompressorA.localSessionId,\n\t\t\t\t);\n\t\t\t\tassert.strictEqual(reNormalizedIdA, sessionSpaceIdA);\n\t\t\t\tfinalIds.add(opSpaceIdA);\n\t\t\t\tconst uuidAOpSpace = compressorA.decompress(reNormalizedIdA);\n\n\t\t\t\tassert.strictEqual(uuidASessionSpace, uuidAOpSpace);\n\n\t\t\t\tif (next !== undefined) {\n\t\t\t\t\tconst [compressorB, idDataB] = next;\n\t\t\t\t\tconst sessionSpaceIdB = idDataB.id;\n\n\t\t\t\t\tconst uuidBSessionSpace = compressorB.decompress(sessionSpaceIdB);\n\t\t\t\t\tassert.strictEqual(uuidASessionSpace, uuidBSessionSpace);\n\t\t\t\t\tconst opSpaceIdB = compressorB.normalizeToOpSpace(sessionSpaceIdB);\n\t\t\t\t\tif (opSpaceIdA !== opSpaceIdB) {\n\t\t\t\t\t\tcompressorB.normalizeToOpSpace(sessionSpaceIdB);\n\t\t\t\t\t\tcompressorA.normalizeToOpSpace(sessionSpaceIdA);\n\t\t\t\t\t}\n\t\t\t\t\tassert.strictEqual(opSpaceIdA, opSpaceIdB);\n\t\t\t\t\tif (!isFinalId(opSpaceIdB)) {\n\t\t\t\t\t\tfail(\"IDs should have been finalized.\");\n\t\t\t\t\t}\n\t\t\t\t\tconst uuidBOpSpace = compressorB.decompress(\n\t\t\t\t\t\topSpaceIdB as unknown as SessionSpaceCompressedId,\n\t\t\t\t\t);\n\t\t\t\t\tassert.strictEqual(uuidAOpSpace, uuidBOpSpace);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tassert(idCreatorCount <= 1, \"Only one client can create an ID.\");\n\t\t\tassert.strictEqual(uuids.size, finalIds.size);\n\t\t\tassert(originatingSession !== undefined, \"Expected originating client to be defined\");\n\t\t\tidIndicesAggregator.set(\n\t\t\t\toriginatingSession,\n\n\t\t\t\t(idIndicesAggregator.get(originatingSession) ??\n\t\t\t\t\tfail(\"Expected pre-existing index for originating client\")) + 1,\n\t\t\t);\n\t\t}\n\n\t\tfor (const [compressor] of sequencedLogs) {\n\t\t\texpectSerializes(compressor);\n\t\t}\n\t}\n}\n\n/**\n * Roundtrips the supplied compressor through serialization and deserialization.\n */\nexport function roundtrip(\n\tcompressor: ReadonlyIdCompressor,\n\twithSession: true,\n): [SerializedIdCompressorWithOngoingSession, IdCompressor];\n\n/**\n * Roundtrips the supplied compressor through serialization and deserialization.\n */\nexport function roundtrip(\n\tcompressor: ReadonlyIdCompressor,\n\twithSession: false,\n): [SerializedIdCompressorWithNoSession, IdCompressor];\n\nexport function roundtrip(\n\tcompressor: ReadonlyIdCompressor,\n\twithSession: boolean,\n): [\n\tSerializedIdCompressorWithOngoingSession | SerializedIdCompressorWithNoSession,\n\tIdCompressor,\n] {\n\t// preserve the capacity request as this property is normally private and resets\n\t// to a default on construction (deserialization)\n\tconst capacity: number = getClusterSize(compressor);\n\tif (withSession) {\n\t\tconst serialized = compressor.serialize(withSession);\n\t\tconst roundtripped = IdCompressor.deserialize({ serialized });\n\t\tmodifyClusterSize(roundtripped, capacity);\n\t\treturn [serialized, roundtripped];\n\t} else {\n\t\tconst nonLocalSerialized = compressor.serialize(withSession);\n\t\tconst roundtripped = IdCompressor.deserialize({\n\t\t\tserialized: nonLocalSerialized,\n\t\t\tnewSessionId: createSessionId(),\n\t\t});\n\t\tmodifyClusterSize(roundtripped, capacity);\n\t\treturn [nonLocalSerialized, roundtripped];\n\t}\n}\n\n/**\n * Asserts that the supplied compressor correctly roundtrips through serialization/deserialization.\n */\nexport function expectSerializes(\n\tcompressor: ReadonlyIdCompressor,\n): [SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession] {\n\tfunction expectSerializesWithSession(\n\t\twithSession: boolean,\n\t): SerializedIdCompressorWithOngoingSession | SerializedIdCompressorWithNoSession {\n\t\tlet serialized:\n\t\t\t| SerializedIdCompressorWithOngoingSession\n\t\t\t| SerializedIdCompressorWithNoSession;\n\t\tlet deserialized: IdCompressor;\n\t\tif (withSession) {\n\t\t\t[serialized, deserialized] = roundtrip(compressor, true);\n\t\t} else {\n\t\t\t[serialized, deserialized] = roundtrip(compressor, false);\n\t\t}\n\t\tassert.strictEqual(compressor.equals(deserialized, withSession), true);\n\t\treturn serialized;\n\t}\n\n\treturn [\n\t\texpectSerializesWithSession(false) as SerializedIdCompressorWithNoSession,\n\t\texpectSerializesWithSession(true) as SerializedIdCompressorWithOngoingSession,\n\t];\n}\n\n/**\n * Merges 'from' into 'to', and returns 'to'.\n */\nexport function mergeArrayMaps<K, V>(\n\tto: Pick<Map<K, V[]>, \"get\" | \"set\">,\n\tfrom: ReadonlyMap<K, V[]>,\n): Pick<Map<K, V[]>, \"get\" | \"set\"> {\n\tfor (const [key, value] of from.entries()) {\n\t\tconst entry = to.get(key);\n\t\tif (entry === undefined) {\n\t\t\tto.set(key, [...value]);\n\t\t} else {\n\t\t\tentry.push(...value);\n\t\t}\n\t}\n\treturn to;\n}\n\ninterface AllocateIds {\n\ttype: \"allocateIds\";\n\tclient: Client;\n\tnumIds: number;\n}\n\ninterface AllocateOutsideIds {\n\ttype: \"allocateOutsideIds\";\n\tsessionId: SessionId;\n\tnumIds: number;\n}\n\ninterface DeliverAllOperations {\n\ttype: \"deliverAllOperations\";\n}\n\ninterface DeliverSomeOperations {\n\ttype: \"deliverSomeOperations\";\n\tclient: Client;\n\tcount: number;\n}\n\ninterface ChangeCapacity {\n\ttype: \"changeCapacity\";\n\tclient: Client;\n\tnewSize: number;\n}\n\n// Represents intent to go offline then resume.\ninterface Reconnect {\n\ttype: \"reconnect\";\n\tclient: Client;\n}\n\ninterface Validate {\n\ttype: \"validate\";\n}\n\ntype Operation =\n\t| AllocateIds\n\t| AllocateOutsideIds\n\t| DeliverSomeOperations\n\t| DeliverAllOperations\n\t| ChangeCapacity\n\t| Reconnect\n\t| Validate;\n\ninterface FuzzTestState extends BaseFuzzTestState {\n\tnetwork: IdCompressorTestNetwork;\n\tactiveClients: Client[];\n\tselectableClients: Client[];\n\tclusterSize: number;\n}\n\nexport interface OperationGenerationConfig {\n\t/**\n\t * maximum cluster size of the network. Default: 25\n\t */\n\tmaxClusterSize?: number;\n\t/**\n\t * Number of ops between validation ops. Default: 200\n\t */\n\tvalidateInterval?: number;\n\t/**\n\t * Fraction of ID allocations that are from an outside client (not Client1/2/3).\n\t */\n\toutsideAllocationFraction?: number;\n}\n\nconst defaultOptions = {\n\tmaxClusterSize: 25,\n\tvalidateInterval: 200,\n\toutsideAllocationFraction: 0.1,\n};\n\nexport function makeOpGenerator(\n\toptions: OperationGenerationConfig,\n): Generator<Operation, FuzzTestState> {\n\tconst { maxClusterSize, validateInterval, outsideAllocationFraction } = {\n\t\t...defaultOptions,\n\t\t...options,\n\t};\n\tassert(outsideAllocationFraction >= 0 && outsideAllocationFraction <= 1);\n\n\tfunction allocateIdsGenerator({\n\t\tactiveClients,\n\t\tclusterSize,\n\t\trandom,\n\t}: FuzzTestState): AllocateIds {\n\t\tconst client = random.pick(activeClients);\n\t\tconst maxIdsPerUsage = clusterSize * 2;\n\t\tconst numIds = Math.floor(random.real(0, 1) ** 3 * maxIdsPerUsage) + 1;\n\t\treturn {\n\t\t\ttype: \"allocateIds\",\n\t\t\tclient,\n\t\t\tnumIds,\n\t\t};\n\t}\n\n\tfunction allocateOutsideIdsGenerator({\n\t\tclusterSize,\n\t\trandom,\n\t}: FuzzTestState): AllocateOutsideIds {\n\t\tconst maxIdsPerUsage = clusterSize * 2;\n\t\tconst numIds = Math.floor(random.real(0, 1) ** 3 * maxIdsPerUsage) + 1;\n\t\treturn {\n\t\t\ttype: \"allocateOutsideIds\",\n\t\t\tsessionId: createSessionId(),\n\t\t\tnumIds,\n\t\t};\n\t}\n\n\tfunction changeCapacityGenerator({ random, activeClients }: FuzzTestState): ChangeCapacity {\n\t\treturn {\n\t\t\ttype: \"changeCapacity\",\n\t\t\tclient: random.pick(activeClients),\n\t\t\tnewSize: Math.min(\n\t\t\t\tMath.floor(random.real(0, 1) ** 2 * maxClusterSize) + 1,\n\t\t\t\tmaxClusterSize,\n\t\t\t),\n\t\t};\n\t}\n\n\tfunction deliverAllOperationsGenerator(): DeliverAllOperations {\n\t\treturn {\n\t\t\ttype: \"deliverAllOperations\",\n\t\t};\n\t}\n\n\tfunction deliverSomeOperationsGenerator({\n\t\trandom,\n\t\tselectableClients,\n\t\tnetwork,\n\t}: FuzzTestState): DeliverSomeOperations {\n\t\tconst pendingClients = selectableClients.filter(\n\t\t\t(c) => network.getPendingOperations(c) > 0,\n\t\t);\n\t\tif (pendingClients.length === 0) {\n\t\t\treturn {\n\t\t\t\ttype: \"deliverSomeOperations\",\n\t\t\t\tclient: random.pick(selectableClients),\n\t\t\t\tcount: 0,\n\t\t\t};\n\t\t}\n\t\tconst client = random.pick(pendingClients);\n\t\treturn {\n\t\t\ttype: \"deliverSomeOperations\",\n\t\t\tclient,\n\t\t\tcount: random.integer(1, network.getPendingOperations(client)),\n\t\t};\n\t}\n\n\tfunction reconnectGenerator({ activeClients, random }: FuzzTestState): Reconnect {\n\t\treturn { type: \"reconnect\", client: random.pick(activeClients) };\n\t}\n\n\tconst allocationWeight = 20;\n\treturn interleave(\n\t\tcreateWeightedGenerator<Operation, FuzzTestState>([\n\t\t\t[changeCapacityGenerator, 1],\n\t\t\t[allocateIdsGenerator, Math.round(allocationWeight * (1 - outsideAllocationFraction))],\n\t\t\t[allocateOutsideIdsGenerator, Math.round(allocationWeight * outsideAllocationFraction)],\n\t\t\t[deliverAllOperationsGenerator, 1],\n\t\t\t[deliverSomeOperationsGenerator, 6],\n\t\t\t[reconnectGenerator, 1],\n\t\t]),\n\t\ttake(1, repeat<Operation, FuzzTestState>({ type: \"validate\" })),\n\t\tvalidateInterval,\n\t);\n}\n\n/**\n * Performs random actions on a test network.\n * @param generator - the generator used to provide operations\n * @param network - the test network to test\n * @param seed - the seed for the random generation of the fuzz actions\n * @param observerClient - if provided, this client will never generate local ids\n * @param synchronizeAtEnd - if provided, all client will have all operations delivered from the server at the end of the test\n * @param validator - if provided, this callback will be invoked periodically during the fuzz test.\n */\nexport function performFuzzActions(\n\tgenerator: Generator<Operation, FuzzTestState>,\n\tnetwork: IdCompressorTestNetwork,\n\tseed: number,\n\tobserverClient?: Client,\n\tsynchronizeAtEnd: boolean = true,\n\tvalidator?: (network: IdCompressorTestNetwork) => void,\n\tsaveInfo?: SaveInfo,\n): void {\n\tconst random = makeRandom(seed);\n\tconst selectableClients: Client[] = network\n\t\t.getTargetCompressors(MetaClient.All)\n\t\t.map(([client]) => client);\n\n\tconst initialState: FuzzTestState = {\n\t\trandom,\n\t\tnetwork,\n\t\tactiveClients: selectableClients.filter((c) => c !== observerClient),\n\t\tselectableClients,\n\t\tclusterSize: network.initialClusterSize,\n\t};\n\n\tperformFuzzActionsBase(\n\t\tgenerator,\n\t\t{\n\t\t\tallocateIds: (state, { client, numIds }) => {\n\t\t\t\tnetwork.allocateAndSendIdsFromRemoteClient(client, sessionIds.get(client), numIds);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tallocateOutsideIds: (state, { sessionId, numIds }) => {\n\t\t\t\tnetwork.allocateAndSendIdsFromRemoteClient(\n\t\t\t\t\tOriginatingClient.Remote,\n\t\t\t\t\tsessionId,\n\t\t\t\t\tnumIds,\n\t\t\t\t);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tchangeCapacity: (state, op) => {\n\t\t\t\tnetwork.changeCapacity(op.client, op.newSize);\n\t\t\t\treturn { ...state, clusterSize: op.newSize };\n\t\t\t},\n\t\t\tdeliverSomeOperations: (state, op) => {\n\t\t\t\tnetwork.deliverOperations(op.client, op.count);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tdeliverAllOperations: (state) => {\n\t\t\t\tnetwork.deliverOperations(DestinationClient.All);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\treconnect: (state, { client }) => {\n\t\t\t\tnetwork.goOfflineThenResume(client);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tvalidate: (state) => {\n\t\t\t\tvalidator?.(network);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t},\n\t\tinitialState,\n\t\tsaveInfo,\n\t);\n\n\tif (synchronizeAtEnd) {\n\t\tnetwork.deliverOperations(DestinationClient.All);\n\t\tvalidator?.(network);\n\t}\n}\n\n/**\n * Helper to generate a fixed number of IDs.\n */\nexport function generateCompressedIds(\n\tcompressor: IdCompressor,\n\tcount: number,\n): SessionSpaceCompressedId[] {\n\tconst ids: SessionSpaceCompressedId[] = [];\n\tfor (let i = 0; i < count; i++) {\n\t\tids.push(compressor.generateCompressedId());\n\t}\n\treturn ids;\n}\n\n/**\n * Creates a compressor that only produces final IDs.\n * It should only be used for testing purposes.\n */\nexport function createAlwaysFinalizedIdCompressor(\n\tlogger?: ITelemetryBaseLogger,\n): IIdCompressor & IIdCompressorCore;\n/**\n * Creates a compressor that only produces final IDs.\n * It should only be used for testing purposes.\n */\nexport function createAlwaysFinalizedIdCompressor(\n\tsessionId: SessionId,\n\tlogger?: ITelemetryBaseLogger,\n\tseed?: number,\n): IIdCompressor & IIdCompressorCore;\nexport function createAlwaysFinalizedIdCompressor(\n\tsessionIdOrLogger?: SessionId | ITelemetryBaseLogger,\n\tloggerOrUndefined?: ITelemetryBaseLogger,\n\tseed?: number,\n): IIdCompressor & IIdCompressorCore {\n\tconst random = seed === undefined ? makeRandom() : makeRandom(seed);\n\tconst sessionId =\n\t\ttypeof sessionIdOrLogger === \"string\" ? sessionIdOrLogger : (random.uuid4() as SessionId);\n\tconst logger =\n\t\t(loggerOrUndefined ?? typeof sessionIdOrLogger === \"object\")\n\t\t\t? (sessionIdOrLogger as ITelemetryBaseLogger)\n\t\t\t: undefined;\n\t// This local session is unused, but it needs to not collide with the GhostSession, so allocate a random one.\n\t// This causes the compressor to serialize non-deterministically even when provided an explicit SessionId.\n\t// This can be fixed in the future if needed.\n\tconst compressor = createIdCompressor(random.uuid4() as SessionId, logger);\n\t// Permanently put the compressor in a ghost session\n\t(compressor as IdCompressor).startGhostSession(sessionId);\n\treturn compressor;\n}\n"]} | ||
| {"version":3,"file":"idCompressorTestUtilities.js","sourceRoot":"","sources":["../../src/test/idCompressorTestUtilities.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6CAA+C;AAE/C,gFAU8C;AAG9C,wDAAkD;AAClD,0CAYqB;AACrB,4EAAsE;AACtE,kDAA0F;AAE1F,mDAQyB;AASzB;;GAEG;AACH,IAAY,MAIX;AAJD,WAAY,MAAM;IACjB,6BAAmB,CAAA;IACnB,6BAAmB,CAAA;IACnB,6BAAmB,CAAA;AACpB,CAAC,EAJW,MAAM,sBAAN,MAAM,QAIjB;AAED;;GAEG;AACH,IAAY,UAEX;AAFD,WAAY,UAAU;IACrB,yBAAW,CAAA;AACZ,CAAC,EAFW,UAAU,0BAAV,UAAU,QAErB;AAED;;GAEG;AACH,IAAY,aAEX;AAFD,WAAY,aAAa;IACxB,kCAAiB,CAAA;AAClB,CAAC,EAFW,aAAa,6BAAb,aAAa,QAExB;AAOY,QAAA,iBAAiB,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,aAAa,EAAE,CAAC;AAMpD,QAAA,iBAAiB,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,UAAU,EAAE,CAAC;AAE9D,kEAAkE;AAClE,MAAa,iBAAiB;IAC7B;;OAEG;IACI,MAAM,CAAC,gBAAgB,CAC7B,MAAc,EACd,eAAe,GAAG,CAAC,EACnB,MAA6B;QAE7B,OAAO,iBAAiB,CAAC,2BAA2B,CACnD,kBAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EACtB,eAAe,EACf,MAAM,CACN,CAAC;IACH,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,2BAA2B,CACxC,SAAoB,EACpB,eAAe,GAAG,CAAC,EACnB,MAA6B;QAE7B,MAAM,UAAU,GAAG,IAAA,6BAAkB,EAAC,SAAS,EAAE,MAAM,CAAiB,CAAC;QACzE,iBAAiB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;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ors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport {\n\ttype BaseFuzzTestState,\n\ttype Generator,\n\ttype SaveInfo,\n\tcreateWeightedGenerator,\n\tinterleave,\n\tmakeRandom,\n\tperformFuzzActions as performFuzzActionsBase,\n\trepeat,\n\ttake,\n} from \"@fluid-private/stochastic-test-utils\";\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\n\nimport { IdCompressor } from \"../idCompressor.js\";\nimport {\n\ttype IIdCompressor,\n\ttype IIdCompressorCore,\n\ttype IdCreationRange,\n\ttype OpSpaceCompressedId,\n\ttype SerializedIdCompressorWithNoSession,\n\ttype SerializedIdCompressorWithOngoingSession,\n\ttype SessionId,\n\ttype SessionSpaceCompressedId,\n\ttype StableId,\n\tcreateIdCompressor,\n\ttoIdCompressorWithCore,\n} from \"../index.js\";\nimport { SessionSpaceNormalizer } from \"../sessionSpaceNormalizer.js\";\nimport { assertIsSessionId, createSessionId, localIdFromGenCount } from \"../utilities.js\";\n\nimport {\n\ttype FinalCompressedId,\n\ttype ReadonlyIdCompressor,\n\tfail,\n\tgetOrCreate,\n\tincrementStableId,\n\tisFinalId,\n\tisLocalId,\n} from \"./testCommon.js\";\n\n/**\n * A readonly `Map` which is known to contain a value for every possible key\n */\nexport interface ClosedMap<K, V> extends Omit<Map<K, V>, \"delete\" | \"clear\"> {\n\tget(key: K): V;\n}\n\n/**\n * Identifies a compressor in a network\n */\nexport enum Client {\n\tClient1 = \"Client1\",\n\tClient2 = \"Client2\",\n\tClient3 = \"Client3\",\n}\n\n/**\n * Identifies categories of compressors\n */\nexport enum MetaClient {\n\tAll = \"All\",\n}\n\n/**\n * Identifies a compressor inside the network but outside the three specially tracked clients.\n */\nexport enum OutsideClient {\n\tRemote = \"Remote\",\n}\n\n/**\n * Used to attribute actions to clients in a distributed collaboration session.\n * `Local` implies a local and unsequenced operation. All others imply sequenced operations.\n */\nexport type OriginatingClient = Client | OutsideClient;\nexport const OriginatingClient = { ...Client, ...OutsideClient };\n\n/**\n * Identifies a compressor to which to send an operation\n */\nexport type DestinationClient = Client | MetaClient;\nexport const DestinationClient = { ...Client, ...MetaClient };\n\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class\nexport class CompressorFactory {\n\t/**\n\t * Creates a new compressor with the supplied cluster capacity.\n\t */\n\tpublic static createCompressor(\n\t\tclient: Client,\n\t\tclusterCapacity = 5,\n\t\tlogger?: ITelemetryBaseLogger,\n\t): IdCompressor {\n\t\treturn CompressorFactory.createCompressorWithSession(\n\t\t\tsessionIds.get(client),\n\t\t\tclusterCapacity,\n\t\t\tlogger,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new compressor with the supplied cluster capacity.\n\t */\n\tpublic static createCompressorWithSession(\n\t\tsessionId: SessionId,\n\t\tclusterCapacity = 5,\n\t\tlogger?: ITelemetryBaseLogger,\n\t): IdCompressor {\n\t\tconst compressor = createIdCompressor(sessionId, logger) as IdCompressor;\n\t\tmodifyClusterSize(compressor, clusterCapacity);\n\t\treturn compressor;\n\t}\n}\n\n/**\n * Modify the requested cluster size of the provided compressor.\n * @remarks\n * This is useful for testing purposes for a few reasons:\n * - Id compressor bugs are often related to edge cases that occur on cluster boundaries\n * - Smaller cluster sizes can enable writing tests without for loops generating \"ids until a new cluster is created\"\n */\nexport function modifyClusterSize(compressor: IIdCompressor, newClusterSize: number): void {\n\tverifyCompressorLike(compressor);\n\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\tcompressor[\"nextRequestedClusterSize\"] = newClusterSize;\n}\n\n/**\n * Returns the current cluster size of the compressor.\n * @privateRemarks\n * This is useful in writing tests to avoid having to hardcode the (currently constant) cluster size.\n */\nexport function getClusterSize(compressor: ReadonlyIdCompressor): number {\n\tverifyCompressorLike(compressor);\n\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\treturn compressor[\"nextRequestedClusterSize\"] as number;\n}\n\nfunction verifyCompressorLike(compressor: ReadonlyIdCompressor | IIdCompressor): void {\n\tassert(\n\t\t// Some IdCompressor tests wrap underlying compressors with proxies--allow this for now.\n\t\t// Because of id-compressor's dynamic import in container-runtime, instanceof checks for IdCompressor\n\t\t// also won't necessarily work nicely. Get a small amount of validation that this function should work\n\t\t// as intended by at least verifying the property name exists.\n\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\ttypeof compressor[\"nextRequestedClusterSize\"] === \"number\",\n\t);\n}\n\n/**\n * Utility for building a huge compressor.\n * Build via the compressor factory.\n */\nexport function buildHugeCompressor(\n\tnumSessions = 10000,\n\tcapacity = 10,\n\tnumClustersPerSession = 3,\n): IdCompressor {\n\tconst compressor = CompressorFactory.createCompressorWithSession(\n\t\tcreateSessionId(),\n\t\tcapacity,\n\t);\n\tconst sessions: SessionId[] = [];\n\tfor (let i = 0; i < numSessions; i++) {\n\t\tsessions.push(createSessionId());\n\t}\n\tfor (let i = 0; i < numSessions * numClustersPerSession; i++) {\n\t\tconst sessionId = sessions[i % numSessions];\n\t\tif (Math.random() > 0.1) {\n\t\t\tfor (let j = 0; j < Math.round(capacity / 2); j++) {\n\t\t\t\tcompressor.generateCompressedId();\n\t\t\t}\n\t\t\tcompressor.finalizeCreationRange(compressor.takeNextCreationRange());\n\t\t}\n\t\tcompressor.finalizeCreationRange({\n\t\t\tsessionId,\n\t\t\tids: {\n\t\t\t\tfirstGenCount: Math.floor(i / numSessions) * capacity + 1,\n\t\t\t\tcount: capacity,\n\t\t\t\trequestedClusterSize: capacity,\n\t\t\t\tlocalIdRanges: [], // remote session, can safely ignore in tests\n\t\t\t},\n\t\t});\n\t}\n\treturn compressor;\n}\n\n/**\n * A closed map from NamedClient to T.\n */\nexport type ClientMap<T> = ClosedMap<Client, T>;\n\nfunction makeSessionIds(): ClientMap<SessionId> {\n\tconst stableIds = new Map<Client, SessionId>();\n\tconst clients = Object.values(Client);\n\tfor (let i = 0; i < clients.length; i++) {\n\t\t// Place session uuids roughly in the middle of uuid space to increase odds of encountering interesting\n\t\t// orderings in sorted collections\n\t\tconst sessionId = assertIsSessionId(`88888888-8888-4888-b${i}88-888888888888`);\n\t\tstableIds.set(clients[i], sessionId);\n\t}\n\treturn stableIds as ClientMap<SessionId>;\n}\n\n/**\n * An array of session ID strings corresponding to all non-local `Client` entries.\n */\nexport const sessionIds = makeSessionIds();\n\n/**\n * Information about a generated ID in a network to be validated by tests\n */\nexport interface TestIdData {\n\treadonly id: SessionSpaceCompressedId;\n\treadonly originatingClient: OriginatingClient;\n\treadonly sessionId: SessionId;\n\treadonly isSequenced: boolean;\n}\n\n/**\n * Simulates a network of ID compressors.\n * Not suitable for performance testing.\n */\nexport class IdCompressorTestNetwork {\n\t/**\n\t * The compressors used in this network\n\t */\n\tprivate readonly compressors: ClientMap<IdCompressor>;\n\t/**\n\t * The log of operations seen by the server so far. Append-only.\n\t */\n\tprivate readonly serverOperations: [\n\t\tcreationRange: IdCreationRange,\n\t\topSpaceIds: OpSpaceCompressedId[],\n\t\tclientFrom: OriginatingClient,\n\t\tsessionIdFrom: SessionId,\n\t][] = [];\n\t/**\n\t * An index into `serverOperations` for each client which represents how many operations have been delivered to that client\n\t */\n\tprivate readonly clientProgress: ClientMap<number>;\n\t/**\n\t * All ids (local and sequenced) that a client has created or received, in order.\n\t */\n\tprivate readonly idLogs: ClientMap<TestIdData[]>;\n\t/**\n\t * All ids that a client has received from the server, in order.\n\t */\n\tprivate readonly sequencedIdLogs: ClientMap<TestIdData[]>;\n\n\tpublic constructor(public readonly initialClusterSize = 5) {\n\t\tconst compressors = new Map<Client, IdCompressor>();\n\t\tconst clientProgress = new Map<Client, number>();\n\t\tconst clientIds = new Map<Client, TestIdData[]>();\n\t\tconst clientSequencedIds = new Map<Client, TestIdData[]>();\n\t\tfor (const client of Object.values(Client)) {\n\t\t\tconst compressor = CompressorFactory.createCompressor(client, initialClusterSize);\n\t\t\tcompressors.set(client, compressor);\n\t\t\tclientProgress.set(client, 0);\n\t\t\tclientIds.set(client, []);\n\t\t\tclientSequencedIds.set(client, []);\n\t\t}\n\t\tthis.compressors = compressors as ClientMap<IdCompressor>;\n\t\tthis.clientProgress = clientProgress as ClientMap<number>;\n\t\tthis.idLogs = clientIds as ClientMap<TestIdData[]>;\n\t\tthis.sequencedIdLogs = clientSequencedIds as ClientMap<TestIdData[]>;\n\t}\n\n\t/**\n\t * Returns the number of undelivered operations for the given client that are in flight in the network.\n\t */\n\tpublic getPendingOperations(destination: Client): number {\n\t\treturn this.serverOperations.length - this.clientProgress.get(destination);\n\t}\n\n\t/**\n\t * Returns an immutable handle to a compressor in the network.\n\t */\n\tpublic getCompressor(client: Client): ReadonlyIdCompressor {\n\t\tconst compressors = this.compressors;\n\t\tconst handler = {\n\t\t\tget<P extends keyof IdCompressor>(_: unknown, property: P): IdCompressor[P] {\n\t\t\t\treturn compressors.get(client)[property];\n\t\t\t},\n\t\t\tset<P extends keyof IdCompressor>(\n\t\t\t\t_: unknown,\n\t\t\t\tproperty: P,\n\t\t\t\tvalue: IdCompressor[P],\n\t\t\t): boolean {\n\t\t\t\tcompressors.get(client)[property] = value;\n\t\t\t\treturn true;\n\t\t\t},\n\t\t};\n\t\treturn new Proxy<IdCompressor>({} as unknown as IdCompressor, handler);\n\t}\n\n\t/**\n\t * Returns a mutable handle to a compressor in the network. Use of mutation methods will break the network invariants and\n\t * should only be used if the network will not be used again.\n\t */\n\tpublic getCompressorUnsafe(client: Client): IdCompressor {\n\t\treturn this.getCompressor(client) as IdCompressor;\n\t}\n\n\t/**\n\t * Returns a mutable handle to a compressor in the network. Use of mutation methods will break the network invariants and\n\t * should only be used if the network will not be used again. Additionally, the returned compressor will be invalidated/unusable\n\t * if any network operations cause it to be regenerated (serialization/deserialization, etc.).\n\t */\n\tpublic getCompressorUnsafeNoProxy(client: Client): IdCompressor {\n\t\treturn this.compressors.get(client);\n\t}\n\n\t/**\n\t * Returns data for all IDs created and received by this client, including ack's of their own (i.e. their own IDs will appear twice)\n\t */\n\tpublic getIdLog(client: Client): readonly TestIdData[] {\n\t\treturn this.idLogs.get(client);\n\t}\n\n\t/**\n\t * Returns data for all IDs received by this client, including ack's of their own.\n\t */\n\tpublic getSequencedIdLog(client: Client): readonly TestIdData[] {\n\t\treturn this.sequencedIdLogs.get(client);\n\t}\n\n\t/**\n\t * Get all compressors for the given destination\n\t */\n\tpublic getTargetCompressors(clientTo: DestinationClient): [Client, IdCompressor][] {\n\t\treturn clientTo === MetaClient.All\n\t\t\t? [...this.compressors.entries()]\n\t\t\t: ([[clientTo, this.getCompressor(clientTo)]] as [Client, IdCompressor][]);\n\t}\n\n\t/**\n\t * Changes the capacity request amount for a client. It will take effect immediately.\n\t */\n\tpublic changeCapacity(client: Client, newClusterCapacity: number): void {\n\t\tmodifyClusterSize(this.compressors.get(client), newClusterCapacity);\n\t}\n\n\tprivate addNewId(\n\t\tclient: Client,\n\t\tid: SessionSpaceCompressedId,\n\t\toriginatingClient: OriginatingClient,\n\t\tsessionIdFrom: SessionId,\n\t\tisSequenced: boolean,\n\t): void {\n\t\tconst idData = {\n\t\t\tid,\n\t\t\toriginatingClient,\n\t\t\tsessionId: sessionIdFrom,\n\t\t\tisSequenced,\n\t\t};\n\t\tconst clientIds = this.idLogs.get(client);\n\t\tclientIds.push(idData);\n\t\tif (isSequenced) {\n\t\t\tconst sequencedIds = this.sequencedIdLogs.get(client);\n\t\t\tsequencedIds.push(idData);\n\t\t}\n\t}\n\n\t/**\n\t * Allocates a new range of local IDs and enqueues them for future delivery via a `testIdDelivery` action.\n\t * Calls to this method determine the total order of delivery, regardless of when `deliverOperations` is called.\n\t */\n\tpublic allocateAndSendIds(clientFrom: Client, numIds: number): OpSpaceCompressedId[] {\n\t\treturn this.allocateAndSendIdsFromRemoteClient(\n\t\t\tclientFrom,\n\t\t\tsessionIds.get(clientFrom),\n\t\t\tnumIds,\n\t\t);\n\t}\n\n\t/**\n\t * Same contract as `allocateAndSendIds`, but the originating client will be a client with the supplied sessionId.\n\t */\n\tpublic allocateAndSendIdsFromRemoteClient(\n\t\tclientFrom: OriginatingClient,\n\t\tsessionIdFrom: SessionId,\n\t\tnumIds: number,\n\t): OpSpaceCompressedId[] {\n\t\tassert(numIds > 0, \"Must allocate a non-zero number of IDs\");\n\t\tif (clientFrom === OriginatingClient.Remote) {\n\t\t\tconst range: IdCreationRange = {\n\t\t\t\tsessionId: sessionIdFrom,\n\t\t\t\tids: {\n\t\t\t\t\tfirstGenCount: 1,\n\t\t\t\t\tcount: numIds,\n\t\t\t\t\trequestedClusterSize: getClusterSize(this.getCompressor(Client.Client1)),\n\t\t\t\t\tlocalIdRanges: [], // remote session, can safely ignore in tests\n\t\t\t\t},\n\t\t\t};\n\t\t\tconst opSpaceIds: OpSpaceCompressedId[] = [];\n\t\t\tfor (let i = 0; i < numIds; i++) {\n\t\t\t\topSpaceIds.push(-(i + 1) as OpSpaceCompressedId);\n\t\t\t}\n\t\t\tthis.serverOperations.push([range, opSpaceIds, clientFrom, sessionIdFrom]);\n\t\t\treturn opSpaceIds;\n\t\t} else {\n\t\t\tassert(sessionIdFrom === sessionIds.get(clientFrom));\n\t\t\tconst compressor = this.compressors.get(clientFrom);\n\t\t\tconst sessionSpaceIds = generateCompressedIds(compressor, numIds);\n\t\t\tfor (let i = 0; i < numIds; i++) {\n\t\t\t\tthis.addNewId(clientFrom, sessionSpaceIds[i], clientFrom, sessionIdFrom, false);\n\t\t\t}\n\t\t\tconst opSpaceIds = sessionSpaceIds.map((id) => compressor.normalizeToOpSpace(id));\n\t\t\tconst creationRange = compressor.takeNextCreationRange();\n\t\t\tthis.serverOperations.push([creationRange, opSpaceIds, clientFrom, sessionIdFrom]);\n\t\t\treturn opSpaceIds;\n\t\t}\n\t}\n\n\t/**\n\t * Delivers all undelivered ID ranges from the server to the target clients.\n\t */\n\tpublic deliverOperations(clientTakingDelivery: Client, opsToDeliver?: number): void;\n\n\t/**\n\t * Delivers all undelivered ID ranges from the server to the target clients.\n\t */\n\tpublic deliverOperations(clientTakingDelivery: DestinationClient): void;\n\n\t/**\n\t * Delivers all undelivered ID ranges from the server to the target clients.\n\t */\n\tpublic deliverOperations(\n\t\tclientTakingDelivery: DestinationClient,\n\t\topsToDeliver?: number,\n\t): void {\n\t\tlet opIndexBound: number;\n\t\tif (clientTakingDelivery === DestinationClient.All) {\n\t\t\tassert(opsToDeliver === undefined);\n\t\t\topIndexBound = this.serverOperations.length;\n\t\t} else {\n\t\t\topIndexBound =\n\t\t\t\topsToDeliver === undefined\n\t\t\t\t\t? this.serverOperations.length\n\t\t\t\t\t: this.clientProgress.get(clientTakingDelivery) + opsToDeliver;\n\t\t}\n\t\tfor (const [clientTo, compressorTo] of this.getTargetCompressors(clientTakingDelivery)) {\n\t\t\tfor (let i = this.clientProgress.get(clientTo); i < opIndexBound; i++) {\n\t\t\t\tconst [range, opSpaceIds, clientFrom, sessionIdFrom] = this.serverOperations[i];\n\t\t\t\tcompressorTo.finalizeCreationRange(range);\n\n\t\t\t\tconst ids = range.ids;\n\t\t\t\tif (ids !== undefined) {\n\t\t\t\t\tfor (const id of opSpaceIds) {\n\t\t\t\t\t\tconst sessionSpaceId = compressorTo.normalizeToSessionSpace(id, range.sessionId);\n\t\t\t\t\t\tthis.addNewId(clientTo, sessionSpaceId, clientFrom, sessionIdFrom, true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.clientProgress.set(clientTo, opIndexBound);\n\t\t}\n\t}\n\n\t/**\n\t * Simulate a client disconnecting (and serializing), then reconnecting (and deserializing)\n\t */\n\tpublic goOfflineThenResume(client: Client): void {\n\t\tconst compressor = this.compressors.get(client);\n\t\tconst [_, resumedCompressor] = roundtrip(compressor, true);\n\t\tthis.compressors.set(client, resumedCompressor);\n\t}\n\n\t/**\n\t * Ensure general validity of the network state. Useful for calling periodically or at the end of test scenarios.\n\t */\n\tpublic assertNetworkState(): void {\n\t\tconst sequencedLogs = Object.values(Client).map(\n\t\t\t(client) => [this.compressors.get(client), this.getSequencedIdLog(client)] as const,\n\t\t);\n\n\t\tconst getLocalIdsInRange = (\n\t\t\trange: IdCreationRange,\n\t\t\topSpaceIds?: OpSpaceCompressedId[],\n\t\t): Set<SessionSpaceCompressedId> => {\n\t\t\tconst localIdsInCreationRange = new Set<SessionSpaceCompressedId>();\n\t\t\tconst ids = range.ids;\n\t\t\tif (ids !== undefined) {\n\t\t\t\tconst { firstGenCount, localIdRanges } = ids;\n\t\t\t\tfor (const [genCount, count] of localIdRanges) {\n\t\t\t\t\tfor (let g = genCount; g < genCount + count; g++) {\n\t\t\t\t\t\tconst local = localIdFromGenCount(g);\n\t\t\t\t\t\tif (opSpaceIds) {\n\t\t\t\t\t\t\tassert.strictEqual(opSpaceIds[g - firstGenCount], local);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlocalIdsInCreationRange.add(local);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn localIdsInCreationRange;\n\t\t};\n\n\t\t// Ensure creation ranges for clients we track contain the correct local ID ranges\n\t\tfor (const [range, opSpaceIds, clientFrom] of this.serverOperations) {\n\t\t\tif (clientFrom !== OriginatingClient.Remote) {\n\t\t\t\tconst localIdsInCreationRange = getLocalIdsInRange(range, opSpaceIds);\n\t\t\t\tlet localCount = 0;\n\t\t\t\tfor (const id of opSpaceIds) {\n\t\t\t\t\tif (isLocalId(id)) {\n\t\t\t\t\t\tlocalCount++;\n\t\t\t\t\t\tassert(localIdsInCreationRange.has(id), \"Local ID not in creation range\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\tlocalCount,\n\t\t\t\t\tlocalIdsInCreationRange.size,\n\t\t\t\t\t\"Local ID count mismatch\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst undeliveredRanges = new Map<Client, IdCreationRange[]>();\n\t\tfor (const [client, progress] of this.clientProgress.entries()) {\n\t\t\tconst ranges = this.serverOperations\n\t\t\t\t.slice(progress)\n\t\t\t\t.filter((op) => op[2] === client)\n\t\t\t\t.map(([range]) => range);\n\t\t\tundeliveredRanges.set(client, ranges);\n\t\t}\n\t\tfor (const [client, ranges] of undeliveredRanges.entries()) {\n\t\t\tconst compressor = this.compressors.get(client);\n\t\t\tlet firstGenCount: number | undefined;\n\t\t\tlet totalCount = 0;\n\t\t\tconst unionedLocalRanges = new SessionSpaceNormalizer();\n\t\t\tfor (const range of ranges) {\n\t\t\t\tassert(range.sessionId === compressor.localSessionId);\n\t\t\t\tif (range.ids !== undefined) {\n\t\t\t\t\t// initialize firstGenCount if not set\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy\n\t\t\t\t\tif (firstGenCount === undefined) {\n\t\t\t\t\t\tfirstGenCount = range.ids.firstGenCount;\n\t\t\t\t\t}\n\t\t\t\t\ttotalCount += range.ids.count;\n\t\t\t\t\tfor (const [genCount, count] of range.ids.localIdRanges) {\n\t\t\t\t\t\tunionedLocalRanges.addLocalRange(genCount, count);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst retakenRange = compressor.takeUnfinalizedCreationRange();\n\t\t\tif (retakenRange.ids === undefined) {\n\t\t\t\tassert.strictEqual(totalCount, 0);\n\t\t\t\tassert.strictEqual(unionedLocalRanges.idRanges.size, 0);\n\t\t\t} else {\n\t\t\t\tconst retakenLocalIds = new SessionSpaceNormalizer();\n\t\t\t\tfor (const [genCount, count] of retakenRange.ids.localIdRanges) {\n\t\t\t\t\tretakenLocalIds.addLocalRange(genCount, count);\n\t\t\t\t}\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\tretakenLocalIds.equals(unionedLocalRanges),\n\t\t\t\t\ttrue,\n\t\t\t\t\t\"Local ID ranges mismatch\",\n\t\t\t\t);\n\t\t\t\tassert.strictEqual(retakenRange.ids.count, totalCount, \"Count mismatch\");\n\t\t\t\tassert.strictEqual(retakenRange.ids.firstGenCount, firstGenCount, \"Count mismatch\");\n\t\t\t}\n\t\t}\n\n\t\t// First, ensure all clients each generated a unique ID for each of their own calls to generate.\n\t\tfor (const [compressor, ids] of sequencedLogs) {\n\t\t\tconst allUuids = new Set<StableId | string>();\n\t\t\tfor (const idData of ids) {\n\t\t\t\tconst uuid = compressor.decompress(idData.id);\n\t\t\t\tassert.strictEqual(!allUuids.has(uuid), true, \"Duplicate UUID generated.\");\n\t\t\t\tallUuids.add(uuid);\n\t\t\t}\n\t\t}\n\n\t\tconst maxLogLength = sequencedLogs\n\t\t\t.map(([_, data]) => data.length)\n\t\t\t// eslint-disable-next-line unicorn/no-array-reduce\n\t\t\t.reduce((p, n) => Math.max(p, n));\n\n\t\tfunction getNextLogWithEntryAt(logsIndex: number, entryIndex: number): number | undefined {\n\t\t\tfor (let i = logsIndex; i < sequencedLogs.length; i++) {\n\t\t\t\tconst log = sequencedLogs[i];\n\t\t\t\tif (log[1].length > entryIndex) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst uuids = new Set<StableId>();\n\t\tconst finalIds = new Set<FinalCompressedId>();\n\t\tconst idIndicesAggregator = new Map<SessionId, number>();\n\n\t\tfunction* getIdLogEntries(\n\t\t\tcolumnIndex: number,\n\t\t): Iterable<\n\t\t\t[\n\t\t\t\tcurrent: [compressor: IdCompressor, idData: TestIdData],\n\t\t\t\tnext?: [compressor: IdCompressor, idData: TestIdData],\n\t\t\t]\n\t\t> {\n\t\t\tlet current = getNextLogWithEntryAt(0, columnIndex);\n\t\t\twhile (current !== undefined) {\n\t\t\t\tconst next = getNextLogWithEntryAt(current + 1, columnIndex);\n\t\t\t\tconst [compressor, log] = sequencedLogs[current];\n\t\t\t\tif (next === undefined) {\n\t\t\t\t\tyield [[compressor, log[columnIndex]]];\n\t\t\t\t} else {\n\t\t\t\t\tconst [compressorNext, logNext] = sequencedLogs[next];\n\t\t\t\t\tyield [\n\t\t\t\t\t\t[compressor, log[columnIndex]],\n\t\t\t\t\t\t[compressorNext, logNext[columnIndex]],\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\t\tcurrent = next;\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < maxLogLength; i++) {\n\t\t\tlet idCreatorCount = 0;\n\t\t\tlet originatingSession: SessionId | undefined;\n\t\t\tfor (const [current, next] of getIdLogEntries(i)) {\n\t\t\t\tconst [compressorA, idDataA] = current;\n\t\t\t\tconst sessionSpaceIdA = idDataA.id;\n\t\t\t\tconst idIndex = getOrCreate(idIndicesAggregator, idDataA.sessionId, () => 0);\n\t\t\t\toriginatingSession ??= idDataA.sessionId;\n\t\t\t\tassert(\n\t\t\t\t\tidDataA.sessionId === originatingSession,\n\t\t\t\t\t\"Test infra gave wrong originating client to TestIdData\",\n\t\t\t\t);\n\n\t\t\t\t// Only one client should have this ID as local in its session space, as only one client could have created this ID\n\t\t\t\tif (isLocalId(sessionSpaceIdA)) {\n\t\t\t\t\tif (originatingSession !== OriginatingClient.Remote) {\n\t\t\t\t\t\tassert.strictEqual(\n\t\t\t\t\t\t\tidDataA.sessionId,\n\t\t\t\t\t\t\tthis.compressors.get(idDataA.originatingClient as Client).localSessionId,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tidCreatorCount++;\n\t\t\t\t}\n\n\t\t\t\tconst uuidASessionSpace = compressorA.decompress(sessionSpaceIdA);\n\t\t\t\tassert.strictEqual(uuidASessionSpace, incrementStableId(idDataA.sessionId, idIndex));\n\t\t\t\tassert.strictEqual(compressorA.recompress(uuidASessionSpace), sessionSpaceIdA);\n\t\t\t\tuuids.add(uuidASessionSpace);\n\t\t\t\tconst opSpaceIdA = compressorA.normalizeToOpSpace(sessionSpaceIdA);\n\t\t\t\tif (!isFinalId(opSpaceIdA)) {\n\t\t\t\t\tfail(\"IDs should have been finalized.\");\n\t\t\t\t}\n\t\t\t\tconst reNormalizedIdA = compressorA.normalizeToSessionSpace(\n\t\t\t\t\topSpaceIdA,\n\t\t\t\t\tcompressorA.localSessionId,\n\t\t\t\t);\n\t\t\t\tassert.strictEqual(reNormalizedIdA, sessionSpaceIdA);\n\t\t\t\tfinalIds.add(opSpaceIdA);\n\t\t\t\tconst uuidAOpSpace = compressorA.decompress(reNormalizedIdA);\n\n\t\t\t\tassert.strictEqual(uuidASessionSpace, uuidAOpSpace);\n\n\t\t\t\tif (next !== undefined) {\n\t\t\t\t\tconst [compressorB, idDataB] = next;\n\t\t\t\t\tconst sessionSpaceIdB = idDataB.id;\n\n\t\t\t\t\tconst uuidBSessionSpace = compressorB.decompress(sessionSpaceIdB);\n\t\t\t\t\tassert.strictEqual(uuidASessionSpace, uuidBSessionSpace);\n\t\t\t\t\tconst opSpaceIdB = compressorB.normalizeToOpSpace(sessionSpaceIdB);\n\t\t\t\t\tif (opSpaceIdA !== opSpaceIdB) {\n\t\t\t\t\t\tcompressorB.normalizeToOpSpace(sessionSpaceIdB);\n\t\t\t\t\t\tcompressorA.normalizeToOpSpace(sessionSpaceIdA);\n\t\t\t\t\t}\n\t\t\t\t\tassert.strictEqual(opSpaceIdA, opSpaceIdB);\n\t\t\t\t\tif (!isFinalId(opSpaceIdB)) {\n\t\t\t\t\t\tfail(\"IDs should have been finalized.\");\n\t\t\t\t\t}\n\t\t\t\t\tconst uuidBOpSpace = compressorB.decompress(\n\t\t\t\t\t\topSpaceIdB as unknown as SessionSpaceCompressedId,\n\t\t\t\t\t);\n\t\t\t\t\tassert.strictEqual(uuidAOpSpace, uuidBOpSpace);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tassert(idCreatorCount <= 1, \"Only one client can create an ID.\");\n\t\t\tassert.strictEqual(uuids.size, finalIds.size);\n\t\t\tassert(originatingSession !== undefined, \"Expected originating client to be defined\");\n\t\t\tidIndicesAggregator.set(\n\t\t\t\toriginatingSession,\n\n\t\t\t\t(idIndicesAggregator.get(originatingSession) ??\n\t\t\t\t\tfail(\"Expected pre-existing index for originating client\")) + 1,\n\t\t\t);\n\t\t}\n\n\t\tfor (const [compressor] of sequencedLogs) {\n\t\t\texpectSerializes(compressor);\n\t\t}\n\t}\n}\n\n/**\n * Roundtrips the supplied compressor through serialization and deserialization.\n */\nexport function roundtrip(\n\tcompressor: ReadonlyIdCompressor,\n\twithSession: true,\n): [SerializedIdCompressorWithOngoingSession, IdCompressor];\n\n/**\n * Roundtrips the supplied compressor through serialization and deserialization.\n */\nexport function roundtrip(\n\tcompressor: ReadonlyIdCompressor,\n\twithSession: false,\n): [SerializedIdCompressorWithNoSession, IdCompressor];\n\nexport function roundtrip(\n\tcompressor: ReadonlyIdCompressor,\n\twithSession: boolean,\n): [\n\tSerializedIdCompressorWithOngoingSession | SerializedIdCompressorWithNoSession,\n\tIdCompressor,\n] {\n\t// preserve the capacity request as this property is normally private and resets\n\t// to a default on construction (deserialization)\n\tconst capacity: number = getClusterSize(compressor);\n\tif (withSession) {\n\t\tconst serialized = compressor.serialize(withSession);\n\t\tconst roundtripped = IdCompressor.deserialize({ serialized });\n\t\tmodifyClusterSize(roundtripped, capacity);\n\t\treturn [serialized, roundtripped];\n\t} else {\n\t\tconst nonLocalSerialized = compressor.serialize(withSession);\n\t\tconst roundtripped = IdCompressor.deserialize({\n\t\t\tserialized: nonLocalSerialized,\n\t\t\tnewSessionId: createSessionId(),\n\t\t});\n\t\tmodifyClusterSize(roundtripped, capacity);\n\t\treturn [nonLocalSerialized, roundtripped];\n\t}\n}\n\n/**\n * Asserts that the supplied compressor correctly roundtrips through serialization/deserialization.\n */\nexport function expectSerializes(\n\tcompressor: ReadonlyIdCompressor,\n): [SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession] {\n\tfunction expectSerializesWithSession(\n\t\twithSession: boolean,\n\t): SerializedIdCompressorWithOngoingSession | SerializedIdCompressorWithNoSession {\n\t\tlet serialized:\n\t\t\t| SerializedIdCompressorWithOngoingSession\n\t\t\t| SerializedIdCompressorWithNoSession;\n\t\tlet deserialized: IdCompressor;\n\t\tif (withSession) {\n\t\t\t[serialized, deserialized] = roundtrip(compressor, true);\n\t\t} else {\n\t\t\t[serialized, deserialized] = roundtrip(compressor, false);\n\t\t}\n\t\tassert.strictEqual(compressor.equals(deserialized, withSession), true);\n\t\treturn serialized;\n\t}\n\n\treturn [\n\t\texpectSerializesWithSession(false) as SerializedIdCompressorWithNoSession,\n\t\texpectSerializesWithSession(true) as SerializedIdCompressorWithOngoingSession,\n\t];\n}\n\n/**\n * Merges 'from' into 'to', and returns 'to'.\n */\nexport function mergeArrayMaps<K, V>(\n\tto: Pick<Map<K, V[]>, \"get\" | \"set\">,\n\tfrom: ReadonlyMap<K, V[]>,\n): Pick<Map<K, V[]>, \"get\" | \"set\"> {\n\tfor (const [key, value] of from.entries()) {\n\t\tconst entry = to.get(key);\n\t\tif (entry === undefined) {\n\t\t\tto.set(key, [...value]);\n\t\t} else {\n\t\t\tentry.push(...value);\n\t\t}\n\t}\n\treturn to;\n}\n\ninterface AllocateIds {\n\ttype: \"allocateIds\";\n\tclient: Client;\n\tnumIds: number;\n}\n\ninterface AllocateOutsideIds {\n\ttype: \"allocateOutsideIds\";\n\tsessionId: SessionId;\n\tnumIds: number;\n}\n\ninterface DeliverAllOperations {\n\ttype: \"deliverAllOperations\";\n}\n\ninterface DeliverSomeOperations {\n\ttype: \"deliverSomeOperations\";\n\tclient: Client;\n\tcount: number;\n}\n\ninterface ChangeCapacity {\n\ttype: \"changeCapacity\";\n\tclient: Client;\n\tnewSize: number;\n}\n\n// Represents intent to go offline then resume.\ninterface Reconnect {\n\ttype: \"reconnect\";\n\tclient: Client;\n}\n\ninterface Validate {\n\ttype: \"validate\";\n}\n\ntype Operation =\n\t| AllocateIds\n\t| AllocateOutsideIds\n\t| DeliverSomeOperations\n\t| DeliverAllOperations\n\t| ChangeCapacity\n\t| Reconnect\n\t| Validate;\n\ninterface FuzzTestState extends BaseFuzzTestState {\n\tnetwork: IdCompressorTestNetwork;\n\tactiveClients: Client[];\n\tselectableClients: Client[];\n\tclusterSize: number;\n}\n\nexport interface OperationGenerationConfig {\n\t/**\n\t * maximum cluster size of the network. Default: 25\n\t */\n\tmaxClusterSize?: number;\n\t/**\n\t * Number of ops between validation ops. Default: 200\n\t */\n\tvalidateInterval?: number;\n\t/**\n\t * Fraction of ID allocations that are from an outside client (not Client1/2/3).\n\t */\n\toutsideAllocationFraction?: number;\n}\n\nconst defaultOptions = {\n\tmaxClusterSize: 25,\n\tvalidateInterval: 200,\n\toutsideAllocationFraction: 0.1,\n};\n\nexport function makeOpGenerator(\n\toptions: OperationGenerationConfig,\n): Generator<Operation, FuzzTestState> {\n\tconst { maxClusterSize, validateInterval, outsideAllocationFraction } = {\n\t\t...defaultOptions,\n\t\t...options,\n\t};\n\tassert(outsideAllocationFraction >= 0 && outsideAllocationFraction <= 1);\n\n\tfunction allocateIdsGenerator({\n\t\tactiveClients,\n\t\tclusterSize,\n\t\trandom,\n\t}: FuzzTestState): AllocateIds {\n\t\tconst client = random.pick(activeClients);\n\t\tconst maxIdsPerUsage = clusterSize * 2;\n\t\tconst numIds = Math.floor(random.real(0, 1) ** 3 * maxIdsPerUsage) + 1;\n\t\treturn {\n\t\t\ttype: \"allocateIds\",\n\t\t\tclient,\n\t\t\tnumIds,\n\t\t};\n\t}\n\n\tfunction allocateOutsideIdsGenerator({\n\t\tclusterSize,\n\t\trandom,\n\t}: FuzzTestState): AllocateOutsideIds {\n\t\tconst maxIdsPerUsage = clusterSize * 2;\n\t\tconst numIds = Math.floor(random.real(0, 1) ** 3 * maxIdsPerUsage) + 1;\n\t\treturn {\n\t\t\ttype: \"allocateOutsideIds\",\n\t\t\tsessionId: createSessionId(),\n\t\t\tnumIds,\n\t\t};\n\t}\n\n\tfunction changeCapacityGenerator({ random, activeClients }: FuzzTestState): ChangeCapacity {\n\t\treturn {\n\t\t\ttype: \"changeCapacity\",\n\t\t\tclient: random.pick(activeClients),\n\t\t\tnewSize: Math.min(\n\t\t\t\tMath.floor(random.real(0, 1) ** 2 * maxClusterSize) + 1,\n\t\t\t\tmaxClusterSize,\n\t\t\t),\n\t\t};\n\t}\n\n\tfunction deliverAllOperationsGenerator(): DeliverAllOperations {\n\t\treturn {\n\t\t\ttype: \"deliverAllOperations\",\n\t\t};\n\t}\n\n\tfunction deliverSomeOperationsGenerator({\n\t\trandom,\n\t\tselectableClients,\n\t\tnetwork,\n\t}: FuzzTestState): DeliverSomeOperations {\n\t\tconst pendingClients = selectableClients.filter(\n\t\t\t(c) => network.getPendingOperations(c) > 0,\n\t\t);\n\t\tif (pendingClients.length === 0) {\n\t\t\treturn {\n\t\t\t\ttype: \"deliverSomeOperations\",\n\t\t\t\tclient: random.pick(selectableClients),\n\t\t\t\tcount: 0,\n\t\t\t};\n\t\t}\n\t\tconst client = random.pick(pendingClients);\n\t\treturn {\n\t\t\ttype: \"deliverSomeOperations\",\n\t\t\tclient,\n\t\t\tcount: random.integer(1, network.getPendingOperations(client)),\n\t\t};\n\t}\n\n\tfunction reconnectGenerator({ activeClients, random }: FuzzTestState): Reconnect {\n\t\treturn { type: \"reconnect\", client: random.pick(activeClients) };\n\t}\n\n\tconst allocationWeight = 20;\n\treturn interleave(\n\t\tcreateWeightedGenerator<Operation, FuzzTestState>([\n\t\t\t[changeCapacityGenerator, 1],\n\t\t\t[allocateIdsGenerator, Math.round(allocationWeight * (1 - outsideAllocationFraction))],\n\t\t\t[allocateOutsideIdsGenerator, Math.round(allocationWeight * outsideAllocationFraction)],\n\t\t\t[deliverAllOperationsGenerator, 1],\n\t\t\t[deliverSomeOperationsGenerator, 6],\n\t\t\t[reconnectGenerator, 1],\n\t\t]),\n\t\ttake(1, repeat<Operation, FuzzTestState>({ type: \"validate\" })),\n\t\tvalidateInterval,\n\t);\n}\n\n/**\n * Performs random actions on a test network.\n * @param generator - the generator used to provide operations\n * @param network - the test network to test\n * @param seed - the seed for the random generation of the fuzz actions\n * @param observerClient - if provided, this client will never generate local ids\n * @param synchronizeAtEnd - if provided, all client will have all operations delivered from the server at the end of the test\n * @param validator - if provided, this callback will be invoked periodically during the fuzz test.\n */\nexport function performFuzzActions(\n\tgenerator: Generator<Operation, FuzzTestState>,\n\tnetwork: IdCompressorTestNetwork,\n\tseed: number,\n\tobserverClient?: Client,\n\tsynchronizeAtEnd: boolean = true,\n\tvalidator?: (network: IdCompressorTestNetwork) => void,\n\tsaveInfo?: SaveInfo,\n): void {\n\tconst random = makeRandom(seed);\n\tconst selectableClients: Client[] = network\n\t\t.getTargetCompressors(MetaClient.All)\n\t\t.map(([client]) => client);\n\n\tconst initialState: FuzzTestState = {\n\t\trandom,\n\t\tnetwork,\n\t\tactiveClients: selectableClients.filter((c) => c !== observerClient),\n\t\tselectableClients,\n\t\tclusterSize: network.initialClusterSize,\n\t};\n\n\tperformFuzzActionsBase(\n\t\tgenerator,\n\t\t{\n\t\t\tallocateIds: (state, { client, numIds }) => {\n\t\t\t\tnetwork.allocateAndSendIdsFromRemoteClient(client, sessionIds.get(client), numIds);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tallocateOutsideIds: (state, { sessionId, numIds }) => {\n\t\t\t\tnetwork.allocateAndSendIdsFromRemoteClient(\n\t\t\t\t\tOriginatingClient.Remote,\n\t\t\t\t\tsessionId,\n\t\t\t\t\tnumIds,\n\t\t\t\t);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tchangeCapacity: (state, op) => {\n\t\t\t\tnetwork.changeCapacity(op.client, op.newSize);\n\t\t\t\treturn { ...state, clusterSize: op.newSize };\n\t\t\t},\n\t\t\tdeliverSomeOperations: (state, op) => {\n\t\t\t\tnetwork.deliverOperations(op.client, op.count);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tdeliverAllOperations: (state) => {\n\t\t\t\tnetwork.deliverOperations(DestinationClient.All);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\treconnect: (state, { client }) => {\n\t\t\t\tnetwork.goOfflineThenResume(client);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tvalidate: (state) => {\n\t\t\t\tvalidator?.(network);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t},\n\t\tinitialState,\n\t\tsaveInfo,\n\t);\n\n\tif (synchronizeAtEnd) {\n\t\tnetwork.deliverOperations(DestinationClient.All);\n\t\tvalidator?.(network);\n\t}\n}\n\n/**\n * Helper to generate a fixed number of IDs.\n */\nexport function generateCompressedIds(\n\tcompressor: IdCompressor,\n\tcount: number,\n): SessionSpaceCompressedId[] {\n\tconst ids: SessionSpaceCompressedId[] = [];\n\tfor (let i = 0; i < count; i++) {\n\t\tids.push(compressor.generateCompressedId());\n\t}\n\treturn ids;\n}\n\n/**\n * Creates a compressor that only produces final IDs.\n * It should only be used for testing purposes.\n */\nexport function createAlwaysFinalizedIdCompressor(\n\tlogger?: ITelemetryBaseLogger,\n): IIdCompressor & IIdCompressorCore;\n/**\n * Creates a compressor that only produces final IDs.\n * It should only be used for testing purposes.\n */\nexport function createAlwaysFinalizedIdCompressor(\n\tsessionId: SessionId,\n\tlogger?: ITelemetryBaseLogger,\n\tseed?: number,\n): IIdCompressor & IIdCompressorCore;\nexport function createAlwaysFinalizedIdCompressor(\n\tsessionIdOrLogger?: SessionId | ITelemetryBaseLogger,\n\tloggerOrUndefined?: ITelemetryBaseLogger,\n\tseed?: number,\n): IIdCompressor & IIdCompressorCore {\n\tconst random = seed === undefined ? makeRandom() : makeRandom(seed);\n\tconst sessionId =\n\t\ttypeof sessionIdOrLogger === \"string\" ? sessionIdOrLogger : (random.uuid4() as SessionId);\n\tconst logger =\n\t\t(loggerOrUndefined ?? typeof sessionIdOrLogger === \"object\")\n\t\t\t? (sessionIdOrLogger as ITelemetryBaseLogger)\n\t\t\t: undefined;\n\t// This local session is unused, but it needs to not collide with the GhostSession, so allocate a random one.\n\t// This causes the compressor to serialize non-deterministically even when provided an explicit SessionId.\n\t// This can be fixed in the future if needed.\n\tconst compressor = createIdCompressor(random.uuid4() as SessionId, logger);\n\t// Permanently put the compressor in a ghost session\n\t(compressor as IdCompressor).startGhostSession(sessionId);\n\treturn toIdCompressorWithCore(compressor);\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"summary.spec.js","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AAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5B,UAAU,CAAC,oBAAoB,EAAE,CAAC;QACnC,CAAC;QAED,MAAM,gBAAgB,GAAG,UAAU,CAAC,qBAAqB,EAAE,CAAC;QAC5D,UAAU,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;QACnD,WAAW,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;QACpD,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAE9C,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\nimport { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { type SessionId, createIdCompressor } from \"../../index.js\";\nimport { modifyClusterSize } from \"../idCompressorTestUtilities.js\";\n\nimport { _dirname } from \"./dirname.cjs\";\n\nconst regenerateSnapshots = process.argv.includes(\"--snapshot\");\n\nlet currentTestName: string | undefined;\nlet currentTestFile: string | undefined;\n\n// Simple filter to avoid tests with a name that would accidentally be parsed as directory traversal or other confusing things.\nconst nameCheck = new RegExp(/^[^\"/\\\\]+$/);\n\nassert(/(dist|lib)[/\\\\]test[/\\\\]snapshots$/.exec(_dirname));\nconst snapshotsFolder = path.join(_dirname, `../../../src/test/snapshots`);\nassert(existsSync(snapshotsFolder));\n\n/**\n * Delete the existing test file directory and recreate it.\n *\n * If the directory does not already exist, this will create it.\n *\n * @param dirPath - The path within the `snapshots` directory.\n */\nfunction useSnapshotDirectory(dirPath: string = \"files\"): void {\n\tconst normalizedDir = path.join(snapshotsFolder, dirPath);\n\t// Basic sanity check to avoid bugs like accidentally recursively deleting everything under `/` if something went wrong (like dirPath navigated up directories a lot).\n\tassert(normalizedDir.startsWith(snapshotsFolder));\n\n\tif (regenerateSnapshots) {\n\t\tif (existsSync(normalizedDir)) {\n\t\t\tconsole.log(`removing snapshot directory: ${normalizedDir}`);\n\t\t\trmSync(normalizedDir, { recursive: true, force: true });\n\t\t}\n\t\tmkdirSync(normalizedDir, { recursive: true });\n\t}\n\n\tbeforeEach(function (): void {\n\t\tcurrentTestName = this.currentTest?.title.replace(/ /g, \"-\") ?? assert.fail();\n\t\tcurrentTestFile = path.join(normalizedDir, currentTestName);\n\t});\n\n\tafterEach(() => {\n\t\tcurrentTestFile = undefined;\n\t\tcurrentTestName = undefined;\n\t});\n}\n\nfunction takeSnapshot(data: string, suffix: string = \"\"): void {\n\tassert(\n\t\tcurrentTestName !== undefined,\n\t\t\"use `useSnapshotDirectory` to configure the tests containing describe block to take snapshots\",\n\t);\n\tassert(currentTestFile !== undefined);\n\n\t// Ensure test name doesn't accidentally navigate up directories or things like that.\n\t// Done here instead of in beforeEach so errors surface better.\n\tif (nameCheck.test(currentTestName) === false) {\n\t\tassert.fail(`Expected test name to pass sanitization: \"${currentTestName}\"`);\n\t}\n\n\tconst fullFile = currentTestFile + suffix;\n\n\tconst exists = existsSync(fullFile);\n\tif (regenerateSnapshots) {\n\t\tassert(exists === false, \"snapshot should not already exist: possible name collision.\");\n\t\twriteFileSync(fullFile, data);\n\t} else {\n\t\tassert(exists, `test snapshot file does not exist: \"${fullFile}\"`);\n\t\tconst pastData = readFileSync(fullFile, \"utf8\");\n\t\tassert.equal(data, pastData, `snapshot different for \"${currentTestName}\"`);\n\t}\n}\n\ndescribe(\"snapshot tests\", () => {\n\tconst client1 = \"403f1e16-5265-4074-8507-417d99a05ee9\" as SessionId;\n\tconst client2 = \"4b02675a-5a81-428d-b7b7-d8c33a16bfde\" as SessionId;\n\n\tuseSnapshotDirectory();\n\n\tit(\"empty compressor summary\", () => {\n\t\tconst compressor = createIdCompressor(client1);\n\t\tconst summary = compressor.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t});\n\n\tit(\"compressor with finalized range from one client\", () => {\n\t\tconst compressor = createIdCompressor(client1);\n\t\tconst compressor2 = createIdCompressor(client2);\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tcompressor.generateCompressedId();\n\t\t}\n\t\tconst idRange = compressor.takeNextCreationRange();\n\t\tcompressor.finalizeCreationRange(idRange);\n\t\tconst summary = compressor.serialize(false);\n\t\tconst summary2 = compressor2.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t\ttakeSnapshot(summary2, \"-client2\");\n\t});\n\n\tit(\"compressors with finalized ranges from two clients\", () => {\n\t\tconst compressor = createIdCompressor(client1);\n\t\tconst compressor2 = createIdCompressor(client2);\n\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tcompressor.generateCompressedId();\n\t\t\tcompressor2.generateCompressedId();\n\t\t}\n\t\tconst idRange = compressor.takeNextCreationRange();\n\t\tconst idRange2 = compressor2.takeNextCreationRange();\n\n\t\tcompressor.finalizeCreationRange(idRange);\n\t\tcompressor2.finalizeCreationRange(idRange);\n\t\tcompressor.finalizeCreationRange(idRange2);\n\t\tcompressor2.finalizeCreationRange(idRange2);\n\n\t\tconst summary = compressor.serialize(false);\n\t\tconst summary2 = compressor2.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t\ttakeSnapshot(summary2, \"-client2\");\n\t});\n\n\tit(\"expansion semantics\", () => {\n\t\tconst compressor = createIdCompressor(client1);\n\t\tconst compressor2 = createIdCompressor(client2);\n\t\tmodifyClusterSize(compressor, 2);\n\t\tcompressor.generateCompressedId();\n\t\tconst idRange = compressor.takeNextCreationRange();\n\t\tcompressor.finalizeCreationRange(idRange);\n\t\tcompressor2.finalizeCreationRange(idRange);\n\n\t\tfor (let i = 0; i < 3; i++) {\n\t\t\tcompressor.generateCompressedId();\n\t\t}\n\n\t\tconst expansionIdRange = compressor.takeNextCreationRange();\n\t\tcompressor.finalizeCreationRange(expansionIdRange);\n\t\tcompressor2.finalizeCreationRange(expansionIdRange);\n\t\tconst summary = compressor.serialize(false);\n\t\tconst summary2 = compressor2.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t\ttakeSnapshot(summary2, \"-client2\");\n\t});\n});\n"]} | ||
| {"version":3,"file":"summary.spec.js","sourceRoot":"","sources":["../../../src/test/snapshots/summary.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,6CAA+C;AAC/C,qCAAqF;AACrF,0DAA6B;AAE7B,6CAA4F;AAC5F,kFAAoE;AAEpE,+CAAyC;AAEzC,MAAM,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAEhE,IAAI,eAAmC,CAAC;AACxC,IAAI,eAAmC,CAAC;AAExC,+HAA+H;AAC/H,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC;AAE3C,IAAA,oBAAM,EAAC,oCAAoC,CAAC,IAAI,CAAC,sBAAQ,CAAC,CAAC,CAAC;AAC5D,MAAM,eAAe,GAAG,mBAAI,CAAC,IAAI,CAAC,sBAAQ,EAAE,6BAA6B,CAAC,CAAC;AAC3E,IAAA,oBAAM,EAAC,IAAA,oBAAU,EAAC,eAAe,CAAC,CAAC,CAAC;AAEpC;;;;;;GAMG;AACH,SAAS,oBAAoB,CAAC,UAAkB,OAAO;IACtD,MAAM,aAAa,GAAG,mBAAI,CAAC,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAC1D,sKAAsK;IACtK,IAAA,oBAAM,EAAC,aAAa,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;IAElD,IAAI,mBAAmB,EAAE,CAAC;QACzB,IAAI,IAAA,oBAAU,EAAC,aAAa,CAAC,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,gCAAgC,aAAa,EAAE,CA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,6BAAkB,EAAC,OAAO,CAAC,CAAC,CAAC;QACvE,MAAM,WAAW,GAAG,IAAA,iCAAsB,EAAC,IAAA,6BAAkB,EAAC,OAAO,CAAC,CAAC,CAAC;QACxE,IAAA,gDAAiB,EAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACjC,UAAU,CAAC,oBAAoB,EAAE,CAAC;QAClC,MAAM,OAAO,GAAG,UAAU,CAAC,qBAAqB,EAAE,CAAC;QACnD,UAAU,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC1C,WAAW,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAE3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5B,UAAU,CAAC,oBAAoB,EAAE,CAAC;QACnC,CAAC;QAED,MAAM,gBAAgB,GAAG,UAAU,CAAC,qBAAqB,EAAE,CAAC;QAC5D,UAAU,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;QACnD,WAAW,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;QACpD,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAE9C,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\nimport { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { type SessionId, createIdCompressor, toIdCompressorWithCore } from \"../../index.js\";\nimport { modifyClusterSize } from \"../idCompressorTestUtilities.js\";\n\nimport { _dirname } from \"./dirname.cjs\";\n\nconst regenerateSnapshots = process.argv.includes(\"--snapshot\");\n\nlet currentTestName: string | undefined;\nlet currentTestFile: string | undefined;\n\n// Simple filter to avoid tests with a name that would accidentally be parsed as directory traversal or other confusing things.\nconst nameCheck = new RegExp(/^[^\"/\\\\]+$/);\n\nassert(/(dist|lib)[/\\\\]test[/\\\\]snapshots$/.exec(_dirname));\nconst snapshotsFolder = path.join(_dirname, `../../../src/test/snapshots`);\nassert(existsSync(snapshotsFolder));\n\n/**\n * Delete the existing test file directory and recreate it.\n *\n * If the directory does not already exist, this will create it.\n *\n * @param dirPath - The path within the `snapshots` directory.\n */\nfunction useSnapshotDirectory(dirPath: string = \"files\"): void {\n\tconst normalizedDir = path.join(snapshotsFolder, dirPath);\n\t// Basic sanity check to avoid bugs like accidentally recursively deleting everything under `/` if something went wrong (like dirPath navigated up directories a lot).\n\tassert(normalizedDir.startsWith(snapshotsFolder));\n\n\tif (regenerateSnapshots) {\n\t\tif (existsSync(normalizedDir)) {\n\t\t\tconsole.log(`removing snapshot directory: ${normalizedDir}`);\n\t\t\trmSync(normalizedDir, { recursive: true, force: true });\n\t\t}\n\t\tmkdirSync(normalizedDir, { recursive: true });\n\t}\n\n\tbeforeEach(function (): void {\n\t\tcurrentTestName = this.currentTest?.title.replace(/ /g, \"-\") ?? assert.fail();\n\t\tcurrentTestFile = path.join(normalizedDir, currentTestName);\n\t});\n\n\tafterEach(() => {\n\t\tcurrentTestFile = undefined;\n\t\tcurrentTestName = undefined;\n\t});\n}\n\nfunction takeSnapshot(data: string, suffix: string = \"\"): void {\n\tassert(\n\t\tcurrentTestName !== undefined,\n\t\t\"use `useSnapshotDirectory` to configure the tests containing describe block to take snapshots\",\n\t);\n\tassert(currentTestFile !== undefined);\n\n\t// Ensure test name doesn't accidentally navigate up directories or things like that.\n\t// Done here instead of in beforeEach so errors surface better.\n\tif (nameCheck.test(currentTestName) === false) {\n\t\tassert.fail(`Expected test name to pass sanitization: \"${currentTestName}\"`);\n\t}\n\n\tconst fullFile = currentTestFile + suffix;\n\n\tconst exists = existsSync(fullFile);\n\tif (regenerateSnapshots) {\n\t\tassert(exists === false, \"snapshot should not already exist: possible name collision.\");\n\t\twriteFileSync(fullFile, data);\n\t} else {\n\t\tassert(exists, `test snapshot file does not exist: \"${fullFile}\"`);\n\t\tconst pastData = readFileSync(fullFile, \"utf8\");\n\t\tassert.equal(data, pastData, `snapshot different for \"${currentTestName}\"`);\n\t}\n}\n\ndescribe(\"snapshot tests\", () => {\n\tconst client1 = \"403f1e16-5265-4074-8507-417d99a05ee9\" as SessionId;\n\tconst client2 = \"4b02675a-5a81-428d-b7b7-d8c33a16bfde\" as SessionId;\n\n\tuseSnapshotDirectory();\n\n\tit(\"empty compressor summary\", () => {\n\t\tconst compressor = toIdCompressorWithCore(createIdCompressor(client1));\n\t\tconst summary = compressor.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t});\n\n\tit(\"compressor with finalized range from one client\", () => {\n\t\tconst compressor = toIdCompressorWithCore(createIdCompressor(client1));\n\t\tconst compressor2 = toIdCompressorWithCore(createIdCompressor(client2));\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tcompressor.generateCompressedId();\n\t\t}\n\t\tconst idRange = compressor.takeNextCreationRange();\n\t\tcompressor.finalizeCreationRange(idRange);\n\t\tconst summary = compressor.serialize(false);\n\t\tconst summary2 = compressor2.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t\ttakeSnapshot(summary2, \"-client2\");\n\t});\n\n\tit(\"compressors with finalized ranges from two clients\", () => {\n\t\tconst compressor = toIdCompressorWithCore(createIdCompressor(client1));\n\t\tconst compressor2 = toIdCompressorWithCore(createIdCompressor(client2));\n\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tcompressor.generateCompressedId();\n\t\t\tcompressor2.generateCompressedId();\n\t\t}\n\t\tconst idRange = compressor.takeNextCreationRange();\n\t\tconst idRange2 = compressor2.takeNextCreationRange();\n\n\t\tcompressor.finalizeCreationRange(idRange);\n\t\tcompressor2.finalizeCreationRange(idRange);\n\t\tcompressor.finalizeCreationRange(idRange2);\n\t\tcompressor2.finalizeCreationRange(idRange2);\n\n\t\tconst summary = compressor.serialize(false);\n\t\tconst summary2 = compressor2.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t\ttakeSnapshot(summary2, \"-client2\");\n\t});\n\n\tit(\"expansion semantics\", () => {\n\t\tconst compressor = toIdCompressorWithCore(createIdCompressor(client1));\n\t\tconst compressor2 = toIdCompressorWithCore(createIdCompressor(client2));\n\t\tmodifyClusterSize(compressor, 2);\n\t\tcompressor.generateCompressedId();\n\t\tconst idRange = compressor.takeNextCreationRange();\n\t\tcompressor.finalizeCreationRange(idRange);\n\t\tcompressor2.finalizeCreationRange(idRange);\n\n\t\tfor (let i = 0; i < 3; i++) {\n\t\t\tcompressor.generateCompressedId();\n\t\t}\n\n\t\tconst expansionIdRange = compressor.takeNextCreationRange();\n\t\tcompressor.finalizeCreationRange(expansionIdRange);\n\t\tcompressor2.finalizeCreationRange(expansionIdRange);\n\t\tconst summary = compressor.serialize(false);\n\t\tconst summary2 = compressor2.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t\ttakeSnapshot(summary2, \"-client2\");\n\t});\n});\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"validateIdCompressorPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateIdCompressorPrevious.generated.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by \"flub generate typetests\" from @fluid-tools/build-cli.\n *\n * Baseline (previous) version: 2.92.0\n */\n\nimport type { TypeOnly, MinimalType, FullType, requireAssignableTo } from \"@fluidframework/build-tools\";\nimport type * as old from \"@fluidframework/id-compressor-previous/legacy\";\n\nimport type * as current from \"@fluidframework/id-compressor/legacy\";\n\ndeclare type MakeUnusedImportErrorsGoAway<T> = TypeOnly<T> | MinimalType<T> | FullType<T> | typeof old | typeof current | requireAssignableTo<true, true>;\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_createIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_createIdCompressor = requireAssignableTo<TypeOnly<typeof current.createIdCompressor>, TypeOnly<typeof old.createIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_createSessionId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_createSessionId = requireAssignableTo<TypeOnly<typeof current.createSessionId>, TypeOnly<typeof old.createSessionId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_deserializeIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_deserializeIdCompressor = requireAssignableTo<TypeOnly<typeof current.deserializeIdCompressor>, TypeOnly<typeof old.deserializeIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_serializeIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_serializeIdCompressor = requireAssignableTo<TypeOnly<typeof current.serializeIdCompressor>, TypeOnly<typeof old.serializeIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IdCreationRange\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_Interface_IdCreationRange = requireAssignableTo<TypeOnly<old.IdCreationRange>, TypeOnly<current.IdCreationRange>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IdCreationRange\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Interface_IdCreationRange = requireAssignableTo<TypeOnly<current.IdCreationRange>, TypeOnly<old.IdCreationRange>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressor\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_Interface_IIdCompressor = requireAssignableTo<TypeOnly<old.IIdCompressor>, TypeOnly<current.IIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Interface_IIdCompressor = requireAssignableTo<TypeOnly<current.IIdCompressor>, TypeOnly<old.IIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressorCore\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_Interface_IIdCompressorCore = requireAssignableTo<TypeOnly<old.IIdCompressorCore>, TypeOnly<current.IIdCompressorCore>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressorCore\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Interface_IIdCompressorCore = requireAssignableTo<TypeOnly<current.IIdCompressorCore>, TypeOnly<old.IIdCompressorCore>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_OpSpaceCompressedId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_OpSpaceCompressedId = requireAssignableTo<TypeOnly<old.OpSpaceCompressedId>, TypeOnly<current.OpSpaceCompressedId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_OpSpaceCompressedId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_OpSpaceCompressedId = requireAssignableTo<TypeOnly<current.OpSpaceCompressedId>, TypeOnly<old.OpSpaceCompressedId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressor\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressor = requireAssignableTo<TypeOnly<old.SerializedIdCompressor>, TypeOnly<current.SerializedIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressor = requireAssignableTo<TypeOnly<current.SerializedIdCompressor>, TypeOnly<old.SerializedIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithNoSession\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressorWithNoSession = requireAssignableTo<TypeOnly<old.SerializedIdCompressorWithNoSession>, TypeOnly<current.SerializedIdCompressorWithNoSession>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithNoSession\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressorWithNoSession = requireAssignableTo<TypeOnly<current.SerializedIdCompressorWithNoSession>, TypeOnly<old.SerializedIdCompressorWithNoSession>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithOngoingSession\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressorWithOngoingSession = requireAssignableTo<TypeOnly<old.SerializedIdCompressorWithOngoingSession>, TypeOnly<current.SerializedIdCompressorWithOngoingSession>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithOngoingSession\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressorWithOngoingSession = requireAssignableTo<TypeOnly<current.SerializedIdCompressorWithOngoingSession>, TypeOnly<old.SerializedIdCompressorWithOngoingSession>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SessionId = requireAssignableTo<TypeOnly<old.SessionId>, TypeOnly<current.SessionId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SessionId = requireAssignableTo<TypeOnly<current.SessionId>, TypeOnly<old.SessionId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionSpaceCompressedId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SessionSpaceCompressedId = requireAssignableTo<TypeOnly<old.SessionSpaceCompressedId>, TypeOnly<current.SessionSpaceCompressedId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionSpaceCompressedId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SessionSpaceCompressedId = requireAssignableTo<TypeOnly<current.SessionSpaceCompressedId>, TypeOnly<old.SessionSpaceCompressedId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_StableId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_StableId = requireAssignableTo<TypeOnly<old.StableId>, TypeOnly<current.StableId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_StableId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_StableId = requireAssignableTo<TypeOnly<current.StableId>, TypeOnly<old.StableId>>\n"]} | ||
| {"version":3,"file":"validateIdCompressorPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateIdCompressorPrevious.generated.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by \"flub generate typetests\" from @fluid-tools/build-cli.\n *\n * Baseline (previous) version: 2.92.0\n */\n\nimport type { TypeOnly, MinimalType, FullType, requireAssignableTo } from \"@fluidframework/build-tools\";\nimport type * as old from \"@fluidframework/id-compressor-previous/legacy\";\n\nimport type * as current from \"@fluidframework/id-compressor/legacy\";\n\ndeclare type MakeUnusedImportErrorsGoAway<T> = TypeOnly<T> | MinimalType<T> | FullType<T> | typeof old | typeof current | requireAssignableTo<true, true>;\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_createIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_createIdCompressor = requireAssignableTo<TypeOnly<typeof current.createIdCompressor>, TypeOnly<typeof old.createIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_createSessionId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_createSessionId = requireAssignableTo<TypeOnly<typeof current.createSessionId>, TypeOnly<typeof old.createSessionId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_deserializeIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_deserializeIdCompressor = requireAssignableTo<TypeOnly<typeof current.deserializeIdCompressor>, TypeOnly<typeof old.deserializeIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_serializeIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_serializeIdCompressor = requireAssignableTo<TypeOnly<typeof current.serializeIdCompressor>, TypeOnly<typeof old.serializeIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IdCreationRange\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_Interface_IdCreationRange = requireAssignableTo<TypeOnly<old.IdCreationRange>, TypeOnly<current.IdCreationRange>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IdCreationRange\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Interface_IdCreationRange = requireAssignableTo<TypeOnly<current.IdCreationRange>, TypeOnly<old.IdCreationRange>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressor\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_Interface_IIdCompressor = requireAssignableTo<TypeOnly<old.IIdCompressor>, TypeOnly<current.IIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Interface_IIdCompressor = requireAssignableTo<TypeOnly<current.IIdCompressor>, TypeOnly<old.IIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressorCore\": {\"forwardCompat\": false}\n */\n// @ts-expect-error compatibility expected to be broken\ndeclare type old_as_current_for_Interface_IIdCompressorCore = requireAssignableTo<TypeOnly<old.IIdCompressorCore>, TypeOnly<current.IIdCompressorCore>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressorCore\": {\"backCompat\": false}\n */\n// @ts-expect-error compatibility expected to be broken\ndeclare type current_as_old_for_Interface_IIdCompressorCore = requireAssignableTo<TypeOnly<current.IIdCompressorCore>, TypeOnly<old.IIdCompressorCore>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_OpSpaceCompressedId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_OpSpaceCompressedId = requireAssignableTo<TypeOnly<old.OpSpaceCompressedId>, TypeOnly<current.OpSpaceCompressedId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_OpSpaceCompressedId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_OpSpaceCompressedId = requireAssignableTo<TypeOnly<current.OpSpaceCompressedId>, TypeOnly<old.OpSpaceCompressedId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressor\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressor = requireAssignableTo<TypeOnly<old.SerializedIdCompressor>, TypeOnly<current.SerializedIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressor = requireAssignableTo<TypeOnly<current.SerializedIdCompressor>, TypeOnly<old.SerializedIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithNoSession\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressorWithNoSession = requireAssignableTo<TypeOnly<old.SerializedIdCompressorWithNoSession>, TypeOnly<current.SerializedIdCompressorWithNoSession>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithNoSession\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressorWithNoSession = requireAssignableTo<TypeOnly<current.SerializedIdCompressorWithNoSession>, TypeOnly<old.SerializedIdCompressorWithNoSession>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithOngoingSession\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressorWithOngoingSession = requireAssignableTo<TypeOnly<old.SerializedIdCompressorWithOngoingSession>, TypeOnly<current.SerializedIdCompressorWithOngoingSession>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithOngoingSession\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressorWithOngoingSession = requireAssignableTo<TypeOnly<current.SerializedIdCompressorWithOngoingSession>, TypeOnly<old.SerializedIdCompressorWithOngoingSession>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SessionId = requireAssignableTo<TypeOnly<old.SessionId>, TypeOnly<current.SessionId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SessionId = requireAssignableTo<TypeOnly<current.SessionId>, TypeOnly<old.SessionId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionSpaceCompressedId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SessionSpaceCompressedId = requireAssignableTo<TypeOnly<old.SessionSpaceCompressedId>, TypeOnly<current.SessionSpaceCompressedId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionSpaceCompressedId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SessionSpaceCompressedId = requireAssignableTo<TypeOnly<current.SessionSpaceCompressedId>, TypeOnly<old.SessionSpaceCompressedId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_StableId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_StableId = requireAssignableTo<TypeOnly<old.StableId>, TypeOnly<current.StableId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_StableId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_StableId = requireAssignableTo<TypeOnly<current.StableId>, TypeOnly<old.StableId>>\n"]} |
@@ -68,15 +68,3 @@ /*! | ||
| * | ||
| * @privateremarks To be made internal in 2.100.0 | ||
| * | ||
| * @deprecated `IIdCompressorCore` will be removed from the public API in 2.100.0. | ||
| * | ||
| * - If you use `serialize()`, use the free function | ||
| * {@link (serializeIdCompressor:1) | serializeIdCompressor(compressor, withSession)} instead. | ||
| * | ||
| * - `takeNextCreationRange`, `takeUnfinalizedCreationRange`, `finalizeCreationRange`, and | ||
| * `beginGhostSession` are internal runtime operations. External consumers should not call | ||
| * them directly. If you depend on these APIs, please file an issue on the FluidFramework | ||
| * repository describing your use case. | ||
| * | ||
| * @legacy @beta | ||
| * @internal | ||
| */ | ||
@@ -83,0 +71,0 @@ export interface IIdCompressorCore { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"idCompressor.d.ts","sourceRoot":"","sources":["../../src/types/idCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,mBAAmB,EACnB,SAAS,EACT,wBAAwB,EACxB,QAAQ,EACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACX,eAAe,EACf,mCAAmC,EACnC,wCAAwC,EACxC,MAAM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AwB,IAAI,CAAC,wBAAwB,GAAG,mBAAmB,CAAC,GAAG,QAAQ,CAAC;IAExF;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,EAAE,wBAAwB,GAAG,mBAAmB,CAAC;IAEtE;;;;;;;OAOG;IACH,uBAAuB,CACtB,EAAE,EAAE,mBAAmB,EACvB,eAAe,EAAE,SAAS,GACxB,wBAAwB,CAAC;IAE5B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,EAAE,wBAAwB,GAAG,QAAQ,CAAC;IAEnD;;;;;OAKG;IACH,UAAU,CAAC,YAAY,EAAE,QAAQ,GAAG,wBAAwB,CAAC;IAE7D;;;;OAIG;IACH,aAAa,CAAC,YAAY,EAAE,QAAQ,GAAG,wBAAwB,GAAG,SAAS,CAAC;CAC5E"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"idCompressor.js","sourceRoot":"","sources":["../../src/types/idCompressor.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tOpSpaceCompressedId,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"./identifiers.js\";\nimport type {\n\tIdCreationRange,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n} from \"./persisted-types/index.js\";\n\n/**\n * A distributed UUID generator and compressor.\n *\n * Generates arbitrary non-colliding v4 UUIDs, called stable IDs, for multiple \"sessions\" (which can be distributed across the network),\n * providing each session with the ability to map these UUIDs to `numbers`.\n *\n * A session is a unique identifier that denotes a single compressor. New IDs are created through a single compressor API\n * which should then sent in ranges to the server for total ordering (and are subsequently relayed to other clients). When a new ID is\n * created it is said to be created by the compressor's \"local\" session.\n *\n * For each stable ID created, two numeric IDs are provided by the compressor:\n *\n * 1. A session-local ID, which is stable for the lifetime of the session (which could be longer than that of the compressor object, as it may\n * be serialized for offline usage). Available as soon as the stable ID is allocated. These IDs are session-unique and are thus only\n * safely usable within the scope of the compressor that created it.\n *\n * 2. A final ID, which is stable across serialization and deserialization of an IdCompressor. Available as soon as the range containing\n * the corresponding session-local ID is totally ordered (via consensus) with respect to other sessions' allocations.\n * Final IDs are known to and publicly usable by any compressor that has received them.\n *\n * Compressors will allocate UUIDs in non-random ways to reduce entropy allowing for optimized storage of the data needed\n * to map the UUIDs to the numbers.\n *\n * The following invariants are upheld by IdCompressor:\n *\n * 1. Session-local IDs will always decompress to the same UUIDs for the lifetime of the session.\n *\n * 2. Final IDs will always decompress to the same UUIDs.\n *\n * 3. After a server-processed range of session-local IDs (from any session) is received by a compressor, any of those session-local IDs may be\n * translated by the compressor into the corresponding final ID. For any given session-local ID, this translation will always yield the\n * same final ID.\n *\n * 4. A UUID will always compress into the same session-local ID for the lifetime of the session.\n *\n * Session-local IDs are sent across the wire in efficiently-represented ranges. These ranges are created by querying the compressor, and *must*\n * be ordered (i.e. sent to the server) in the order they are created in order to preserve the above invariants.\n *\n * Session-local IDs can be used immediately after creation, but will eventually (after being sequenced) have a corresponding final ID. This\n * could make reasoning about equality of those two forms difficult. For example, if a cache is keyed off of a\n * session-local ID but is later queried using the final ID (which is semantically equal, as it decompresses to the same UUID/string) it will\n * produce a cache miss. In order to make using collections of both remotely created and locally created IDs easy, regardless of whether the\n * session-local IDs have been finalized, the compressor defines two \"spaces\" of IDs:\n *\n * 1. Session space: in this space, all IDs are normalized to their \"most local form\". This means that all IDs created by the local session\n * will be in local form, regardless of if they have been finalized. Remotely created IDs, which could only have been received after\n * finalizing and will never have a local form for the compressor, will of course be final IDs. This space should be used with consumer APIs\n * and data structures, as the lifetime of the IDs is guaranteed to be the same as the compressor object. Care must be taken to not use\n * these IDs across compressor objects, as the local IDs are specific to the compressor that created them.\n *\n * 2. Op space: in this space, all IDs are normalized to their \"most final form\". This means that all IDs except session-local IDs that\n * have not yet been finalized will be in final ID form. This space is useful for serialization in ops (e.g. references), as other clients\n * that receive them need not do any work to normalize them to *their* session-space in the common case. Note that IDs in op space may move\n * out of Op space over time, namely, when a session-local ID in this space becomes finalized, and thereafter has a \"more final form\".\n * Consequentially, it may be useful to restrict parameters of a persisted type to this space (to optimize perf), but it is potentially\n * incorrect to use this type for a runtime variable. This is an asymmetry that does not affect session space, as local IDs are always as\n * \"local as possible\".\n *\n * These two spaces naturally define a rule: consumers of compressed IDs should use session-space IDs, but serialized forms such as ops\n * should use op-space IDs.\n *\n * @privateremarks To be made internal in 2.100.0\n *\n * @deprecated `IIdCompressorCore` will be removed from the public API in 2.100.0.\n *\n * - If you use `serialize()`, use the free function\n * {@link (serializeIdCompressor:1) | serializeIdCompressor(compressor, withSession)} instead.\n *\n * - `takeNextCreationRange`, `takeUnfinalizedCreationRange`, `finalizeCreationRange`, and\n * `beginGhostSession` are internal runtime operations. External consumers should not call\n * them directly. If you depend on these APIs, please file an issue on the FluidFramework\n * repository describing your use case.\n *\n * @legacy @beta\n */\nexport interface IIdCompressorCore {\n\t/**\n\t * Returns a range of IDs created by this session in a format for sending to the server for finalizing.\n\t * The range will include all IDs generated via calls to `generateCompressedId` since the last time a\n\t * range was taken (via this method or `takeUnfinalizedCreationRange`).\n\t * @returns the range of IDs, which may be empty. This range must be sent to the server for ordering before\n\t * it is finalized. Ranges must be sent to the server in the order that they are taken via calls to this method.\n\t */\n\ttakeNextCreationRange(): IdCreationRange;\n\n\t/**\n\t * Returns a range of IDs created by this session in a format for sending to the server for finalizing.\n\t * The range will include all unfinalized IDs generated via calls to `generateCompressedId`.\n\t * @returns the range of IDs, which may be empty. This range must be sent to the server for ordering before\n\t * it is finalized. Ranges must be sent to the server in the order that they are taken via calls to this method.\n\t * Note: after finalizing the range returned by this method, finalizing any ranges that had been previously taken\n\t * will result in an error.\n\t */\n\ttakeUnfinalizedCreationRange(): IdCreationRange;\n\n\t/**\n\t * Resets the next creation range to include all unfinalized IDs.\n\t *\n\t * @remarks\n\t * IMPORTANT: This must only be called if it's CERTAIN that the unfinalized range will never be finalized as-is (e.g. by in-flight ops).\n\t *\n\t * After calling this, the next call to {@link IIdCompressorCore.takeNextCreationRange} will produce a range\n\t * covering all unfinalized IDs (equivalent to what {@link IIdCompressorCore.takeUnfinalizedCreationRange} would\n\t * have returned) plus any IDs generated after this call.\n\t *\n\t * Unlike {@link IIdCompressorCore.takeUnfinalizedCreationRange}, this method does not produce or return a range,\n\t * and does not advance the internal range counter. It is useful when the caller wants to\n\t * defer the actual range submission to the next natural {@link IIdCompressorCore.takeNextCreationRange} call.\n\t */\n\tresetUnfinalizedCreationRange(): void;\n\n\t/**\n\t * Finalizes the supplied range of IDs (which may be from either a remote or local session).\n\t * @param range - the range of session-local IDs to finalize.\n\t */\n\tfinalizeCreationRange(range: IdCreationRange): void;\n\n\t/**\n\t * Run a callback that is performed from the perspective of a special \"ghost\" session.\n\t * Any ids generated by this session will be immediately finalized on the local client as if\n\t * they were created by a remote client with `ghostSessionId`.\n\t *\n\t * *WARNING:* This API requires an external consensus mechanism to safely use:\n\t * In an attached container (i.e. multiple clients may have the document loaded), all clients must guarantee that:\n\t * - They invoke this API starting from the same finalized creation ranges\n\t * - This API is invoked with the same ghost session id\n\t * - `ghostSessionCallback` deterministically mints the same number of ids on each client within the ghost session\n\t * Failure to meet these requirement will result in divergence across clients and eventual consistency errors.\n\t * While the ghost sesion callback is running, IdCompressor does not support serialization.\n\t * @remarks This API is primarily intended for data migration scenarios which are able to deterministically transform\n\t * data in some format into data in a new format.\n\t * The first requirement (that all clients must invoke the API with the same finalized creation ranges) is guaranteed\n\t * for this scenario because the data transformation callback occurs at a specific ack within the op stream on all\n\t * clients, and clients don't finalize creation ranges for local changes they might have at this point in time.\n\t * @param ghostSessionId - The session id that minted ids generated within `ghostSessionCallback` should be attributed to.\n\t * @param ghostSessionCallback - Callback which mints ids attributed to the ghost session.\n\t */\n\tbeginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void;\n\n\t/**\n\t * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.\n\t * This includes finalized state as well as un-finalized state and is therefore suitable for use in offline scenarios.\n\t */\n\tserialize(withSession: true): SerializedIdCompressorWithOngoingSession;\n\n\t/**\n\t * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.\n\t * This only includes finalized state and is therefore suitable for use in summaries.\n\t */\n\tserialize(withSession: false): SerializedIdCompressorWithNoSession;\n}\n\n/**\n * A distributed UUID generator and compressor.\n * `IdCompressor` offers the ability to generate arbitrary non-colliding v4 UUIDs, called stable IDs, while compressing them into small integers\n * for efficient storage and transmission. It also provides the ability to decompress these integers back into their original UUIDs.\n *\n * The compressor is designed to be used in a distributed environment, where multiple clients may be generating IDs concurrently.\n * IDs generated by a compressor, via calls to `generateCompressedId`, are created in the compressor's \"local\" session.\n * These IDs are unique within the session, but may not be unique across sessions. In the context of Fluid, the scope of a session\n * is the same as the scope of a container. This means that anytime IDs are transferred between sessions, they must be translated\n * through a process called \"normalization\":\n * - The scope of a local session (in which local IDs are unique) is called the \"session space\" of the client.\n * - The context of persisted state (in Fluid, this is the context of ops and summaries) is called \"op space\".\n * - `SessionSpaceCompressedId`s, generated via calls to `generateCompressedId`, should NEVER be serialized directly.\n * In Fluid, this means they should not be included in ops or summaries.\n * - Before serialization, IDs must be normalized to op space to ensure they are interpretable by other clients.\n * - Upon receipt, IDs should be normalized back to session space before use.\n *\n * Example Usage:\n *\n * ### Client A (Sender)\n *\n * ```typescript\n * // Generate several local IDs\n * const localId1 = idCompressor.generateCompressedId();\n * const localId2 = idCompressor.generateCompressedId();\n * const localId3 = idCompressor.generateCompressedId();\n *\n * // Normalize these IDs to op space for inclusion in a message\n * const opSpaceId1 = idCompressor.normalizeToOpSpace(localId1);\n * const opSpaceId2 = idCompressor.normalizeToOpSpace(localId2);\n * const opSpaceId3 = idCompressor.normalizeToOpSpace(localId3);\n *\n * // Create and send a message containing these op space IDs along with the sender's session ID\n * // In Fluid, this would be an op or summary\n * const message = {\n * sessionID: idCompressor.localSessionId,\n * ids: [opSpaceId1, opSpaceId2, opSpaceId3]\n * };\n * ```\n *\n * ### Client B (Receiver)\n *\n * ```typescript\n * // Receive the message from Client A\n * const receivedMessage = ...; // In Fluid, this would be an op or summary\n *\n * // Normalize the received IDs back to session space, utilizing the sender's session ID\n * const sessionSpaceId1 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[0], receivedMessage.sessionID);\n * const sessionSpaceId2 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[1], receivedMessage.sessionID);\n * const sessionSpaceId3 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[2], receivedMessage.sessionID);\n * ```\n * @public\n */\nexport interface IIdCompressor {\n\t/**\n\t * The local session ID.\n\t */\n\tlocalSessionId: SessionId;\n\n\t/**\n\t * Generates a new compressed ID.\n\t * The returned ID is in session space and should not be serialized directly. See `IIdCompressor` for more details.\n\t * @returns A new local ID in session space.\n\t */\n\tgenerateCompressedId(): SessionSpaceCompressedId;\n\n\t/**\n\t * Generates a new ID that is guaranteed to be unique across all sessions known to this compressor without the need for any\n\t * normalization. The returned ID is not guaranteed to be a compressed ID (small number); it may be a stable ID (UUID string).\n\t * In Fluid, the likelihood of generating the bulkier stable ID is dictated by network conditions and is highly probably in\n\t * scenarios such as offline. This is still useful for use cases where simplicity is more important than performance and\n\t * this approach will often be superior to generating a UUID.\n\t * If small numbers are a requirement, `generateCompressedId` and normalization should be used instead.\n\t * See `IIdCompressor` for more details.\n\t * @returns A new local ID in session space.\n\t */\n\tgenerateDocumentUniqueId(): (SessionSpaceCompressedId & OpSpaceCompressedId) | StableId;\n\n\t/**\n\t * Normalizes a session space ID into op space.\n\t * The returned ID is in op space and can be safely serialized. However, it should be normalized back to session space before use.\n\t * See `IIdCompressor` for more details.\n\t * @param id - The local ID to normalize.\n\t * @returns The ID in op space.\n\t */\n\tnormalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;\n\n\t/**\n\t * Normalizes an ID into session space.\n\t * @param id - The ID to normalize.\n\t * @param originSessionId - The session from which `id` originated. This should be the ID of the client that normalized `id` to op space.\n\t * This means that it may not be the client that created `id` in the first place, but rather the client that serialized it.\n\t * This is an important distinction in the case of a reference, where a client might refer to an ID created by another client.\n\t * @returns The session-space ID in the local session corresponding to `id`.\n\t */\n\tnormalizeToSessionSpace(\n\t\tid: OpSpaceCompressedId,\n\t\toriginSessionId: SessionId,\n\t): SessionSpaceCompressedId;\n\n\t/**\n\t * Decompresses a previously compressed ID into a UUID.\n\t * @param id - The compressed ID to be decompressed.\n\t * @returns The UUID associated with the compressed ID.\n\t * @throws If the ID was not generated by any session known to this compressor.\n\t */\n\tdecompress(id: SessionSpaceCompressedId): StableId;\n\n\t/**\n\t * Recompresses a UUID.\n\t * @param uncompressed - The UUID to recompress.\n\t * @returns The `CompressedId` associated with `uncompressed`.\n\t * @throws If the UUID was not generated by any session known to this compressor.\n\t */\n\trecompress(uncompressed: StableId): SessionSpaceCompressedId;\n\n\t/**\n\t * Attempts to recompress a UUID.\n\t * @param uncompressed - The UUID to recompress.\n\t * @returns The `CompressedId` associated with `uncompressed` or undefined if the UUID was not generated by any session known to this compressor.\n\t */\n\ttryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;\n}\n"]} | ||
| {"version":3,"file":"idCompressor.js","sourceRoot":"","sources":["../../src/types/idCompressor.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tOpSpaceCompressedId,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"./identifiers.js\";\nimport type {\n\tIdCreationRange,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n} from \"./persisted-types/index.js\";\n\n/**\n * A distributed UUID generator and compressor.\n *\n * Generates arbitrary non-colliding v4 UUIDs, called stable IDs, for multiple \"sessions\" (which can be distributed across the network),\n * providing each session with the ability to map these UUIDs to `numbers`.\n *\n * A session is a unique identifier that denotes a single compressor. New IDs are created through a single compressor API\n * which should then sent in ranges to the server for total ordering (and are subsequently relayed to other clients). When a new ID is\n * created it is said to be created by the compressor's \"local\" session.\n *\n * For each stable ID created, two numeric IDs are provided by the compressor:\n *\n * 1. A session-local ID, which is stable for the lifetime of the session (which could be longer than that of the compressor object, as it may\n * be serialized for offline usage). Available as soon as the stable ID is allocated. These IDs are session-unique and are thus only\n * safely usable within the scope of the compressor that created it.\n *\n * 2. A final ID, which is stable across serialization and deserialization of an IdCompressor. Available as soon as the range containing\n * the corresponding session-local ID is totally ordered (via consensus) with respect to other sessions' allocations.\n * Final IDs are known to and publicly usable by any compressor that has received them.\n *\n * Compressors will allocate UUIDs in non-random ways to reduce entropy allowing for optimized storage of the data needed\n * to map the UUIDs to the numbers.\n *\n * The following invariants are upheld by IdCompressor:\n *\n * 1. Session-local IDs will always decompress to the same UUIDs for the lifetime of the session.\n *\n * 2. Final IDs will always decompress to the same UUIDs.\n *\n * 3. After a server-processed range of session-local IDs (from any session) is received by a compressor, any of those session-local IDs may be\n * translated by the compressor into the corresponding final ID. For any given session-local ID, this translation will always yield the\n * same final ID.\n *\n * 4. A UUID will always compress into the same session-local ID for the lifetime of the session.\n *\n * Session-local IDs are sent across the wire in efficiently-represented ranges. These ranges are created by querying the compressor, and *must*\n * be ordered (i.e. sent to the server) in the order they are created in order to preserve the above invariants.\n *\n * Session-local IDs can be used immediately after creation, but will eventually (after being sequenced) have a corresponding final ID. This\n * could make reasoning about equality of those two forms difficult. For example, if a cache is keyed off of a\n * session-local ID but is later queried using the final ID (which is semantically equal, as it decompresses to the same UUID/string) it will\n * produce a cache miss. In order to make using collections of both remotely created and locally created IDs easy, regardless of whether the\n * session-local IDs have been finalized, the compressor defines two \"spaces\" of IDs:\n *\n * 1. Session space: in this space, all IDs are normalized to their \"most local form\". This means that all IDs created by the local session\n * will be in local form, regardless of if they have been finalized. Remotely created IDs, which could only have been received after\n * finalizing and will never have a local form for the compressor, will of course be final IDs. This space should be used with consumer APIs\n * and data structures, as the lifetime of the IDs is guaranteed to be the same as the compressor object. Care must be taken to not use\n * these IDs across compressor objects, as the local IDs are specific to the compressor that created them.\n *\n * 2. Op space: in this space, all IDs are normalized to their \"most final form\". This means that all IDs except session-local IDs that\n * have not yet been finalized will be in final ID form. This space is useful for serialization in ops (e.g. references), as other clients\n * that receive them need not do any work to normalize them to *their* session-space in the common case. Note that IDs in op space may move\n * out of Op space over time, namely, when a session-local ID in this space becomes finalized, and thereafter has a \"more final form\".\n * Consequentially, it may be useful to restrict parameters of a persisted type to this space (to optimize perf), but it is potentially\n * incorrect to use this type for a runtime variable. This is an asymmetry that does not affect session space, as local IDs are always as\n * \"local as possible\".\n *\n * These two spaces naturally define a rule: consumers of compressed IDs should use session-space IDs, but serialized forms such as ops\n * should use op-space IDs.\n *\n * @internal\n */\nexport interface IIdCompressorCore {\n\t/**\n\t * Returns a range of IDs created by this session in a format for sending to the server for finalizing.\n\t * The range will include all IDs generated via calls to `generateCompressedId` since the last time a\n\t * range was taken (via this method or `takeUnfinalizedCreationRange`).\n\t * @returns the range of IDs, which may be empty. This range must be sent to the server for ordering before\n\t * it is finalized. Ranges must be sent to the server in the order that they are taken via calls to this method.\n\t */\n\ttakeNextCreationRange(): IdCreationRange;\n\n\t/**\n\t * Returns a range of IDs created by this session in a format for sending to the server for finalizing.\n\t * The range will include all unfinalized IDs generated via calls to `generateCompressedId`.\n\t * @returns the range of IDs, which may be empty. This range must be sent to the server for ordering before\n\t * it is finalized. Ranges must be sent to the server in the order that they are taken via calls to this method.\n\t * Note: after finalizing the range returned by this method, finalizing any ranges that had been previously taken\n\t * will result in an error.\n\t */\n\ttakeUnfinalizedCreationRange(): IdCreationRange;\n\n\t/**\n\t * Resets the next creation range to include all unfinalized IDs.\n\t *\n\t * @remarks\n\t * IMPORTANT: This must only be called if it's CERTAIN that the unfinalized range will never be finalized as-is (e.g. by in-flight ops).\n\t *\n\t * After calling this, the next call to {@link IIdCompressorCore.takeNextCreationRange} will produce a range\n\t * covering all unfinalized IDs (equivalent to what {@link IIdCompressorCore.takeUnfinalizedCreationRange} would\n\t * have returned) plus any IDs generated after this call.\n\t *\n\t * Unlike {@link IIdCompressorCore.takeUnfinalizedCreationRange}, this method does not produce or return a range,\n\t * and does not advance the internal range counter. It is useful when the caller wants to\n\t * defer the actual range submission to the next natural {@link IIdCompressorCore.takeNextCreationRange} call.\n\t */\n\tresetUnfinalizedCreationRange(): void;\n\n\t/**\n\t * Finalizes the supplied range of IDs (which may be from either a remote or local session).\n\t * @param range - the range of session-local IDs to finalize.\n\t */\n\tfinalizeCreationRange(range: IdCreationRange): void;\n\n\t/**\n\t * Run a callback that is performed from the perspective of a special \"ghost\" session.\n\t * Any ids generated by this session will be immediately finalized on the local client as if\n\t * they were created by a remote client with `ghostSessionId`.\n\t *\n\t * *WARNING:* This API requires an external consensus mechanism to safely use:\n\t * In an attached container (i.e. multiple clients may have the document loaded), all clients must guarantee that:\n\t * - They invoke this API starting from the same finalized creation ranges\n\t * - This API is invoked with the same ghost session id\n\t * - `ghostSessionCallback` deterministically mints the same number of ids on each client within the ghost session\n\t * Failure to meet these requirement will result in divergence across clients and eventual consistency errors.\n\t * While the ghost sesion callback is running, IdCompressor does not support serialization.\n\t * @remarks This API is primarily intended for data migration scenarios which are able to deterministically transform\n\t * data in some format into data in a new format.\n\t * The first requirement (that all clients must invoke the API with the same finalized creation ranges) is guaranteed\n\t * for this scenario because the data transformation callback occurs at a specific ack within the op stream on all\n\t * clients, and clients don't finalize creation ranges for local changes they might have at this point in time.\n\t * @param ghostSessionId - The session id that minted ids generated within `ghostSessionCallback` should be attributed to.\n\t * @param ghostSessionCallback - Callback which mints ids attributed to the ghost session.\n\t */\n\tbeginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void;\n\n\t/**\n\t * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.\n\t * This includes finalized state as well as un-finalized state and is therefore suitable for use in offline scenarios.\n\t */\n\tserialize(withSession: true): SerializedIdCompressorWithOngoingSession;\n\n\t/**\n\t * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.\n\t * This only includes finalized state and is therefore suitable for use in summaries.\n\t */\n\tserialize(withSession: false): SerializedIdCompressorWithNoSession;\n}\n\n/**\n * A distributed UUID generator and compressor.\n * `IdCompressor` offers the ability to generate arbitrary non-colliding v4 UUIDs, called stable IDs, while compressing them into small integers\n * for efficient storage and transmission. It also provides the ability to decompress these integers back into their original UUIDs.\n *\n * The compressor is designed to be used in a distributed environment, where multiple clients may be generating IDs concurrently.\n * IDs generated by a compressor, via calls to `generateCompressedId`, are created in the compressor's \"local\" session.\n * These IDs are unique within the session, but may not be unique across sessions. In the context of Fluid, the scope of a session\n * is the same as the scope of a container. This means that anytime IDs are transferred between sessions, they must be translated\n * through a process called \"normalization\":\n * - The scope of a local session (in which local IDs are unique) is called the \"session space\" of the client.\n * - The context of persisted state (in Fluid, this is the context of ops and summaries) is called \"op space\".\n * - `SessionSpaceCompressedId`s, generated via calls to `generateCompressedId`, should NEVER be serialized directly.\n * In Fluid, this means they should not be included in ops or summaries.\n * - Before serialization, IDs must be normalized to op space to ensure they are interpretable by other clients.\n * - Upon receipt, IDs should be normalized back to session space before use.\n *\n * Example Usage:\n *\n * ### Client A (Sender)\n *\n * ```typescript\n * // Generate several local IDs\n * const localId1 = idCompressor.generateCompressedId();\n * const localId2 = idCompressor.generateCompressedId();\n * const localId3 = idCompressor.generateCompressedId();\n *\n * // Normalize these IDs to op space for inclusion in a message\n * const opSpaceId1 = idCompressor.normalizeToOpSpace(localId1);\n * const opSpaceId2 = idCompressor.normalizeToOpSpace(localId2);\n * const opSpaceId3 = idCompressor.normalizeToOpSpace(localId3);\n *\n * // Create and send a message containing these op space IDs along with the sender's session ID\n * // In Fluid, this would be an op or summary\n * const message = {\n * sessionID: idCompressor.localSessionId,\n * ids: [opSpaceId1, opSpaceId2, opSpaceId3]\n * };\n * ```\n *\n * ### Client B (Receiver)\n *\n * ```typescript\n * // Receive the message from Client A\n * const receivedMessage = ...; // In Fluid, this would be an op or summary\n *\n * // Normalize the received IDs back to session space, utilizing the sender's session ID\n * const sessionSpaceId1 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[0], receivedMessage.sessionID);\n * const sessionSpaceId2 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[1], receivedMessage.sessionID);\n * const sessionSpaceId3 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[2], receivedMessage.sessionID);\n * ```\n * @public\n */\nexport interface IIdCompressor {\n\t/**\n\t * The local session ID.\n\t */\n\tlocalSessionId: SessionId;\n\n\t/**\n\t * Generates a new compressed ID.\n\t * The returned ID is in session space and should not be serialized directly. See `IIdCompressor` for more details.\n\t * @returns A new local ID in session space.\n\t */\n\tgenerateCompressedId(): SessionSpaceCompressedId;\n\n\t/**\n\t * Generates a new ID that is guaranteed to be unique across all sessions known to this compressor without the need for any\n\t * normalization. The returned ID is not guaranteed to be a compressed ID (small number); it may be a stable ID (UUID string).\n\t * In Fluid, the likelihood of generating the bulkier stable ID is dictated by network conditions and is highly probably in\n\t * scenarios such as offline. This is still useful for use cases where simplicity is more important than performance and\n\t * this approach will often be superior to generating a UUID.\n\t * If small numbers are a requirement, `generateCompressedId` and normalization should be used instead.\n\t * See `IIdCompressor` for more details.\n\t * @returns A new local ID in session space.\n\t */\n\tgenerateDocumentUniqueId(): (SessionSpaceCompressedId & OpSpaceCompressedId) | StableId;\n\n\t/**\n\t * Normalizes a session space ID into op space.\n\t * The returned ID is in op space and can be safely serialized. However, it should be normalized back to session space before use.\n\t * See `IIdCompressor` for more details.\n\t * @param id - The local ID to normalize.\n\t * @returns The ID in op space.\n\t */\n\tnormalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;\n\n\t/**\n\t * Normalizes an ID into session space.\n\t * @param id - The ID to normalize.\n\t * @param originSessionId - The session from which `id` originated. This should be the ID of the client that normalized `id` to op space.\n\t * This means that it may not be the client that created `id` in the first place, but rather the client that serialized it.\n\t * This is an important distinction in the case of a reference, where a client might refer to an ID created by another client.\n\t * @returns The session-space ID in the local session corresponding to `id`.\n\t */\n\tnormalizeToSessionSpace(\n\t\tid: OpSpaceCompressedId,\n\t\toriginSessionId: SessionId,\n\t): SessionSpaceCompressedId;\n\n\t/**\n\t * Decompresses a previously compressed ID into a UUID.\n\t * @param id - The compressed ID to be decompressed.\n\t * @returns The UUID associated with the compressed ID.\n\t * @throws If the ID was not generated by any session known to this compressor.\n\t */\n\tdecompress(id: SessionSpaceCompressedId): StableId;\n\n\t/**\n\t * Recompresses a UUID.\n\t * @param uncompressed - The UUID to recompress.\n\t * @returns The `CompressedId` associated with `uncompressed`.\n\t * @throws If the UUID was not generated by any session known to this compressor.\n\t */\n\trecompress(uncompressed: StableId): SessionSpaceCompressedId;\n\n\t/**\n\t * Attempts to recompress a UUID.\n\t * @param uncompressed - The UUID to recompress.\n\t * @returns The `CompressedId` associated with `uncompressed` or undefined if the UUID was not generated by any session known to this compressor.\n\t */\n\ttryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;\n}\n"]} |
+13
-36
@@ -6,3 +6,4 @@ /*! | ||
| import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces"; | ||
| import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal"; | ||
| import type { TelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal"; | ||
| import type { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/legacy"; | ||
| import { type Index } from "./persistanceUtilities.js"; | ||
@@ -43,3 +44,3 @@ import { Sessions } from "./sessions.js"; | ||
| private ongoingGhostSession?; | ||
| constructor(localSessionIdOrDeserialized: SessionId | Sessions, logger: ITelemetryLoggerExt | undefined); | ||
| constructor(localSessionIdOrDeserialized: SessionId | Sessions, logger: TelemetryLoggerExt | undefined); | ||
| generateCompressedId(): SessionSpaceCompressedId; | ||
@@ -73,3 +74,3 @@ generateDocumentUniqueId(): (SessionSpaceCompressedId & OpSpaceCompressedId) | StableId; | ||
| serialized: SerializedIdCompressorWithOngoingSession; | ||
| logger?: ITelemetryLoggerExt | undefined; | ||
| logger?: TelemetryLoggerExt | undefined; | ||
| newSessionId?: never; | ||
@@ -79,5 +80,5 @@ } | { | ||
| newSessionId: SessionId; | ||
| logger?: ITelemetryLoggerExt | undefined; | ||
| logger?: TelemetryLoggerExt | undefined; | ||
| }): IdCompressor; | ||
| static deserialize2_0(index: Index, sessionId: SessionId | undefined, logger: ITelemetryLoggerExt | undefined): IdCompressor; | ||
| static deserialize2_0(index: Index, sessionId: SessionId | undefined, logger: TelemetryLoggerExt | undefined): IdCompressor; | ||
| equals(other: IdCompressor, includeLocalState: boolean): boolean; | ||
@@ -88,11 +89,5 @@ } | ||
| * | ||
| * @remarks | ||
| * The returned compressor previously also implemented {@link IIdCompressorCore}, but that | ||
| * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return | ||
| * type in a future release. Consumers should type variables as {@link IIdCompressor} and | ||
| * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly. | ||
| * | ||
| * @legacy @beta | ||
| */ | ||
| export declare function createIdCompressor(logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore; | ||
| export declare function createIdCompressor(logger?: ITelemetryBaseLogger): IIdCompressor; | ||
| /** | ||
@@ -102,35 +97,17 @@ * Create a new {@link IIdCompressor}. | ||
| * | ||
| * @remarks | ||
| * The returned compressor previously also implemented {@link IIdCompressorCore}, but that | ||
| * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return | ||
| * type in a future release. Consumers should type variables as {@link IIdCompressor} and | ||
| * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly. | ||
| * | ||
| * @legacy @beta | ||
| */ | ||
| export declare function createIdCompressor(sessionId: SessionId, logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore; | ||
| export declare function createIdCompressor(sessionId: SessionId, logger?: ITelemetryBaseLogger): IIdCompressor; | ||
| /** | ||
| * Deserializes the supplied state into an ID compressor. | ||
| * | ||
| * @remarks | ||
| * The returned compressor previously also implemented {@link IIdCompressorCore}, but that | ||
| * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return | ||
| * type in a future release. Consumers should type variables as {@link IIdCompressor} and | ||
| * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly. | ||
| * | ||
| * @legacy @beta | ||
| */ | ||
| export declare function deserializeIdCompressor(serialized: SerializedIdCompressorWithOngoingSession, logger?: ITelemetryLoggerExt): IIdCompressor & IIdCompressorCore; | ||
| export declare function deserializeIdCompressor(serialized: SerializedIdCompressorWithOngoingSession, logger?: ITelemetryLoggerExt): IIdCompressor; | ||
| /** | ||
| * Deserializes the supplied state into an ID compressor. | ||
| * | ||
| * @remarks | ||
| * The returned compressor previously also implemented {@link IIdCompressorCore}, but that | ||
| * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return | ||
| * type in a future release. Consumers should type variables as {@link IIdCompressor} and | ||
| * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly. | ||
| * | ||
| * @legacy @beta | ||
| */ | ||
| export declare function deserializeIdCompressor(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId, logger?: ITelemetryLoggerExt): IIdCompressor & IIdCompressorCore; | ||
| export declare function deserializeIdCompressor(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId, logger?: ITelemetryLoggerExt): IIdCompressor; | ||
| /** | ||
@@ -158,5 +135,5 @@ * Serializes an ID compressor. | ||
| * always implement both {@link IIdCompressor} and {@link IIdCompressorCore}, but their | ||
| * return types will be narrowed to {@link IIdCompressor} to keep {@link IIdCompressorCore} | ||
| * out of the `@legacy` API surface. Internal consumers that need access to core | ||
| * compressor operations (serialization, range management, etc.) should use this function. | ||
| * public return type is narrowed to {@link IIdCompressor}. Internal consumers that | ||
| * need access to core compressor operations (serialization, range management, etc.) | ||
| * use this function to recover the {@link IIdCompressorCore} surface. | ||
| * | ||
@@ -163,0 +140,0 @@ * @param compressor - A compressor created by `createIdCompressor` or |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"idCompressor.d.ts","sourceRoot":"","sources":["../src/idCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,OAAO,EACN,KAAK,mBAAmB,EAGxB,MAAM,0CAA0C,CAAC;AASlD,OAAO,EACN,KAAK,KAAK,EAOV,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAGN,QAAQ,EAKR,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACX,aAAa,EAEb,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EAEnB,mCAAmC,EACnC,wCAAwC,EACxC,SAAS,EACT,wBAAwB,EACxB,QAAQ,EACR,MAAM,kBAAkB,CAAC;AAwB1B;;GAEG;AAEH,qBAAa,YAAa,YAAW,aAAa,EAAE,iBAAiB;IAmDnE,OAAO,CAAC,QAAQ,CAAC,MAAM;IAlDxB;;OAEG;IACH,gBAAuB,cAAc,SAAW;IAIhD,SAAgB,cAAc,EAAE,SAAS,CAAC;IAC1C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgC;IAE3D,OAAO,CAAC,aAAa,CAAK;IAM1B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB,CAAK;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAM/C;;;;;OAKG;IAEH,OAAO,CAAC,wBAAwB,CAAe;IAE/C,OAAO,CAAC,qBAAqB,CAAK;IAElC,OAAO,CAAC,0BAA0B,CAAK;IAEvC,OAAO,CAAC,mBAAmB,CAAC,CAAiE;gBAK5F,4BAA4B,EAAE,SAAS,GAAG,QAAQ,EACjC,MAAM,EAAE,mBAA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K,EAAE,YAAY,EAAE,iBAAiB,EAAE,OAAO,GAAG,OAAO;CAgBvE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,aAAa,CAAC;AACjF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,SAAS,EACpB,MAAM,CAAC,EAAE,oBAAoB,GAC3B,aAAa,CAAC;AAyBjB;;;;GAIG;AACH,wBAAgB,uBAAuB,CACtC,UAAU,EAAE,wCAAwC,EACpD,MAAM,CAAC,EAAE,mBAAmB,GAC1B,aAAa,CAAC;AACjB;;;;GAIG;AACH,wBAAgB,uBAAuB,CACtC,UAAU,EAAE,mCAAmC,EAC/C,YAAY,EAAE,SAAS,EACvB,MAAM,CAAC,EAAE,mBAAmB,GAC1B,aAAa,CAAC;AAwBjB;;;;;;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"} |
@@ -7,3 +7,3 @@ /*! | ||
| import { assert } from "@fluidframework/core-utils/internal"; | ||
| import { LoggingError, createChildLogger, } from "@fluidframework/telemetry-utils/internal"; | ||
| import { LoggingError, createChildLogger, extractTelemetryLoggerExt, } from "@fluidframework/telemetry-utils/internal"; | ||
| import { FinalSpace } from "./finalSpace.js"; | ||
@@ -29,3 +29,2 @@ import { isFinalId, } from "./identifiers.js"; | ||
| */ | ||
| // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API | ||
| export class IdCompressor { | ||
@@ -572,3 +571,3 @@ // #endregion | ||
| serialized: serialized, | ||
| logger: loggerOrUndefined, | ||
| logger: extractTelemetryLoggerExt(loggerOrUndefined), | ||
| newSessionId: sessionIdOrLogger, | ||
@@ -580,3 +579,3 @@ }); | ||
| serialized: serialized, | ||
| logger: sessionIdOrLogger, | ||
| logger: extractTelemetryLoggerExt(sessionIdOrLogger), | ||
| }); | ||
@@ -594,5 +593,5 @@ } | ||
| * always implement both {@link IIdCompressor} and {@link IIdCompressorCore}, but their | ||
| * return types will be narrowed to {@link IIdCompressor} to keep {@link IIdCompressorCore} | ||
| * out of the `@legacy` API surface. Internal consumers that need access to core | ||
| * compressor operations (serialization, range management, etc.) should use this function. | ||
| * public return type is narrowed to {@link IIdCompressor}. Internal consumers that | ||
| * need access to core compressor operations (serialization, range management, etc.) | ||
| * use this function to recover the {@link IIdCompressorCore} surface. | ||
| * | ||
@@ -606,5 +605,4 @@ * @param compressor - A compressor created by `createIdCompressor` or | ||
| assert("serialize" in compressor, 0xced /* Expected compressor to implement IIdCompressorCore */); | ||
| // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API | ||
| return compressor; | ||
| } | ||
| //# sourceMappingURL=idCompressor.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"idCompressor.js","sourceRoot":"","sources":["../src/idCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9E,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAEN,YAAY,EACZ,iBAAiB,GACjB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAIN,SAAS,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEN,WAAW,EACX,UAAU,EACV,eAAe,EACf,YAAY,EACZ,WAAW,EACX,gBAAgB,GAChB,MAAM,2BAA2B,CAAC;AAC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AAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,sBAAsB,CACrC,UAAyB;IAGzB,MAAM,CACL,WAAW,IAAI,UAAU,EACzB,KAAK,CAAC,wDAAwD,CAC9D,CAAC;IACF,qHAAqH;IACrH,OAAO,UAA+C,CAAC;AACxD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tLoggingError,\n\tcreateChildLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { FinalSpace } from \"./finalSpace.js\";\nimport {\n\ttype FinalCompressedId,\n\ttype LocalCompressedId,\n\ttype NumericUuid,\n\tisFinalId,\n} from \"./identifiers.js\";\nimport {\n\ttype Index,\n\treadBoolean,\n\treadNumber,\n\treadNumericUuid,\n\twriteBoolean,\n\twriteNumber,\n\twriteNumericUuid,\n} from \"./persistanceUtilities.js\";\nimport { SessionSpaceNormalizer } from \"./sessionSpaceNormalizer.js\";\nimport {\n\ttype IdCluster,\n\tSession,\n\tSessions,\n\tgetAlignedFinal,\n\tgetAlignedLocal,\n\tlastFinalizedFinal,\n\tlastFinalizedLocal,\n} from \"./sessions.js\";\nimport type {\n\tIIdCompressor,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n\tIIdCompressorCore,\n\tIdCreationRange,\n\tOpSpaceCompressedId,\n\tSerializedIdCompressor,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"./types/index.js\";\nimport {\n\tcreateSessionId,\n\tgenCountFromLocalId,\n\tlocalIdFromGenCount,\n\tnumericUuidFromStableId,\n\toffsetNumericUuid,\n\tstableIdFromNumericUuid,\n\tsubtractNumericUuids,\n} from \"./utilities.js\";\n\n/**\n * The version of IdCompressor that is currently persisted.\n * This should not be changed without careful consideration to compatibility.\n */\nconst currentWrittenVersion = 2;\n\nfunction rangeFinalizationError(expectedStart: number, actualStart: number): LoggingError {\n\treturn new LoggingError(\"Ranges finalized out of order\", {\n\t\texpectedStart,\n\t\tactualStart,\n\t});\n}\n\n/**\n * See {@link IIdCompressor} and {@link IIdCompressorCore}\n */\n// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\nexport class IdCompressor implements IIdCompressor, IIdCompressorCore {\n\t/**\n\t * Max allowed initial cluster size.\n\t */\n\tpublic static readonly maxClusterSize = 2 ** 20;\n\n\t// #region Local state\n\n\tpublic readonly localSessionId: SessionId;\n\tprivate readonly localSession: Session;\n\tprivate readonly normalizer = new SessionSpaceNormalizer();\n\t// The number of IDs generated by the local session\n\tprivate localGenCount = 0;\n\n\t// #endregion\n\n\t// #region Final state\n\n\t/**\n\t * The gen count to be annotated on the range returned by the next call to `takeNextCreationRange`.\n\t * This is advanced to `generatedIdCount` + 1 each time it is called.\n\t * On the other hand, when `resetUnfinalizedCreationRange` is called,\n\t * this is moved back to the start of the unfinalized range, to ensure those IDs are included in the next range.\n\t */\n\tprivate nextRangeBaseGenCount = 1;\n\tprivate readonly sessions = new Sessions();\n\tprivate readonly finalSpace = new FinalSpace();\n\n\t// #endregion\n\n\t// #region Ephemeral state\n\n\t/**\n\t * Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.\n\t * Eventually, this can be adjusted dynamically to have cluster reservation policies that\n\t * optimize the number of eager finals.\n\t * It is not readonly as it is accessed by tests for clear-box testing.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/prefer-readonly\n\tprivate nextRequestedClusterSize: number = 512;\n\t// The number of local IDs generated since the last telemetry was sent.\n\tprivate telemetryLocalIdCount = 0;\n\t// The number of eager final IDs generated since the last telemetry was sent.\n\tprivate telemetryEagerFinalIdCount = 0;\n\t// The ongoing ghost session, if one exists.\n\tprivate ongoingGhostSession?: { cluster?: IdCluster; ghostSessionId: SessionId } | undefined;\n\n\t// #endregion\n\n\tpublic constructor(\n\t\tlocalSessionIdOrDeserialized: SessionId | Sessions,\n\t\tprivate readonly logger: ITelemetryLoggerExt | undefined,\n\t) {\n\t\tif (typeof localSessionIdOrDeserialized === \"string\") {\n\t\t\tthis.localSessionId = localSessionIdOrDeserialized;\n\t\t\tthis.localSession = this.sessions.getOrCreate(localSessionIdOrDeserialized);\n\t\t} else {\n\t\t\t// Deserialize case\n\t\t\tthis.sessions = localSessionIdOrDeserialized;\n\t\t\t// As policy, the first session is always the local session. Preserve this invariant\n\t\t\t// during deserialization.\n\t\t\tconst firstSession = localSessionIdOrDeserialized.sessions().next();\n\t\t\tassert(!firstSession.done, 0x754 /* First session must be present. */);\n\t\t\tthis.localSession = firstSession.value;\n\t\t\tthis.localSessionId = stableIdFromNumericUuid(\n\t\t\t\tthis.localSession.sessionUuid,\n\t\t\t) as SessionId;\n\t\t}\n\t}\n\n\tpublic generateCompressedId(): SessionSpaceCompressedId {\n\t\t// This ghost session code inside this block should not be changed without a version bump (it is performed at a consensus point)\n\t\tif (this.ongoingGhostSession) {\n\t\t\tif (this.ongoingGhostSession.cluster === undefined) {\n\t\t\t\tthis.ongoingGhostSession.cluster = this.addEmptyCluster(\n\t\t\t\t\tthis.sessions.getOrCreate(this.ongoingGhostSession.ghostSessionId),\n\t\t\t\t\t1,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.ongoingGhostSession.cluster.capacity++;\n\t\t\t}\n\t\t\tthis.ongoingGhostSession.cluster.count++;\n\t\t\treturn lastFinalizedFinal(\n\t\t\t\tthis.ongoingGhostSession.cluster,\n\t\t\t) as unknown as SessionSpaceCompressedId;\n\t\t} else {\n\t\t\tthis.localGenCount++;\n\t\t\tconst lastCluster = this.localSession.getLastCluster();\n\t\t\tif (lastCluster === undefined) {\n\t\t\t\tthis.telemetryLocalIdCount++;\n\t\t\t\treturn this.generateNextLocalId();\n\t\t\t}\n\n\t\t\t// If there exists a cluster of final IDs already claimed by the local session that still has room in it,\n\t\t\t// it is known prior to range sequencing what a local ID's corresponding final ID will be.\n\t\t\t// In this case, it is safe to return the final ID immediately. This is guaranteed to be safe because\n\t\t\t// any op that the local session sends that contains one of those final IDs are guaranteed to arrive to\n\t\t\t// collaborators *after* the one containing the creation range.\n\t\t\tconst clusterOffset = this.localGenCount - genCountFromLocalId(lastCluster.baseLocalId);\n\t\t\tif (lastCluster.capacity > clusterOffset) {\n\t\t\t\tthis.telemetryEagerFinalIdCount++;\n\t\t\t\t// Space in the cluster: eager final\n\t\t\t\treturn ((lastCluster.baseFinalId as number) +\n\t\t\t\t\tclusterOffset) as SessionSpaceCompressedId;\n\t\t\t}\n\t\t\t// No space in the cluster, return next local\n\t\t\tthis.telemetryLocalIdCount++;\n\t\t\treturn this.generateNextLocalId();\n\t\t}\n\t}\n\n\tpublic generateDocumentUniqueId():\n\t\t| (SessionSpaceCompressedId & OpSpaceCompressedId)\n\t\t| StableId {\n\t\tconst id = this.generateCompressedId();\n\t\treturn isFinalId(id) ? id : this.decompress(id);\n\t}\n\n\t/**\n\t * Starts a ghost session. Only exposed for test purposes (this class is not exported from the package).\n\t * @param ghostSessionId - The session ID to start the ghost session with.\n\t */\n\tpublic startGhostSession(ghostSessionId: SessionId): void {\n\t\tassert(!this.ongoingGhostSession, 0x8fe /* Ghost session already in progress. */);\n\t\tthis.ongoingGhostSession = { ghostSessionId };\n\t}\n\n\t/**\n\t * {@inheritdoc IIdCompressorCore.beginGhostSession}\n\t */\n\tpublic beginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void {\n\t\tthis.startGhostSession(ghostSessionId);\n\t\ttry {\n\t\t\tghostSessionCallback();\n\t\t} finally {\n\t\t\tthis.ongoingGhostSession = undefined;\n\t\t}\n\t}\n\n\tprivate generateNextLocalId(): LocalCompressedId {\n\t\t// Must tell the normalizer that we generated a local ID\n\t\tthis.normalizer.addLocalRange(this.localGenCount, 1);\n\t\treturn localIdFromGenCount(this.localGenCount);\n\t}\n\n\tpublic takeNextCreationRange(): IdCreationRange {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0x8a6 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\tconst count = this.localGenCount - (this.nextRangeBaseGenCount - 1);\n\t\tif (count === 0) {\n\t\t\treturn {\n\t\t\t\tsessionId: this.localSessionId,\n\t\t\t};\n\t\t}\n\t\tconst range: IdCreationRange = {\n\t\t\tsessionId: this.localSessionId,\n\t\t\tids: {\n\t\t\t\tfirstGenCount: this.nextRangeBaseGenCount,\n\t\t\t\tcount,\n\t\t\t\trequestedClusterSize: this.nextRequestedClusterSize,\n\t\t\t\tlocalIdRanges: this.normalizer.getRangesBetween(\n\t\t\t\t\tthis.nextRangeBaseGenCount,\n\t\t\t\t\tthis.localGenCount,\n\t\t\t\t),\n\t\t\t},\n\t\t};\n\t\treturn this.updateToRange(range);\n\t}\n\n\tpublic takeUnfinalizedCreationRange(): IdCreationRange {\n\t\tthis.resetUnfinalizedCreationRange();\n\t\treturn this.takeNextCreationRange();\n\t}\n\n\tpublic resetUnfinalizedCreationRange(): void {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0xcec /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\n\t\tconst lastLocalCluster = this.localSession.getLastCluster();\n\t\tthis.nextRangeBaseGenCount =\n\t\t\tlastLocalCluster === undefined\n\t\t\t\t? 1\n\t\t\t\t: genCountFromLocalId(\n\t\t\t\t\t\t(lastLocalCluster.baseLocalId - lastLocalCluster.count) as LocalCompressedId,\n\t\t\t\t\t);\n\t}\n\n\tprivate updateToRange(range: IdCreationRange): IdCreationRange {\n\t\tthis.nextRangeBaseGenCount = this.localGenCount + 1;\n\t\treturn IdCompressor.assertValidRange(range);\n\t}\n\n\tprivate static assertValidRange(range: IdCreationRange): IdCreationRange {\n\t\tif (range.ids === undefined) {\n\t\t\treturn range;\n\t\t}\n\t\tconst { count, requestedClusterSize } = range.ids;\n\t\tassert(count > 0, 0x755 /* Malformed ID Range. */);\n\t\tassert(requestedClusterSize > 0, 0x876 /* Clusters must have a positive capacity. */);\n\t\tassert(\n\t\t\trequestedClusterSize <= IdCompressor.maxClusterSize,\n\t\t\t0x877 /* Clusters must not exceed max cluster size. */,\n\t\t);\n\t\treturn range;\n\t}\n\n\tpublic finalizeCreationRange(range: IdCreationRange): void {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0x8a7 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\t// Check if the range has IDs\n\t\tif (range.ids === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tIdCompressor.assertValidRange(range);\n\t\tconst { sessionId, ids } = range;\n\t\tconst { count, firstGenCount, requestedClusterSize } = ids;\n\t\tconst session = this.sessions.getOrCreate(sessionId);\n\t\tconst isLocal = session === this.localSession;\n\t\tconst rangeBaseLocal = localIdFromGenCount(firstGenCount);\n\t\tlet lastCluster = session.getLastCluster();\n\t\tif (lastCluster === undefined) {\n\t\t\t// This is the first cluster in the session space\n\t\t\tif (rangeBaseLocal !== -1) {\n\t\t\t\tthrow rangeFinalizationError(-1, rangeBaseLocal);\n\t\t\t}\n\t\t\tlastCluster = this.addEmptyCluster(session, requestedClusterSize + count);\n\t\t\tif (isLocal) {\n\t\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\t\teventName: \"RuntimeIdCompressor:FirstCluster\",\n\t\t\t\t\tsessionId: this.localSessionId,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tconst remainingCapacity = lastCluster.capacity - lastCluster.count;\n\t\tif (lastCluster.baseLocalId - lastCluster.count !== rangeBaseLocal) {\n\t\t\tthrow rangeFinalizationError(\n\t\t\t\tlastCluster.baseLocalId - lastCluster.count,\n\t\t\t\trangeBaseLocal,\n\t\t\t);\n\t\t}\n\n\t\tif (remainingCapacity >= count) {\n\t\t\t// The current range fits in the existing cluster\n\t\t\tlastCluster.count += count;\n\t\t} else {\n\t\t\tconst overflow = count - remainingCapacity;\n\t\t\tconst newClaimedFinalCount = overflow + requestedClusterSize;\n\t\t\tif (lastCluster === this.finalSpace.getLastCluster()) {\n\t\t\t\t// The last cluster in the sessions chain is the last cluster globally, so it can be expanded.\n\t\t\t\tlastCluster.capacity += newClaimedFinalCount;\n\t\t\t\tlastCluster.count += count;\n\t\t\t\tassert(\n\t\t\t\t\t!this.sessions.clusterCollides(lastCluster),\n\t\t\t\t\t0x756 /* Cluster collision detected. */,\n\t\t\t\t);\n\t\t\t\tif (isLocal) {\n\t\t\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"RuntimeIdCompressor:ClusterExpansion\",\n\t\t\t\t\t\tsessionId: this.localSessionId,\n\t\t\t\t\t\tpreviousCapacity: lastCluster.capacity - newClaimedFinalCount,\n\t\t\t\t\t\tnewCapacity: lastCluster.capacity,\n\t\t\t\t\t\toverflow,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// The last cluster in the sessions chain is *not* the last cluster globally. Fill and overflow to new.\n\t\t\t\tlastCluster.count = lastCluster.capacity;\n\t\t\t\tconst newCluster = this.addEmptyCluster(session, newClaimedFinalCount);\n\t\t\t\tnewCluster.count += overflow;\n\t\t\t\tif (isLocal) {\n\t\t\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"RuntimeIdCompressor:NewCluster\",\n\t\t\t\t\t\tsessionId: this.localSessionId,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (isLocal) {\n\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\teventName: \"RuntimeIdCompressor:IdCompressorStatus\",\n\t\t\t\teagerFinalIdCount: this.telemetryEagerFinalIdCount,\n\t\t\t\tlocalIdCount: this.telemetryLocalIdCount,\n\t\t\t\tsessionId: this.localSessionId,\n\t\t\t});\n\t\t\tthis.telemetryEagerFinalIdCount = 0;\n\t\t\tthis.telemetryLocalIdCount = 0;\n\t\t}\n\n\t\tassert(!session.isEmpty(), 0x757 /* Empty sessions should not be created. */);\n\t}\n\n\tprivate addEmptyCluster(session: Session, capacity: number): IdCluster {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession?.cluster,\n\t\t\t0x8a8 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\tconst newCluster = session.addNewCluster(\n\t\t\tthis.finalSpace.getAllocatedIdLimit(),\n\t\t\tcapacity,\n\t\t\t0,\n\t\t);\n\t\tassert(\n\t\t\t!this.sessions.clusterCollides(newCluster),\n\t\t\t0x758 /* Cluster collision detected. */,\n\t\t);\n\t\tthis.finalSpace.addCluster(newCluster);\n\t\treturn newCluster;\n\t}\n\n\tpublic normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId {\n\t\tif (isFinalId(id)) {\n\t\t\treturn id;\n\t\t} else {\n\t\t\tconst local = id as unknown as LocalCompressedId;\n\t\t\tif (!this.normalizer.contains(local)) {\n\t\t\t\tthrow new Error(\"Invalid ID to normalize.\");\n\t\t\t}\n\t\t\tconst finalForm = this.localSession.tryConvertToFinal(local, true);\n\t\t\treturn finalForm === undefined\n\t\t\t\t? (local as unknown as OpSpaceCompressedId)\n\t\t\t\t: (finalForm as OpSpaceCompressedId);\n\t\t}\n\t}\n\n\tpublic normalizeToSessionSpace(\n\t\tid: OpSpaceCompressedId,\n\t\toriginSessionId: SessionId,\n\t): SessionSpaceCompressedId {\n\t\tif (isFinalId(id)) {\n\t\t\tconst containingCluster = this.localSession.getClusterByAllocatedFinal(id);\n\t\t\tif (containingCluster === undefined) {\n\t\t\t\t// Does not exist in local cluster chain\n\t\t\t\tif (id >= this.finalSpace.getFinalizedIdLimit()) {\n\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t}\n\t\t\t\treturn id as unknown as SessionSpaceCompressedId;\n\t\t\t} else {\n\t\t\t\tconst alignedLocal = getAlignedLocal(containingCluster, id);\n\t\t\t\tif (this.normalizer.contains(alignedLocal)) {\n\t\t\t\t\treturn alignedLocal;\n\t\t\t\t} else {\n\t\t\t\t\tif (genCountFromLocalId(alignedLocal) > this.localGenCount) {\n\t\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t\t}\n\t\t\t\t\treturn id as unknown as SessionSpaceCompressedId;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst localToNormalize = id as unknown as LocalCompressedId;\n\t\t\tif (originSessionId === this.localSessionId) {\n\t\t\t\tif (this.normalizer.contains(localToNormalize)) {\n\t\t\t\t\treturn localToNormalize;\n\t\t\t\t} else {\n\t\t\t\t\t// We never generated this local ID, so fail\n\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// LocalId from a remote session\n\t\t\t\tconst remoteSession = this.sessions.get(originSessionId);\n\t\t\t\tif (remoteSession === undefined) {\n\t\t\t\t\tthrow new Error(\"No IDs have ever been finalized by the supplied session.\");\n\t\t\t\t}\n\t\t\t\tconst correspondingFinal = remoteSession.tryConvertToFinal(localToNormalize, false);\n\t\t\t\tif (correspondingFinal === undefined) {\n\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t}\n\t\t\t\treturn correspondingFinal as unknown as SessionSpaceCompressedId;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic decompress(id: SessionSpaceCompressedId): StableId {\n\t\tif (isFinalId(id)) {\n\t\t\tconst containingCluster = Session.getContainingCluster(id, this.finalSpace.clusters);\n\t\t\tif (containingCluster === undefined) {\n\t\t\t\tthrow new Error(\"Unknown ID\");\n\t\t\t}\n\t\t\tconst alignedLocal = getAlignedLocal(containingCluster, id);\n\t\t\tconst alignedGenCount = genCountFromLocalId(alignedLocal);\n\t\t\tconst lastFinalizedGenCount = genCountFromLocalId(lastFinalizedLocal(containingCluster));\n\t\t\tif (alignedGenCount > lastFinalizedGenCount) {\n\t\t\t\t// should be an eager final id generated by the local session\n\t\t\t\tif (containingCluster.session === this.localSession) {\n\t\t\t\t\tassert(!this.normalizer.contains(alignedLocal), 0x759 /* Normalizer out of sync. */);\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"Unknown ID\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn stableIdFromNumericUuid(\n\t\t\t\toffsetNumericUuid(containingCluster.session.sessionUuid, alignedGenCount - 1),\n\t\t\t);\n\t\t} else {\n\t\t\tconst localToDecompress = id as unknown as LocalCompressedId;\n\t\t\tif (!this.normalizer.contains(localToDecompress)) {\n\t\t\t\tthrow new Error(\"Unknown ID\");\n\t\t\t}\n\t\t\treturn stableIdFromNumericUuid(\n\t\t\t\toffsetNumericUuid(\n\t\t\t\t\tthis.localSession.sessionUuid,\n\t\t\t\t\tgenCountFromLocalId(localToDecompress) - 1,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic recompress(uncompressed: StableId): SessionSpaceCompressedId {\n\t\tconst recompressed = this.tryRecompress(uncompressed);\n\t\tif (recompressed === undefined) {\n\t\t\tthrow new Error(\"Could not recompress.\");\n\t\t}\n\t\treturn recompressed;\n\t}\n\n\tpublic tryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined {\n\t\tconst match = this.sessions.getContainingCluster(uncompressed);\n\t\tif (match === undefined) {\n\t\t\tconst numericUncompressed = numericUuidFromStableId(uncompressed);\n\t\t\tconst offset = subtractNumericUuids(numericUncompressed, this.localSession.sessionUuid);\n\t\t\tif (offset < Number.MAX_SAFE_INTEGER) {\n\t\t\t\tconst genCountEquivalent = Number(offset) + 1;\n\t\t\t\tconst localEquivalent = localIdFromGenCount(genCountEquivalent);\n\t\t\t\tif (this.normalizer.contains(localEquivalent)) {\n\t\t\t\t\treturn localEquivalent;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst [containingCluster, alignedLocal] = match;\n\t\t\tif (containingCluster.session === this.localSession) {\n\t\t\t\t// Local session\n\t\t\t\tif (this.normalizer.contains(alignedLocal)) {\n\t\t\t\t\treturn alignedLocal;\n\t\t\t\t} else {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tgenCountFromLocalId(alignedLocal) <= this.localGenCount,\n\t\t\t\t\t\t0x75a /* Clusters out of sync. */,\n\t\t\t\t\t);\n\t\t\t\t\t// Id is an eager final\n\t\t\t\t\treturn getAlignedFinal(containingCluster, alignedLocal) as\n\t\t\t\t\t\t| SessionSpaceCompressedId\n\t\t\t\t\t\t| undefined;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Not the local session\n\t\t\t\treturn genCountFromLocalId(alignedLocal) >= lastFinalizedLocal(containingCluster)\n\t\t\t\t\t? (getAlignedFinal(containingCluster, alignedLocal) as\n\t\t\t\t\t\t\t| SessionSpaceCompressedId\n\t\t\t\t\t\t\t| undefined)\n\t\t\t\t\t: undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic serialize(withSession: true): SerializedIdCompressorWithOngoingSession;\n\tpublic serialize(withSession: false): SerializedIdCompressorWithNoSession;\n\tpublic serialize(hasLocalState: boolean): SerializedIdCompressor {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0x8a9 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\tconst { normalizer, finalSpace, sessions, localGenCount, logger, nextRangeBaseGenCount } =\n\t\t\tthis;\n\t\tconst sessionIndexMap = new Map<Session, number>();\n\t\tlet sessionIndex = 0;\n\t\tfor (const session of sessions.sessions()) {\n\t\t\t// Filter empty sessions to prevent them accumulating in the serialized state\n\t\t\tif (!session.isEmpty() || hasLocalState) {\n\t\t\t\tsessionIndexMap.set(session, sessionIndex);\n\t\t\t\tsessionIndex++;\n\t\t\t}\n\t\t}\n\t\tconst localStateSize = hasLocalState\n\t\t\t? 1 + // generated ID count\n\t\t\t\t1 + // next range base genCount\n\t\t\t\t1 + // count of normalizer pairs\n\t\t\t\tnormalizer.idRanges.size * 2 // pairs\n\t\t\t: 0;\n\t\t// Layout size, in 8 byte increments\n\t\tconst totalSize =\n\t\t\t1 + // version\n\t\t\t1 + // hasLocalState\n\t\t\t1 + // session count\n\t\t\t1 + // cluster count\n\t\t\tsessionIndexMap.size * 2 + // session IDs\n\t\t\tfinalSpace.clusters.length * 3 + // clusters: (sessionIndex, capacity, count)[]\n\t\t\tlocalStateSize; // local state, if present\n\n\t\tconst serializedFloat = new Float64Array(totalSize);\n\t\tconst serializedUint = new BigUint64Array(serializedFloat.buffer);\n\t\tlet index = 0;\n\t\tindex = writeNumber(serializedFloat, index, currentWrittenVersion);\n\t\tindex = writeBoolean(serializedFloat, index, hasLocalState);\n\t\tindex = writeNumber(serializedFloat, index, sessionIndexMap.size);\n\t\tindex = writeNumber(serializedFloat, index, finalSpace.clusters.length);\n\n\t\tfor (const [session] of sessionIndexMap.entries()) {\n\t\t\tindex = writeNumericUuid(serializedUint, index, session.sessionUuid);\n\t\t}\n\n\t\tfor (const cluster of finalSpace.clusters) {\n\t\t\tindex = writeNumber(\n\t\t\t\tserializedFloat,\n\t\t\t\tindex,\n\t\t\t\tsessionIndexMap.get(cluster.session) as number,\n\t\t\t);\n\t\t\tindex = writeNumber(serializedFloat, index, cluster.capacity);\n\t\t\tindex = writeNumber(serializedFloat, index, cluster.count);\n\t\t}\n\n\t\tif (hasLocalState) {\n\t\t\tindex = writeNumber(serializedFloat, index, localGenCount);\n\t\t\tindex = writeNumber(serializedFloat, index, nextRangeBaseGenCount);\n\t\t\tindex = writeNumber(serializedFloat, index, normalizer.idRanges.size);\n\t\t\tfor (const [leadingGenCount, count] of normalizer.idRanges.entries()) {\n\t\t\t\tindex = writeNumber(serializedFloat, index, leadingGenCount);\n\t\t\t\tindex = writeNumber(serializedFloat, index, count);\n\t\t\t}\n\t\t}\n\n\t\tassert(index === totalSize, 0x75b /* Serialized size was incorrectly calculated. */);\n\t\tlogger?.sendTelemetryEvent({\n\t\t\teventName: \"RuntimeIdCompressor:SerializedIdCompressorSize\",\n\t\t\tsize: serializedFloat.byteLength,\n\t\t\tclusterCount: finalSpace.clusters.length,\n\t\t\tsessionCount: sessionIndexMap.size,\n\t\t});\n\n\t\treturn bufferToString(serializedFloat.buffer, \"base64\") as SerializedIdCompressor;\n\t}\n\n\tpublic static deserialize(\n\t\tparams:\n\t\t\t| {\n\t\t\t\t\tserialized: SerializedIdCompressorWithOngoingSession;\n\t\t\t\t\tlogger?: ITelemetryLoggerExt | undefined;\n\t\t\t\t\tnewSessionId?: never;\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\tserialized: SerializedIdCompressorWithNoSession;\n\t\t\t\t\tnewSessionId: SessionId;\n\t\t\t\t\tlogger?: ITelemetryLoggerExt | undefined;\n\t\t\t },\n\t): IdCompressor {\n\t\tconst { serialized, newSessionId, logger } = params;\n\t\tconst buffer = stringToBuffer(serialized, \"base64\");\n\t\tconst index: Index = {\n\t\t\tindex: 0,\n\t\t\tbufferFloat: new Float64Array(buffer),\n\t\t\tbufferUint: new BigUint64Array(buffer),\n\t\t};\n\t\tconst version = readNumber(index);\n\t\tswitch (version) {\n\t\t\tcase 1: {\n\t\t\t\tthrow new Error(\"IdCompressor version 1.0 is no longer supported.\");\n\t\t\t}\n\t\t\tcase 2: {\n\t\t\t\treturn IdCompressor.deserialize2_0(index, newSessionId, logger);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(\"Unknown IdCompressor serialized version.\");\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic deserialize2_0(\n\t\tindex: Index,\n\t\tsessionId: SessionId | undefined,\n\t\tlogger: ITelemetryLoggerExt | undefined,\n\t): IdCompressor {\n\t\tconst hasLocalState = readBoolean(index);\n\t\tconst sessionCount = readNumber(index);\n\t\tconst clusterCount = readNumber(index);\n\n\t\t// Sessions\n\t\tlet sessionOffset = 0;\n\t\tconst sessions: [NumericUuid, Session][] = [];\n\t\tif (hasLocalState) {\n\t\t\tassert(\n\t\t\t\tsessionId === undefined,\n\t\t\t\t0x75e /* Local state should not exist in serialized form. */,\n\t\t\t);\n\t\t} else {\n\t\t\t// If !hasLocalState, there won't be a serialized local session ID so insert one at the beginning\n\t\t\tassert(sessionId !== undefined, 0x75d /* Local session ID is undefined. */);\n\t\t\tconst localSessionNumeric = numericUuidFromStableId(sessionId);\n\t\t\tsessions.push([localSessionNumeric, new Session(localSessionNumeric)]);\n\t\t\tsessionOffset = 1;\n\t\t}\n\n\t\tfor (let i = 0; i < sessionCount; i++) {\n\t\t\tconst numeric = readNumericUuid(index);\n\t\t\tsessions.push([numeric, new Session(numeric)]);\n\t\t}\n\n\t\tconst compressor = new IdCompressor(new Sessions(sessions), logger);\n\n\t\t// Clusters\n\t\tlet baseFinalId = 0;\n\t\tfor (let i = 0; i < clusterCount; i++) {\n\t\t\tconst sessionIndex = readNumber(index);\n\t\t\tconst sessionArray = sessions[sessionIndex + sessionOffset];\n\t\t\tassert(\n\t\t\t\tsessionArray !== undefined,\n\t\t\t\t0x9d8 /* sessionArray is undefined in IdCompressor.deserialize2_0 */,\n\t\t\t);\n\t\t\tconst session = sessionArray[1];\n\t\t\tconst capacity = readNumber(index);\n\t\t\tconst count = readNumber(index);\n\t\t\tconst cluster = session.addNewCluster(baseFinalId as FinalCompressedId, capacity, count);\n\t\t\tcompressor.finalSpace.addCluster(cluster);\n\t\t\tbaseFinalId += capacity;\n\t\t}\n\n\t\t// Local state\n\t\tif (hasLocalState) {\n\t\t\tcompressor.localGenCount = readNumber(index);\n\t\t\tcompressor.nextRangeBaseGenCount = readNumber(index);\n\t\t\tconst normalizerCount = readNumber(index);\n\t\t\tfor (let i = 0; i < normalizerCount; i++) {\n\t\t\t\tcompressor.normalizer.addLocalRange(readNumber(index), readNumber(index));\n\t\t\t}\n\t\t}\n\n\t\tassert(\n\t\t\tindex.index === index.bufferFloat.length,\n\t\t\t0x75f /* Failed to read entire serialized compressor. */,\n\t\t);\n\t\treturn compressor;\n\t}\n\n\tpublic equals(other: IdCompressor, includeLocalState: boolean): boolean {\n\t\tif (\n\t\t\tincludeLocalState &&\n\t\t\t(this.localSessionId !== other.localSessionId ||\n\t\t\t\t!this.localSession.equals(other.localSession) ||\n\t\t\t\t!this.normalizer.equals(other.normalizer) ||\n\t\t\t\tthis.nextRangeBaseGenCount !== other.nextRangeBaseGenCount ||\n\t\t\t\tthis.localGenCount !== other.localGenCount)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\tthis.sessions.equals(other.sessions, includeLocalState) &&\n\t\t\tthis.finalSpace.equals(other.finalSpace)\n\t\t);\n\t}\n}\n\n/**\n * Create a new {@link IIdCompressor}.\n *\n * @remarks\n * The returned compressor previously also implemented {@link IIdCompressorCore}, but that\n * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return\n * type in a future release. Consumers should type variables as {@link IIdCompressor} and\n * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly.\n *\n * @legacy @beta\n */\nexport function createIdCompressor(\n\tlogger?: ITelemetryBaseLogger,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n): IIdCompressor & IIdCompressorCore;\n/**\n * Create a new {@link IIdCompressor}.\n * @param sessionId - The seed ID for the compressor.\n *\n * @remarks\n * The returned compressor previously also implemented {@link IIdCompressorCore}, but that\n * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return\n * type in a future release. Consumers should type variables as {@link IIdCompressor} and\n * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly.\n *\n * @legacy @beta\n */\nexport function createIdCompressor(\n\tsessionId: SessionId,\n\tlogger?: ITelemetryBaseLogger,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n): IIdCompressor & IIdCompressorCore;\nexport function createIdCompressor(\n\tsessionIdOrLogger?: SessionId | ITelemetryBaseLogger,\n\tloggerOrUndefined?: ITelemetryBaseLogger,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n): IIdCompressor & IIdCompressorCore {\n\tlet localSessionId: SessionId;\n\tlet logger: ITelemetryBaseLogger | undefined;\n\tif (sessionIdOrLogger === undefined) {\n\t\tlocalSessionId = createSessionId();\n\t} else {\n\t\tif (typeof sessionIdOrLogger === \"string\") {\n\t\t\tlocalSessionId = sessionIdOrLogger;\n\t\t\tlogger = loggerOrUndefined;\n\t\t} else {\n\t\t\tlocalSessionId = createSessionId();\n\t\t\tlogger = sessionIdOrLogger;\n\t\t}\n\t}\n\tconst compressor = new IdCompressor(\n\t\tlocalSessionId,\n\t\tlogger === undefined ? undefined : createChildLogger({ logger }),\n\t);\n\treturn compressor;\n}\n\n/**\n * Deserializes the supplied state into an ID compressor.\n *\n * @remarks\n * The returned compressor previously also implemented {@link IIdCompressorCore}, but that\n * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return\n * type in a future release. Consumers should type variables as {@link IIdCompressor} and\n * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly.\n *\n * @legacy @beta\n */\nexport function deserializeIdCompressor(\n\tserialized: SerializedIdCompressorWithOngoingSession,\n\tlogger?: ITelemetryLoggerExt,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n): IIdCompressor & IIdCompressorCore;\n/**\n * Deserializes the supplied state into an ID compressor.\n *\n * @remarks\n * The returned compressor previously also implemented {@link IIdCompressorCore}, but that\n * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return\n * type in a future release. Consumers should type variables as {@link IIdCompressor} and\n * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly.\n *\n * @legacy @beta\n */\nexport function deserializeIdCompressor(\n\tserialized: SerializedIdCompressorWithNoSession,\n\tnewSessionId: SessionId,\n\tlogger?: ITelemetryLoggerExt,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n): IIdCompressor & IIdCompressorCore;\nexport function deserializeIdCompressor(\n\tserialized: SerializedIdCompressor | SerializedIdCompressorWithNoSession,\n\tsessionIdOrLogger: SessionId | ITelemetryLoggerExt | undefined,\n\tloggerOrUndefined?: ITelemetryLoggerExt,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n): IIdCompressor & IIdCompressorCore {\n\tif (typeof sessionIdOrLogger === \"string\") {\n\t\treturn IdCompressor.deserialize({\n\t\t\tserialized: serialized as SerializedIdCompressorWithNoSession,\n\t\t\tlogger: loggerOrUndefined,\n\t\t\tnewSessionId: sessionIdOrLogger,\n\t\t});\n\t}\n\n\tassert(\n\t\tloggerOrUndefined === undefined,\n\t\t0xc2d /* logger would be in sessionIdOrLogger in this codepath */,\n\t);\n\treturn IdCompressor.deserialize({\n\t\tserialized: serialized as SerializedIdCompressorWithOngoingSession,\n\t\tlogger: sessionIdOrLogger,\n\t});\n}\n\n/**\n * Serializes an ID compressor.\n * @param compressor - The compressor to serialize.\n * @param withSession - If true, the serialized state will include local session\n * state (for stashing). If false, only finalized state is included (for summaries).\n * @legacy @beta\n */\nexport function serializeIdCompressor(\n\tcompressor: IIdCompressor,\n\twithSession: true,\n): SerializedIdCompressorWithOngoingSession;\n/**\n * Serializes an ID compressor.\n * @param compressor - The compressor to serialize.\n * @param withSession - If true, the serialized state will include local session\n * state (for stashing). If false, only finalized state is included (for summaries).\n * @legacy @beta\n */\nexport function serializeIdCompressor(\n\tcompressor: IIdCompressor,\n\twithSession: false,\n): SerializedIdCompressorWithNoSession;\nexport function serializeIdCompressor(\n\tcompressor: IIdCompressor,\n\twithSession: boolean,\n): SerializedIdCompressorWithOngoingSession | SerializedIdCompressorWithNoSession {\n\tconst core = toIdCompressorWithCore(compressor);\n\treturn withSession ? core.serialize(true) : core.serialize(false);\n}\n\n/**\n * Casts an {@link IIdCompressor} to include {@link IIdCompressorCore}.\n *\n * @remarks\n * Compressors returned by `createIdCompressor` and `deserializeIdCompressor`\n * always implement both {@link IIdCompressor} and {@link IIdCompressorCore}, but their\n * return types will be narrowed to {@link IIdCompressor} to keep {@link IIdCompressorCore}\n * out of the `@legacy` API surface. Internal consumers that need access to core\n * compressor operations (serialization, range management, etc.) should use this function.\n *\n * @param compressor - A compressor created by `createIdCompressor` or\n * `deserializeIdCompressor`.\n * @returns The same compressor, typed to include {@link IIdCompressorCore}.\n * @internal\n */\nexport function toIdCompressorWithCore(\n\tcompressor: IIdCompressor,\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n): IIdCompressor & IIdCompressorCore {\n\tassert(\n\t\t\"serialize\" in compressor,\n\t\t0xced /* Expected compressor to implement IIdCompressorCore */,\n\t);\n\t// eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API\n\treturn compressor as IIdCompressor & IIdCompressorCore;\n}\n"]} | ||
| {"version":3,"file":"idCompressor.js","sourceRoot":"","sources":["../src/idCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9E,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EACN,YAAY,EACZ,iBAAiB,EACjB,yBAAyB,GACzB,MAAM,0CAA0C,CAAC;AAIlD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAIN,SAAS,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEN,WAAW,EACX,UAAU,EACV,eAAe,EACf,YAAY,EACZ,WAAW,EACX,gBAAgB,GAChB,MAAM,2BAA2B,CAAC;AACnC,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AO,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,sBAAsB,CACrC,UAAyB;IAEzB,MAAM,CACL,WAAW,IAAI,UAAU,EACzB,KAAK,CAAC,wDAAwD,CAC9D,CAAC;IACF,OAAO,UAA+C,CAAC;AACxD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { TelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\nimport {\n\tLoggingError,\n\tcreateChildLogger,\n\textractTelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n// eslint-disable-next-line import-x/no-internal-modules -- Needed to avoid specialized /internal ITelemetryLoggerExt\nimport type { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/legacy\";\n\nimport { FinalSpace } from \"./finalSpace.js\";\nimport {\n\ttype FinalCompressedId,\n\ttype LocalCompressedId,\n\ttype NumericUuid,\n\tisFinalId,\n} from \"./identifiers.js\";\nimport {\n\ttype Index,\n\treadBoolean,\n\treadNumber,\n\treadNumericUuid,\n\twriteBoolean,\n\twriteNumber,\n\twriteNumericUuid,\n} from \"./persistanceUtilities.js\";\nimport { SessionSpaceNormalizer } from \"./sessionSpaceNormalizer.js\";\nimport {\n\ttype IdCluster,\n\tSession,\n\tSessions,\n\tgetAlignedFinal,\n\tgetAlignedLocal,\n\tlastFinalizedFinal,\n\tlastFinalizedLocal,\n} from \"./sessions.js\";\nimport type {\n\tIIdCompressor,\n\tIIdCompressorCore,\n\tIdCreationRange,\n\tOpSpaceCompressedId,\n\tSerializedIdCompressor,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"./types/index.js\";\nimport {\n\tcreateSessionId,\n\tgenCountFromLocalId,\n\tlocalIdFromGenCount,\n\tnumericUuidFromStableId,\n\toffsetNumericUuid,\n\tstableIdFromNumericUuid,\n\tsubtractNumericUuids,\n} from \"./utilities.js\";\n\n/**\n * The version of IdCompressor that is currently persisted.\n * This should not be changed without careful consideration to compatibility.\n */\nconst currentWrittenVersion = 2;\n\nfunction rangeFinalizationError(expectedStart: number, actualStart: number): LoggingError {\n\treturn new LoggingError(\"Ranges finalized out of order\", {\n\t\texpectedStart,\n\t\tactualStart,\n\t});\n}\n\n/**\n * See {@link IIdCompressor} and {@link IIdCompressorCore}\n */\nexport class IdCompressor implements IIdCompressor, IIdCompressorCore {\n\t/**\n\t * Max allowed initial cluster size.\n\t */\n\tpublic static readonly maxClusterSize = 2 ** 20;\n\n\t// #region Local state\n\n\tpublic readonly localSessionId: SessionId;\n\tprivate readonly localSession: Session;\n\tprivate readonly normalizer = new SessionSpaceNormalizer();\n\t// The number of IDs generated by the local session\n\tprivate localGenCount = 0;\n\n\t// #endregion\n\n\t// #region Final state\n\n\t/**\n\t * The gen count to be annotated on the range returned by the next call to `takeNextCreationRange`.\n\t * This is advanced to `generatedIdCount` + 1 each time it is called.\n\t * On the other hand, when `resetUnfinalizedCreationRange` is called,\n\t * this is moved back to the start of the unfinalized range, to ensure those IDs are included in the next range.\n\t */\n\tprivate nextRangeBaseGenCount = 1;\n\tprivate readonly sessions = new Sessions();\n\tprivate readonly finalSpace = new FinalSpace();\n\n\t// #endregion\n\n\t// #region Ephemeral state\n\n\t/**\n\t * Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.\n\t * Eventually, this can be adjusted dynamically to have cluster reservation policies that\n\t * optimize the number of eager finals.\n\t * It is not readonly as it is accessed by tests for clear-box testing.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/prefer-readonly\n\tprivate nextRequestedClusterSize: number = 512;\n\t// The number of local IDs generated since the last telemetry was sent.\n\tprivate telemetryLocalIdCount = 0;\n\t// The number of eager final IDs generated since the last telemetry was sent.\n\tprivate telemetryEagerFinalIdCount = 0;\n\t// The ongoing ghost session, if one exists.\n\tprivate ongoingGhostSession?: { cluster?: IdCluster; ghostSessionId: SessionId } | undefined;\n\n\t// #endregion\n\n\tpublic constructor(\n\t\tlocalSessionIdOrDeserialized: SessionId | Sessions,\n\t\tprivate readonly logger: TelemetryLoggerExt | undefined,\n\t) {\n\t\tif (typeof localSessionIdOrDeserialized === \"string\") {\n\t\t\tthis.localSessionId = localSessionIdOrDeserialized;\n\t\t\tthis.localSession = this.sessions.getOrCreate(localSessionIdOrDeserialized);\n\t\t} else {\n\t\t\t// Deserialize case\n\t\t\tthis.sessions = localSessionIdOrDeserialized;\n\t\t\t// As policy, the first session is always the local session. Preserve this invariant\n\t\t\t// during deserialization.\n\t\t\tconst firstSession = localSessionIdOrDeserialized.sessions().next();\n\t\t\tassert(!firstSession.done, 0x754 /* First session must be present. */);\n\t\t\tthis.localSession = firstSession.value;\n\t\t\tthis.localSessionId = stableIdFromNumericUuid(\n\t\t\t\tthis.localSession.sessionUuid,\n\t\t\t) as SessionId;\n\t\t}\n\t}\n\n\tpublic generateCompressedId(): SessionSpaceCompressedId {\n\t\t// This ghost session code inside this block should not be changed without a version bump (it is performed at a consensus point)\n\t\tif (this.ongoingGhostSession) {\n\t\t\tif (this.ongoingGhostSession.cluster === undefined) {\n\t\t\t\tthis.ongoingGhostSession.cluster = this.addEmptyCluster(\n\t\t\t\t\tthis.sessions.getOrCreate(this.ongoingGhostSession.ghostSessionId),\n\t\t\t\t\t1,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.ongoingGhostSession.cluster.capacity++;\n\t\t\t}\n\t\t\tthis.ongoingGhostSession.cluster.count++;\n\t\t\treturn lastFinalizedFinal(\n\t\t\t\tthis.ongoingGhostSession.cluster,\n\t\t\t) as unknown as SessionSpaceCompressedId;\n\t\t} else {\n\t\t\tthis.localGenCount++;\n\t\t\tconst lastCluster = this.localSession.getLastCluster();\n\t\t\tif (lastCluster === undefined) {\n\t\t\t\tthis.telemetryLocalIdCount++;\n\t\t\t\treturn this.generateNextLocalId();\n\t\t\t}\n\n\t\t\t// If there exists a cluster of final IDs already claimed by the local session that still has room in it,\n\t\t\t// it is known prior to range sequencing what a local ID's corresponding final ID will be.\n\t\t\t// In this case, it is safe to return the final ID immediately. This is guaranteed to be safe because\n\t\t\t// any op that the local session sends that contains one of those final IDs are guaranteed to arrive to\n\t\t\t// collaborators *after* the one containing the creation range.\n\t\t\tconst clusterOffset = this.localGenCount - genCountFromLocalId(lastCluster.baseLocalId);\n\t\t\tif (lastCluster.capacity > clusterOffset) {\n\t\t\t\tthis.telemetryEagerFinalIdCount++;\n\t\t\t\t// Space in the cluster: eager final\n\t\t\t\treturn ((lastCluster.baseFinalId as number) +\n\t\t\t\t\tclusterOffset) as SessionSpaceCompressedId;\n\t\t\t}\n\t\t\t// No space in the cluster, return next local\n\t\t\tthis.telemetryLocalIdCount++;\n\t\t\treturn this.generateNextLocalId();\n\t\t}\n\t}\n\n\tpublic generateDocumentUniqueId():\n\t\t| (SessionSpaceCompressedId & OpSpaceCompressedId)\n\t\t| StableId {\n\t\tconst id = this.generateCompressedId();\n\t\treturn isFinalId(id) ? id : this.decompress(id);\n\t}\n\n\t/**\n\t * Starts a ghost session. Only exposed for test purposes (this class is not exported from the package).\n\t * @param ghostSessionId - The session ID to start the ghost session with.\n\t */\n\tpublic startGhostSession(ghostSessionId: SessionId): void {\n\t\tassert(!this.ongoingGhostSession, 0x8fe /* Ghost session already in progress. */);\n\t\tthis.ongoingGhostSession = { ghostSessionId };\n\t}\n\n\t/**\n\t * {@inheritdoc IIdCompressorCore.beginGhostSession}\n\t */\n\tpublic beginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void {\n\t\tthis.startGhostSession(ghostSessionId);\n\t\ttry {\n\t\t\tghostSessionCallback();\n\t\t} finally {\n\t\t\tthis.ongoingGhostSession = undefined;\n\t\t}\n\t}\n\n\tprivate generateNextLocalId(): LocalCompressedId {\n\t\t// Must tell the normalizer that we generated a local ID\n\t\tthis.normalizer.addLocalRange(this.localGenCount, 1);\n\t\treturn localIdFromGenCount(this.localGenCount);\n\t}\n\n\tpublic takeNextCreationRange(): IdCreationRange {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0x8a6 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\tconst count = this.localGenCount - (this.nextRangeBaseGenCount - 1);\n\t\tif (count === 0) {\n\t\t\treturn {\n\t\t\t\tsessionId: this.localSessionId,\n\t\t\t};\n\t\t}\n\t\tconst range: IdCreationRange = {\n\t\t\tsessionId: this.localSessionId,\n\t\t\tids: {\n\t\t\t\tfirstGenCount: this.nextRangeBaseGenCount,\n\t\t\t\tcount,\n\t\t\t\trequestedClusterSize: this.nextRequestedClusterSize,\n\t\t\t\tlocalIdRanges: this.normalizer.getRangesBetween(\n\t\t\t\t\tthis.nextRangeBaseGenCount,\n\t\t\t\t\tthis.localGenCount,\n\t\t\t\t),\n\t\t\t},\n\t\t};\n\t\treturn this.updateToRange(range);\n\t}\n\n\tpublic takeUnfinalizedCreationRange(): IdCreationRange {\n\t\tthis.resetUnfinalizedCreationRange();\n\t\treturn this.takeNextCreationRange();\n\t}\n\n\tpublic resetUnfinalizedCreationRange(): void {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0xcec /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\n\t\tconst lastLocalCluster = this.localSession.getLastCluster();\n\t\tthis.nextRangeBaseGenCount =\n\t\t\tlastLocalCluster === undefined\n\t\t\t\t? 1\n\t\t\t\t: genCountFromLocalId(\n\t\t\t\t\t\t(lastLocalCluster.baseLocalId - lastLocalCluster.count) as LocalCompressedId,\n\t\t\t\t\t);\n\t}\n\n\tprivate updateToRange(range: IdCreationRange): IdCreationRange {\n\t\tthis.nextRangeBaseGenCount = this.localGenCount + 1;\n\t\treturn IdCompressor.assertValidRange(range);\n\t}\n\n\tprivate static assertValidRange(range: IdCreationRange): IdCreationRange {\n\t\tif (range.ids === undefined) {\n\t\t\treturn range;\n\t\t}\n\t\tconst { count, requestedClusterSize } = range.ids;\n\t\tassert(count > 0, 0x755 /* Malformed ID Range. */);\n\t\tassert(requestedClusterSize > 0, 0x876 /* Clusters must have a positive capacity. */);\n\t\tassert(\n\t\t\trequestedClusterSize <= IdCompressor.maxClusterSize,\n\t\t\t0x877 /* Clusters must not exceed max cluster size. */,\n\t\t);\n\t\treturn range;\n\t}\n\n\tpublic finalizeCreationRange(range: IdCreationRange): void {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0x8a7 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\t// Check if the range has IDs\n\t\tif (range.ids === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tIdCompressor.assertValidRange(range);\n\t\tconst { sessionId, ids } = range;\n\t\tconst { count, firstGenCount, requestedClusterSize } = ids;\n\t\tconst session = this.sessions.getOrCreate(sessionId);\n\t\tconst isLocal = session === this.localSession;\n\t\tconst rangeBaseLocal = localIdFromGenCount(firstGenCount);\n\t\tlet lastCluster = session.getLastCluster();\n\t\tif (lastCluster === undefined) {\n\t\t\t// This is the first cluster in the session space\n\t\t\tif (rangeBaseLocal !== -1) {\n\t\t\t\tthrow rangeFinalizationError(-1, rangeBaseLocal);\n\t\t\t}\n\t\t\tlastCluster = this.addEmptyCluster(session, requestedClusterSize + count);\n\t\t\tif (isLocal) {\n\t\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\t\teventName: \"RuntimeIdCompressor:FirstCluster\",\n\t\t\t\t\tsessionId: this.localSessionId,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tconst remainingCapacity = lastCluster.capacity - lastCluster.count;\n\t\tif (lastCluster.baseLocalId - lastCluster.count !== rangeBaseLocal) {\n\t\t\tthrow rangeFinalizationError(\n\t\t\t\tlastCluster.baseLocalId - lastCluster.count,\n\t\t\t\trangeBaseLocal,\n\t\t\t);\n\t\t}\n\n\t\tif (remainingCapacity >= count) {\n\t\t\t// The current range fits in the existing cluster\n\t\t\tlastCluster.count += count;\n\t\t} else {\n\t\t\tconst overflow = count - remainingCapacity;\n\t\t\tconst newClaimedFinalCount = overflow + requestedClusterSize;\n\t\t\tif (lastCluster === this.finalSpace.getLastCluster()) {\n\t\t\t\t// The last cluster in the sessions chain is the last cluster globally, so it can be expanded.\n\t\t\t\tlastCluster.capacity += newClaimedFinalCount;\n\t\t\t\tlastCluster.count += count;\n\t\t\t\tassert(\n\t\t\t\t\t!this.sessions.clusterCollides(lastCluster),\n\t\t\t\t\t0x756 /* Cluster collision detected. */,\n\t\t\t\t);\n\t\t\t\tif (isLocal) {\n\t\t\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"RuntimeIdCompressor:ClusterExpansion\",\n\t\t\t\t\t\tsessionId: this.localSessionId,\n\t\t\t\t\t\tpreviousCapacity: lastCluster.capacity - newClaimedFinalCount,\n\t\t\t\t\t\tnewCapacity: lastCluster.capacity,\n\t\t\t\t\t\toverflow,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// The last cluster in the sessions chain is *not* the last cluster globally. Fill and overflow to new.\n\t\t\t\tlastCluster.count = lastCluster.capacity;\n\t\t\t\tconst newCluster = this.addEmptyCluster(session, newClaimedFinalCount);\n\t\t\t\tnewCluster.count += overflow;\n\t\t\t\tif (isLocal) {\n\t\t\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"RuntimeIdCompressor:NewCluster\",\n\t\t\t\t\t\tsessionId: this.localSessionId,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (isLocal) {\n\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\teventName: \"RuntimeIdCompressor:IdCompressorStatus\",\n\t\t\t\teagerFinalIdCount: this.telemetryEagerFinalIdCount,\n\t\t\t\tlocalIdCount: this.telemetryLocalIdCount,\n\t\t\t\tsessionId: this.localSessionId,\n\t\t\t});\n\t\t\tthis.telemetryEagerFinalIdCount = 0;\n\t\t\tthis.telemetryLocalIdCount = 0;\n\t\t}\n\n\t\tassert(!session.isEmpty(), 0x757 /* Empty sessions should not be created. */);\n\t}\n\n\tprivate addEmptyCluster(session: Session, capacity: number): IdCluster {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession?.cluster,\n\t\t\t0x8a8 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\tconst newCluster = session.addNewCluster(\n\t\t\tthis.finalSpace.getAllocatedIdLimit(),\n\t\t\tcapacity,\n\t\t\t0,\n\t\t);\n\t\tassert(\n\t\t\t!this.sessions.clusterCollides(newCluster),\n\t\t\t0x758 /* Cluster collision detected. */,\n\t\t);\n\t\tthis.finalSpace.addCluster(newCluster);\n\t\treturn newCluster;\n\t}\n\n\tpublic normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId {\n\t\tif (isFinalId(id)) {\n\t\t\treturn id;\n\t\t} else {\n\t\t\tconst local = id as unknown as LocalCompressedId;\n\t\t\tif (!this.normalizer.contains(local)) {\n\t\t\t\tthrow new Error(\"Invalid ID to normalize.\");\n\t\t\t}\n\t\t\tconst finalForm = this.localSession.tryConvertToFinal(local, true);\n\t\t\treturn finalForm === undefined\n\t\t\t\t? (local as unknown as OpSpaceCompressedId)\n\t\t\t\t: (finalForm as OpSpaceCompressedId);\n\t\t}\n\t}\n\n\tpublic normalizeToSessionSpace(\n\t\tid: OpSpaceCompressedId,\n\t\toriginSessionId: SessionId,\n\t): SessionSpaceCompressedId {\n\t\tif (isFinalId(id)) {\n\t\t\tconst containingCluster = this.localSession.getClusterByAllocatedFinal(id);\n\t\t\tif (containingCluster === undefined) {\n\t\t\t\t// Does not exist in local cluster chain\n\t\t\t\tif (id >= this.finalSpace.getFinalizedIdLimit()) {\n\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t}\n\t\t\t\treturn id as unknown as SessionSpaceCompressedId;\n\t\t\t} else {\n\t\t\t\tconst alignedLocal = getAlignedLocal(containingCluster, id);\n\t\t\t\tif (this.normalizer.contains(alignedLocal)) {\n\t\t\t\t\treturn alignedLocal;\n\t\t\t\t} else {\n\t\t\t\t\tif (genCountFromLocalId(alignedLocal) > this.localGenCount) {\n\t\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t\t}\n\t\t\t\t\treturn id as unknown as SessionSpaceCompressedId;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst localToNormalize = id as unknown as LocalCompressedId;\n\t\t\tif (originSessionId === this.localSessionId) {\n\t\t\t\tif (this.normalizer.contains(localToNormalize)) {\n\t\t\t\t\treturn localToNormalize;\n\t\t\t\t} else {\n\t\t\t\t\t// We never generated this local ID, so fail\n\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// LocalId from a remote session\n\t\t\t\tconst remoteSession = this.sessions.get(originSessionId);\n\t\t\t\tif (remoteSession === undefined) {\n\t\t\t\t\tthrow new Error(\"No IDs have ever been finalized by the supplied session.\");\n\t\t\t\t}\n\t\t\t\tconst correspondingFinal = remoteSession.tryConvertToFinal(localToNormalize, false);\n\t\t\t\tif (correspondingFinal === undefined) {\n\t\t\t\t\tthrow new Error(\"Unknown op space ID.\");\n\t\t\t\t}\n\t\t\t\treturn correspondingFinal as unknown as SessionSpaceCompressedId;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic decompress(id: SessionSpaceCompressedId): StableId {\n\t\tif (isFinalId(id)) {\n\t\t\tconst containingCluster = Session.getContainingCluster(id, this.finalSpace.clusters);\n\t\t\tif (containingCluster === undefined) {\n\t\t\t\tthrow new Error(\"Unknown ID\");\n\t\t\t}\n\t\t\tconst alignedLocal = getAlignedLocal(containingCluster, id);\n\t\t\tconst alignedGenCount = genCountFromLocalId(alignedLocal);\n\t\t\tconst lastFinalizedGenCount = genCountFromLocalId(lastFinalizedLocal(containingCluster));\n\t\t\tif (alignedGenCount > lastFinalizedGenCount) {\n\t\t\t\t// should be an eager final id generated by the local session\n\t\t\t\tif (containingCluster.session === this.localSession) {\n\t\t\t\t\tassert(!this.normalizer.contains(alignedLocal), 0x759 /* Normalizer out of sync. */);\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"Unknown ID\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn stableIdFromNumericUuid(\n\t\t\t\toffsetNumericUuid(containingCluster.session.sessionUuid, alignedGenCount - 1),\n\t\t\t);\n\t\t} else {\n\t\t\tconst localToDecompress = id as unknown as LocalCompressedId;\n\t\t\tif (!this.normalizer.contains(localToDecompress)) {\n\t\t\t\tthrow new Error(\"Unknown ID\");\n\t\t\t}\n\t\t\treturn stableIdFromNumericUuid(\n\t\t\t\toffsetNumericUuid(\n\t\t\t\t\tthis.localSession.sessionUuid,\n\t\t\t\t\tgenCountFromLocalId(localToDecompress) - 1,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic recompress(uncompressed: StableId): SessionSpaceCompressedId {\n\t\tconst recompressed = this.tryRecompress(uncompressed);\n\t\tif (recompressed === undefined) {\n\t\t\tthrow new Error(\"Could not recompress.\");\n\t\t}\n\t\treturn recompressed;\n\t}\n\n\tpublic tryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined {\n\t\tconst match = this.sessions.getContainingCluster(uncompressed);\n\t\tif (match === undefined) {\n\t\t\tconst numericUncompressed = numericUuidFromStableId(uncompressed);\n\t\t\tconst offset = subtractNumericUuids(numericUncompressed, this.localSession.sessionUuid);\n\t\t\tif (offset < Number.MAX_SAFE_INTEGER) {\n\t\t\t\tconst genCountEquivalent = Number(offset) + 1;\n\t\t\t\tconst localEquivalent = localIdFromGenCount(genCountEquivalent);\n\t\t\t\tif (this.normalizer.contains(localEquivalent)) {\n\t\t\t\t\treturn localEquivalent;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst [containingCluster, alignedLocal] = match;\n\t\t\tif (containingCluster.session === this.localSession) {\n\t\t\t\t// Local session\n\t\t\t\tif (this.normalizer.contains(alignedLocal)) {\n\t\t\t\t\treturn alignedLocal;\n\t\t\t\t} else {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tgenCountFromLocalId(alignedLocal) <= this.localGenCount,\n\t\t\t\t\t\t0x75a /* Clusters out of sync. */,\n\t\t\t\t\t);\n\t\t\t\t\t// Id is an eager final\n\t\t\t\t\treturn getAlignedFinal(containingCluster, alignedLocal) as\n\t\t\t\t\t\t| SessionSpaceCompressedId\n\t\t\t\t\t\t| undefined;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Not the local session\n\t\t\t\treturn genCountFromLocalId(alignedLocal) >= lastFinalizedLocal(containingCluster)\n\t\t\t\t\t? (getAlignedFinal(containingCluster, alignedLocal) as\n\t\t\t\t\t\t\t| SessionSpaceCompressedId\n\t\t\t\t\t\t\t| undefined)\n\t\t\t\t\t: undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic serialize(withSession: true): SerializedIdCompressorWithOngoingSession;\n\tpublic serialize(withSession: false): SerializedIdCompressorWithNoSession;\n\tpublic serialize(hasLocalState: boolean): SerializedIdCompressor {\n\t\tassert(\n\t\t\t!this.ongoingGhostSession,\n\t\t\t0x8a9 /* IdCompressor should not be operated normally when in a ghost session */,\n\t\t);\n\t\tconst { normalizer, finalSpace, sessions, localGenCount, logger, nextRangeBaseGenCount } =\n\t\t\tthis;\n\t\tconst sessionIndexMap = new Map<Session, number>();\n\t\tlet sessionIndex = 0;\n\t\tfor (const session of sessions.sessions()) {\n\t\t\t// Filter empty sessions to prevent them accumulating in the serialized state\n\t\t\tif (!session.isEmpty() || hasLocalState) {\n\t\t\t\tsessionIndexMap.set(session, sessionIndex);\n\t\t\t\tsessionIndex++;\n\t\t\t}\n\t\t}\n\t\tconst localStateSize = hasLocalState\n\t\t\t? 1 + // generated ID count\n\t\t\t\t1 + // next range base genCount\n\t\t\t\t1 + // count of normalizer pairs\n\t\t\t\tnormalizer.idRanges.size * 2 // pairs\n\t\t\t: 0;\n\t\t// Layout size, in 8 byte increments\n\t\tconst totalSize =\n\t\t\t1 + // version\n\t\t\t1 + // hasLocalState\n\t\t\t1 + // session count\n\t\t\t1 + // cluster count\n\t\t\tsessionIndexMap.size * 2 + // session IDs\n\t\t\tfinalSpace.clusters.length * 3 + // clusters: (sessionIndex, capacity, count)[]\n\t\t\tlocalStateSize; // local state, if present\n\n\t\tconst serializedFloat = new Float64Array(totalSize);\n\t\tconst serializedUint = new BigUint64Array(serializedFloat.buffer);\n\t\tlet index = 0;\n\t\tindex = writeNumber(serializedFloat, index, currentWrittenVersion);\n\t\tindex = writeBoolean(serializedFloat, index, hasLocalState);\n\t\tindex = writeNumber(serializedFloat, index, sessionIndexMap.size);\n\t\tindex = writeNumber(serializedFloat, index, finalSpace.clusters.length);\n\n\t\tfor (const [session] of sessionIndexMap.entries()) {\n\t\t\tindex = writeNumericUuid(serializedUint, index, session.sessionUuid);\n\t\t}\n\n\t\tfor (const cluster of finalSpace.clusters) {\n\t\t\tindex = writeNumber(\n\t\t\t\tserializedFloat,\n\t\t\t\tindex,\n\t\t\t\tsessionIndexMap.get(cluster.session) as number,\n\t\t\t);\n\t\t\tindex = writeNumber(serializedFloat, index, cluster.capacity);\n\t\t\tindex = writeNumber(serializedFloat, index, cluster.count);\n\t\t}\n\n\t\tif (hasLocalState) {\n\t\t\tindex = writeNumber(serializedFloat, index, localGenCount);\n\t\t\tindex = writeNumber(serializedFloat, index, nextRangeBaseGenCount);\n\t\t\tindex = writeNumber(serializedFloat, index, normalizer.idRanges.size);\n\t\t\tfor (const [leadingGenCount, count] of normalizer.idRanges.entries()) {\n\t\t\t\tindex = writeNumber(serializedFloat, index, leadingGenCount);\n\t\t\t\tindex = writeNumber(serializedFloat, index, count);\n\t\t\t}\n\t\t}\n\n\t\tassert(index === totalSize, 0x75b /* Serialized size was incorrectly calculated. */);\n\t\tlogger?.sendTelemetryEvent({\n\t\t\teventName: \"RuntimeIdCompressor:SerializedIdCompressorSize\",\n\t\t\tsize: serializedFloat.byteLength,\n\t\t\tclusterCount: finalSpace.clusters.length,\n\t\t\tsessionCount: sessionIndexMap.size,\n\t\t});\n\n\t\treturn bufferToString(serializedFloat.buffer, \"base64\") as SerializedIdCompressor;\n\t}\n\n\tpublic static deserialize(\n\t\tparams:\n\t\t\t| {\n\t\t\t\t\tserialized: SerializedIdCompressorWithOngoingSession;\n\t\t\t\t\tlogger?: TelemetryLoggerExt | undefined;\n\t\t\t\t\tnewSessionId?: never;\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\tserialized: SerializedIdCompressorWithNoSession;\n\t\t\t\t\tnewSessionId: SessionId;\n\t\t\t\t\tlogger?: TelemetryLoggerExt | undefined;\n\t\t\t },\n\t): IdCompressor {\n\t\tconst { serialized, newSessionId, logger } = params;\n\t\tconst buffer = stringToBuffer(serialized, \"base64\");\n\t\tconst index: Index = {\n\t\t\tindex: 0,\n\t\t\tbufferFloat: new Float64Array(buffer),\n\t\t\tbufferUint: new BigUint64Array(buffer),\n\t\t};\n\t\tconst version = readNumber(index);\n\t\tswitch (version) {\n\t\t\tcase 1: {\n\t\t\t\tthrow new Error(\"IdCompressor version 1.0 is no longer supported.\");\n\t\t\t}\n\t\t\tcase 2: {\n\t\t\t\treturn IdCompressor.deserialize2_0(index, newSessionId, logger);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(\"Unknown IdCompressor serialized version.\");\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic deserialize2_0(\n\t\tindex: Index,\n\t\tsessionId: SessionId | undefined,\n\t\tlogger: TelemetryLoggerExt | undefined,\n\t): IdCompressor {\n\t\tconst hasLocalState = readBoolean(index);\n\t\tconst sessionCount = readNumber(index);\n\t\tconst clusterCount = readNumber(index);\n\n\t\t// Sessions\n\t\tlet sessionOffset = 0;\n\t\tconst sessions: [NumericUuid, Session][] = [];\n\t\tif (hasLocalState) {\n\t\t\tassert(\n\t\t\t\tsessionId === undefined,\n\t\t\t\t0x75e /* Local state should not exist in serialized form. */,\n\t\t\t);\n\t\t} else {\n\t\t\t// If !hasLocalState, there won't be a serialized local session ID so insert one at the beginning\n\t\t\tassert(sessionId !== undefined, 0x75d /* Local session ID is undefined. */);\n\t\t\tconst localSessionNumeric = numericUuidFromStableId(sessionId);\n\t\t\tsessions.push([localSessionNumeric, new Session(localSessionNumeric)]);\n\t\t\tsessionOffset = 1;\n\t\t}\n\n\t\tfor (let i = 0; i < sessionCount; i++) {\n\t\t\tconst numeric = readNumericUuid(index);\n\t\t\tsessions.push([numeric, new Session(numeric)]);\n\t\t}\n\n\t\tconst compressor = new IdCompressor(new Sessions(sessions), logger);\n\n\t\t// Clusters\n\t\tlet baseFinalId = 0;\n\t\tfor (let i = 0; i < clusterCount; i++) {\n\t\t\tconst sessionIndex = readNumber(index);\n\t\t\tconst sessionArray = sessions[sessionIndex + sessionOffset];\n\t\t\tassert(\n\t\t\t\tsessionArray !== undefined,\n\t\t\t\t0x9d8 /* sessionArray is undefined in IdCompressor.deserialize2_0 */,\n\t\t\t);\n\t\t\tconst session = sessionArray[1];\n\t\t\tconst capacity = readNumber(index);\n\t\t\tconst count = readNumber(index);\n\t\t\tconst cluster = session.addNewCluster(baseFinalId as FinalCompressedId, capacity, count);\n\t\t\tcompressor.finalSpace.addCluster(cluster);\n\t\t\tbaseFinalId += capacity;\n\t\t}\n\n\t\t// Local state\n\t\tif (hasLocalState) {\n\t\t\tcompressor.localGenCount = readNumber(index);\n\t\t\tcompressor.nextRangeBaseGenCount = readNumber(index);\n\t\t\tconst normalizerCount = readNumber(index);\n\t\t\tfor (let i = 0; i < normalizerCount; i++) {\n\t\t\t\tcompressor.normalizer.addLocalRange(readNumber(index), readNumber(index));\n\t\t\t}\n\t\t}\n\n\t\tassert(\n\t\t\tindex.index === index.bufferFloat.length,\n\t\t\t0x75f /* Failed to read entire serialized compressor. */,\n\t\t);\n\t\treturn compressor;\n\t}\n\n\tpublic equals(other: IdCompressor, includeLocalState: boolean): boolean {\n\t\tif (\n\t\t\tincludeLocalState &&\n\t\t\t(this.localSessionId !== other.localSessionId ||\n\t\t\t\t!this.localSession.equals(other.localSession) ||\n\t\t\t\t!this.normalizer.equals(other.normalizer) ||\n\t\t\t\tthis.nextRangeBaseGenCount !== other.nextRangeBaseGenCount ||\n\t\t\t\tthis.localGenCount !== other.localGenCount)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\tthis.sessions.equals(other.sessions, includeLocalState) &&\n\t\t\tthis.finalSpace.equals(other.finalSpace)\n\t\t);\n\t}\n}\n\n/**\n * Create a new {@link IIdCompressor}.\n *\n * @legacy @beta\n */\nexport function createIdCompressor(logger?: ITelemetryBaseLogger): IIdCompressor;\n/**\n * Create a new {@link IIdCompressor}.\n * @param sessionId - The seed ID for the compressor.\n *\n * @legacy @beta\n */\nexport function createIdCompressor(\n\tsessionId: SessionId,\n\tlogger?: ITelemetryBaseLogger,\n): IIdCompressor;\nexport function createIdCompressor(\n\tsessionIdOrLogger?: SessionId | ITelemetryBaseLogger,\n\tloggerOrUndefined?: ITelemetryBaseLogger,\n): IIdCompressor & IIdCompressorCore {\n\tlet localSessionId: SessionId;\n\tlet logger: ITelemetryBaseLogger | undefined;\n\tif (sessionIdOrLogger === undefined) {\n\t\tlocalSessionId = createSessionId();\n\t} else {\n\t\tif (typeof sessionIdOrLogger === \"string\") {\n\t\t\tlocalSessionId = sessionIdOrLogger;\n\t\t\tlogger = loggerOrUndefined;\n\t\t} else {\n\t\t\tlocalSessionId = createSessionId();\n\t\t\tlogger = sessionIdOrLogger;\n\t\t}\n\t}\n\tconst compressor = new IdCompressor(\n\t\tlocalSessionId,\n\t\tlogger === undefined ? undefined : createChildLogger({ logger }),\n\t);\n\treturn compressor;\n}\n\n/**\n * Deserializes the supplied state into an ID compressor.\n *\n * @legacy @beta\n */\nexport function deserializeIdCompressor(\n\tserialized: SerializedIdCompressorWithOngoingSession,\n\tlogger?: ITelemetryLoggerExt,\n): IIdCompressor;\n/**\n * Deserializes the supplied state into an ID compressor.\n *\n * @legacy @beta\n */\nexport function deserializeIdCompressor(\n\tserialized: SerializedIdCompressorWithNoSession,\n\tnewSessionId: SessionId,\n\tlogger?: ITelemetryLoggerExt,\n): IIdCompressor;\nexport function deserializeIdCompressor(\n\tserialized: SerializedIdCompressor | SerializedIdCompressorWithNoSession,\n\tsessionIdOrLogger: SessionId | ITelemetryLoggerExt | undefined,\n\tloggerOrUndefined?: ITelemetryLoggerExt,\n): IIdCompressor & IIdCompressorCore {\n\tif (typeof sessionIdOrLogger === \"string\") {\n\t\treturn IdCompressor.deserialize({\n\t\t\tserialized: serialized as SerializedIdCompressorWithNoSession,\n\t\t\tlogger: extractTelemetryLoggerExt<{ PossiblyUndefined: true }>(loggerOrUndefined),\n\t\t\tnewSessionId: sessionIdOrLogger,\n\t\t});\n\t}\n\n\tassert(\n\t\tloggerOrUndefined === undefined,\n\t\t0xc2d /* logger would be in sessionIdOrLogger in this codepath */,\n\t);\n\treturn IdCompressor.deserialize({\n\t\tserialized: serialized as SerializedIdCompressorWithOngoingSession,\n\t\tlogger: extractTelemetryLoggerExt<{ PossiblyUndefined: true }>(sessionIdOrLogger),\n\t});\n}\n\n/**\n * Serializes an ID compressor.\n * @param compressor - The compressor to serialize.\n * @param withSession - If true, the serialized state will include local session\n * state (for stashing). If false, only finalized state is included (for summaries).\n * @legacy @beta\n */\nexport function serializeIdCompressor(\n\tcompressor: IIdCompressor,\n\twithSession: true,\n): SerializedIdCompressorWithOngoingSession;\n/**\n * Serializes an ID compressor.\n * @param compressor - The compressor to serialize.\n * @param withSession - If true, the serialized state will include local session\n * state (for stashing). If false, only finalized state is included (for summaries).\n * @legacy @beta\n */\nexport function serializeIdCompressor(\n\tcompressor: IIdCompressor,\n\twithSession: false,\n): SerializedIdCompressorWithNoSession;\nexport function serializeIdCompressor(\n\tcompressor: IIdCompressor,\n\twithSession: boolean,\n): SerializedIdCompressorWithOngoingSession | SerializedIdCompressorWithNoSession {\n\tconst core = toIdCompressorWithCore(compressor);\n\treturn withSession ? core.serialize(true) : core.serialize(false);\n}\n\n/**\n * Casts an {@link IIdCompressor} to include {@link IIdCompressorCore}.\n *\n * @remarks\n * Compressors returned by `createIdCompressor` and `deserializeIdCompressor`\n * always implement both {@link IIdCompressor} and {@link IIdCompressorCore}, but their\n * public return type is narrowed to {@link IIdCompressor}. Internal consumers that\n * need access to core compressor operations (serialization, range management, etc.)\n * use this function to recover the {@link IIdCompressorCore} surface.\n *\n * @param compressor - A compressor created by `createIdCompressor` or\n * `deserializeIdCompressor`.\n * @returns The same compressor, typed to include {@link IIdCompressorCore}.\n * @internal\n */\nexport function toIdCompressorWithCore(\n\tcompressor: IIdCompressor,\n): IIdCompressor & IIdCompressorCore {\n\tassert(\n\t\t\"serialize\" in compressor,\n\t\t0xced /* Expected compressor to implement IIdCompressorCore */,\n\t);\n\treturn compressor as IIdCompressor & IIdCompressorCore;\n}\n"]} |
+0
-1
@@ -21,3 +21,2 @@ /*! | ||
| // #region @legacyBeta APIs | ||
| IIdCompressorCore, | ||
| IdCreationRange, | ||
@@ -24,0 +23,0 @@ SerializedIdCompressor, |
@@ -8,3 +8,3 @@ /*! | ||
| export declare const pkgName = "@fluidframework/id-compressor"; | ||
| export declare const pkgVersion = "2.93.0"; | ||
| export declare const pkgVersion = "2.100.0"; | ||
| //# sourceMappingURL=packageVersion.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,WAAW,CAAC"} | ||
| {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,YAAY,CAAC"} |
@@ -8,3 +8,3 @@ /*! | ||
| export const pkgName = "@fluidframework/id-compressor"; | ||
| export const pkgVersion = "2.93.0"; | ||
| export const pkgVersion = "2.100.0"; | ||
| //# sourceMappingURL=packageVersion.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,+BAA+B,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/id-compressor\";\nexport const pkgVersion = \"2.93.0\";\n"]} | ||
| {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,+BAA+B,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/id-compressor\";\nexport const pkgVersion = \"2.100.0\";\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"appendOnlySortedMap.perf.spec.js","sourceRoot":"","sources":["../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C,CAAC;QACtD,CAAC;QACD,WAAW,GAAG,CAAC,CAAC;IACjB,CAAC,CAAC;IAEF,SAAS,CAAC;QACT,IAAI;QACJ,KAAK,EAAE,cAAc;QACrB,MAAM;QACN,WAAW,EAAE,GAAG,EAAE;YACjB,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QACxD,CAAC;KACD,CAAC,CAAC;IAEH,SAAS,CAAC;QACT,IAAI;QACJ,KAAK,EAAE,wBAAwB;QAC/B,MAAM;QACN,WAAW,EAAE,GAAG,EAAE;YACjB,GAAG,CAAC,kBAAkB,CAAC,UAAU,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QACvE,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACzC,yBAAyB,CAAC,GAAG,EAAE,CAAC,IAAI,mBAAmB,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type IRandom, makeRandom } from \"@fluid-private/stochastic-test-utils\";\nimport { BenchmarkType, benchmark } from \"@fluid-tools/benchmark\";\n\nimport { AppendOnlySortedMap } from \"../appendOnlySortedMap.js\";\nimport { compareFiniteNumbers } from \"../utilities.js\";\n\nfunction runAppendOnlyMapPerfTests(\n\tmapBuilder: () => AppendOnlySortedMap<number, number>,\n): void {\n\tconst type = BenchmarkType.Measurement;\n\tlet map: AppendOnlySortedMap<number, number>;\n\tlet rand: IRandom;\n\tconst keyChoices: number[] = [];\n\tlet localChoice = 0;\n\tconst before = (): void => {\n\t\trand = makeRandom(42);\n\t\tmap = mapBuilder();\n\t\tlet curKey = 0;\n\t\tfor (let i = 0; i < 100000; i++) {\n\t\t\tmap.append(curKey, rand.integer(0, Number.MAX_SAFE_INTEGER));\n\t\t\tcurKey += rand.integer(1, 10);\n\t\t}\n\t\tconst keys = [...map.keys()];\n\t\tfor (let i = 0; i < map.size; i++) {\n\t\t\tkeyChoices.push(keys[rand.integer(0, map.size - 1)]);\n\t\t}\n\t\tlocalChoice = 0;\n\t};\n\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `lookup a key`,\n\t\tbefore,\n\t\tbenchmarkFn: () => {\n\t\t\tmap.get(keyChoices[localChoice++ % keyChoices.length]);\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `lookup a pair or lower`,\n\t\tbefore,\n\t\tbenchmarkFn: () => {\n\t\t\tmap.getPairOrNextLower(keyChoices[localChoice++ % keyChoices.length]);\n\t\t},\n\t});\n}\n\ndescribe(\"AppendOnlySortedMap Perf\", () => {\n\trunAppendOnlyMapPerfTests(() => new AppendOnlySortedMap(compareFiniteNumbers));\n});\n"]} | ||
| {"version":3,"file":"appendOnlySortedMap.perf.spec.js","sourceRoot":"","sources":["../../src/test/appendOnlySortedMap.perf.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,SAAS,yBAAyB,CACjC,UAAqD;IAErD,MAAM,KAAK,GAAG,GAAuE,EAAE;QACtF,MAAM,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;QAC5B,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;QACzB,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACjC,GAAG,CAAC,M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I,MAAM,GAAG,CAAC,CAAC;gBACf,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE;oBACzB,GAAG,CAAC,kBAAkB,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;gBAClE,CAAC,CAAC,CAAC;YACJ,CAAC;SACD,CAAC;KACF,CAAC,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACzC,yBAAyB,CAAC,GAAG,EAAE,CAAC,IAAI,mBAAmB,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { makeRandom } from \"@fluid-private/stochastic-test-utils\";\nimport { benchmarkDuration, benchmarkIt } from \"@fluid-tools/benchmark\";\n\nimport { AppendOnlySortedMap } from \"../appendOnlySortedMap.js\";\nimport { compareFiniteNumbers } from \"../utilities.js\";\n\nfunction runAppendOnlyMapPerfTests(\n\tmapBuilder: () => AppendOnlySortedMap<number, number>,\n): void {\n\tconst setup = (): { map: AppendOnlySortedMap<number, number>; keyChoices: number[] } => {\n\t\tconst rand = makeRandom(42);\n\t\tconst map = mapBuilder();\n\t\tlet curKey = 0;\n\t\tfor (let i = 0; i < 100000; i++) {\n\t\t\tmap.append(curKey, rand.integer(0, Number.MAX_SAFE_INTEGER));\n\t\t\tcurKey += rand.integer(1, 10);\n\t\t}\n\t\tconst keyChoices: number[] = [];\n\t\tconst keys = [...map.keys()];\n\t\tfor (let i = 0; i < map.size; i++) {\n\t\t\tkeyChoices.push(keys[rand.integer(0, map.size - 1)]);\n\t\t}\n\t\treturn { map, keyChoices };\n\t};\n\n\tbenchmarkIt({\n\t\ttitle: `lookup a key`,\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tconst { map, keyChoices } = setup();\n\t\t\t\tlet choice = 0;\n\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\tmap.get(keyChoices[choice++ % keyChoices.length]);\n\t\t\t\t});\n\t\t\t},\n\t\t}),\n\t});\n\n\tbenchmarkIt({\n\t\ttitle: `lookup a pair or lower`,\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tconst { map, keyChoices } = setup();\n\t\t\t\tlet choice = 0;\n\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\tmap.getPairOrNextLower(keyChoices[choice++ % keyChoices.length]);\n\t\t\t\t});\n\t\t\t},\n\t\t}),\n\t});\n}\n\ndescribe(\"AppendOnlySortedMap Perf\", () => {\n\trunAppendOnlyMapPerfTests(() => new AppendOnlySortedMap(compareFiniteNumbers));\n});\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"idCompressor.perf.spec.js","sourceRoot":"","sources":["../../src/test/idCompressor.perf.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,6DAA6D;AAE7D,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AASlD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EACN,MAAM,EACN,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,UAAU,GACV,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAGN,IAAI,EACJ,SAAS,EACT,SAAS,GACT,MAAM,iBAAiB,CAAC;AAEzB,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAEnC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAClC,MAAM,IAAI,GAAG,aAAa,CAAC,WAAW,CAA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AuB;iBACrC,CAAC,CAAC;YACJ,CAAC;SACD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { take } from \"@fluid-private/stochastic-test-utils\";\nimport { BenchmarkType, benchmark } from \"@fluid-tools/benchmark\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { IdCompressor } from \"../idCompressor.js\";\nimport type {\n\tIdCreationRange,\n\tOpSpaceCompressedId,\n\tSerializedIdCompressorWithNoSession,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"../index.js\";\nimport { createSessionId } from \"../utilities.js\";\n\nimport {\n\tClient,\n\tDestinationClient,\n\tIdCompressorTestNetwork,\n\tbuildHugeCompressor,\n\tmakeOpGenerator,\n\tperformFuzzActions,\n\tsessionIds,\n} from \"./idCompressorTestUtilities.js\";\nimport {\n\ttype FinalCompressedId,\n\ttype LocalCompressedId,\n\tfail,\n\tisFinalId,\n\tisLocalId,\n} from \"./testCommon.js\";\n\nconst initialClusterCapacity = 512;\n\ndescribe(\"IdCompressor Perf\", () => {\n\tconst type = BenchmarkType.Measurement;\n\tconst localClient = Client.Client1;\n\tconst remoteClient = Client.Client2;\n\tlet perfCompressor: IdCompressor;\n\n\tfunction setupCompressors(\n\t\tclusterSize: number,\n\t\tlocalClientCanEdit: boolean,\n\t\tsynchronizeAtEnd: boolean,\n\t): IdCompressorTestNetwork {\n\t\tconst perfNetwork = new IdCompressorTestNetwork(clusterSize);\n\t\tconst maxClusterSize = clusterSize * 2;\n\t\tconst generator = take(\n\t\t\t1000,\n\t\t\tmakeOpGenerator({\n\t\t\t\tvalidateInterval: 2000,\n\t\t\t\tmaxClusterSize,\n\t\t\t\toutsideAllocationFraction: 0.9,\n\t\t\t}),\n\t\t);\n\t\tperformFuzzActions(\n\t\t\tgenerator,\n\t\t\tperfNetwork,\n\t\t\tMath.E,\n\t\t\tlocalClientCanEdit ? undefined : localClient,\n\t\t\tsynchronizeAtEnd,\n\t\t);\n\t\tperfCompressor = perfNetwork.getCompressorUnsafeNoProxy(localClient);\n\t\treturn perfNetwork;\n\t}\n\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: false,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): LocalCompressedId;\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: true,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): FinalCompressedId & SessionSpaceCompressedId;\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: boolean,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): SessionSpaceCompressedId;\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: boolean,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): SessionSpaceCompressedId {\n\t\tconst log = network.getIdLog(client);\n\t\tfor (let i = log.length - 1; i > 0; i--) {\n\t\t\tconst { id, originatingClient } = log[i];\n\t\t\tif (\n\t\t\t\toriginatingClient === client &&\n\t\t\t\t((eagerFinal && isFinalId(id)) || (!eagerFinal && isLocalId(id)))\n\t\t\t) {\n\t\t\t\tassert(eagerFinal === isFinalId(id), \"Not local/final as requested.\");\n\t\t\t\treturn id;\n\t\t\t}\n\t\t}\n\t\tfail(\"no ID found in log\");\n\t}\n\n\tfunction benchmarkWithFlag(creator: (flag: boolean) => void): void {\n\t\tfor (const flag of [true, false]) {\n\t\t\tcreator(flag);\n\t\t}\n\t}\n\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `allocate local ID`,\n\t\tbefore: () => {\n\t\t\tsetupCompressors(initialClusterCapacity, true, true);\n\t\t},\n\t\tbenchmarkFn: () => {\n\t\t\tperfCompressor!.generateCompressedId();\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype,\n\t\ttitle: \"take an ID creation range\",\n\t\tbefore: () => {\n\t\t\tsetupCompressors(initialClusterCapacity, true, true);\n\t\t},\n\t\tbenchmarkFn: () => {\n\t\t\tperfCompressor!.generateCompressedId();\n\t\t\tperfCompressor!.takeNextCreationRange();\n\t\t},\n\t});\n\n\tfor (const clusterSize of [1, 10, 500, 1000]) {\n\t\tconst numIds = 7;\n\t\tconst session1 = \"8150a099-5302-4672-b5f3-7a4492b59418\" as SessionId;\n\t\tconst session2 = \"f2ded886-92da-4248-967b-eb96ee04cf51\" as SessionId;\n\t\tlet session: SessionId = session1;\n\t\tlet nextFirstFinalizedGenCount1 = 1;\n\t\tlet nextFirstFinalizedGenCount2 = 1;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `finalize a range of IDs (cluster size = ${clusterSize})`,\n\t\t\tbefore: () => {\n\t\t\t\tsetupCompressors(clusterSize, false, true);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\t// Create a range with as minimal overhead as possible, as we'd like for this code to not exist\n\t\t\t\t// in the timing loop at all (but benchmark forces us to do so)\n\t\t\t\tconst isFirstClient = session === session1;\n\t\t\t\tconst firstGenCount = isFirstClient\n\t\t\t\t\t? nextFirstFinalizedGenCount1\n\t\t\t\t\t: nextFirstFinalizedGenCount2;\n\t\t\t\tconst range: IdCreationRange = {\n\t\t\t\t\tsessionId: session,\n\t\t\t\t\tids: {\n\t\t\t\t\t\tfirstGenCount,\n\t\t\t\t\t\tcount: numIds,\n\t\t\t\t\t\trequestedClusterSize: initialClusterCapacity,\n\t\t\t\t\t\tlocalIdRanges: [], // no need to populate, as session is remote and compressor would ignore in production\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tperfCompressor!.finalizeCreationRange(range);\n\n\t\t\t\tconst lastGenCount = firstGenCount + numIds;\n\t\t\t\tif (isFirstClient) {\n\t\t\t\t\tnextFirstFinalizedGenCount1 = lastGenCount;\n\t\t\t\t} else {\n\t\t\t\t\tnextFirstFinalizedGenCount2 = lastGenCount;\n\t\t\t\t}\n\t\t\t\t// Alternate clients to sidestep optimization that packs them all into last cluster\n\t\t\t\tsession = isFirstClient ? session1 : session2;\n\t\t\t},\n\t\t});\n\t}\n\n\tbenchmarkWithFlag((isLocal) => {\n\t\tconst remoteSessionId = sessionIds.get(remoteClient);\n\t\tlet opSpaceId!: OpSpaceCompressedId;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `normalize a ${\n\t\t\t\tisLocal ? \"local\" : \"final\"\n\t\t\t} ID from a remote session to session space`,\n\t\t\tbefore: () => {\n\t\t\t\tconst network = setupCompressors(initialClusterCapacity, true, true);\n\t\t\t\tconst remoteSession = getIdMadeBy(remoteClient, false, network);\n\t\t\t\topSpaceId = (\n\t\t\t\t\tisLocal\n\t\t\t\t\t\t? remoteSession\n\t\t\t\t\t\t: network.getCompressor(remoteClient).normalizeToOpSpace(remoteSession)\n\t\t\t\t) as OpSpaceCompressedId;\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.normalizeToSessionSpace(opSpaceId, remoteSessionId);\n\t\t\t},\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((eagerFinal) => {\n\t\tlet id!: OpSpaceCompressedId & FinalCompressedId;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `normalize a final ID corresponding to a ${\n\t\t\t\teagerFinal ? \"eager final\" : \"local\"\n\t\t\t} ID from op space to the local session`,\n\t\t\tbefore: () => {\n\t\t\t\tconst network = setupCompressors(initialClusterCapacity, true, true);\n\t\t\t\tconst opId = perfCompressor.normalizeToOpSpace(\n\t\t\t\t\tgetIdMadeBy(localClient, eagerFinal, network),\n\t\t\t\t);\n\t\t\t\tassert(isFinalId(opId), \"Must be final\");\n\t\t\t\tid = opId;\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.normalizeToSessionSpace(id, perfCompressor.localSessionId);\n\t\t\t},\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((isLocalOriginator) => {\n\t\tconst remoteSessionId = sessionIds.get(remoteClient);\n\t\tlet opSpaceId!: OpSpaceCompressedId;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `normalize a final ID from a ${\n\t\t\t\tisLocalOriginator ? \"local\" : \"remote\"\n\t\t\t} session to a small session space (common case)`,\n\t\t\tbefore: () => {\n\t\t\t\tconst network = setupCompressors(initialClusterCapacity, false, true);\n\t\t\t\t// Ensure the local session has several different clusters\n\t\t\t\tfor (let clusterCount = 0; clusterCount < 5; clusterCount++) {\n\t\t\t\t\tnetwork.allocateAndSendIds(\n\t\t\t\t\t\tlocalClient,\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\t\t\tperfCompressor[\"nextRequestedClusterSize\"],\n\t\t\t\t\t);\n\t\t\t\t\tnetwork.allocateAndSendIds(\n\t\t\t\t\t\tremoteClient,\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\t\t\tperfCompressor[\"nextRequestedClusterSize\"] * 2,\n\t\t\t\t\t);\n\t\t\t\t\tnetwork.deliverOperations(DestinationClient.All);\n\t\t\t\t}\n\t\t\t\tconst client = isLocalOriginator ? localClient : remoteClient;\n\t\t\t\tconst idFromSession = getIdMadeBy(client, true, network);\n\t\t\t\topSpaceId = network.getCompressor(client).normalizeToOpSpace(idFromSession);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.normalizeToSessionSpace(opSpaceId, remoteSessionId);\n\t\t\t},\n\t\t});\n\t});\n\n\tlet unackedLocalId!: LocalCompressedId;\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `normalize an unacked local ID from the local session to op space`,\n\t\tbefore: () => {\n\t\t\tconst network = setupCompressors(initialClusterCapacity, true, false);\n\t\t\t// Ensure no eager finals\n\t\t\tnetwork.allocateAndSendIds(\n\t\t\t\tlocalClient,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\tnetwork.getCompressor(localClient)[\"nextRequestedClusterSize\"] * 2 + 1,\n\t\t\t);\n\t\t\tunackedLocalId = getIdMadeBy(localClient, false, network);\n\t\t\tassert(\n\t\t\t\tperfCompressor.normalizeToOpSpace(unackedLocalId) === (unackedLocalId as number),\n\t\t\t\t\"Local was acked.\",\n\t\t\t);\n\t\t},\n\t\tbenchmarkFn: () => {\n\t\t\tperfCompressor!.normalizeToOpSpace(unackedLocalId);\n\t\t},\n\t});\n\n\tbenchmarkWithFlag((eagerFinal) => {\n\t\tlet id!: SessionSpaceCompressedId;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `normalize an acked ${\n\t\t\t\teagerFinal ? \"eager final\" : \"local\"\n\t\t\t} ID from the local session to op space`,\n\t\t\tbefore: () => {\n\t\t\t\tconst network = setupCompressors(initialClusterCapacity, true, true);\n\t\t\t\tid = getIdMadeBy(localClient, eagerFinal, network);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.normalizeToOpSpace(id);\n\t\t\t},\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((local) => {\n\t\tlet finalIdToDecompress!: SessionSpaceCompressedId & FinalCompressedId;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `decompress a final ID from a ${\n\t\t\t\tlocal ? \"local\" : \"remote\"\n\t\t\t} client into a stable ID`,\n\t\t\tbefore: () => {\n\t\t\t\tconst network = setupCompressors(initialClusterCapacity, true, true);\n\t\t\t\tfinalIdToDecompress = getIdMadeBy(local ? localClient : remoteClient, true, network);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.decompress(finalIdToDecompress);\n\t\t\t},\n\t\t});\n\t});\n\n\tlet localIdToDecompress!: LocalCompressedId;\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `decompress a local ID into a stable ID`,\n\t\tbefore: () => {\n\t\t\tconst network = setupCompressors(initialClusterCapacity, true, true);\n\t\t\tlocalIdToDecompress = getIdMadeBy(localClient, false, network);\n\t\t},\n\t\tbenchmarkFn: () => {\n\t\t\tperfCompressor!.decompress(localIdToDecompress);\n\t\t},\n\t});\n\n\tbenchmarkWithFlag((eagerFinal) => {\n\t\tlet stableToCompress!: StableId;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `recompress a stable ID to a ${eagerFinal ? \"local\" : \"final\"} ID`,\n\t\t\tbefore: () => {\n\t\t\t\tconst network = setupCompressors(initialClusterCapacity, true, true);\n\t\t\t\tstableToCompress = perfCompressor.decompress(\n\t\t\t\t\tgetIdMadeBy(localClient, eagerFinal, network),\n\t\t\t\t);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.recompress(stableToCompress);\n\t\t\t},\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((manySessions) => {\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `serialize an IdCompressor (${manySessions ? \"many sessions\" : \"many clusters\"})`,\n\t\t\tbefore: () => {\n\t\t\t\tif (manySessions) {\n\t\t\t\t\tperfCompressor = buildHugeCompressor(undefined, initialClusterCapacity);\n\t\t\t\t} else {\n\t\t\t\t\tsetupCompressors(initialClusterCapacity, false, true);\n\t\t\t\t}\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.serialize(false);\n\t\t\t},\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((manySessions) => {\n\t\tlet serialized!: SerializedIdCompressorWithNoSession;\n\t\tconst overrideRemoteSessionId = createSessionId();\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `deserialize an IdCompressor (${\n\t\t\t\tmanySessions ? \"many sessions\" : \"many clusters\"\n\t\t\t})`,\n\t\t\tbefore: () => {\n\t\t\t\tif (manySessions) {\n\t\t\t\t\tperfCompressor = buildHugeCompressor(undefined, initialClusterCapacity);\n\t\t\t\t} else {\n\t\t\t\t\tsetupCompressors(initialClusterCapacity, false, true);\n\t\t\t\t}\n\t\t\t\tserialized = perfCompressor.serialize(false);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tIdCompressor.deserialize({\n\t\t\t\t\tserialized,\n\t\t\t\t\tnewSessionId: overrideRemoteSessionId,\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t});\n});\n"]} | ||
| {"version":3,"file":"idCompressor.perf.spec.js","sourceRoot":"","sources":["../../src/test/idCompressor.perf.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQlD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EACN,MAAM,EACN,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,UAAU,GACV,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAGN,IAAI,EACJ,SAAS,EACT,SAAS,GACT,MAAM,iBAAiB,CAAC;AAEzB,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAEnC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAClC,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;IACnC,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC;IAEpC,SAAS,gBAAgB,CACxB,WAAmB,EACnB,kBAA2B,EAC3B,gBAAyB;QAEzB,MAAM,WAAW,GAAG,IAAI,uBAAuB,CAAC,WAAW,CAAC,CAAC;QAC7D,MAAM,cAAc,GAAG,WAAW,GAAG,CAAC,CAAC;QACvC,MAAM,SAAS,GAAG,IAAI,CACrB,IAAI,EACJ,eAAe,CAAC;YACf,gBAAgB,EAAE,IAAI;YACtB,cAAc;YAC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,mBAAmB,CAAC,SAAS,EAAE,sBAAsB,CAAC;wBACxD,CAAC,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,cAAc,CAAC;oBACxE,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE;wBACzB,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;oBACjC,CAAC,CAAC,CAAC;gBACJ,CAAC;aACD,CAAC;SACF,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,iBAAiB,CAAC,CAAC,YAAY,EAAE,EAAE;QAClC,MAAM,uBAAuB,GAAG,eAAe,EAAE,CAAC;QAClD,WAAW,CAAC;YACX,KAAK,EAAE,gCACN,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAClC,GAAG;YACH,GAAG,iBAAiB,CAAC;gBACpB,iBAAiB,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;oBAClC,MAAM,cAAc,GAAG,YAAY;wBAClC,CAAC,CAAC,mBAAmB,CAAC,SAAS,EAAE,sBAAsB,CAAC;wBACxD,CAAC,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,cAAc,CAAC;oBACxE,MAAM,UAAU,GACf,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;oBACjC,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE;wBACzB,YAAY,CAAC,WAAW,CAAC;4BACxB,UAAU;4BACV,YAAY,EAAE,uBAAuB;yBACrC,CAAC,CAAC;oBACJ,CAAC,CAAC,CAAC;gBACJ,CAAC;aACD,CAAC;SACF,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { take } from \"@fluid-private/stochastic-test-utils\";\nimport { benchmarkDuration, benchmarkIt } from \"@fluid-tools/benchmark\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { IdCompressor } from \"../idCompressor.js\";\nimport type {\n\tIdCreationRange,\n\tOpSpaceCompressedId,\n\tSerializedIdCompressorWithNoSession,\n\tSessionId,\n\tSessionSpaceCompressedId,\n} from \"../index.js\";\nimport { createSessionId } from \"../utilities.js\";\n\nimport {\n\tClient,\n\tDestinationClient,\n\tIdCompressorTestNetwork,\n\tbuildHugeCompressor,\n\tmakeOpGenerator,\n\tperformFuzzActions,\n\tsessionIds,\n} from \"./idCompressorTestUtilities.js\";\nimport {\n\ttype FinalCompressedId,\n\ttype LocalCompressedId,\n\tfail,\n\tisFinalId,\n\tisLocalId,\n} from \"./testCommon.js\";\n\nconst initialClusterCapacity = 512;\n\ndescribe(\"IdCompressor Perf\", () => {\n\tconst localClient = Client.Client1;\n\tconst remoteClient = Client.Client2;\n\n\tfunction setupCompressors(\n\t\tclusterSize: number,\n\t\tlocalClientCanEdit: boolean,\n\t\tsynchronizeAtEnd: boolean,\n\t): { network: IdCompressorTestNetwork; perfCompressor: IdCompressor } {\n\t\tconst perfNetwork = new IdCompressorTestNetwork(clusterSize);\n\t\tconst maxClusterSize = clusterSize * 2;\n\t\tconst generator = take(\n\t\t\t1000,\n\t\t\tmakeOpGenerator({\n\t\t\t\tvalidateInterval: 2000,\n\t\t\t\tmaxClusterSize,\n\t\t\t\toutsideAllocationFraction: 0.9,\n\t\t\t}),\n\t\t);\n\t\tperformFuzzActions(\n\t\t\tgenerator,\n\t\t\tperfNetwork,\n\t\t\tMath.E,\n\t\t\tlocalClientCanEdit ? undefined : localClient,\n\t\t\tsynchronizeAtEnd,\n\t\t);\n\t\tconst perfCompressor = perfNetwork.getCompressorUnsafeNoProxy(localClient);\n\t\treturn { network: perfNetwork, perfCompressor };\n\t}\n\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: false,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): LocalCompressedId;\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: true,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): FinalCompressedId & SessionSpaceCompressedId;\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: boolean,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): SessionSpaceCompressedId;\n\tfunction getIdMadeBy(\n\t\tclient: Client,\n\t\teagerFinal: boolean,\n\t\tnetwork: IdCompressorTestNetwork,\n\t): SessionSpaceCompressedId {\n\t\tconst log = network.getIdLog(client);\n\t\tfor (let i = log.length - 1; i > 0; i--) {\n\t\t\tconst { id, originatingClient } = log[i];\n\t\t\tif (\n\t\t\t\toriginatingClient === client &&\n\t\t\t\t((eagerFinal && isFinalId(id)) || (!eagerFinal && isLocalId(id)))\n\t\t\t) {\n\t\t\t\tassert(eagerFinal === isFinalId(id), \"Not local/final as requested.\");\n\t\t\t\treturn id;\n\t\t\t}\n\t\t}\n\t\tfail(\"no ID found in log\");\n\t}\n\n\tfunction benchmarkWithFlag(creator: (flag: boolean) => void): void {\n\t\tfor (const flag of [true, false]) {\n\t\t\tcreator(flag);\n\t\t}\n\t}\n\n\tbenchmarkIt({\n\t\ttitle: `allocate local ID`,\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tconst { perfCompressor } = setupCompressors(initialClusterCapacity, true, true);\n\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\tperfCompressor.generateCompressedId();\n\t\t\t\t});\n\t\t\t},\n\t\t}),\n\t});\n\n\tbenchmarkIt({\n\t\ttitle: \"take an ID creation range\",\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tconst { perfCompressor } = setupCompressors(initialClusterCapacity, true, true);\n\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\tperfCompressor.generateCompressedId();\n\t\t\t\t\tperfCompressor.takeNextCreationRange();\n\t\t\t\t});\n\t\t\t},\n\t\t}),\n\t});\n\n\tfor (const clusterSize of [1, 10, 500, 1000]) {\n\t\tconst numIds = 7;\n\t\tconst session1 = \"8150a099-5302-4672-b5f3-7a4492b59418\" as SessionId;\n\t\tconst session2 = \"f2ded886-92da-4248-967b-eb96ee04cf51\" as SessionId;\n\t\tbenchmarkIt({\n\t\t\ttitle: `finalize a range of IDs (cluster size = ${clusterSize})`,\n\t\t\t...benchmarkDuration({\n\t\t\t\t// Force batch size of 1\n\t\t\t\tminBatchDurationSeconds: 0,\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst { perfCompressor } = setupCompressors(clusterSize, false, true);\n\t\t\t\t\tlet session: SessionId = session1;\n\t\t\t\t\tlet nextFirstFinalizedGenCount1 = 1;\n\t\t\t\t\tlet nextFirstFinalizedGenCount2 = 1;\n\t\t\t\t\tlet duration: number;\n\t\t\t\t\tdo {\n\t\t\t\t\t\t// Create a range with as minimal overhead as possible\n\t\t\t\t\t\tconst isFirstClient = session === session1;\n\t\t\t\t\t\tconst firstGenCount = isFirstClient\n\t\t\t\t\t\t\t? nextFirstFinalizedGenCount1\n\t\t\t\t\t\t\t: nextFirstFinalizedGenCount2;\n\t\t\t\t\t\tconst range: IdCreationRange = {\n\t\t\t\t\t\t\tsessionId: session,\n\t\t\t\t\t\t\tids: {\n\t\t\t\t\t\t\t\tfirstGenCount,\n\t\t\t\t\t\t\t\tcount: numIds,\n\t\t\t\t\t\t\t\trequestedClusterSize: initialClusterCapacity,\n\t\t\t\t\t\t\t\tlocalIdRanges: [], // no need to populate, as session is remote and compressor would ignore in production\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst start = state.timer.now();\n\t\t\t\t\t\tperfCompressor.finalizeCreationRange(range);\n\t\t\t\t\t\tconst end = state.timer.now();\n\t\t\t\t\t\tduration = state.timer.toSeconds(start, end);\n\n\t\t\t\t\t\tconst lastGenCount = firstGenCount + numIds;\n\t\t\t\t\t\tif (isFirstClient) {\n\t\t\t\t\t\t\tnextFirstFinalizedGenCount1 = lastGenCount;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnextFirstFinalizedGenCount2 = lastGenCount;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Alternate clients to sidestep optimization that packs them all into last cluster\n\t\t\t\t\t\tsession = isFirstClient ? session1 : session2;\n\t\t\t\t\t} while (state.recordBatch(duration));\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t}\n\n\tbenchmarkWithFlag((isLocal) => {\n\t\tconst remoteSessionId = sessionIds.get(remoteClient);\n\t\tbenchmarkIt({\n\t\t\ttitle: `normalize a ${\n\t\t\t\tisLocal ? \"local\" : \"final\"\n\t\t\t} ID from a remote session to session space`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tconst remoteSession = getIdMadeBy(remoteClient, false, network);\n\t\t\t\t\tconst opSpaceId = (\n\t\t\t\t\t\tisLocal\n\t\t\t\t\t\t\t? remoteSession\n\t\t\t\t\t\t\t: network.getCompressor(remoteClient).normalizeToOpSpace(remoteSession)\n\t\t\t\t\t) as OpSpaceCompressedId;\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tperfCompressor.normalizeToSessionSpace(opSpaceId, remoteSessionId);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((eagerFinal) => {\n\t\tbenchmarkIt({\n\t\t\ttitle: `normalize a final ID corresponding to a ${\n\t\t\t\teagerFinal ? \"eager final\" : \"local\"\n\t\t\t} ID from op space to the local session`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tconst opId = perfCompressor.normalizeToOpSpace(\n\t\t\t\t\t\tgetIdMadeBy(localClient, eagerFinal, network),\n\t\t\t\t\t);\n\t\t\t\t\tassert(isFinalId(opId), \"Must be final\");\n\t\t\t\t\tconst id = opId as OpSpaceCompressedId & FinalCompressedId;\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tperfCompressor.normalizeToSessionSpace(id, perfCompressor.localSessionId);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((isLocalOriginator) => {\n\t\tconst remoteSessionId = sessionIds.get(remoteClient);\n\t\tbenchmarkIt({\n\t\t\ttitle: `normalize a final ID from a ${\n\t\t\t\tisLocalOriginator ? \"local\" : \"remote\"\n\t\t\t} session to a small session space (common case)`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\t// Ensure the local session has several different clusters\n\t\t\t\t\tfor (let clusterCount = 0; clusterCount < 5; clusterCount++) {\n\t\t\t\t\t\tnetwork.allocateAndSendIds(\n\t\t\t\t\t\t\tlocalClient,\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\t\t\t\tperfCompressor[\"nextRequestedClusterSize\"],\n\t\t\t\t\t\t);\n\t\t\t\t\t\tnetwork.allocateAndSendIds(\n\t\t\t\t\t\t\tremoteClient,\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\t\t\t\tperfCompressor[\"nextRequestedClusterSize\"] * 2,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tnetwork.deliverOperations(DestinationClient.All);\n\t\t\t\t\t}\n\t\t\t\t\tconst client = isLocalOriginator ? localClient : remoteClient;\n\t\t\t\t\tconst idFromSession = getIdMadeBy(client, true, network);\n\t\t\t\t\tconst opSpaceId = network.getCompressor(client).normalizeToOpSpace(idFromSession);\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tperfCompressor.normalizeToSessionSpace(opSpaceId, remoteSessionId);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n\n\tbenchmarkIt({\n\t\ttitle: `normalize an unacked local ID from the local session to op space`,\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\ttrue,\n\t\t\t\t\tfalse,\n\t\t\t\t);\n\t\t\t\t// Ensure no eager finals\n\t\t\t\tnetwork.allocateAndSendIds(\n\t\t\t\t\tlocalClient,\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\t\tnetwork.getCompressor(localClient)[\"nextRequestedClusterSize\"] * 2 + 1,\n\t\t\t\t);\n\t\t\t\tconst unackedLocalId = getIdMadeBy(localClient, false, network);\n\t\t\t\tassert(\n\t\t\t\t\tperfCompressor.normalizeToOpSpace(unackedLocalId) === (unackedLocalId as number),\n\t\t\t\t\t\"Local was acked.\",\n\t\t\t\t);\n\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\tperfCompressor.normalizeToOpSpace(unackedLocalId);\n\t\t\t\t});\n\t\t\t},\n\t\t}),\n\t});\n\n\tbenchmarkWithFlag((eagerFinal) => {\n\t\tbenchmarkIt({\n\t\t\ttitle: `normalize an acked ${\n\t\t\t\teagerFinal ? \"eager final\" : \"local\"\n\t\t\t} ID from the local session to op space`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tconst id = getIdMadeBy(localClient, eagerFinal, network);\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tperfCompressor.normalizeToOpSpace(id);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((local) => {\n\t\tbenchmarkIt({\n\t\t\ttitle: `decompress a final ID from a ${\n\t\t\t\tlocal ? \"local\" : \"remote\"\n\t\t\t} client into a stable ID`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tconst finalIdToDecompress = getIdMadeBy(\n\t\t\t\t\t\tlocal ? localClient : remoteClient,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tnetwork,\n\t\t\t\t\t);\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tperfCompressor.decompress(finalIdToDecompress);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n\n\tbenchmarkIt({\n\t\ttitle: `decompress a local ID into a stable ID`,\n\t\t...benchmarkDuration({\n\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\ttrue,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\tconst localIdToDecompress = getIdMadeBy(localClient, false, network);\n\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\tperfCompressor.decompress(localIdToDecompress);\n\t\t\t\t});\n\t\t\t},\n\t\t}),\n\t});\n\n\tbenchmarkWithFlag((eagerFinal) => {\n\t\tbenchmarkIt({\n\t\t\ttitle: `recompress a stable ID to a ${eagerFinal ? \"local\" : \"final\"} ID`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst { network, perfCompressor } = setupCompressors(\n\t\t\t\t\t\tinitialClusterCapacity,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tconst stableToCompress = perfCompressor.decompress(\n\t\t\t\t\t\tgetIdMadeBy(localClient, eagerFinal, network),\n\t\t\t\t\t);\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tperfCompressor.recompress(stableToCompress);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((manySessions) => {\n\t\tbenchmarkIt({\n\t\t\ttitle: `serialize an IdCompressor (${manySessions ? \"many sessions\" : \"many clusters\"})`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst perfCompressor = manySessions\n\t\t\t\t\t\t? buildHugeCompressor(undefined, initialClusterCapacity)\n\t\t\t\t\t\t: setupCompressors(initialClusterCapacity, false, true).perfCompressor;\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tperfCompressor.serialize(false);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n\n\tbenchmarkWithFlag((manySessions) => {\n\t\tconst overrideRemoteSessionId = createSessionId();\n\t\tbenchmarkIt({\n\t\t\ttitle: `deserialize an IdCompressor (${\n\t\t\t\tmanySessions ? \"many sessions\" : \"many clusters\"\n\t\t\t})`,\n\t\t\t...benchmarkDuration({\n\t\t\t\tbenchmarkFnCustom: async (state) => {\n\t\t\t\t\tconst perfCompressor = manySessions\n\t\t\t\t\t\t? buildHugeCompressor(undefined, initialClusterCapacity)\n\t\t\t\t\t\t: setupCompressors(initialClusterCapacity, false, true).perfCompressor;\n\t\t\t\t\tconst serialized: SerializedIdCompressorWithNoSession =\n\t\t\t\t\t\tperfCompressor.serialize(false);\n\t\t\t\t\tstate.timeAllBatches(() => {\n\t\t\t\t\t\tIdCompressor.deserialize({\n\t\t\t\t\t\t\tserialized,\n\t\t\t\t\t\t\tnewSessionId: overrideRemoteSessionId,\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t});\n});\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"idCompressorTestUtilities.d.ts","sourceRoot":"","sources":["../../src/test/idCompressorTestUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,QAAQ,EAOb,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,iBAAiB,EAEtB,KAAK,mBAAmB,EACxB,KAAK,mCAAmC,EACxC,KAAK,wCAAwC,EAC7C,KAAK,SAAS,EACd,KAAK,wBAAwB,EAG7B,MAAM,aAAa,CAAC;AAIrB,OAAO,EAEN,KAAK,oBAAoB,EAMzB,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC3E,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;CACf;AAED;;GAEG;AACH,oBAAY,MAAM;IACjB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,OAAO,YAAY;CACnB;AAED;;GAEG;AACH,oBAAY,UAAU;IACrB,GAAG,QAAQ;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0DN;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,UAAU,EAAE,YAAY,EACxB,KAAK,EAAE,MAAM,GACX,wBAAwB,EAAE,CAM5B;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,CAChD,MAAM,CAAC,EAAE,oBAAoB,GAC3B,aAAa,GAAG,iBAAiB,CAAC;AACrC;;;GAGG;AACH,wBAAgB,iCAAiC,CAChD,SAAS,EAAE,SAAS,EACpB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,IAAI,CAAC,EAAE,MAAM,GACX,aAAa,GAAG,iBAAiB,CAAC"} | ||
| {"version":3,"file":"idCompressorTestUtilities.d.ts","sourceRoot":"","sources":["../../src/test/idCompressorTestUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,QAAQ,EAOb,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,iBAAiB,EAEtB,KAAK,mBAAmB,EACxB,KAAK,mCAAmC,EACxC,KAAK,wCAAwC,EAC7C,KAAK,SAAS,EACd,KAAK,wBAAwB,EAI7B,MAAM,aAAa,CAAC;AAIrB,OAAO,EAEN,KAAK,oBAAoB,EAMzB,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC3E,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;CACf;AAED;;GAEG;AACH,oBAAY,MAAM;IACjB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,OAAO,YAAY;CACnB;AAED;;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D,QAAQ,CAAC,EAAE,QAAQ,GACjB,IAAI,CA0DN;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,UAAU,EAAE,YAAY,EACxB,KAAK,EAAE,MAAM,GACX,wBAAwB,EAAE,CAM5B;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,CAChD,MAAM,CAAC,EAAE,oBAAoB,GAC3B,aAAa,GAAG,iBAAiB,CAAC;AACrC;;;GAGG;AACH,wBAAgB,iCAAiC,CAChD,SAAS,EAAE,SAAS,EACpB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,IAAI,CAAC,EAAE,MAAM,GACX,aAAa,GAAG,iBAAiB,CAAC"} |
@@ -8,3 +8,3 @@ /*! | ||
| import { IdCompressor } from "../idCompressor.js"; | ||
| import { createIdCompressor, } from "../index.js"; | ||
| import { createIdCompressor, toIdCompressorWithCore, } from "../index.js"; | ||
| import { SessionSpaceNormalizer } from "../sessionSpaceNormalizer.js"; | ||
@@ -699,4 +699,4 @@ import { assertIsSessionId, createSessionId, localIdFromGenCount } from "../utilities.js"; | ||
| compressor.startGhostSession(sessionId); | ||
| return compressor; | ||
| return toIdCompressorWithCore(compressor); | ||
| } | ||
| //# sourceMappingURL=idCompressorTestUtilities.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"idCompressorTestUtilities.js","sourceRoot":"","sources":["../../src/test/idCompressorTestUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAIN,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,kBAAkB,IAAI,sBAAsB,EAC5C,MAAM,EACN,IAAI,GACJ,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAUN,kBAAkB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,C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AI,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC;AAkBD,MAAM,UAAU,iCAAiC,CAChD,iBAAoD,EACpD,iBAAwC,EACxC,IAAa;IAEb,MAAM,MAAM,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACpE,MAAM,SAAS,GACd,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAE,MAAM,CAAC,KAAK,EAAgB,CAAC;IAC3F,MAAM,MAAM,GACX,CAAC,iBAAiB,IAAI,OAAO,iBAAiB,KAAK,QAAQ,CAAC;QAC3D,CAAC,CAAE,iBAA0C;QAC7C,CAAC,CAAC,SAAS,CAAC;IACd,6GAA6G;IAC7G,0GAA0G;IAC1G,6CAA6C;IAC7C,MAAM,UAAU,GAAG,kBAAkB,CAAC,MAAM,CAAC,KAAK,EAAe,EAAE,MAAM,CAAC,CAAC;IAC3E,oDAAoD;IACnD,UAA2B,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC1D,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport {\n\ttype BaseFuzzTestState,\n\ttype Generator,\n\ttype SaveInfo,\n\tcreateWeightedGenerator,\n\tinterleave,\n\tmakeRandom,\n\tperformFuzzActions as performFuzzActionsBase,\n\trepeat,\n\ttake,\n} from \"@fluid-private/stochastic-test-utils\";\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\n\nimport { IdCompressor } from \"../idCompressor.js\";\nimport {\n\ttype IIdCompressor,\n\ttype IIdCompressorCore,\n\ttype IdCreationRange,\n\ttype OpSpaceCompressedId,\n\ttype SerializedIdCompressorWithNoSession,\n\ttype SerializedIdCompressorWithOngoingSession,\n\ttype SessionId,\n\ttype SessionSpaceCompressedId,\n\ttype StableId,\n\tcreateIdCompressor,\n} from \"../index.js\";\nimport { SessionSpaceNormalizer } from \"../sessionSpaceNormalizer.js\";\nimport { assertIsSessionId, createSessionId, localIdFromGenCount } from \"../utilities.js\";\n\nimport {\n\ttype FinalCompressedId,\n\ttype ReadonlyIdCompressor,\n\tfail,\n\tgetOrCreate,\n\tincrementStableId,\n\tisFinalId,\n\tisLocalId,\n} from \"./testCommon.js\";\n\n/**\n * A readonly `Map` which is known to contain a value for every possible key\n */\nexport interface ClosedMap<K, V> extends Omit<Map<K, V>, \"delete\" | \"clear\"> {\n\tget(key: K): V;\n}\n\n/**\n * Identifies a compressor in a network\n */\nexport enum Client {\n\tClient1 = \"Client1\",\n\tClient2 = \"Client2\",\n\tClient3 = \"Client3\",\n}\n\n/**\n * Identifies categories of compressors\n */\nexport enum MetaClient {\n\tAll = \"All\",\n}\n\n/**\n * Identifies a compressor inside the network but outside the three specially tracked clients.\n */\nexport enum OutsideClient {\n\tRemote = \"Remote\",\n}\n\n/**\n * Used to attribute actions to clients in a distributed collaboration session.\n * `Local` implies a local and unsequenced operation. All others imply sequenced operations.\n */\nexport type OriginatingClient = Client | OutsideClient;\nexport const OriginatingClient = { ...Client, ...OutsideClient };\n\n/**\n * Identifies a compressor to which to send an operation\n */\nexport type DestinationClient = Client | MetaClient;\nexport const DestinationClient = { ...Client, ...MetaClient };\n\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class\nexport class CompressorFactory {\n\t/**\n\t * Creates a new compressor with the supplied cluster capacity.\n\t */\n\tpublic static createCompressor(\n\t\tclient: Client,\n\t\tclusterCapacity = 5,\n\t\tlogger?: ITelemetryBaseLogger,\n\t): IdCompressor {\n\t\treturn CompressorFactory.createCompressorWithSession(\n\t\t\tsessionIds.get(client),\n\t\t\tclusterCapacity,\n\t\t\tlogger,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new compressor with the supplied cluster capacity.\n\t */\n\tpublic static createCompressorWithSession(\n\t\tsessionId: SessionId,\n\t\tclusterCapacity = 5,\n\t\tlogger?: ITelemetryBaseLogger,\n\t): IdCompressor {\n\t\tconst compressor = createIdCompressor(sessionId, logger) as IdCompressor;\n\t\tmodifyClusterSize(compressor, clusterCapacity);\n\t\treturn compressor;\n\t}\n}\n\n/**\n * Modify the requested cluster size of the provided compressor.\n * @remarks\n * This is useful for testing purposes for a few reasons:\n * - Id compressor bugs are often related to edge cases that occur on cluster boundaries\n * - Smaller cluster sizes can enable writing tests without for loops generating \"ids until a new cluster is created\"\n */\nexport function modifyClusterSize(compressor: IIdCompressor, newClusterSize: number): void {\n\tverifyCompressorLike(compressor);\n\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\tcompressor[\"nextRequestedClusterSize\"] = newClusterSize;\n}\n\n/**\n * Returns the current cluster size of the compressor.\n * @privateRemarks\n * This is useful in writing tests to avoid having to hardcode the (currently constant) cluster size.\n */\nexport function getClusterSize(compressor: ReadonlyIdCompressor): number {\n\tverifyCompressorLike(compressor);\n\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\treturn compressor[\"nextRequestedClusterSize\"] as number;\n}\n\nfunction verifyCompressorLike(compressor: ReadonlyIdCompressor | IIdCompressor): void {\n\tassert(\n\t\t// Some IdCompressor tests wrap underlying compressors with proxies--allow this for now.\n\t\t// Because of id-compressor's dynamic import in container-runtime, instanceof checks for IdCompressor\n\t\t// also won't necessarily work nicely. Get a small amount of validation that this function should work\n\t\t// as intended by at least verifying the property name exists.\n\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\ttypeof compressor[\"nextRequestedClusterSize\"] === \"number\",\n\t);\n}\n\n/**\n * Utility for building a huge compressor.\n * Build via the compressor factory.\n */\nexport function buildHugeCompressor(\n\tnumSessions = 10000,\n\tcapacity = 10,\n\tnumClustersPerSession = 3,\n): IdCompressor {\n\tconst compressor = CompressorFactory.createCompressorWithSession(\n\t\tcreateSessionId(),\n\t\tcapacity,\n\t);\n\tconst sessions: SessionId[] = [];\n\tfor (let i = 0; i < numSessions; i++) {\n\t\tsessions.push(createSessionId());\n\t}\n\tfor (let i = 0; i < numSessions * numClustersPerSession; i++) {\n\t\tconst sessionId = sessions[i % numSessions];\n\t\tif (Math.random() > 0.1) {\n\t\t\tfor (let j = 0; j < Math.round(capacity / 2); j++) {\n\t\t\t\tcompressor.generateCompressedId();\n\t\t\t}\n\t\t\tcompressor.finalizeCreationRange(compressor.takeNextCreationRange());\n\t\t}\n\t\tcompressor.finalizeCreationRange({\n\t\t\tsessionId,\n\t\t\tids: {\n\t\t\t\tfirstGenCount: Math.floor(i / numSessions) * capacity + 1,\n\t\t\t\tcount: capacity,\n\t\t\t\trequestedClusterSize: capacity,\n\t\t\t\tlocalIdRanges: [], // remote session, can safely ignore in tests\n\t\t\t},\n\t\t});\n\t}\n\treturn compressor;\n}\n\n/**\n * A closed map from NamedClient to T.\n */\nexport type ClientMap<T> = ClosedMap<Client, T>;\n\nfunction makeSessionIds(): ClientMap<SessionId> {\n\tconst stableIds = new Map<Client, SessionId>();\n\tconst clients = Object.values(Client);\n\tfor (let i = 0; i < clients.length; i++) {\n\t\t// Place session uuids roughly in the middle of uuid space to increase odds of encountering interesting\n\t\t// orderings in sorted collections\n\t\tconst sessionId = assertIsSessionId(`88888888-8888-4888-b${i}88-888888888888`);\n\t\tstableIds.set(clients[i], sessionId);\n\t}\n\treturn stableIds as ClientMap<SessionId>;\n}\n\n/**\n * An array of session ID strings corresponding to all non-local `Client` entries.\n */\nexport const sessionIds = makeSessionIds();\n\n/**\n * Information about a generated ID in a network to be validated by tests\n */\nexport interface TestIdData {\n\treadonly id: SessionSpaceCompressedId;\n\treadonly originatingClient: OriginatingClient;\n\treadonly sessionId: SessionId;\n\treadonly isSequenced: boolean;\n}\n\n/**\n * Simulates a network of ID compressors.\n * Not suitable for performance testing.\n */\nexport class IdCompressorTestNetwork {\n\t/**\n\t * The compressors used in this network\n\t */\n\tprivate readonly compressors: ClientMap<IdCompressor>;\n\t/**\n\t * The log of operations seen by the server so far. Append-only.\n\t */\n\tprivate readonly serverOperations: [\n\t\tcreationRange: IdCreationRange,\n\t\topSpaceIds: OpSpaceCompressedId[],\n\t\tclientFrom: OriginatingClient,\n\t\tsessionIdFrom: SessionId,\n\t][] = [];\n\t/**\n\t * An index into `serverOperations` for each client which represents how many operations have been delivered to that client\n\t */\n\tprivate readonly clientProgress: ClientMap<number>;\n\t/**\n\t * All ids (local and sequenced) that a client has created or received, in order.\n\t */\n\tprivate readonly idLogs: ClientMap<TestIdData[]>;\n\t/**\n\t * All ids that a client has received from the server, in order.\n\t */\n\tprivate readonly sequencedIdLogs: ClientMap<TestIdData[]>;\n\n\tpublic constructor(public readonly initialClusterSize = 5) {\n\t\tconst compressors = new Map<Client, IdCompressor>();\n\t\tconst clientProgress = new Map<Client, number>();\n\t\tconst clientIds = new Map<Client, TestIdData[]>();\n\t\tconst clientSequencedIds = new Map<Client, TestIdData[]>();\n\t\tfor (const client of Object.values(Client)) {\n\t\t\tconst compressor = CompressorFactory.createCompressor(client, initialClusterSize);\n\t\t\tcompressors.set(client, compressor);\n\t\t\tclientProgress.set(client, 0);\n\t\t\tclientIds.set(client, []);\n\t\t\tclientSequencedIds.set(client, []);\n\t\t}\n\t\tthis.compressors = compressors as ClientMap<IdCompressor>;\n\t\tthis.clientProgress = clientProgress as ClientMap<number>;\n\t\tthis.idLogs = clientIds as ClientMap<TestIdData[]>;\n\t\tthis.sequencedIdLogs = clientSequencedIds as ClientMap<TestIdData[]>;\n\t}\n\n\t/**\n\t * Returns the number of undelivered operations for the given client that are in flight in the network.\n\t */\n\tpublic getPendingOperations(destination: Client): number {\n\t\treturn this.serverOperations.length - this.clientProgress.get(destination);\n\t}\n\n\t/**\n\t * Returns an immutable handle to a compressor in the network.\n\t */\n\tpublic getCompressor(client: Client): ReadonlyIdCompressor {\n\t\tconst compressors = this.compressors;\n\t\tconst handler = {\n\t\t\tget<P extends keyof IdCompressor>(_: unknown, property: P): IdCompressor[P] {\n\t\t\t\treturn compressors.get(client)[property];\n\t\t\t},\n\t\t\tset<P extends keyof IdCompressor>(\n\t\t\t\t_: unknown,\n\t\t\t\tproperty: P,\n\t\t\t\tvalue: IdCompressor[P],\n\t\t\t): boolean {\n\t\t\t\tcompressors.get(client)[property] = value;\n\t\t\t\treturn true;\n\t\t\t},\n\t\t};\n\t\treturn new Proxy<IdCompressor>({} as unknown as IdCompressor, handler);\n\t}\n\n\t/**\n\t * Returns a mutable handle to a compressor in the network. Use of mutation methods will break the network invariants and\n\t * should only be used if the network will not be used again.\n\t */\n\tpublic getCompressorUnsafe(client: Client): IdCompressor {\n\t\treturn this.getCompressor(client) as IdCompressor;\n\t}\n\n\t/**\n\t * Returns a mutable handle to a compressor in the network. Use of mutation methods will break the network invariants and\n\t * should only be used if the network will not be used again. Additionally, the returned compressor will be invalidated/unusable\n\t * if any network operations cause it to be regenerated (serialization/deserialization, etc.).\n\t */\n\tpublic getCompressorUnsafeNoProxy(client: Client): IdCompressor {\n\t\treturn this.compressors.get(client);\n\t}\n\n\t/**\n\t * Returns data for all IDs created and received by this client, including ack's of their own (i.e. their own IDs will appear twice)\n\t */\n\tpublic getIdLog(client: Client): readonly TestIdData[] {\n\t\treturn this.idLogs.get(client);\n\t}\n\n\t/**\n\t * Returns data for all IDs received by this client, including ack's of their own.\n\t */\n\tpublic getSequencedIdLog(client: Client): readonly TestIdData[] {\n\t\treturn this.sequencedIdLogs.get(client);\n\t}\n\n\t/**\n\t * Get all compressors for the given destination\n\t */\n\tpublic getTargetCompressors(clientTo: DestinationClient): [Client, IdCompressor][] {\n\t\treturn clientTo === MetaClient.All\n\t\t\t? [...this.compressors.entries()]\n\t\t\t: ([[clientTo, this.getCompressor(clientTo)]] as [Client, IdCompressor][]);\n\t}\n\n\t/**\n\t * Changes the capacity request amount for a client. It will take effect immediately.\n\t */\n\tpublic changeCapacity(client: Client, newClusterCapacity: number): void {\n\t\tmodifyClusterSize(this.compressors.get(client), newClusterCapacity);\n\t}\n\n\tprivate addNewId(\n\t\tclient: Client,\n\t\tid: SessionSpaceCompressedId,\n\t\toriginatingClient: OriginatingClient,\n\t\tsessionIdFrom: SessionId,\n\t\tisSequenced: boolean,\n\t): void {\n\t\tconst idData = {\n\t\t\tid,\n\t\t\toriginatingClient,\n\t\t\tsessionId: sessionIdFrom,\n\t\t\tisSequenced,\n\t\t};\n\t\tconst clientIds = this.idLogs.get(client);\n\t\tclientIds.push(idData);\n\t\tif (isSequenced) {\n\t\t\tconst sequencedIds = this.sequencedIdLogs.get(client);\n\t\t\tsequencedIds.push(idData);\n\t\t}\n\t}\n\n\t/**\n\t * Allocates a new range of local IDs and enqueues them for future delivery via a `testIdDelivery` action.\n\t * Calls to this method determine the total order of delivery, regardless of when `deliverOperations` is called.\n\t */\n\tpublic allocateAndSendIds(clientFrom: Client, numIds: number): OpSpaceCompressedId[] {\n\t\treturn this.allocateAndSendIdsFromRemoteClient(\n\t\t\tclientFrom,\n\t\t\tsessionIds.get(clientFrom),\n\t\t\tnumIds,\n\t\t);\n\t}\n\n\t/**\n\t * Same contract as `allocateAndSendIds`, but the originating client will be a client with the supplied sessionId.\n\t */\n\tpublic allocateAndSendIdsFromRemoteClient(\n\t\tclientFrom: OriginatingClient,\n\t\tsessionIdFrom: SessionId,\n\t\tnumIds: number,\n\t): OpSpaceCompressedId[] {\n\t\tassert(numIds > 0, \"Must allocate a non-zero number of IDs\");\n\t\tif (clientFrom === OriginatingClient.Remote) {\n\t\t\tconst range: IdCreationRange = {\n\t\t\t\tsessionId: sessionIdFrom,\n\t\t\t\tids: {\n\t\t\t\t\tfirstGenCount: 1,\n\t\t\t\t\tcount: numIds,\n\t\t\t\t\trequestedClusterSize: getClusterSize(this.getCompressor(Client.Client1)),\n\t\t\t\t\tlocalIdRanges: [], // remote session, can safely ignore in tests\n\t\t\t\t},\n\t\t\t};\n\t\t\tconst opSpaceIds: OpSpaceCompressedId[] = [];\n\t\t\tfor (let i = 0; i < numIds; i++) {\n\t\t\t\topSpaceIds.push(-(i + 1) as OpSpaceCompressedId);\n\t\t\t}\n\t\t\tthis.serverOperations.push([range, opSpaceIds, clientFrom, sessionIdFrom]);\n\t\t\treturn opSpaceIds;\n\t\t} else {\n\t\t\tassert(sessionIdFrom === sessionIds.get(clientFrom));\n\t\t\tconst compressor = this.compressors.get(clientFrom);\n\t\t\tconst sessionSpaceIds = generateCompressedIds(compressor, numIds);\n\t\t\tfor (let i = 0; i < numIds; i++) {\n\t\t\t\tthis.addNewId(clientFrom, sessionSpaceIds[i], clientFrom, sessionIdFrom, false);\n\t\t\t}\n\t\t\tconst opSpaceIds = sessionSpaceIds.map((id) => compressor.normalizeToOpSpace(id));\n\t\t\tconst creationRange = compressor.takeNextCreationRange();\n\t\t\tthis.serverOperations.push([creationRange, opSpaceIds, clientFrom, sessionIdFrom]);\n\t\t\treturn opSpaceIds;\n\t\t}\n\t}\n\n\t/**\n\t * Delivers all undelivered ID ranges from the server to the target clients.\n\t */\n\tpublic deliverOperations(clientTakingDelivery: Client, opsToDeliver?: number): void;\n\n\t/**\n\t * Delivers all undelivered ID ranges from the server to the target clients.\n\t */\n\tpublic deliverOperations(clientTakingDelivery: DestinationClient): void;\n\n\t/**\n\t * Delivers all undelivered ID ranges from the server to the target clients.\n\t */\n\tpublic deliverOperations(\n\t\tclientTakingDelivery: DestinationClient,\n\t\topsToDeliver?: number,\n\t): void {\n\t\tlet opIndexBound: number;\n\t\tif (clientTakingDelivery === DestinationClient.All) {\n\t\t\tassert(opsToDeliver === undefined);\n\t\t\topIndexBound = this.serverOperations.length;\n\t\t} else {\n\t\t\topIndexBound =\n\t\t\t\topsToDeliver === undefined\n\t\t\t\t\t? this.serverOperations.length\n\t\t\t\t\t: this.clientProgress.get(clientTakingDelivery) + opsToDeliver;\n\t\t}\n\t\tfor (const [clientTo, compressorTo] of this.getTargetCompressors(clientTakingDelivery)) {\n\t\t\tfor (let i = this.clientProgress.get(clientTo); i < opIndexBound; i++) {\n\t\t\t\tconst [range, opSpaceIds, clientFrom, sessionIdFrom] = this.serverOperations[i];\n\t\t\t\tcompressorTo.finalizeCreationRange(range);\n\n\t\t\t\tconst ids = range.ids;\n\t\t\t\tif (ids !== undefined) {\n\t\t\t\t\tfor (const id of opSpaceIds) {\n\t\t\t\t\t\tconst sessionSpaceId = compressorTo.normalizeToSessionSpace(id, range.sessionId);\n\t\t\t\t\t\tthis.addNewId(clientTo, sessionSpaceId, clientFrom, sessionIdFrom, true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.clientProgress.set(clientTo, opIndexBound);\n\t\t}\n\t}\n\n\t/**\n\t * Simulate a client disconnecting (and serializing), then reconnecting (and deserializing)\n\t */\n\tpublic goOfflineThenResume(client: Client): void {\n\t\tconst compressor = this.compressors.get(client);\n\t\tconst [_, resumedCompressor] = roundtrip(compressor, true);\n\t\tthis.compressors.set(client, resumedCompressor);\n\t}\n\n\t/**\n\t * Ensure general validity of the network state. Useful for calling periodically or at the end of test scenarios.\n\t */\n\tpublic assertNetworkState(): void {\n\t\tconst sequencedLogs = Object.values(Client).map(\n\t\t\t(client) => [this.compressors.get(client), this.getSequencedIdLog(client)] as const,\n\t\t);\n\n\t\tconst getLocalIdsInRange = (\n\t\t\trange: IdCreationRange,\n\t\t\topSpaceIds?: OpSpaceCompressedId[],\n\t\t): Set<SessionSpaceCompressedId> => {\n\t\t\tconst localIdsInCreationRange = new Set<SessionSpaceCompressedId>();\n\t\t\tconst ids = range.ids;\n\t\t\tif (ids !== undefined) {\n\t\t\t\tconst { firstGenCount, localIdRanges } = ids;\n\t\t\t\tfor (const [genCount, count] of localIdRanges) {\n\t\t\t\t\tfor (let g = genCount; g < genCount + count; g++) {\n\t\t\t\t\t\tconst local = localIdFromGenCount(g);\n\t\t\t\t\t\tif (opSpaceIds) {\n\t\t\t\t\t\t\tassert.strictEqual(opSpaceIds[g - firstGenCount], local);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlocalIdsInCreationRange.add(local);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn localIdsInCreationRange;\n\t\t};\n\n\t\t// Ensure creation ranges for clients we track contain the correct local ID ranges\n\t\tfor (const [range, opSpaceIds, clientFrom] of this.serverOperations) {\n\t\t\tif (clientFrom !== OriginatingClient.Remote) {\n\t\t\t\tconst localIdsInCreationRange = getLocalIdsInRange(range, opSpaceIds);\n\t\t\t\tlet localCount = 0;\n\t\t\t\tfor (const id of opSpaceIds) {\n\t\t\t\t\tif (isLocalId(id)) {\n\t\t\t\t\t\tlocalCount++;\n\t\t\t\t\t\tassert(localIdsInCreationRange.has(id), \"Local ID not in creation range\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\tlocalCount,\n\t\t\t\t\tlocalIdsInCreationRange.size,\n\t\t\t\t\t\"Local ID count mismatch\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst undeliveredRanges = new Map<Client, IdCreationRange[]>();\n\t\tfor (const [client, progress] of this.clientProgress.entries()) {\n\t\t\tconst ranges = this.serverOperations\n\t\t\t\t.slice(progress)\n\t\t\t\t.filter((op) => op[2] === client)\n\t\t\t\t.map(([range]) => range);\n\t\t\tundeliveredRanges.set(client, ranges);\n\t\t}\n\t\tfor (const [client, ranges] of undeliveredRanges.entries()) {\n\t\t\tconst compressor = this.compressors.get(client);\n\t\t\tlet firstGenCount: number | undefined;\n\t\t\tlet totalCount = 0;\n\t\t\tconst unionedLocalRanges = new SessionSpaceNormalizer();\n\t\t\tfor (const range of ranges) {\n\t\t\t\tassert(range.sessionId === compressor.localSessionId);\n\t\t\t\tif (range.ids !== undefined) {\n\t\t\t\t\t// initialize firstGenCount if not set\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy\n\t\t\t\t\tif (firstGenCount === undefined) {\n\t\t\t\t\t\tfirstGenCount = range.ids.firstGenCount;\n\t\t\t\t\t}\n\t\t\t\t\ttotalCount += range.ids.count;\n\t\t\t\t\tfor (const [genCount, count] of range.ids.localIdRanges) {\n\t\t\t\t\t\tunionedLocalRanges.addLocalRange(genCount, count);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst retakenRange = compressor.takeUnfinalizedCreationRange();\n\t\t\tif (retakenRange.ids === undefined) {\n\t\t\t\tassert.strictEqual(totalCount, 0);\n\t\t\t\tassert.strictEqual(unionedLocalRanges.idRanges.size, 0);\n\t\t\t} else {\n\t\t\t\tconst retakenLocalIds = new SessionSpaceNormalizer();\n\t\t\t\tfor (const [genCount, count] of retakenRange.ids.localIdRanges) {\n\t\t\t\t\tretakenLocalIds.addLocalRange(genCount, count);\n\t\t\t\t}\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\tretakenLocalIds.equals(unionedLocalRanges),\n\t\t\t\t\ttrue,\n\t\t\t\t\t\"Local ID ranges mismatch\",\n\t\t\t\t);\n\t\t\t\tassert.strictEqual(retakenRange.ids.count, totalCount, \"Count mismatch\");\n\t\t\t\tassert.strictEqual(retakenRange.ids.firstGenCount, firstGenCount, \"Count mismatch\");\n\t\t\t}\n\t\t}\n\n\t\t// First, ensure all clients each generated a unique ID for each of their own calls to generate.\n\t\tfor (const [compressor, ids] of sequencedLogs) {\n\t\t\tconst allUuids = new Set<StableId | string>();\n\t\t\tfor (const idData of ids) {\n\t\t\t\tconst uuid = compressor.decompress(idData.id);\n\t\t\t\tassert.strictEqual(!allUuids.has(uuid), true, \"Duplicate UUID generated.\");\n\t\t\t\tallUuids.add(uuid);\n\t\t\t}\n\t\t}\n\n\t\tconst maxLogLength = sequencedLogs\n\t\t\t.map(([_, data]) => data.length)\n\t\t\t// eslint-disable-next-line unicorn/no-array-reduce\n\t\t\t.reduce((p, n) => Math.max(p, n));\n\n\t\tfunction getNextLogWithEntryAt(logsIndex: number, entryIndex: number): number | undefined {\n\t\t\tfor (let i = logsIndex; i < sequencedLogs.length; i++) {\n\t\t\t\tconst log = sequencedLogs[i];\n\t\t\t\tif (log[1].length > entryIndex) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst uuids = new Set<StableId>();\n\t\tconst finalIds = new Set<FinalCompressedId>();\n\t\tconst idIndicesAggregator = new Map<SessionId, number>();\n\n\t\tfunction* getIdLogEntries(\n\t\t\tcolumnIndex: number,\n\t\t): Iterable<\n\t\t\t[\n\t\t\t\tcurrent: [compressor: IdCompressor, idData: TestIdData],\n\t\t\t\tnext?: [compressor: IdCompressor, idData: TestIdData],\n\t\t\t]\n\t\t> {\n\t\t\tlet current = getNextLogWithEntryAt(0, columnIndex);\n\t\t\twhile (current !== undefined) {\n\t\t\t\tconst next = getNextLogWithEntryAt(current + 1, columnIndex);\n\t\t\t\tconst [compressor, log] = sequencedLogs[current];\n\t\t\t\tif (next === undefined) {\n\t\t\t\t\tyield [[compressor, log[columnIndex]]];\n\t\t\t\t} else {\n\t\t\t\t\tconst [compressorNext, logNext] = sequencedLogs[next];\n\t\t\t\t\tyield [\n\t\t\t\t\t\t[compressor, log[columnIndex]],\n\t\t\t\t\t\t[compressorNext, logNext[columnIndex]],\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\t\tcurrent = next;\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < maxLogLength; i++) {\n\t\t\tlet idCreatorCount = 0;\n\t\t\tlet originatingSession: SessionId | undefined;\n\t\t\tfor (const [current, next] of getIdLogEntries(i)) {\n\t\t\t\tconst [compressorA, idDataA] = current;\n\t\t\t\tconst sessionSpaceIdA = idDataA.id;\n\t\t\t\tconst idIndex = getOrCreate(idIndicesAggregator, idDataA.sessionId, () => 0);\n\t\t\t\toriginatingSession ??= idDataA.sessionId;\n\t\t\t\tassert(\n\t\t\t\t\tidDataA.sessionId === originatingSession,\n\t\t\t\t\t\"Test infra gave wrong originating client to TestIdData\",\n\t\t\t\t);\n\n\t\t\t\t// Only one client should have this ID as local in its session space, as only one client could have created this ID\n\t\t\t\tif (isLocalId(sessionSpaceIdA)) {\n\t\t\t\t\tif (originatingSession !== OriginatingClient.Remote) {\n\t\t\t\t\t\tassert.strictEqual(\n\t\t\t\t\t\t\tidDataA.sessionId,\n\t\t\t\t\t\t\tthis.compressors.get(idDataA.originatingClient as Client).localSessionId,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tidCreatorCount++;\n\t\t\t\t}\n\n\t\t\t\tconst uuidASessionSpace = compressorA.decompress(sessionSpaceIdA);\n\t\t\t\tassert.strictEqual(uuidASessionSpace, incrementStableId(idDataA.sessionId, idIndex));\n\t\t\t\tassert.strictEqual(compressorA.recompress(uuidASessionSpace), sessionSpaceIdA);\n\t\t\t\tuuids.add(uuidASessionSpace);\n\t\t\t\tconst opSpaceIdA = compressorA.normalizeToOpSpace(sessionSpaceIdA);\n\t\t\t\tif (!isFinalId(opSpaceIdA)) {\n\t\t\t\t\tfail(\"IDs should have been finalized.\");\n\t\t\t\t}\n\t\t\t\tconst reNormalizedIdA = compressorA.normalizeToSessionSpace(\n\t\t\t\t\topSpaceIdA,\n\t\t\t\t\tcompressorA.localSessionId,\n\t\t\t\t);\n\t\t\t\tassert.strictEqual(reNormalizedIdA, sessionSpaceIdA);\n\t\t\t\tfinalIds.add(opSpaceIdA);\n\t\t\t\tconst uuidAOpSpace = compressorA.decompress(reNormalizedIdA);\n\n\t\t\t\tassert.strictEqual(uuidASessionSpace, uuidAOpSpace);\n\n\t\t\t\tif (next !== undefined) {\n\t\t\t\t\tconst [compressorB, idDataB] = next;\n\t\t\t\t\tconst sessionSpaceIdB = idDataB.id;\n\n\t\t\t\t\tconst uuidBSessionSpace = compressorB.decompress(sessionSpaceIdB);\n\t\t\t\t\tassert.strictEqual(uuidASessionSpace, uuidBSessionSpace);\n\t\t\t\t\tconst opSpaceIdB = compressorB.normalizeToOpSpace(sessionSpaceIdB);\n\t\t\t\t\tif (opSpaceIdA !== opSpaceIdB) {\n\t\t\t\t\t\tcompressorB.normalizeToOpSpace(sessionSpaceIdB);\n\t\t\t\t\t\tcompressorA.normalizeToOpSpace(sessionSpaceIdA);\n\t\t\t\t\t}\n\t\t\t\t\tassert.strictEqual(opSpaceIdA, opSpaceIdB);\n\t\t\t\t\tif (!isFinalId(opSpaceIdB)) {\n\t\t\t\t\t\tfail(\"IDs should have been finalized.\");\n\t\t\t\t\t}\n\t\t\t\t\tconst uuidBOpSpace = compressorB.decompress(\n\t\t\t\t\t\topSpaceIdB as unknown as SessionSpaceCompressedId,\n\t\t\t\t\t);\n\t\t\t\t\tassert.strictEqual(uuidAOpSpace, uuidBOpSpace);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tassert(idCreatorCount <= 1, \"Only one client can create an ID.\");\n\t\t\tassert.strictEqual(uuids.size, finalIds.size);\n\t\t\tassert(originatingSession !== undefined, \"Expected originating client to be defined\");\n\t\t\tidIndicesAggregator.set(\n\t\t\t\toriginatingSession,\n\n\t\t\t\t(idIndicesAggregator.get(originatingSession) ??\n\t\t\t\t\tfail(\"Expected pre-existing index for originating client\")) + 1,\n\t\t\t);\n\t\t}\n\n\t\tfor (const [compressor] of sequencedLogs) {\n\t\t\texpectSerializes(compressor);\n\t\t}\n\t}\n}\n\n/**\n * Roundtrips the supplied compressor through serialization and deserialization.\n */\nexport function roundtrip(\n\tcompressor: ReadonlyIdCompressor,\n\twithSession: true,\n): [SerializedIdCompressorWithOngoingSession, IdCompressor];\n\n/**\n * Roundtrips the supplied compressor through serialization and deserialization.\n */\nexport function roundtrip(\n\tcompressor: ReadonlyIdCompressor,\n\twithSession: false,\n): [SerializedIdCompressorWithNoSession, IdCompressor];\n\nexport function roundtrip(\n\tcompressor: ReadonlyIdCompressor,\n\twithSession: boolean,\n): [\n\tSerializedIdCompressorWithOngoingSession | SerializedIdCompressorWithNoSession,\n\tIdCompressor,\n] {\n\t// preserve the capacity request as this property is normally private and resets\n\t// to a default on construction (deserialization)\n\tconst capacity: number = getClusterSize(compressor);\n\tif (withSession) {\n\t\tconst serialized = compressor.serialize(withSession);\n\t\tconst roundtripped = IdCompressor.deserialize({ serialized });\n\t\tmodifyClusterSize(roundtripped, capacity);\n\t\treturn [serialized, roundtripped];\n\t} else {\n\t\tconst nonLocalSerialized = compressor.serialize(withSession);\n\t\tconst roundtripped = IdCompressor.deserialize({\n\t\t\tserialized: nonLocalSerialized,\n\t\t\tnewSessionId: createSessionId(),\n\t\t});\n\t\tmodifyClusterSize(roundtripped, capacity);\n\t\treturn [nonLocalSerialized, roundtripped];\n\t}\n}\n\n/**\n * Asserts that the supplied compressor correctly roundtrips through serialization/deserialization.\n */\nexport function expectSerializes(\n\tcompressor: ReadonlyIdCompressor,\n): [SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession] {\n\tfunction expectSerializesWithSession(\n\t\twithSession: boolean,\n\t): SerializedIdCompressorWithOngoingSession | SerializedIdCompressorWithNoSession {\n\t\tlet serialized:\n\t\t\t| SerializedIdCompressorWithOngoingSession\n\t\t\t| SerializedIdCompressorWithNoSession;\n\t\tlet deserialized: IdCompressor;\n\t\tif (withSession) {\n\t\t\t[serialized, deserialized] = roundtrip(compressor, true);\n\t\t} else {\n\t\t\t[serialized, deserialized] = roundtrip(compressor, false);\n\t\t}\n\t\tassert.strictEqual(compressor.equals(deserialized, withSession), true);\n\t\treturn serialized;\n\t}\n\n\treturn [\n\t\texpectSerializesWithSession(false) as SerializedIdCompressorWithNoSession,\n\t\texpectSerializesWithSession(true) as SerializedIdCompressorWithOngoingSession,\n\t];\n}\n\n/**\n * Merges 'from' into 'to', and returns 'to'.\n */\nexport function mergeArrayMaps<K, V>(\n\tto: Pick<Map<K, V[]>, \"get\" | \"set\">,\n\tfrom: ReadonlyMap<K, V[]>,\n): Pick<Map<K, V[]>, \"get\" | \"set\"> {\n\tfor (const [key, value] of from.entries()) {\n\t\tconst entry = to.get(key);\n\t\tif (entry === undefined) {\n\t\t\tto.set(key, [...value]);\n\t\t} else {\n\t\t\tentry.push(...value);\n\t\t}\n\t}\n\treturn to;\n}\n\ninterface AllocateIds {\n\ttype: \"allocateIds\";\n\tclient: Client;\n\tnumIds: number;\n}\n\ninterface AllocateOutsideIds {\n\ttype: \"allocateOutsideIds\";\n\tsessionId: SessionId;\n\tnumIds: number;\n}\n\ninterface DeliverAllOperations {\n\ttype: \"deliverAllOperations\";\n}\n\ninterface DeliverSomeOperations {\n\ttype: \"deliverSomeOperations\";\n\tclient: Client;\n\tcount: number;\n}\n\ninterface ChangeCapacity {\n\ttype: \"changeCapacity\";\n\tclient: Client;\n\tnewSize: number;\n}\n\n// Represents intent to go offline then resume.\ninterface Reconnect {\n\ttype: \"reconnect\";\n\tclient: Client;\n}\n\ninterface Validate {\n\ttype: \"validate\";\n}\n\ntype Operation =\n\t| AllocateIds\n\t| AllocateOutsideIds\n\t| DeliverSomeOperations\n\t| DeliverAllOperations\n\t| ChangeCapacity\n\t| Reconnect\n\t| Validate;\n\ninterface FuzzTestState extends BaseFuzzTestState {\n\tnetwork: IdCompressorTestNetwork;\n\tactiveClients: Client[];\n\tselectableClients: Client[];\n\tclusterSize: number;\n}\n\nexport interface OperationGenerationConfig {\n\t/**\n\t * maximum cluster size of the network. Default: 25\n\t */\n\tmaxClusterSize?: number;\n\t/**\n\t * Number of ops between validation ops. Default: 200\n\t */\n\tvalidateInterval?: number;\n\t/**\n\t * Fraction of ID allocations that are from an outside client (not Client1/2/3).\n\t */\n\toutsideAllocationFraction?: number;\n}\n\nconst defaultOptions = {\n\tmaxClusterSize: 25,\n\tvalidateInterval: 200,\n\toutsideAllocationFraction: 0.1,\n};\n\nexport function makeOpGenerator(\n\toptions: OperationGenerationConfig,\n): Generator<Operation, FuzzTestState> {\n\tconst { maxClusterSize, validateInterval, outsideAllocationFraction } = {\n\t\t...defaultOptions,\n\t\t...options,\n\t};\n\tassert(outsideAllocationFraction >= 0 && outsideAllocationFraction <= 1);\n\n\tfunction allocateIdsGenerator({\n\t\tactiveClients,\n\t\tclusterSize,\n\t\trandom,\n\t}: FuzzTestState): AllocateIds {\n\t\tconst client = random.pick(activeClients);\n\t\tconst maxIdsPerUsage = clusterSize * 2;\n\t\tconst numIds = Math.floor(random.real(0, 1) ** 3 * maxIdsPerUsage) + 1;\n\t\treturn {\n\t\t\ttype: \"allocateIds\",\n\t\t\tclient,\n\t\t\tnumIds,\n\t\t};\n\t}\n\n\tfunction allocateOutsideIdsGenerator({\n\t\tclusterSize,\n\t\trandom,\n\t}: FuzzTestState): AllocateOutsideIds {\n\t\tconst maxIdsPerUsage = clusterSize * 2;\n\t\tconst numIds = Math.floor(random.real(0, 1) ** 3 * maxIdsPerUsage) + 1;\n\t\treturn {\n\t\t\ttype: \"allocateOutsideIds\",\n\t\t\tsessionId: createSessionId(),\n\t\t\tnumIds,\n\t\t};\n\t}\n\n\tfunction changeCapacityGenerator({ random, activeClients }: FuzzTestState): ChangeCapacity {\n\t\treturn {\n\t\t\ttype: \"changeCapacity\",\n\t\t\tclient: random.pick(activeClients),\n\t\t\tnewSize: Math.min(\n\t\t\t\tMath.floor(random.real(0, 1) ** 2 * maxClusterSize) + 1,\n\t\t\t\tmaxClusterSize,\n\t\t\t),\n\t\t};\n\t}\n\n\tfunction deliverAllOperationsGenerator(): DeliverAllOperations {\n\t\treturn {\n\t\t\ttype: \"deliverAllOperations\",\n\t\t};\n\t}\n\n\tfunction deliverSomeOperationsGenerator({\n\t\trandom,\n\t\tselectableClients,\n\t\tnetwork,\n\t}: FuzzTestState): DeliverSomeOperations {\n\t\tconst pendingClients = selectableClients.filter(\n\t\t\t(c) => network.getPendingOperations(c) > 0,\n\t\t);\n\t\tif (pendingClients.length === 0) {\n\t\t\treturn {\n\t\t\t\ttype: \"deliverSomeOperations\",\n\t\t\t\tclient: random.pick(selectableClients),\n\t\t\t\tcount: 0,\n\t\t\t};\n\t\t}\n\t\tconst client = random.pick(pendingClients);\n\t\treturn {\n\t\t\ttype: \"deliverSomeOperations\",\n\t\t\tclient,\n\t\t\tcount: random.integer(1, network.getPendingOperations(client)),\n\t\t};\n\t}\n\n\tfunction reconnectGenerator({ activeClients, random }: FuzzTestState): Reconnect {\n\t\treturn { type: \"reconnect\", client: random.pick(activeClients) };\n\t}\n\n\tconst allocationWeight = 20;\n\treturn interleave(\n\t\tcreateWeightedGenerator<Operation, FuzzTestState>([\n\t\t\t[changeCapacityGenerator, 1],\n\t\t\t[allocateIdsGenerator, Math.round(allocationWeight * (1 - outsideAllocationFraction))],\n\t\t\t[allocateOutsideIdsGenerator, Math.round(allocationWeight * outsideAllocationFraction)],\n\t\t\t[deliverAllOperationsGenerator, 1],\n\t\t\t[deliverSomeOperationsGenerator, 6],\n\t\t\t[reconnectGenerator, 1],\n\t\t]),\n\t\ttake(1, repeat<Operation, FuzzTestState>({ type: \"validate\" })),\n\t\tvalidateInterval,\n\t);\n}\n\n/**\n * Performs random actions on a test network.\n * @param generator - the generator used to provide operations\n * @param network - the test network to test\n * @param seed - the seed for the random generation of the fuzz actions\n * @param observerClient - if provided, this client will never generate local ids\n * @param synchronizeAtEnd - if provided, all client will have all operations delivered from the server at the end of the test\n * @param validator - if provided, this callback will be invoked periodically during the fuzz test.\n */\nexport function performFuzzActions(\n\tgenerator: Generator<Operation, FuzzTestState>,\n\tnetwork: IdCompressorTestNetwork,\n\tseed: number,\n\tobserverClient?: Client,\n\tsynchronizeAtEnd: boolean = true,\n\tvalidator?: (network: IdCompressorTestNetwork) => void,\n\tsaveInfo?: SaveInfo,\n): void {\n\tconst random = makeRandom(seed);\n\tconst selectableClients: Client[] = network\n\t\t.getTargetCompressors(MetaClient.All)\n\t\t.map(([client]) => client);\n\n\tconst initialState: FuzzTestState = {\n\t\trandom,\n\t\tnetwork,\n\t\tactiveClients: selectableClients.filter((c) => c !== observerClient),\n\t\tselectableClients,\n\t\tclusterSize: network.initialClusterSize,\n\t};\n\n\tperformFuzzActionsBase(\n\t\tgenerator,\n\t\t{\n\t\t\tallocateIds: (state, { client, numIds }) => {\n\t\t\t\tnetwork.allocateAndSendIdsFromRemoteClient(client, sessionIds.get(client), numIds);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tallocateOutsideIds: (state, { sessionId, numIds }) => {\n\t\t\t\tnetwork.allocateAndSendIdsFromRemoteClient(\n\t\t\t\t\tOriginatingClient.Remote,\n\t\t\t\t\tsessionId,\n\t\t\t\t\tnumIds,\n\t\t\t\t);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tchangeCapacity: (state, op) => {\n\t\t\t\tnetwork.changeCapacity(op.client, op.newSize);\n\t\t\t\treturn { ...state, clusterSize: op.newSize };\n\t\t\t},\n\t\t\tdeliverSomeOperations: (state, op) => {\n\t\t\t\tnetwork.deliverOperations(op.client, op.count);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tdeliverAllOperations: (state) => {\n\t\t\t\tnetwork.deliverOperations(DestinationClient.All);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\treconnect: (state, { client }) => {\n\t\t\t\tnetwork.goOfflineThenResume(client);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tvalidate: (state) => {\n\t\t\t\tvalidator?.(network);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t},\n\t\tinitialState,\n\t\tsaveInfo,\n\t);\n\n\tif (synchronizeAtEnd) {\n\t\tnetwork.deliverOperations(DestinationClient.All);\n\t\tvalidator?.(network);\n\t}\n}\n\n/**\n * Helper to generate a fixed number of IDs.\n */\nexport function generateCompressedIds(\n\tcompressor: IdCompressor,\n\tcount: number,\n): SessionSpaceCompressedId[] {\n\tconst ids: SessionSpaceCompressedId[] = [];\n\tfor (let i = 0; i < count; i++) {\n\t\tids.push(compressor.generateCompressedId());\n\t}\n\treturn ids;\n}\n\n/**\n * Creates a compressor that only produces final IDs.\n * It should only be used for testing purposes.\n */\nexport function createAlwaysFinalizedIdCompressor(\n\tlogger?: ITelemetryBaseLogger,\n): IIdCompressor & IIdCompressorCore;\n/**\n * Creates a compressor that only produces final IDs.\n * It should only be used for testing purposes.\n */\nexport function createAlwaysFinalizedIdCompressor(\n\tsessionId: SessionId,\n\tlogger?: ITelemetryBaseLogger,\n\tseed?: number,\n): IIdCompressor & IIdCompressorCore;\nexport function createAlwaysFinalizedIdCompressor(\n\tsessionIdOrLogger?: SessionId | ITelemetryBaseLogger,\n\tloggerOrUndefined?: ITelemetryBaseLogger,\n\tseed?: number,\n): IIdCompressor & IIdCompressorCore {\n\tconst random = seed === undefined ? makeRandom() : makeRandom(seed);\n\tconst sessionId =\n\t\ttypeof sessionIdOrLogger === \"string\" ? sessionIdOrLogger : (random.uuid4() as SessionId);\n\tconst logger =\n\t\t(loggerOrUndefined ?? typeof sessionIdOrLogger === \"object\")\n\t\t\t? (sessionIdOrLogger as ITelemetryBaseLogger)\n\t\t\t: undefined;\n\t// This local session is unused, but it needs to not collide with the GhostSession, so allocate a random one.\n\t// This causes the compressor to serialize non-deterministically even when provided an explicit SessionId.\n\t// This can be fixed in the future if needed.\n\tconst compressor = createIdCompressor(random.uuid4() as SessionId, logger);\n\t// Permanently put the compressor in a ghost session\n\t(compressor as IdCompressor).startGhostSession(sessionId);\n\treturn compressor;\n}\n"]} | ||
| {"version":3,"file":"idCompressorTestUtilities.js","sourceRoot":"","sources":["../../src/test/idCompressorTestUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAIN,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,kBAAkB,IAAI,sBAAsB,EAC5C,MAAM,EACN,IAAI,GACJ,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAUN,kBAAkB,EAClB,sBAAsB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,iBAAiB,E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AE,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC;AAkBD,MAAM,UAAU,iCAAiC,CAChD,iBAAoD,EACpD,iBAAwC,EACxC,IAAa;IAEb,MAAM,MAAM,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACpE,MAAM,SAAS,GACd,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAE,MAAM,CAAC,KAAK,EAAgB,CAAC;IAC3F,MAAM,MAAM,GACX,CAAC,iBAAiB,IAAI,OAAO,iBAAiB,KAAK,QAAQ,CAAC;QAC3D,CAAC,CAAE,iBAA0C;QAC7C,CAAC,CAAC,SAAS,CAAC;IACd,6GAA6G;IAC7G,0GAA0G;IAC1G,6CAA6C;IAC7C,MAAM,UAAU,GAAG,kBAAkB,CAAC,MAAM,CAAC,KAAK,EAAe,EAAE,MAAM,CAAC,CAAC;IAC3E,oDAAoD;IACnD,UAA2B,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC1D,OAAO,sBAAsB,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport {\n\ttype BaseFuzzTestState,\n\ttype Generator,\n\ttype SaveInfo,\n\tcreateWeightedGenerator,\n\tinterleave,\n\tmakeRandom,\n\tperformFuzzActions as performFuzzActionsBase,\n\trepeat,\n\ttake,\n} from \"@fluid-private/stochastic-test-utils\";\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\n\nimport { IdCompressor } from \"../idCompressor.js\";\nimport {\n\ttype IIdCompressor,\n\ttype IIdCompressorCore,\n\ttype IdCreationRange,\n\ttype OpSpaceCompressedId,\n\ttype SerializedIdCompressorWithNoSession,\n\ttype SerializedIdCompressorWithOngoingSession,\n\ttype SessionId,\n\ttype SessionSpaceCompressedId,\n\ttype StableId,\n\tcreateIdCompressor,\n\ttoIdCompressorWithCore,\n} from \"../index.js\";\nimport { SessionSpaceNormalizer } from \"../sessionSpaceNormalizer.js\";\nimport { assertIsSessionId, createSessionId, localIdFromGenCount } from \"../utilities.js\";\n\nimport {\n\ttype FinalCompressedId,\n\ttype ReadonlyIdCompressor,\n\tfail,\n\tgetOrCreate,\n\tincrementStableId,\n\tisFinalId,\n\tisLocalId,\n} from \"./testCommon.js\";\n\n/**\n * A readonly `Map` which is known to contain a value for every possible key\n */\nexport interface ClosedMap<K, V> extends Omit<Map<K, V>, \"delete\" | \"clear\"> {\n\tget(key: K): V;\n}\n\n/**\n * Identifies a compressor in a network\n */\nexport enum Client {\n\tClient1 = \"Client1\",\n\tClient2 = \"Client2\",\n\tClient3 = \"Client3\",\n}\n\n/**\n * Identifies categories of compressors\n */\nexport enum MetaClient {\n\tAll = \"All\",\n}\n\n/**\n * Identifies a compressor inside the network but outside the three specially tracked clients.\n */\nexport enum OutsideClient {\n\tRemote = \"Remote\",\n}\n\n/**\n * Used to attribute actions to clients in a distributed collaboration session.\n * `Local` implies a local and unsequenced operation. All others imply sequenced operations.\n */\nexport type OriginatingClient = Client | OutsideClient;\nexport const OriginatingClient = { ...Client, ...OutsideClient };\n\n/**\n * Identifies a compressor to which to send an operation\n */\nexport type DestinationClient = Client | MetaClient;\nexport const DestinationClient = { ...Client, ...MetaClient };\n\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class\nexport class CompressorFactory {\n\t/**\n\t * Creates a new compressor with the supplied cluster capacity.\n\t */\n\tpublic static createCompressor(\n\t\tclient: Client,\n\t\tclusterCapacity = 5,\n\t\tlogger?: ITelemetryBaseLogger,\n\t): IdCompressor {\n\t\treturn CompressorFactory.createCompressorWithSession(\n\t\t\tsessionIds.get(client),\n\t\t\tclusterCapacity,\n\t\t\tlogger,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new compressor with the supplied cluster capacity.\n\t */\n\tpublic static createCompressorWithSession(\n\t\tsessionId: SessionId,\n\t\tclusterCapacity = 5,\n\t\tlogger?: ITelemetryBaseLogger,\n\t): IdCompressor {\n\t\tconst compressor = createIdCompressor(sessionId, logger) as IdCompressor;\n\t\tmodifyClusterSize(compressor, clusterCapacity);\n\t\treturn compressor;\n\t}\n}\n\n/**\n * Modify the requested cluster size of the provided compressor.\n * @remarks\n * This is useful for testing purposes for a few reasons:\n * - Id compressor bugs are often related to edge cases that occur on cluster boundaries\n * - Smaller cluster sizes can enable writing tests without for loops generating \"ids until a new cluster is created\"\n */\nexport function modifyClusterSize(compressor: IIdCompressor, newClusterSize: number): void {\n\tverifyCompressorLike(compressor);\n\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\tcompressor[\"nextRequestedClusterSize\"] = newClusterSize;\n}\n\n/**\n * Returns the current cluster size of the compressor.\n * @privateRemarks\n * This is useful in writing tests to avoid having to hardcode the (currently constant) cluster size.\n */\nexport function getClusterSize(compressor: ReadonlyIdCompressor): number {\n\tverifyCompressorLike(compressor);\n\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\treturn compressor[\"nextRequestedClusterSize\"] as number;\n}\n\nfunction verifyCompressorLike(compressor: ReadonlyIdCompressor | IIdCompressor): void {\n\tassert(\n\t\t// Some IdCompressor tests wrap underlying compressors with proxies--allow this for now.\n\t\t// Because of id-compressor's dynamic import in container-runtime, instanceof checks for IdCompressor\n\t\t// also won't necessarily work nicely. Get a small amount of validation that this function should work\n\t\t// as intended by at least verifying the property name exists.\n\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\ttypeof compressor[\"nextRequestedClusterSize\"] === \"number\",\n\t);\n}\n\n/**\n * Utility for building a huge compressor.\n * Build via the compressor factory.\n */\nexport function buildHugeCompressor(\n\tnumSessions = 10000,\n\tcapacity = 10,\n\tnumClustersPerSession = 3,\n): IdCompressor {\n\tconst compressor = CompressorFactory.createCompressorWithSession(\n\t\tcreateSessionId(),\n\t\tcapacity,\n\t);\n\tconst sessions: SessionId[] = [];\n\tfor (let i = 0; i < numSessions; i++) {\n\t\tsessions.push(createSessionId());\n\t}\n\tfor (let i = 0; i < numSessions * numClustersPerSession; i++) {\n\t\tconst sessionId = sessions[i % numSessions];\n\t\tif (Math.random() > 0.1) {\n\t\t\tfor (let j = 0; j < Math.round(capacity / 2); j++) {\n\t\t\t\tcompressor.generateCompressedId();\n\t\t\t}\n\t\t\tcompressor.finalizeCreationRange(compressor.takeNextCreationRange());\n\t\t}\n\t\tcompressor.finalizeCreationRange({\n\t\t\tsessionId,\n\t\t\tids: {\n\t\t\t\tfirstGenCount: Math.floor(i / numSessions) * capacity + 1,\n\t\t\t\tcount: capacity,\n\t\t\t\trequestedClusterSize: capacity,\n\t\t\t\tlocalIdRanges: [], // remote session, can safely ignore in tests\n\t\t\t},\n\t\t});\n\t}\n\treturn compressor;\n}\n\n/**\n * A closed map from NamedClient to T.\n */\nexport type ClientMap<T> = ClosedMap<Client, T>;\n\nfunction makeSessionIds(): ClientMap<SessionId> {\n\tconst stableIds = new Map<Client, SessionId>();\n\tconst clients = Object.values(Client);\n\tfor (let i = 0; i < clients.length; i++) {\n\t\t// Place session uuids roughly in the middle of uuid space to increase odds of encountering interesting\n\t\t// orderings in sorted collections\n\t\tconst sessionId = assertIsSessionId(`88888888-8888-4888-b${i}88-888888888888`);\n\t\tstableIds.set(clients[i], sessionId);\n\t}\n\treturn stableIds as ClientMap<SessionId>;\n}\n\n/**\n * An array of session ID strings corresponding to all non-local `Client` entries.\n */\nexport const sessionIds = makeSessionIds();\n\n/**\n * Information about a generated ID in a network to be validated by tests\n */\nexport interface TestIdData {\n\treadonly id: SessionSpaceCompressedId;\n\treadonly originatingClient: OriginatingClient;\n\treadonly sessionId: SessionId;\n\treadonly isSequenced: boolean;\n}\n\n/**\n * Simulates a network of ID compressors.\n * Not suitable for performance testing.\n */\nexport class IdCompressorTestNetwork {\n\t/**\n\t * The compressors used in this network\n\t */\n\tprivate readonly compressors: ClientMap<IdCompressor>;\n\t/**\n\t * The log of operations seen by the server so far. Append-only.\n\t */\n\tprivate readonly serverOperations: [\n\t\tcreationRange: IdCreationRange,\n\t\topSpaceIds: OpSpaceCompressedId[],\n\t\tclientFrom: OriginatingClient,\n\t\tsessionIdFrom: SessionId,\n\t][] = [];\n\t/**\n\t * An index into `serverOperations` for each client which represents how many operations have been delivered to that client\n\t */\n\tprivate readonly clientProgress: ClientMap<number>;\n\t/**\n\t * All ids (local and sequenced) that a client has created or received, in order.\n\t */\n\tprivate readonly idLogs: ClientMap<TestIdData[]>;\n\t/**\n\t * All ids that a client has received from the server, in order.\n\t */\n\tprivate readonly sequencedIdLogs: ClientMap<TestIdData[]>;\n\n\tpublic constructor(public readonly initialClusterSize = 5) {\n\t\tconst compressors = new Map<Client, IdCompressor>();\n\t\tconst clientProgress = new Map<Client, number>();\n\t\tconst clientIds = new Map<Client, TestIdData[]>();\n\t\tconst clientSequencedIds = new Map<Client, TestIdData[]>();\n\t\tfor (const client of Object.values(Client)) {\n\t\t\tconst compressor = CompressorFactory.createCompressor(client, initialClusterSize);\n\t\t\tcompressors.set(client, compressor);\n\t\t\tclientProgress.set(client, 0);\n\t\t\tclientIds.set(client, []);\n\t\t\tclientSequencedIds.set(client, []);\n\t\t}\n\t\tthis.compressors = compressors as ClientMap<IdCompressor>;\n\t\tthis.clientProgress = clientProgress as ClientMap<number>;\n\t\tthis.idLogs = clientIds as ClientMap<TestIdData[]>;\n\t\tthis.sequencedIdLogs = clientSequencedIds as ClientMap<TestIdData[]>;\n\t}\n\n\t/**\n\t * Returns the number of undelivered operations for the given client that are in flight in the network.\n\t */\n\tpublic getPendingOperations(destination: Client): number {\n\t\treturn this.serverOperations.length - this.clientProgress.get(destination);\n\t}\n\n\t/**\n\t * Returns an immutable handle to a compressor in the network.\n\t */\n\tpublic getCompressor(client: Client): ReadonlyIdCompressor {\n\t\tconst compressors = this.compressors;\n\t\tconst handler = {\n\t\t\tget<P extends keyof IdCompressor>(_: unknown, property: P): IdCompressor[P] {\n\t\t\t\treturn compressors.get(client)[property];\n\t\t\t},\n\t\t\tset<P extends keyof IdCompressor>(\n\t\t\t\t_: unknown,\n\t\t\t\tproperty: P,\n\t\t\t\tvalue: IdCompressor[P],\n\t\t\t): boolean {\n\t\t\t\tcompressors.get(client)[property] = value;\n\t\t\t\treturn true;\n\t\t\t},\n\t\t};\n\t\treturn new Proxy<IdCompressor>({} as unknown as IdCompressor, handler);\n\t}\n\n\t/**\n\t * Returns a mutable handle to a compressor in the network. Use of mutation methods will break the network invariants and\n\t * should only be used if the network will not be used again.\n\t */\n\tpublic getCompressorUnsafe(client: Client): IdCompressor {\n\t\treturn this.getCompressor(client) as IdCompressor;\n\t}\n\n\t/**\n\t * Returns a mutable handle to a compressor in the network. Use of mutation methods will break the network invariants and\n\t * should only be used if the network will not be used again. Additionally, the returned compressor will be invalidated/unusable\n\t * if any network operations cause it to be regenerated (serialization/deserialization, etc.).\n\t */\n\tpublic getCompressorUnsafeNoProxy(client: Client): IdCompressor {\n\t\treturn this.compressors.get(client);\n\t}\n\n\t/**\n\t * Returns data for all IDs created and received by this client, including ack's of their own (i.e. their own IDs will appear twice)\n\t */\n\tpublic getIdLog(client: Client): readonly TestIdData[] {\n\t\treturn this.idLogs.get(client);\n\t}\n\n\t/**\n\t * Returns data for all IDs received by this client, including ack's of their own.\n\t */\n\tpublic getSequencedIdLog(client: Client): readonly TestIdData[] {\n\t\treturn this.sequencedIdLogs.get(client);\n\t}\n\n\t/**\n\t * Get all compressors for the given destination\n\t */\n\tpublic getTargetCompressors(clientTo: DestinationClient): [Client, IdCompressor][] {\n\t\treturn clientTo === MetaClient.All\n\t\t\t? [...this.compressors.entries()]\n\t\t\t: ([[clientTo, this.getCompressor(clientTo)]] as [Client, IdCompressor][]);\n\t}\n\n\t/**\n\t * Changes the capacity request amount for a client. It will take effect immediately.\n\t */\n\tpublic changeCapacity(client: Client, newClusterCapacity: number): void {\n\t\tmodifyClusterSize(this.compressors.get(client), newClusterCapacity);\n\t}\n\n\tprivate addNewId(\n\t\tclient: Client,\n\t\tid: SessionSpaceCompressedId,\n\t\toriginatingClient: OriginatingClient,\n\t\tsessionIdFrom: SessionId,\n\t\tisSequenced: boolean,\n\t): void {\n\t\tconst idData = {\n\t\t\tid,\n\t\t\toriginatingClient,\n\t\t\tsessionId: sessionIdFrom,\n\t\t\tisSequenced,\n\t\t};\n\t\tconst clientIds = this.idLogs.get(client);\n\t\tclientIds.push(idData);\n\t\tif (isSequenced) {\n\t\t\tconst sequencedIds = this.sequencedIdLogs.get(client);\n\t\t\tsequencedIds.push(idData);\n\t\t}\n\t}\n\n\t/**\n\t * Allocates a new range of local IDs and enqueues them for future delivery via a `testIdDelivery` action.\n\t * Calls to this method determine the total order of delivery, regardless of when `deliverOperations` is called.\n\t */\n\tpublic allocateAndSendIds(clientFrom: Client, numIds: number): OpSpaceCompressedId[] {\n\t\treturn this.allocateAndSendIdsFromRemoteClient(\n\t\t\tclientFrom,\n\t\t\tsessionIds.get(clientFrom),\n\t\t\tnumIds,\n\t\t);\n\t}\n\n\t/**\n\t * Same contract as `allocateAndSendIds`, but the originating client will be a client with the supplied sessionId.\n\t */\n\tpublic allocateAndSendIdsFromRemoteClient(\n\t\tclientFrom: OriginatingClient,\n\t\tsessionIdFrom: SessionId,\n\t\tnumIds: number,\n\t): OpSpaceCompressedId[] {\n\t\tassert(numIds > 0, \"Must allocate a non-zero number of IDs\");\n\t\tif (clientFrom === OriginatingClient.Remote) {\n\t\t\tconst range: IdCreationRange = {\n\t\t\t\tsessionId: sessionIdFrom,\n\t\t\t\tids: {\n\t\t\t\t\tfirstGenCount: 1,\n\t\t\t\t\tcount: numIds,\n\t\t\t\t\trequestedClusterSize: getClusterSize(this.getCompressor(Client.Client1)),\n\t\t\t\t\tlocalIdRanges: [], // remote session, can safely ignore in tests\n\t\t\t\t},\n\t\t\t};\n\t\t\tconst opSpaceIds: OpSpaceCompressedId[] = [];\n\t\t\tfor (let i = 0; i < numIds; i++) {\n\t\t\t\topSpaceIds.push(-(i + 1) as OpSpaceCompressedId);\n\t\t\t}\n\t\t\tthis.serverOperations.push([range, opSpaceIds, clientFrom, sessionIdFrom]);\n\t\t\treturn opSpaceIds;\n\t\t} else {\n\t\t\tassert(sessionIdFrom === sessionIds.get(clientFrom));\n\t\t\tconst compressor = this.compressors.get(clientFrom);\n\t\t\tconst sessionSpaceIds = generateCompressedIds(compressor, numIds);\n\t\t\tfor (let i = 0; i < numIds; i++) {\n\t\t\t\tthis.addNewId(clientFrom, sessionSpaceIds[i], clientFrom, sessionIdFrom, false);\n\t\t\t}\n\t\t\tconst opSpaceIds = sessionSpaceIds.map((id) => compressor.normalizeToOpSpace(id));\n\t\t\tconst creationRange = compressor.takeNextCreationRange();\n\t\t\tthis.serverOperations.push([creationRange, opSpaceIds, clientFrom, sessionIdFrom]);\n\t\t\treturn opSpaceIds;\n\t\t}\n\t}\n\n\t/**\n\t * Delivers all undelivered ID ranges from the server to the target clients.\n\t */\n\tpublic deliverOperations(clientTakingDelivery: Client, opsToDeliver?: number): void;\n\n\t/**\n\t * Delivers all undelivered ID ranges from the server to the target clients.\n\t */\n\tpublic deliverOperations(clientTakingDelivery: DestinationClient): void;\n\n\t/**\n\t * Delivers all undelivered ID ranges from the server to the target clients.\n\t */\n\tpublic deliverOperations(\n\t\tclientTakingDelivery: DestinationClient,\n\t\topsToDeliver?: number,\n\t): void {\n\t\tlet opIndexBound: number;\n\t\tif (clientTakingDelivery === DestinationClient.All) {\n\t\t\tassert(opsToDeliver === undefined);\n\t\t\topIndexBound = this.serverOperations.length;\n\t\t} else {\n\t\t\topIndexBound =\n\t\t\t\topsToDeliver === undefined\n\t\t\t\t\t? this.serverOperations.length\n\t\t\t\t\t: this.clientProgress.get(clientTakingDelivery) + opsToDeliver;\n\t\t}\n\t\tfor (const [clientTo, compressorTo] of this.getTargetCompressors(clientTakingDelivery)) {\n\t\t\tfor (let i = this.clientProgress.get(clientTo); i < opIndexBound; i++) {\n\t\t\t\tconst [range, opSpaceIds, clientFrom, sessionIdFrom] = this.serverOperations[i];\n\t\t\t\tcompressorTo.finalizeCreationRange(range);\n\n\t\t\t\tconst ids = range.ids;\n\t\t\t\tif (ids !== undefined) {\n\t\t\t\t\tfor (const id of opSpaceIds) {\n\t\t\t\t\t\tconst sessionSpaceId = compressorTo.normalizeToSessionSpace(id, range.sessionId);\n\t\t\t\t\t\tthis.addNewId(clientTo, sessionSpaceId, clientFrom, sessionIdFrom, true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.clientProgress.set(clientTo, opIndexBound);\n\t\t}\n\t}\n\n\t/**\n\t * Simulate a client disconnecting (and serializing), then reconnecting (and deserializing)\n\t */\n\tpublic goOfflineThenResume(client: Client): void {\n\t\tconst compressor = this.compressors.get(client);\n\t\tconst [_, resumedCompressor] = roundtrip(compressor, true);\n\t\tthis.compressors.set(client, resumedCompressor);\n\t}\n\n\t/**\n\t * Ensure general validity of the network state. Useful for calling periodically or at the end of test scenarios.\n\t */\n\tpublic assertNetworkState(): void {\n\t\tconst sequencedLogs = Object.values(Client).map(\n\t\t\t(client) => [this.compressors.get(client), this.getSequencedIdLog(client)] as const,\n\t\t);\n\n\t\tconst getLocalIdsInRange = (\n\t\t\trange: IdCreationRange,\n\t\t\topSpaceIds?: OpSpaceCompressedId[],\n\t\t): Set<SessionSpaceCompressedId> => {\n\t\t\tconst localIdsInCreationRange = new Set<SessionSpaceCompressedId>();\n\t\t\tconst ids = range.ids;\n\t\t\tif (ids !== undefined) {\n\t\t\t\tconst { firstGenCount, localIdRanges } = ids;\n\t\t\t\tfor (const [genCount, count] of localIdRanges) {\n\t\t\t\t\tfor (let g = genCount; g < genCount + count; g++) {\n\t\t\t\t\t\tconst local = localIdFromGenCount(g);\n\t\t\t\t\t\tif (opSpaceIds) {\n\t\t\t\t\t\t\tassert.strictEqual(opSpaceIds[g - firstGenCount], local);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlocalIdsInCreationRange.add(local);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn localIdsInCreationRange;\n\t\t};\n\n\t\t// Ensure creation ranges for clients we track contain the correct local ID ranges\n\t\tfor (const [range, opSpaceIds, clientFrom] of this.serverOperations) {\n\t\t\tif (clientFrom !== OriginatingClient.Remote) {\n\t\t\t\tconst localIdsInCreationRange = getLocalIdsInRange(range, opSpaceIds);\n\t\t\t\tlet localCount = 0;\n\t\t\t\tfor (const id of opSpaceIds) {\n\t\t\t\t\tif (isLocalId(id)) {\n\t\t\t\t\t\tlocalCount++;\n\t\t\t\t\t\tassert(localIdsInCreationRange.has(id), \"Local ID not in creation range\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\tlocalCount,\n\t\t\t\t\tlocalIdsInCreationRange.size,\n\t\t\t\t\t\"Local ID count mismatch\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst undeliveredRanges = new Map<Client, IdCreationRange[]>();\n\t\tfor (const [client, progress] of this.clientProgress.entries()) {\n\t\t\tconst ranges = this.serverOperations\n\t\t\t\t.slice(progress)\n\t\t\t\t.filter((op) => op[2] === client)\n\t\t\t\t.map(([range]) => range);\n\t\t\tundeliveredRanges.set(client, ranges);\n\t\t}\n\t\tfor (const [client, ranges] of undeliveredRanges.entries()) {\n\t\t\tconst compressor = this.compressors.get(client);\n\t\t\tlet firstGenCount: number | undefined;\n\t\t\tlet totalCount = 0;\n\t\t\tconst unionedLocalRanges = new SessionSpaceNormalizer();\n\t\t\tfor (const range of ranges) {\n\t\t\t\tassert(range.sessionId === compressor.localSessionId);\n\t\t\t\tif (range.ids !== undefined) {\n\t\t\t\t\t// initialize firstGenCount if not set\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy\n\t\t\t\t\tif (firstGenCount === undefined) {\n\t\t\t\t\t\tfirstGenCount = range.ids.firstGenCount;\n\t\t\t\t\t}\n\t\t\t\t\ttotalCount += range.ids.count;\n\t\t\t\t\tfor (const [genCount, count] of range.ids.localIdRanges) {\n\t\t\t\t\t\tunionedLocalRanges.addLocalRange(genCount, count);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst retakenRange = compressor.takeUnfinalizedCreationRange();\n\t\t\tif (retakenRange.ids === undefined) {\n\t\t\t\tassert.strictEqual(totalCount, 0);\n\t\t\t\tassert.strictEqual(unionedLocalRanges.idRanges.size, 0);\n\t\t\t} else {\n\t\t\t\tconst retakenLocalIds = new SessionSpaceNormalizer();\n\t\t\t\tfor (const [genCount, count] of retakenRange.ids.localIdRanges) {\n\t\t\t\t\tretakenLocalIds.addLocalRange(genCount, count);\n\t\t\t\t}\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\tretakenLocalIds.equals(unionedLocalRanges),\n\t\t\t\t\ttrue,\n\t\t\t\t\t\"Local ID ranges mismatch\",\n\t\t\t\t);\n\t\t\t\tassert.strictEqual(retakenRange.ids.count, totalCount, \"Count mismatch\");\n\t\t\t\tassert.strictEqual(retakenRange.ids.firstGenCount, firstGenCount, \"Count mismatch\");\n\t\t\t}\n\t\t}\n\n\t\t// First, ensure all clients each generated a unique ID for each of their own calls to generate.\n\t\tfor (const [compressor, ids] of sequencedLogs) {\n\t\t\tconst allUuids = new Set<StableId | string>();\n\t\t\tfor (const idData of ids) {\n\t\t\t\tconst uuid = compressor.decompress(idData.id);\n\t\t\t\tassert.strictEqual(!allUuids.has(uuid), true, \"Duplicate UUID generated.\");\n\t\t\t\tallUuids.add(uuid);\n\t\t\t}\n\t\t}\n\n\t\tconst maxLogLength = sequencedLogs\n\t\t\t.map(([_, data]) => data.length)\n\t\t\t// eslint-disable-next-line unicorn/no-array-reduce\n\t\t\t.reduce((p, n) => Math.max(p, n));\n\n\t\tfunction getNextLogWithEntryAt(logsIndex: number, entryIndex: number): number | undefined {\n\t\t\tfor (let i = logsIndex; i < sequencedLogs.length; i++) {\n\t\t\t\tconst log = sequencedLogs[i];\n\t\t\t\tif (log[1].length > entryIndex) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst uuids = new Set<StableId>();\n\t\tconst finalIds = new Set<FinalCompressedId>();\n\t\tconst idIndicesAggregator = new Map<SessionId, number>();\n\n\t\tfunction* getIdLogEntries(\n\t\t\tcolumnIndex: number,\n\t\t): Iterable<\n\t\t\t[\n\t\t\t\tcurrent: [compressor: IdCompressor, idData: TestIdData],\n\t\t\t\tnext?: [compressor: IdCompressor, idData: TestIdData],\n\t\t\t]\n\t\t> {\n\t\t\tlet current = getNextLogWithEntryAt(0, columnIndex);\n\t\t\twhile (current !== undefined) {\n\t\t\t\tconst next = getNextLogWithEntryAt(current + 1, columnIndex);\n\t\t\t\tconst [compressor, log] = sequencedLogs[current];\n\t\t\t\tif (next === undefined) {\n\t\t\t\t\tyield [[compressor, log[columnIndex]]];\n\t\t\t\t} else {\n\t\t\t\t\tconst [compressorNext, logNext] = sequencedLogs[next];\n\t\t\t\t\tyield [\n\t\t\t\t\t\t[compressor, log[columnIndex]],\n\t\t\t\t\t\t[compressorNext, logNext[columnIndex]],\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\t\tcurrent = next;\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < maxLogLength; i++) {\n\t\t\tlet idCreatorCount = 0;\n\t\t\tlet originatingSession: SessionId | undefined;\n\t\t\tfor (const [current, next] of getIdLogEntries(i)) {\n\t\t\t\tconst [compressorA, idDataA] = current;\n\t\t\t\tconst sessionSpaceIdA = idDataA.id;\n\t\t\t\tconst idIndex = getOrCreate(idIndicesAggregator, idDataA.sessionId, () => 0);\n\t\t\t\toriginatingSession ??= idDataA.sessionId;\n\t\t\t\tassert(\n\t\t\t\t\tidDataA.sessionId === originatingSession,\n\t\t\t\t\t\"Test infra gave wrong originating client to TestIdData\",\n\t\t\t\t);\n\n\t\t\t\t// Only one client should have this ID as local in its session space, as only one client could have created this ID\n\t\t\t\tif (isLocalId(sessionSpaceIdA)) {\n\t\t\t\t\tif (originatingSession !== OriginatingClient.Remote) {\n\t\t\t\t\t\tassert.strictEqual(\n\t\t\t\t\t\t\tidDataA.sessionId,\n\t\t\t\t\t\t\tthis.compressors.get(idDataA.originatingClient as Client).localSessionId,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tidCreatorCount++;\n\t\t\t\t}\n\n\t\t\t\tconst uuidASessionSpace = compressorA.decompress(sessionSpaceIdA);\n\t\t\t\tassert.strictEqual(uuidASessionSpace, incrementStableId(idDataA.sessionId, idIndex));\n\t\t\t\tassert.strictEqual(compressorA.recompress(uuidASessionSpace), sessionSpaceIdA);\n\t\t\t\tuuids.add(uuidASessionSpace);\n\t\t\t\tconst opSpaceIdA = compressorA.normalizeToOpSpace(sessionSpaceIdA);\n\t\t\t\tif (!isFinalId(opSpaceIdA)) {\n\t\t\t\t\tfail(\"IDs should have been finalized.\");\n\t\t\t\t}\n\t\t\t\tconst reNormalizedIdA = compressorA.normalizeToSessionSpace(\n\t\t\t\t\topSpaceIdA,\n\t\t\t\t\tcompressorA.localSessionId,\n\t\t\t\t);\n\t\t\t\tassert.strictEqual(reNormalizedIdA, sessionSpaceIdA);\n\t\t\t\tfinalIds.add(opSpaceIdA);\n\t\t\t\tconst uuidAOpSpace = compressorA.decompress(reNormalizedIdA);\n\n\t\t\t\tassert.strictEqual(uuidASessionSpace, uuidAOpSpace);\n\n\t\t\t\tif (next !== undefined) {\n\t\t\t\t\tconst [compressorB, idDataB] = next;\n\t\t\t\t\tconst sessionSpaceIdB = idDataB.id;\n\n\t\t\t\t\tconst uuidBSessionSpace = compressorB.decompress(sessionSpaceIdB);\n\t\t\t\t\tassert.strictEqual(uuidASessionSpace, uuidBSessionSpace);\n\t\t\t\t\tconst opSpaceIdB = compressorB.normalizeToOpSpace(sessionSpaceIdB);\n\t\t\t\t\tif (opSpaceIdA !== opSpaceIdB) {\n\t\t\t\t\t\tcompressorB.normalizeToOpSpace(sessionSpaceIdB);\n\t\t\t\t\t\tcompressorA.normalizeToOpSpace(sessionSpaceIdA);\n\t\t\t\t\t}\n\t\t\t\t\tassert.strictEqual(opSpaceIdA, opSpaceIdB);\n\t\t\t\t\tif (!isFinalId(opSpaceIdB)) {\n\t\t\t\t\t\tfail(\"IDs should have been finalized.\");\n\t\t\t\t\t}\n\t\t\t\t\tconst uuidBOpSpace = compressorB.decompress(\n\t\t\t\t\t\topSpaceIdB as unknown as SessionSpaceCompressedId,\n\t\t\t\t\t);\n\t\t\t\t\tassert.strictEqual(uuidAOpSpace, uuidBOpSpace);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tassert(idCreatorCount <= 1, \"Only one client can create an ID.\");\n\t\t\tassert.strictEqual(uuids.size, finalIds.size);\n\t\t\tassert(originatingSession !== undefined, \"Expected originating client to be defined\");\n\t\t\tidIndicesAggregator.set(\n\t\t\t\toriginatingSession,\n\n\t\t\t\t(idIndicesAggregator.get(originatingSession) ??\n\t\t\t\t\tfail(\"Expected pre-existing index for originating client\")) + 1,\n\t\t\t);\n\t\t}\n\n\t\tfor (const [compressor] of sequencedLogs) {\n\t\t\texpectSerializes(compressor);\n\t\t}\n\t}\n}\n\n/**\n * Roundtrips the supplied compressor through serialization and deserialization.\n */\nexport function roundtrip(\n\tcompressor: ReadonlyIdCompressor,\n\twithSession: true,\n): [SerializedIdCompressorWithOngoingSession, IdCompressor];\n\n/**\n * Roundtrips the supplied compressor through serialization and deserialization.\n */\nexport function roundtrip(\n\tcompressor: ReadonlyIdCompressor,\n\twithSession: false,\n): [SerializedIdCompressorWithNoSession, IdCompressor];\n\nexport function roundtrip(\n\tcompressor: ReadonlyIdCompressor,\n\twithSession: boolean,\n): [\n\tSerializedIdCompressorWithOngoingSession | SerializedIdCompressorWithNoSession,\n\tIdCompressor,\n] {\n\t// preserve the capacity request as this property is normally private and resets\n\t// to a default on construction (deserialization)\n\tconst capacity: number = getClusterSize(compressor);\n\tif (withSession) {\n\t\tconst serialized = compressor.serialize(withSession);\n\t\tconst roundtripped = IdCompressor.deserialize({ serialized });\n\t\tmodifyClusterSize(roundtripped, capacity);\n\t\treturn [serialized, roundtripped];\n\t} else {\n\t\tconst nonLocalSerialized = compressor.serialize(withSession);\n\t\tconst roundtripped = IdCompressor.deserialize({\n\t\t\tserialized: nonLocalSerialized,\n\t\t\tnewSessionId: createSessionId(),\n\t\t});\n\t\tmodifyClusterSize(roundtripped, capacity);\n\t\treturn [nonLocalSerialized, roundtripped];\n\t}\n}\n\n/**\n * Asserts that the supplied compressor correctly roundtrips through serialization/deserialization.\n */\nexport function expectSerializes(\n\tcompressor: ReadonlyIdCompressor,\n): [SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession] {\n\tfunction expectSerializesWithSession(\n\t\twithSession: boolean,\n\t): SerializedIdCompressorWithOngoingSession | SerializedIdCompressorWithNoSession {\n\t\tlet serialized:\n\t\t\t| SerializedIdCompressorWithOngoingSession\n\t\t\t| SerializedIdCompressorWithNoSession;\n\t\tlet deserialized: IdCompressor;\n\t\tif (withSession) {\n\t\t\t[serialized, deserialized] = roundtrip(compressor, true);\n\t\t} else {\n\t\t\t[serialized, deserialized] = roundtrip(compressor, false);\n\t\t}\n\t\tassert.strictEqual(compressor.equals(deserialized, withSession), true);\n\t\treturn serialized;\n\t}\n\n\treturn [\n\t\texpectSerializesWithSession(false) as SerializedIdCompressorWithNoSession,\n\t\texpectSerializesWithSession(true) as SerializedIdCompressorWithOngoingSession,\n\t];\n}\n\n/**\n * Merges 'from' into 'to', and returns 'to'.\n */\nexport function mergeArrayMaps<K, V>(\n\tto: Pick<Map<K, V[]>, \"get\" | \"set\">,\n\tfrom: ReadonlyMap<K, V[]>,\n): Pick<Map<K, V[]>, \"get\" | \"set\"> {\n\tfor (const [key, value] of from.entries()) {\n\t\tconst entry = to.get(key);\n\t\tif (entry === undefined) {\n\t\t\tto.set(key, [...value]);\n\t\t} else {\n\t\t\tentry.push(...value);\n\t\t}\n\t}\n\treturn to;\n}\n\ninterface AllocateIds {\n\ttype: \"allocateIds\";\n\tclient: Client;\n\tnumIds: number;\n}\n\ninterface AllocateOutsideIds {\n\ttype: \"allocateOutsideIds\";\n\tsessionId: SessionId;\n\tnumIds: number;\n}\n\ninterface DeliverAllOperations {\n\ttype: \"deliverAllOperations\";\n}\n\ninterface DeliverSomeOperations {\n\ttype: \"deliverSomeOperations\";\n\tclient: Client;\n\tcount: number;\n}\n\ninterface ChangeCapacity {\n\ttype: \"changeCapacity\";\n\tclient: Client;\n\tnewSize: number;\n}\n\n// Represents intent to go offline then resume.\ninterface Reconnect {\n\ttype: \"reconnect\";\n\tclient: Client;\n}\n\ninterface Validate {\n\ttype: \"validate\";\n}\n\ntype Operation =\n\t| AllocateIds\n\t| AllocateOutsideIds\n\t| DeliverSomeOperations\n\t| DeliverAllOperations\n\t| ChangeCapacity\n\t| Reconnect\n\t| Validate;\n\ninterface FuzzTestState extends BaseFuzzTestState {\n\tnetwork: IdCompressorTestNetwork;\n\tactiveClients: Client[];\n\tselectableClients: Client[];\n\tclusterSize: number;\n}\n\nexport interface OperationGenerationConfig {\n\t/**\n\t * maximum cluster size of the network. Default: 25\n\t */\n\tmaxClusterSize?: number;\n\t/**\n\t * Number of ops between validation ops. Default: 200\n\t */\n\tvalidateInterval?: number;\n\t/**\n\t * Fraction of ID allocations that are from an outside client (not Client1/2/3).\n\t */\n\toutsideAllocationFraction?: number;\n}\n\nconst defaultOptions = {\n\tmaxClusterSize: 25,\n\tvalidateInterval: 200,\n\toutsideAllocationFraction: 0.1,\n};\n\nexport function makeOpGenerator(\n\toptions: OperationGenerationConfig,\n): Generator<Operation, FuzzTestState> {\n\tconst { maxClusterSize, validateInterval, outsideAllocationFraction } = {\n\t\t...defaultOptions,\n\t\t...options,\n\t};\n\tassert(outsideAllocationFraction >= 0 && outsideAllocationFraction <= 1);\n\n\tfunction allocateIdsGenerator({\n\t\tactiveClients,\n\t\tclusterSize,\n\t\trandom,\n\t}: FuzzTestState): AllocateIds {\n\t\tconst client = random.pick(activeClients);\n\t\tconst maxIdsPerUsage = clusterSize * 2;\n\t\tconst numIds = Math.floor(random.real(0, 1) ** 3 * maxIdsPerUsage) + 1;\n\t\treturn {\n\t\t\ttype: \"allocateIds\",\n\t\t\tclient,\n\t\t\tnumIds,\n\t\t};\n\t}\n\n\tfunction allocateOutsideIdsGenerator({\n\t\tclusterSize,\n\t\trandom,\n\t}: FuzzTestState): AllocateOutsideIds {\n\t\tconst maxIdsPerUsage = clusterSize * 2;\n\t\tconst numIds = Math.floor(random.real(0, 1) ** 3 * maxIdsPerUsage) + 1;\n\t\treturn {\n\t\t\ttype: \"allocateOutsideIds\",\n\t\t\tsessionId: createSessionId(),\n\t\t\tnumIds,\n\t\t};\n\t}\n\n\tfunction changeCapacityGenerator({ random, activeClients }: FuzzTestState): ChangeCapacity {\n\t\treturn {\n\t\t\ttype: \"changeCapacity\",\n\t\t\tclient: random.pick(activeClients),\n\t\t\tnewSize: Math.min(\n\t\t\t\tMath.floor(random.real(0, 1) ** 2 * maxClusterSize) + 1,\n\t\t\t\tmaxClusterSize,\n\t\t\t),\n\t\t};\n\t}\n\n\tfunction deliverAllOperationsGenerator(): DeliverAllOperations {\n\t\treturn {\n\t\t\ttype: \"deliverAllOperations\",\n\t\t};\n\t}\n\n\tfunction deliverSomeOperationsGenerator({\n\t\trandom,\n\t\tselectableClients,\n\t\tnetwork,\n\t}: FuzzTestState): DeliverSomeOperations {\n\t\tconst pendingClients = selectableClients.filter(\n\t\t\t(c) => network.getPendingOperations(c) > 0,\n\t\t);\n\t\tif (pendingClients.length === 0) {\n\t\t\treturn {\n\t\t\t\ttype: \"deliverSomeOperations\",\n\t\t\t\tclient: random.pick(selectableClients),\n\t\t\t\tcount: 0,\n\t\t\t};\n\t\t}\n\t\tconst client = random.pick(pendingClients);\n\t\treturn {\n\t\t\ttype: \"deliverSomeOperations\",\n\t\t\tclient,\n\t\t\tcount: random.integer(1, network.getPendingOperations(client)),\n\t\t};\n\t}\n\n\tfunction reconnectGenerator({ activeClients, random }: FuzzTestState): Reconnect {\n\t\treturn { type: \"reconnect\", client: random.pick(activeClients) };\n\t}\n\n\tconst allocationWeight = 20;\n\treturn interleave(\n\t\tcreateWeightedGenerator<Operation, FuzzTestState>([\n\t\t\t[changeCapacityGenerator, 1],\n\t\t\t[allocateIdsGenerator, Math.round(allocationWeight * (1 - outsideAllocationFraction))],\n\t\t\t[allocateOutsideIdsGenerator, Math.round(allocationWeight * outsideAllocationFraction)],\n\t\t\t[deliverAllOperationsGenerator, 1],\n\t\t\t[deliverSomeOperationsGenerator, 6],\n\t\t\t[reconnectGenerator, 1],\n\t\t]),\n\t\ttake(1, repeat<Operation, FuzzTestState>({ type: \"validate\" })),\n\t\tvalidateInterval,\n\t);\n}\n\n/**\n * Performs random actions on a test network.\n * @param generator - the generator used to provide operations\n * @param network - the test network to test\n * @param seed - the seed for the random generation of the fuzz actions\n * @param observerClient - if provided, this client will never generate local ids\n * @param synchronizeAtEnd - if provided, all client will have all operations delivered from the server at the end of the test\n * @param validator - if provided, this callback will be invoked periodically during the fuzz test.\n */\nexport function performFuzzActions(\n\tgenerator: Generator<Operation, FuzzTestState>,\n\tnetwork: IdCompressorTestNetwork,\n\tseed: number,\n\tobserverClient?: Client,\n\tsynchronizeAtEnd: boolean = true,\n\tvalidator?: (network: IdCompressorTestNetwork) => void,\n\tsaveInfo?: SaveInfo,\n): void {\n\tconst random = makeRandom(seed);\n\tconst selectableClients: Client[] = network\n\t\t.getTargetCompressors(MetaClient.All)\n\t\t.map(([client]) => client);\n\n\tconst initialState: FuzzTestState = {\n\t\trandom,\n\t\tnetwork,\n\t\tactiveClients: selectableClients.filter((c) => c !== observerClient),\n\t\tselectableClients,\n\t\tclusterSize: network.initialClusterSize,\n\t};\n\n\tperformFuzzActionsBase(\n\t\tgenerator,\n\t\t{\n\t\t\tallocateIds: (state, { client, numIds }) => {\n\t\t\t\tnetwork.allocateAndSendIdsFromRemoteClient(client, sessionIds.get(client), numIds);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tallocateOutsideIds: (state, { sessionId, numIds }) => {\n\t\t\t\tnetwork.allocateAndSendIdsFromRemoteClient(\n\t\t\t\t\tOriginatingClient.Remote,\n\t\t\t\t\tsessionId,\n\t\t\t\t\tnumIds,\n\t\t\t\t);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tchangeCapacity: (state, op) => {\n\t\t\t\tnetwork.changeCapacity(op.client, op.newSize);\n\t\t\t\treturn { ...state, clusterSize: op.newSize };\n\t\t\t},\n\t\t\tdeliverSomeOperations: (state, op) => {\n\t\t\t\tnetwork.deliverOperations(op.client, op.count);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tdeliverAllOperations: (state) => {\n\t\t\t\tnetwork.deliverOperations(DestinationClient.All);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\treconnect: (state, { client }) => {\n\t\t\t\tnetwork.goOfflineThenResume(client);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tvalidate: (state) => {\n\t\t\t\tvalidator?.(network);\n\t\t\t\treturn state;\n\t\t\t},\n\t\t},\n\t\tinitialState,\n\t\tsaveInfo,\n\t);\n\n\tif (synchronizeAtEnd) {\n\t\tnetwork.deliverOperations(DestinationClient.All);\n\t\tvalidator?.(network);\n\t}\n}\n\n/**\n * Helper to generate a fixed number of IDs.\n */\nexport function generateCompressedIds(\n\tcompressor: IdCompressor,\n\tcount: number,\n): SessionSpaceCompressedId[] {\n\tconst ids: SessionSpaceCompressedId[] = [];\n\tfor (let i = 0; i < count; i++) {\n\t\tids.push(compressor.generateCompressedId());\n\t}\n\treturn ids;\n}\n\n/**\n * Creates a compressor that only produces final IDs.\n * It should only be used for testing purposes.\n */\nexport function createAlwaysFinalizedIdCompressor(\n\tlogger?: ITelemetryBaseLogger,\n): IIdCompressor & IIdCompressorCore;\n/**\n * Creates a compressor that only produces final IDs.\n * It should only be used for testing purposes.\n */\nexport function createAlwaysFinalizedIdCompressor(\n\tsessionId: SessionId,\n\tlogger?: ITelemetryBaseLogger,\n\tseed?: number,\n): IIdCompressor & IIdCompressorCore;\nexport function createAlwaysFinalizedIdCompressor(\n\tsessionIdOrLogger?: SessionId | ITelemetryBaseLogger,\n\tloggerOrUndefined?: ITelemetryBaseLogger,\n\tseed?: number,\n): IIdCompressor & IIdCompressorCore {\n\tconst random = seed === undefined ? makeRandom() : makeRandom(seed);\n\tconst sessionId =\n\t\ttypeof sessionIdOrLogger === \"string\" ? sessionIdOrLogger : (random.uuid4() as SessionId);\n\tconst logger =\n\t\t(loggerOrUndefined ?? typeof sessionIdOrLogger === \"object\")\n\t\t\t? (sessionIdOrLogger as ITelemetryBaseLogger)\n\t\t\t: undefined;\n\t// This local session is unused, but it needs to not collide with the GhostSession, so allocate a random one.\n\t// This causes the compressor to serialize non-deterministically even when provided an explicit SessionId.\n\t// This can be fixed in the future if needed.\n\tconst compressor = createIdCompressor(random.uuid4() as SessionId, logger);\n\t// Permanently put the compressor in a ghost session\n\t(compressor as IdCompressor).startGhostSession(sessionId);\n\treturn toIdCompressorWithCore(compressor);\n}\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"summary.spec.js","sourceRoot":"","sources":["../../../src/test/snapshots/summary.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAkB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,C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AAC;QAC5C,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAE9C,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\nimport { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { type SessionId, createIdCompressor } from \"../../index.js\";\nimport { modifyClusterSize } from \"../idCompressorTestUtilities.js\";\n\nimport { _dirname } from \"./dirname.cjs\";\n\nconst regenerateSnapshots = process.argv.includes(\"--snapshot\");\n\nlet currentTestName: string | undefined;\nlet currentTestFile: string | undefined;\n\n// Simple filter to avoid tests with a name that would accidentally be parsed as directory traversal or other confusing things.\nconst nameCheck = new RegExp(/^[^\"/\\\\]+$/);\n\nassert(/(dist|lib)[/\\\\]test[/\\\\]snapshots$/.exec(_dirname));\nconst snapshotsFolder = path.join(_dirname, `../../../src/test/snapshots`);\nassert(existsSync(snapshotsFolder));\n\n/**\n * Delete the existing test file directory and recreate it.\n *\n * If the directory does not already exist, this will create it.\n *\n * @param dirPath - The path within the `snapshots` directory.\n */\nfunction useSnapshotDirectory(dirPath: string = \"files\"): void {\n\tconst normalizedDir = path.join(snapshotsFolder, dirPath);\n\t// Basic sanity check to avoid bugs like accidentally recursively deleting everything under `/` if something went wrong (like dirPath navigated up directories a lot).\n\tassert(normalizedDir.startsWith(snapshotsFolder));\n\n\tif (regenerateSnapshots) {\n\t\tif (existsSync(normalizedDir)) {\n\t\t\tconsole.log(`removing snapshot directory: ${normalizedDir}`);\n\t\t\trmSync(normalizedDir, { recursive: true, force: true });\n\t\t}\n\t\tmkdirSync(normalizedDir, { recursive: true });\n\t}\n\n\tbeforeEach(function (): void {\n\t\tcurrentTestName = this.currentTest?.title.replace(/ /g, \"-\") ?? assert.fail();\n\t\tcurrentTestFile = path.join(normalizedDir, currentTestName);\n\t});\n\n\tafterEach(() => {\n\t\tcurrentTestFile = undefined;\n\t\tcurrentTestName = undefined;\n\t});\n}\n\nfunction takeSnapshot(data: string, suffix: string = \"\"): void {\n\tassert(\n\t\tcurrentTestName !== undefined,\n\t\t\"use `useSnapshotDirectory` to configure the tests containing describe block to take snapshots\",\n\t);\n\tassert(currentTestFile !== undefined);\n\n\t// Ensure test name doesn't accidentally navigate up directories or things like that.\n\t// Done here instead of in beforeEach so errors surface better.\n\tif (nameCheck.test(currentTestName) === false) {\n\t\tassert.fail(`Expected test name to pass sanitization: \"${currentTestName}\"`);\n\t}\n\n\tconst fullFile = currentTestFile + suffix;\n\n\tconst exists = existsSync(fullFile);\n\tif (regenerateSnapshots) {\n\t\tassert(exists === false, \"snapshot should not already exist: possible name collision.\");\n\t\twriteFileSync(fullFile, data);\n\t} else {\n\t\tassert(exists, `test snapshot file does not exist: \"${fullFile}\"`);\n\t\tconst pastData = readFileSync(fullFile, \"utf8\");\n\t\tassert.equal(data, pastData, `snapshot different for \"${currentTestName}\"`);\n\t}\n}\n\ndescribe(\"snapshot tests\", () => {\n\tconst client1 = \"403f1e16-5265-4074-8507-417d99a05ee9\" as SessionId;\n\tconst client2 = \"4b02675a-5a81-428d-b7b7-d8c33a16bfde\" as SessionId;\n\n\tuseSnapshotDirectory();\n\n\tit(\"empty compressor summary\", () => {\n\t\tconst compressor = createIdCompressor(client1);\n\t\tconst summary = compressor.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t});\n\n\tit(\"compressor with finalized range from one client\", () => {\n\t\tconst compressor = createIdCompressor(client1);\n\t\tconst compressor2 = createIdCompressor(client2);\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tcompressor.generateCompressedId();\n\t\t}\n\t\tconst idRange = compressor.takeNextCreationRange();\n\t\tcompressor.finalizeCreationRange(idRange);\n\t\tconst summary = compressor.serialize(false);\n\t\tconst summary2 = compressor2.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t\ttakeSnapshot(summary2, \"-client2\");\n\t});\n\n\tit(\"compressors with finalized ranges from two clients\", () => {\n\t\tconst compressor = createIdCompressor(client1);\n\t\tconst compressor2 = createIdCompressor(client2);\n\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tcompressor.generateCompressedId();\n\t\t\tcompressor2.generateCompressedId();\n\t\t}\n\t\tconst idRange = compressor.takeNextCreationRange();\n\t\tconst idRange2 = compressor2.takeNextCreationRange();\n\n\t\tcompressor.finalizeCreationRange(idRange);\n\t\tcompressor2.finalizeCreationRange(idRange);\n\t\tcompressor.finalizeCreationRange(idRange2);\n\t\tcompressor2.finalizeCreationRange(idRange2);\n\n\t\tconst summary = compressor.serialize(false);\n\t\tconst summary2 = compressor2.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t\ttakeSnapshot(summary2, \"-client2\");\n\t});\n\n\tit(\"expansion semantics\", () => {\n\t\tconst compressor = createIdCompressor(client1);\n\t\tconst compressor2 = createIdCompressor(client2);\n\t\tmodifyClusterSize(compressor, 2);\n\t\tcompressor.generateCompressedId();\n\t\tconst idRange = compressor.takeNextCreationRange();\n\t\tcompressor.finalizeCreationRange(idRange);\n\t\tcompressor2.finalizeCreationRange(idRange);\n\n\t\tfor (let i = 0; i < 3; i++) {\n\t\t\tcompressor.generateCompressedId();\n\t\t}\n\n\t\tconst expansionIdRange = compressor.takeNextCreationRange();\n\t\tcompressor.finalizeCreationRange(expansionIdRange);\n\t\tcompressor2.finalizeCreationRange(expansionIdRange);\n\t\tconst summary = compressor.serialize(false);\n\t\tconst summary2 = compressor2.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t\ttakeSnapshot(summary2, \"-client2\");\n\t});\n});\n"]} | ||
| {"version":3,"file":"summary.spec.js","sourceRoot":"","sources":["../../../src/test/snapshots/summary.spec.ts"],"names":[],"mappings":"AAAA;;;GA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UAAU,CAAC,qBAAqB,EAAE,CAAC;QACnD,UAAU,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC1C,WAAW,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAE3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5B,UAAU,CAAC,oBAAoB,EAAE,CAAC;QACnC,CAAC;QAED,MAAM,gBAAgB,GAAG,UAAU,CAAC,qBAAqB,EAAE,CAAC;QAC5D,UAAU,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;QACnD,WAAW,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;QACpD,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAE9C,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\nimport { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { type SessionId, createIdCompressor, toIdCompressorWithCore } from \"../../index.js\";\nimport { modifyClusterSize } from \"../idCompressorTestUtilities.js\";\n\nimport { _dirname } from \"./dirname.cjs\";\n\nconst regenerateSnapshots = process.argv.includes(\"--snapshot\");\n\nlet currentTestName: string | undefined;\nlet currentTestFile: string | undefined;\n\n// Simple filter to avoid tests with a name that would accidentally be parsed as directory traversal or other confusing things.\nconst nameCheck = new RegExp(/^[^\"/\\\\]+$/);\n\nassert(/(dist|lib)[/\\\\]test[/\\\\]snapshots$/.exec(_dirname));\nconst snapshotsFolder = path.join(_dirname, `../../../src/test/snapshots`);\nassert(existsSync(snapshotsFolder));\n\n/**\n * Delete the existing test file directory and recreate it.\n *\n * If the directory does not already exist, this will create it.\n *\n * @param dirPath - The path within the `snapshots` directory.\n */\nfunction useSnapshotDirectory(dirPath: string = \"files\"): void {\n\tconst normalizedDir = path.join(snapshotsFolder, dirPath);\n\t// Basic sanity check to avoid bugs like accidentally recursively deleting everything under `/` if something went wrong (like dirPath navigated up directories a lot).\n\tassert(normalizedDir.startsWith(snapshotsFolder));\n\n\tif (regenerateSnapshots) {\n\t\tif (existsSync(normalizedDir)) {\n\t\t\tconsole.log(`removing snapshot directory: ${normalizedDir}`);\n\t\t\trmSync(normalizedDir, { recursive: true, force: true });\n\t\t}\n\t\tmkdirSync(normalizedDir, { recursive: true });\n\t}\n\n\tbeforeEach(function (): void {\n\t\tcurrentTestName = this.currentTest?.title.replace(/ /g, \"-\") ?? assert.fail();\n\t\tcurrentTestFile = path.join(normalizedDir, currentTestName);\n\t});\n\n\tafterEach(() => {\n\t\tcurrentTestFile = undefined;\n\t\tcurrentTestName = undefined;\n\t});\n}\n\nfunction takeSnapshot(data: string, suffix: string = \"\"): void {\n\tassert(\n\t\tcurrentTestName !== undefined,\n\t\t\"use `useSnapshotDirectory` to configure the tests containing describe block to take snapshots\",\n\t);\n\tassert(currentTestFile !== undefined);\n\n\t// Ensure test name doesn't accidentally navigate up directories or things like that.\n\t// Done here instead of in beforeEach so errors surface better.\n\tif (nameCheck.test(currentTestName) === false) {\n\t\tassert.fail(`Expected test name to pass sanitization: \"${currentTestName}\"`);\n\t}\n\n\tconst fullFile = currentTestFile + suffix;\n\n\tconst exists = existsSync(fullFile);\n\tif (regenerateSnapshots) {\n\t\tassert(exists === false, \"snapshot should not already exist: possible name collision.\");\n\t\twriteFileSync(fullFile, data);\n\t} else {\n\t\tassert(exists, `test snapshot file does not exist: \"${fullFile}\"`);\n\t\tconst pastData = readFileSync(fullFile, \"utf8\");\n\t\tassert.equal(data, pastData, `snapshot different for \"${currentTestName}\"`);\n\t}\n}\n\ndescribe(\"snapshot tests\", () => {\n\tconst client1 = \"403f1e16-5265-4074-8507-417d99a05ee9\" as SessionId;\n\tconst client2 = \"4b02675a-5a81-428d-b7b7-d8c33a16bfde\" as SessionId;\n\n\tuseSnapshotDirectory();\n\n\tit(\"empty compressor summary\", () => {\n\t\tconst compressor = toIdCompressorWithCore(createIdCompressor(client1));\n\t\tconst summary = compressor.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t});\n\n\tit(\"compressor with finalized range from one client\", () => {\n\t\tconst compressor = toIdCompressorWithCore(createIdCompressor(client1));\n\t\tconst compressor2 = toIdCompressorWithCore(createIdCompressor(client2));\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tcompressor.generateCompressedId();\n\t\t}\n\t\tconst idRange = compressor.takeNextCreationRange();\n\t\tcompressor.finalizeCreationRange(idRange);\n\t\tconst summary = compressor.serialize(false);\n\t\tconst summary2 = compressor2.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t\ttakeSnapshot(summary2, \"-client2\");\n\t});\n\n\tit(\"compressors with finalized ranges from two clients\", () => {\n\t\tconst compressor = toIdCompressorWithCore(createIdCompressor(client1));\n\t\tconst compressor2 = toIdCompressorWithCore(createIdCompressor(client2));\n\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tcompressor.generateCompressedId();\n\t\t\tcompressor2.generateCompressedId();\n\t\t}\n\t\tconst idRange = compressor.takeNextCreationRange();\n\t\tconst idRange2 = compressor2.takeNextCreationRange();\n\n\t\tcompressor.finalizeCreationRange(idRange);\n\t\tcompressor2.finalizeCreationRange(idRange);\n\t\tcompressor.finalizeCreationRange(idRange2);\n\t\tcompressor2.finalizeCreationRange(idRange2);\n\n\t\tconst summary = compressor.serialize(false);\n\t\tconst summary2 = compressor2.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t\ttakeSnapshot(summary2, \"-client2\");\n\t});\n\n\tit(\"expansion semantics\", () => {\n\t\tconst compressor = toIdCompressorWithCore(createIdCompressor(client1));\n\t\tconst compressor2 = toIdCompressorWithCore(createIdCompressor(client2));\n\t\tmodifyClusterSize(compressor, 2);\n\t\tcompressor.generateCompressedId();\n\t\tconst idRange = compressor.takeNextCreationRange();\n\t\tcompressor.finalizeCreationRange(idRange);\n\t\tcompressor2.finalizeCreationRange(idRange);\n\n\t\tfor (let i = 0; i < 3; i++) {\n\t\t\tcompressor.generateCompressedId();\n\t\t}\n\n\t\tconst expansionIdRange = compressor.takeNextCreationRange();\n\t\tcompressor.finalizeCreationRange(expansionIdRange);\n\t\tcompressor2.finalizeCreationRange(expansionIdRange);\n\t\tconst summary = compressor.serialize(false);\n\t\tconst summary2 = compressor2.serialize(false);\n\n\t\ttakeSnapshot(summary);\n\t\ttakeSnapshot(summary2, \"-client2\");\n\t});\n});\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"validateIdCompressorPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateIdCompressorPrevious.generated.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by \"flub generate typetests\" from @fluid-tools/build-cli.\n *\n * Baseline (previous) version: 2.92.0\n */\n\nimport type { TypeOnly, MinimalType, FullType, requireAssignableTo } from \"@fluidframework/build-tools\";\nimport type * as old from \"@fluidframework/id-compressor-previous/legacy\";\n\nimport type * as current from \"@fluidframework/id-compressor/legacy\";\n\ndeclare type MakeUnusedImportErrorsGoAway<T> = TypeOnly<T> | MinimalType<T> | FullType<T> | typeof old | typeof current | requireAssignableTo<true, true>;\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_createIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_createIdCompressor = requireAssignableTo<TypeOnly<typeof current.createIdCompressor>, TypeOnly<typeof old.createIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_createSessionId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_createSessionId = requireAssignableTo<TypeOnly<typeof current.createSessionId>, TypeOnly<typeof old.createSessionId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_deserializeIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_deserializeIdCompressor = requireAssignableTo<TypeOnly<typeof current.deserializeIdCompressor>, TypeOnly<typeof old.deserializeIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_serializeIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_serializeIdCompressor = requireAssignableTo<TypeOnly<typeof current.serializeIdCompressor>, TypeOnly<typeof old.serializeIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IdCreationRange\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_Interface_IdCreationRange = requireAssignableTo<TypeOnly<old.IdCreationRange>, TypeOnly<current.IdCreationRange>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IdCreationRange\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Interface_IdCreationRange = requireAssignableTo<TypeOnly<current.IdCreationRange>, TypeOnly<old.IdCreationRange>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressor\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_Interface_IIdCompressor = requireAssignableTo<TypeOnly<old.IIdCompressor>, TypeOnly<current.IIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Interface_IIdCompressor = requireAssignableTo<TypeOnly<current.IIdCompressor>, TypeOnly<old.IIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressorCore\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_Interface_IIdCompressorCore = requireAssignableTo<TypeOnly<old.IIdCompressorCore>, TypeOnly<current.IIdCompressorCore>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressorCore\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Interface_IIdCompressorCore = requireAssignableTo<TypeOnly<current.IIdCompressorCore>, TypeOnly<old.IIdCompressorCore>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_OpSpaceCompressedId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_OpSpaceCompressedId = requireAssignableTo<TypeOnly<old.OpSpaceCompressedId>, TypeOnly<current.OpSpaceCompressedId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_OpSpaceCompressedId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_OpSpaceCompressedId = requireAssignableTo<TypeOnly<current.OpSpaceCompressedId>, TypeOnly<old.OpSpaceCompressedId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressor\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressor = requireAssignableTo<TypeOnly<old.SerializedIdCompressor>, TypeOnly<current.SerializedIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressor = requireAssignableTo<TypeOnly<current.SerializedIdCompressor>, TypeOnly<old.SerializedIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithNoSession\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressorWithNoSession = requireAssignableTo<TypeOnly<old.SerializedIdCompressorWithNoSession>, TypeOnly<current.SerializedIdCompressorWithNoSession>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithNoSession\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressorWithNoSession = requireAssignableTo<TypeOnly<current.SerializedIdCompressorWithNoSession>, TypeOnly<old.SerializedIdCompressorWithNoSession>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithOngoingSession\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressorWithOngoingSession = requireAssignableTo<TypeOnly<old.SerializedIdCompressorWithOngoingSession>, TypeOnly<current.SerializedIdCompressorWithOngoingSession>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithOngoingSession\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressorWithOngoingSession = requireAssignableTo<TypeOnly<current.SerializedIdCompressorWithOngoingSession>, TypeOnly<old.SerializedIdCompressorWithOngoingSession>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SessionId = requireAssignableTo<TypeOnly<old.SessionId>, TypeOnly<current.SessionId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SessionId = requireAssignableTo<TypeOnly<current.SessionId>, TypeOnly<old.SessionId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionSpaceCompressedId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SessionSpaceCompressedId = requireAssignableTo<TypeOnly<old.SessionSpaceCompressedId>, TypeOnly<current.SessionSpaceCompressedId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionSpaceCompressedId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SessionSpaceCompressedId = requireAssignableTo<TypeOnly<current.SessionSpaceCompressedId>, TypeOnly<old.SessionSpaceCompressedId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_StableId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_StableId = requireAssignableTo<TypeOnly<old.StableId>, TypeOnly<current.StableId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_StableId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_StableId = requireAssignableTo<TypeOnly<current.StableId>, TypeOnly<old.StableId>>\n"]} | ||
| {"version":3,"file":"validateIdCompressorPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateIdCompressorPrevious.generated.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by \"flub generate typetests\" from @fluid-tools/build-cli.\n *\n * Baseline (previous) version: 2.92.0\n */\n\nimport type { TypeOnly, MinimalType, FullType, requireAssignableTo } from \"@fluidframework/build-tools\";\nimport type * as old from \"@fluidframework/id-compressor-previous/legacy\";\n\nimport type * as current from \"@fluidframework/id-compressor/legacy\";\n\ndeclare type MakeUnusedImportErrorsGoAway<T> = TypeOnly<T> | MinimalType<T> | FullType<T> | typeof old | typeof current | requireAssignableTo<true, true>;\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_createIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_createIdCompressor = requireAssignableTo<TypeOnly<typeof current.createIdCompressor>, TypeOnly<typeof old.createIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_createSessionId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_createSessionId = requireAssignableTo<TypeOnly<typeof current.createSessionId>, TypeOnly<typeof old.createSessionId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_deserializeIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_deserializeIdCompressor = requireAssignableTo<TypeOnly<typeof current.deserializeIdCompressor>, TypeOnly<typeof old.deserializeIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_serializeIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_serializeIdCompressor = requireAssignableTo<TypeOnly<typeof current.serializeIdCompressor>, TypeOnly<typeof old.serializeIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IdCreationRange\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_Interface_IdCreationRange = requireAssignableTo<TypeOnly<old.IdCreationRange>, TypeOnly<current.IdCreationRange>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IdCreationRange\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Interface_IdCreationRange = requireAssignableTo<TypeOnly<current.IdCreationRange>, TypeOnly<old.IdCreationRange>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressor\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_Interface_IIdCompressor = requireAssignableTo<TypeOnly<old.IIdCompressor>, TypeOnly<current.IIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Interface_IIdCompressor = requireAssignableTo<TypeOnly<current.IIdCompressor>, TypeOnly<old.IIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressorCore\": {\"forwardCompat\": false}\n */\n// @ts-expect-error compatibility expected to be broken\ndeclare type old_as_current_for_Interface_IIdCompressorCore = requireAssignableTo<TypeOnly<old.IIdCompressorCore>, TypeOnly<current.IIdCompressorCore>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressorCore\": {\"backCompat\": false}\n */\n// @ts-expect-error compatibility expected to be broken\ndeclare type current_as_old_for_Interface_IIdCompressorCore = requireAssignableTo<TypeOnly<current.IIdCompressorCore>, TypeOnly<old.IIdCompressorCore>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_OpSpaceCompressedId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_OpSpaceCompressedId = requireAssignableTo<TypeOnly<old.OpSpaceCompressedId>, TypeOnly<current.OpSpaceCompressedId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_OpSpaceCompressedId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_OpSpaceCompressedId = requireAssignableTo<TypeOnly<current.OpSpaceCompressedId>, TypeOnly<old.OpSpaceCompressedId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressor\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressor = requireAssignableTo<TypeOnly<old.SerializedIdCompressor>, TypeOnly<current.SerializedIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressor = requireAssignableTo<TypeOnly<current.SerializedIdCompressor>, TypeOnly<old.SerializedIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithNoSession\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressorWithNoSession = requireAssignableTo<TypeOnly<old.SerializedIdCompressorWithNoSession>, TypeOnly<current.SerializedIdCompressorWithNoSession>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithNoSession\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressorWithNoSession = requireAssignableTo<TypeOnly<current.SerializedIdCompressorWithNoSession>, TypeOnly<old.SerializedIdCompressorWithNoSession>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithOngoingSession\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressorWithOngoingSession = requireAssignableTo<TypeOnly<old.SerializedIdCompressorWithOngoingSession>, TypeOnly<current.SerializedIdCompressorWithOngoingSession>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithOngoingSession\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressorWithOngoingSession = requireAssignableTo<TypeOnly<current.SerializedIdCompressorWithOngoingSession>, TypeOnly<old.SerializedIdCompressorWithOngoingSession>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SessionId = requireAssignableTo<TypeOnly<old.SessionId>, TypeOnly<current.SessionId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SessionId = requireAssignableTo<TypeOnly<current.SessionId>, TypeOnly<old.SessionId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionSpaceCompressedId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SessionSpaceCompressedId = requireAssignableTo<TypeOnly<old.SessionSpaceCompressedId>, TypeOnly<current.SessionSpaceCompressedId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionSpaceCompressedId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SessionSpaceCompressedId = requireAssignableTo<TypeOnly<current.SessionSpaceCompressedId>, TypeOnly<old.SessionSpaceCompressedId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_StableId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_StableId = requireAssignableTo<TypeOnly<old.StableId>, TypeOnly<current.StableId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_StableId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_StableId = requireAssignableTo<TypeOnly<current.StableId>, TypeOnly<old.StableId>>\n"]} |
@@ -68,15 +68,3 @@ /*! | ||
| * | ||
| * @privateremarks To be made internal in 2.100.0 | ||
| * | ||
| * @deprecated `IIdCompressorCore` will be removed from the public API in 2.100.0. | ||
| * | ||
| * - If you use `serialize()`, use the free function | ||
| * {@link (serializeIdCompressor:1) | serializeIdCompressor(compressor, withSession)} instead. | ||
| * | ||
| * - `takeNextCreationRange`, `takeUnfinalizedCreationRange`, `finalizeCreationRange`, and | ||
| * `beginGhostSession` are internal runtime operations. External consumers should not call | ||
| * them directly. If you depend on these APIs, please file an issue on the FluidFramework | ||
| * repository describing your use case. | ||
| * | ||
| * @legacy @beta | ||
| * @internal | ||
| */ | ||
@@ -83,0 +71,0 @@ export interface IIdCompressorCore { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"idCompressor.d.ts","sourceRoot":"","sources":["../../src/types/idCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,mBAAmB,EACnB,SAAS,EACT,wBAAwB,EACxB,QAAQ,EACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACX,eAAe,EACf,mCAAmC,EACnC,wCAAwC,EACxC,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;;;OAMG;IACH,qBAAqB,IAAI,eAAe,CAAC;IAEzC;;;;;;;OAOG;IACH,4BAA4B,IAAI,eAAe,CAAC;IAE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IAE5B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,EAAE,wBAAwB,GAAG,QAAQ,CAAC;IAEnD;;;;;OAKG;IACH,UAAU,CAAC,YAAY,EAAE,QAAQ,GAAG,wBAAwB,CAAC;IAE7D;;;;OAIG;IACH,aAAa,CAAC,YAAY,EAAE,QAAQ,GAAG,wBAAwB,GAAG,SAAS,CAAC;CAC5E"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"idCompressor.js","sourceRoot":"","sources":["../../src/types/idCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tOpSpaceCompressedId,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"./identifiers.js\";\nimport type {\n\tIdCreationRange,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n} from \"./persisted-types/index.js\";\n\n/**\n * A distributed UUID generator and compressor.\n *\n * Generates arbitrary non-colliding v4 UUIDs, called stable IDs, for multiple \"sessions\" (which can be distributed across the network),\n * providing each session with the ability to map these UUIDs to `numbers`.\n *\n * A session is a unique identifier that denotes a single compressor. New IDs are created through a single compressor API\n * which should then sent in ranges to the server for total ordering (and are subsequently relayed to other clients). When a new ID is\n * created it is said to be created by the compressor's \"local\" session.\n *\n * For each stable ID created, two numeric IDs are provided by the compressor:\n *\n * 1. A session-local ID, which is stable for the lifetime of the session (which could be longer than that of the compressor object, as it may\n * be serialized for offline usage). Available as soon as the stable ID is allocated. These IDs are session-unique and are thus only\n * safely usable within the scope of the compressor that created it.\n *\n * 2. A final ID, which is stable across serialization and deserialization of an IdCompressor. Available as soon as the range containing\n * the corresponding session-local ID is totally ordered (via consensus) with respect to other sessions' allocations.\n * Final IDs are known to and publicly usable by any compressor that has received them.\n *\n * Compressors will allocate UUIDs in non-random ways to reduce entropy allowing for optimized storage of the data needed\n * to map the UUIDs to the numbers.\n *\n * The following invariants are upheld by IdCompressor:\n *\n * 1. Session-local IDs will always decompress to the same UUIDs for the lifetime of the session.\n *\n * 2. Final IDs will always decompress to the same UUIDs.\n *\n * 3. After a server-processed range of session-local IDs (from any session) is received by a compressor, any of those session-local IDs may be\n * translated by the compressor into the corresponding final ID. For any given session-local ID, this translation will always yield the\n * same final ID.\n *\n * 4. A UUID will always compress into the same session-local ID for the lifetime of the session.\n *\n * Session-local IDs are sent across the wire in efficiently-represented ranges. These ranges are created by querying the compressor, and *must*\n * be ordered (i.e. sent to the server) in the order they are created in order to preserve the above invariants.\n *\n * Session-local IDs can be used immediately after creation, but will eventually (after being sequenced) have a corresponding final ID. This\n * could make reasoning about equality of those two forms difficult. For example, if a cache is keyed off of a\n * session-local ID but is later queried using the final ID (which is semantically equal, as it decompresses to the same UUID/string) it will\n * produce a cache miss. In order to make using collections of both remotely created and locally created IDs easy, regardless of whether the\n * session-local IDs have been finalized, the compressor defines two \"spaces\" of IDs:\n *\n * 1. Session space: in this space, all IDs are normalized to their \"most local form\". This means that all IDs created by the local session\n * will be in local form, regardless of if they have been finalized. Remotely created IDs, which could only have been received after\n * finalizing and will never have a local form for the compressor, will of course be final IDs. This space should be used with consumer APIs\n * and data structures, as the lifetime of the IDs is guaranteed to be the same as the compressor object. Care must be taken to not use\n * these IDs across compressor objects, as the local IDs are specific to the compressor that created them.\n *\n * 2. Op space: in this space, all IDs are normalized to their \"most final form\". This means that all IDs except session-local IDs that\n * have not yet been finalized will be in final ID form. This space is useful for serialization in ops (e.g. references), as other clients\n * that receive them need not do any work to normalize them to *their* session-space in the common case. Note that IDs in op space may move\n * out of Op space over time, namely, when a session-local ID in this space becomes finalized, and thereafter has a \"more final form\".\n * Consequentially, it may be useful to restrict parameters of a persisted type to this space (to optimize perf), but it is potentially\n * incorrect to use this type for a runtime variable. This is an asymmetry that does not affect session space, as local IDs are always as\n * \"local as possible\".\n *\n * These two spaces naturally define a rule: consumers of compressed IDs should use session-space IDs, but serialized forms such as ops\n * should use op-space IDs.\n *\n * @privateremarks To be made internal in 2.100.0\n *\n * @deprecated `IIdCompressorCore` will be removed from the public API in 2.100.0.\n *\n * - If you use `serialize()`, use the free function\n * {@link (serializeIdCompressor:1) | serializeIdCompressor(compressor, withSession)} instead.\n *\n * - `takeNextCreationRange`, `takeUnfinalizedCreationRange`, `finalizeCreationRange`, and\n * `beginGhostSession` are internal runtime operations. External consumers should not call\n * them directly. If you depend on these APIs, please file an issue on the FluidFramework\n * repository describing your use case.\n *\n * @legacy @beta\n */\nexport interface IIdCompressorCore {\n\t/**\n\t * Returns a range of IDs created by this session in a format for sending to the server for finalizing.\n\t * The range will include all IDs generated via calls to `generateCompressedId` since the last time a\n\t * range was taken (via this method or `takeUnfinalizedCreationRange`).\n\t * @returns the range of IDs, which may be empty. This range must be sent to the server for ordering before\n\t * it is finalized. Ranges must be sent to the server in the order that they are taken via calls to this method.\n\t */\n\ttakeNextCreationRange(): IdCreationRange;\n\n\t/**\n\t * Returns a range of IDs created by this session in a format for sending to the server for finalizing.\n\t * The range will include all unfinalized IDs generated via calls to `generateCompressedId`.\n\t * @returns the range of IDs, which may be empty. This range must be sent to the server for ordering before\n\t * it is finalized. Ranges must be sent to the server in the order that they are taken via calls to this method.\n\t * Note: after finalizing the range returned by this method, finalizing any ranges that had been previously taken\n\t * will result in an error.\n\t */\n\ttakeUnfinalizedCreationRange(): IdCreationRange;\n\n\t/**\n\t * Resets the next creation range to include all unfinalized IDs.\n\t *\n\t * @remarks\n\t * IMPORTANT: This must only be called if it's CERTAIN that the unfinalized range will never be finalized as-is (e.g. by in-flight ops).\n\t *\n\t * After calling this, the next call to {@link IIdCompressorCore.takeNextCreationRange} will produce a range\n\t * covering all unfinalized IDs (equivalent to what {@link IIdCompressorCore.takeUnfinalizedCreationRange} would\n\t * have returned) plus any IDs generated after this call.\n\t *\n\t * Unlike {@link IIdCompressorCore.takeUnfinalizedCreationRange}, this method does not produce or return a range,\n\t * and does not advance the internal range counter. It is useful when the caller wants to\n\t * defer the actual range submission to the next natural {@link IIdCompressorCore.takeNextCreationRange} call.\n\t */\n\tresetUnfinalizedCreationRange(): void;\n\n\t/**\n\t * Finalizes the supplied range of IDs (which may be from either a remote or local session).\n\t * @param range - the range of session-local IDs to finalize.\n\t */\n\tfinalizeCreationRange(range: IdCreationRange): void;\n\n\t/**\n\t * Run a callback that is performed from the perspective of a special \"ghost\" session.\n\t * Any ids generated by this session will be immediately finalized on the local client as if\n\t * they were created by a remote client with `ghostSessionId`.\n\t *\n\t * *WARNING:* This API requires an external consensus mechanism to safely use:\n\t * In an attached container (i.e. multiple clients may have the document loaded), all clients must guarantee that:\n\t * - They invoke this API starting from the same finalized creation ranges\n\t * - This API is invoked with the same ghost session id\n\t * - `ghostSessionCallback` deterministically mints the same number of ids on each client within the ghost session\n\t * Failure to meet these requirement will result in divergence across clients and eventual consistency errors.\n\t * While the ghost sesion callback is running, IdCompressor does not support serialization.\n\t * @remarks This API is primarily intended for data migration scenarios which are able to deterministically transform\n\t * data in some format into data in a new format.\n\t * The first requirement (that all clients must invoke the API with the same finalized creation ranges) is guaranteed\n\t * for this scenario because the data transformation callback occurs at a specific ack within the op stream on all\n\t * clients, and clients don't finalize creation ranges for local changes they might have at this point in time.\n\t * @param ghostSessionId - The session id that minted ids generated within `ghostSessionCallback` should be attributed to.\n\t * @param ghostSessionCallback - Callback which mints ids attributed to the ghost session.\n\t */\n\tbeginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void;\n\n\t/**\n\t * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.\n\t * This includes finalized state as well as un-finalized state and is therefore suitable for use in offline scenarios.\n\t */\n\tserialize(withSession: true): SerializedIdCompressorWithOngoingSession;\n\n\t/**\n\t * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.\n\t * This only includes finalized state and is therefore suitable for use in summaries.\n\t */\n\tserialize(withSession: false): SerializedIdCompressorWithNoSession;\n}\n\n/**\n * A distributed UUID generator and compressor.\n * `IdCompressor` offers the ability to generate arbitrary non-colliding v4 UUIDs, called stable IDs, while compressing them into small integers\n * for efficient storage and transmission. It also provides the ability to decompress these integers back into their original UUIDs.\n *\n * The compressor is designed to be used in a distributed environment, where multiple clients may be generating IDs concurrently.\n * IDs generated by a compressor, via calls to `generateCompressedId`, are created in the compressor's \"local\" session.\n * These IDs are unique within the session, but may not be unique across sessions. In the context of Fluid, the scope of a session\n * is the same as the scope of a container. This means that anytime IDs are transferred between sessions, they must be translated\n * through a process called \"normalization\":\n * - The scope of a local session (in which local IDs are unique) is called the \"session space\" of the client.\n * - The context of persisted state (in Fluid, this is the context of ops and summaries) is called \"op space\".\n * - `SessionSpaceCompressedId`s, generated via calls to `generateCompressedId`, should NEVER be serialized directly.\n * In Fluid, this means they should not be included in ops or summaries.\n * - Before serialization, IDs must be normalized to op space to ensure they are interpretable by other clients.\n * - Upon receipt, IDs should be normalized back to session space before use.\n *\n * Example Usage:\n *\n * ### Client A (Sender)\n *\n * ```typescript\n * // Generate several local IDs\n * const localId1 = idCompressor.generateCompressedId();\n * const localId2 = idCompressor.generateCompressedId();\n * const localId3 = idCompressor.generateCompressedId();\n *\n * // Normalize these IDs to op space for inclusion in a message\n * const opSpaceId1 = idCompressor.normalizeToOpSpace(localId1);\n * const opSpaceId2 = idCompressor.normalizeToOpSpace(localId2);\n * const opSpaceId3 = idCompressor.normalizeToOpSpace(localId3);\n *\n * // Create and send a message containing these op space IDs along with the sender's session ID\n * // In Fluid, this would be an op or summary\n * const message = {\n * sessionID: idCompressor.localSessionId,\n * ids: [opSpaceId1, opSpaceId2, opSpaceId3]\n * };\n * ```\n *\n * ### Client B (Receiver)\n *\n * ```typescript\n * // Receive the message from Client A\n * const receivedMessage = ...; // In Fluid, this would be an op or summary\n *\n * // Normalize the received IDs back to session space, utilizing the sender's session ID\n * const sessionSpaceId1 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[0], receivedMessage.sessionID);\n * const sessionSpaceId2 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[1], receivedMessage.sessionID);\n * const sessionSpaceId3 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[2], receivedMessage.sessionID);\n * ```\n * @public\n */\nexport interface IIdCompressor {\n\t/**\n\t * The local session ID.\n\t */\n\tlocalSessionId: SessionId;\n\n\t/**\n\t * Generates a new compressed ID.\n\t * The returned ID is in session space and should not be serialized directly. See `IIdCompressor` for more details.\n\t * @returns A new local ID in session space.\n\t */\n\tgenerateCompressedId(): SessionSpaceCompressedId;\n\n\t/**\n\t * Generates a new ID that is guaranteed to be unique across all sessions known to this compressor without the need for any\n\t * normalization. The returned ID is not guaranteed to be a compressed ID (small number); it may be a stable ID (UUID string).\n\t * In Fluid, the likelihood of generating the bulkier stable ID is dictated by network conditions and is highly probably in\n\t * scenarios such as offline. This is still useful for use cases where simplicity is more important than performance and\n\t * this approach will often be superior to generating a UUID.\n\t * If small numbers are a requirement, `generateCompressedId` and normalization should be used instead.\n\t * See `IIdCompressor` for more details.\n\t * @returns A new local ID in session space.\n\t */\n\tgenerateDocumentUniqueId(): (SessionSpaceCompressedId & OpSpaceCompressedId) | StableId;\n\n\t/**\n\t * Normalizes a session space ID into op space.\n\t * The returned ID is in op space and can be safely serialized. However, it should be normalized back to session space before use.\n\t * See `IIdCompressor` for more details.\n\t * @param id - The local ID to normalize.\n\t * @returns The ID in op space.\n\t */\n\tnormalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;\n\n\t/**\n\t * Normalizes an ID into session space.\n\t * @param id - The ID to normalize.\n\t * @param originSessionId - The session from which `id` originated. This should be the ID of the client that normalized `id` to op space.\n\t * This means that it may not be the client that created `id` in the first place, but rather the client that serialized it.\n\t * This is an important distinction in the case of a reference, where a client might refer to an ID created by another client.\n\t * @returns The session-space ID in the local session corresponding to `id`.\n\t */\n\tnormalizeToSessionSpace(\n\t\tid: OpSpaceCompressedId,\n\t\toriginSessionId: SessionId,\n\t): SessionSpaceCompressedId;\n\n\t/**\n\t * Decompresses a previously compressed ID into a UUID.\n\t * @param id - The compressed ID to be decompressed.\n\t * @returns The UUID associated with the compressed ID.\n\t * @throws If the ID was not generated by any session known to this compressor.\n\t */\n\tdecompress(id: SessionSpaceCompressedId): StableId;\n\n\t/**\n\t * Recompresses a UUID.\n\t * @param uncompressed - The UUID to recompress.\n\t * @returns The `CompressedId` associated with `uncompressed`.\n\t * @throws If the UUID was not generated by any session known to this compressor.\n\t */\n\trecompress(uncompressed: StableId): SessionSpaceCompressedId;\n\n\t/**\n\t * Attempts to recompress a UUID.\n\t * @param uncompressed - The UUID to recompress.\n\t * @returns The `CompressedId` associated with `uncompressed` or undefined if the UUID was not generated by any session known to this compressor.\n\t */\n\ttryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;\n}\n"]} | ||
| {"version":3,"file":"idCompressor.js","sourceRoot":"","sources":["../../src/types/idCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tOpSpaceCompressedId,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"./identifiers.js\";\nimport type {\n\tIdCreationRange,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n} from \"./persisted-types/index.js\";\n\n/**\n * A distributed UUID generator and compressor.\n *\n * Generates arbitrary non-colliding v4 UUIDs, called stable IDs, for multiple \"sessions\" (which can be distributed across the network),\n * providing each session with the ability to map these UUIDs to `numbers`.\n *\n * A session is a unique identifier that denotes a single compressor. New IDs are created through a single compressor API\n * which should then sent in ranges to the server for total ordering (and are subsequently relayed to other clients). When a new ID is\n * created it is said to be created by the compressor's \"local\" session.\n *\n * For each stable ID created, two numeric IDs are provided by the compressor:\n *\n * 1. A session-local ID, which is stable for the lifetime of the session (which could be longer than that of the compressor object, as it may\n * be serialized for offline usage). Available as soon as the stable ID is allocated. These IDs are session-unique and are thus only\n * safely usable within the scope of the compressor that created it.\n *\n * 2. A final ID, which is stable across serialization and deserialization of an IdCompressor. Available as soon as the range containing\n * the corresponding session-local ID is totally ordered (via consensus) with respect to other sessions' allocations.\n * Final IDs are known to and publicly usable by any compressor that has received them.\n *\n * Compressors will allocate UUIDs in non-random ways to reduce entropy allowing for optimized storage of the data needed\n * to map the UUIDs to the numbers.\n *\n * The following invariants are upheld by IdCompressor:\n *\n * 1. Session-local IDs will always decompress to the same UUIDs for the lifetime of the session.\n *\n * 2. Final IDs will always decompress to the same UUIDs.\n *\n * 3. After a server-processed range of session-local IDs (from any session) is received by a compressor, any of those session-local IDs may be\n * translated by the compressor into the corresponding final ID. For any given session-local ID, this translation will always yield the\n * same final ID.\n *\n * 4. A UUID will always compress into the same session-local ID for the lifetime of the session.\n *\n * Session-local IDs are sent across the wire in efficiently-represented ranges. These ranges are created by querying the compressor, and *must*\n * be ordered (i.e. sent to the server) in the order they are created in order to preserve the above invariants.\n *\n * Session-local IDs can be used immediately after creation, but will eventually (after being sequenced) have a corresponding final ID. This\n * could make reasoning about equality of those two forms difficult. For example, if a cache is keyed off of a\n * session-local ID but is later queried using the final ID (which is semantically equal, as it decompresses to the same UUID/string) it will\n * produce a cache miss. In order to make using collections of both remotely created and locally created IDs easy, regardless of whether the\n * session-local IDs have been finalized, the compressor defines two \"spaces\" of IDs:\n *\n * 1. Session space: in this space, all IDs are normalized to their \"most local form\". This means that all IDs created by the local session\n * will be in local form, regardless of if they have been finalized. Remotely created IDs, which could only have been received after\n * finalizing and will never have a local form for the compressor, will of course be final IDs. This space should be used with consumer APIs\n * and data structures, as the lifetime of the IDs is guaranteed to be the same as the compressor object. Care must be taken to not use\n * these IDs across compressor objects, as the local IDs are specific to the compressor that created them.\n *\n * 2. Op space: in this space, all IDs are normalized to their \"most final form\". This means that all IDs except session-local IDs that\n * have not yet been finalized will be in final ID form. This space is useful for serialization in ops (e.g. references), as other clients\n * that receive them need not do any work to normalize them to *their* session-space in the common case. Note that IDs in op space may move\n * out of Op space over time, namely, when a session-local ID in this space becomes finalized, and thereafter has a \"more final form\".\n * Consequentially, it may be useful to restrict parameters of a persisted type to this space (to optimize perf), but it is potentially\n * incorrect to use this type for a runtime variable. This is an asymmetry that does not affect session space, as local IDs are always as\n * \"local as possible\".\n *\n * These two spaces naturally define a rule: consumers of compressed IDs should use session-space IDs, but serialized forms such as ops\n * should use op-space IDs.\n *\n * @internal\n */\nexport interface IIdCompressorCore {\n\t/**\n\t * Returns a range of IDs created by this session in a format for sending to the server for finalizing.\n\t * The range will include all IDs generated via calls to `generateCompressedId` since the last time a\n\t * range was taken (via this method or `takeUnfinalizedCreationRange`).\n\t * @returns the range of IDs, which may be empty. This range must be sent to the server for ordering before\n\t * it is finalized. Ranges must be sent to the server in the order that they are taken via calls to this method.\n\t */\n\ttakeNextCreationRange(): IdCreationRange;\n\n\t/**\n\t * Returns a range of IDs created by this session in a format for sending to the server for finalizing.\n\t * The range will include all unfinalized IDs generated via calls to `generateCompressedId`.\n\t * @returns the range of IDs, which may be empty. This range must be sent to the server for ordering before\n\t * it is finalized. Ranges must be sent to the server in the order that they are taken via calls to this method.\n\t * Note: after finalizing the range returned by this method, finalizing any ranges that had been previously taken\n\t * will result in an error.\n\t */\n\ttakeUnfinalizedCreationRange(): IdCreationRange;\n\n\t/**\n\t * Resets the next creation range to include all unfinalized IDs.\n\t *\n\t * @remarks\n\t * IMPORTANT: This must only be called if it's CERTAIN that the unfinalized range will never be finalized as-is (e.g. by in-flight ops).\n\t *\n\t * After calling this, the next call to {@link IIdCompressorCore.takeNextCreationRange} will produce a range\n\t * covering all unfinalized IDs (equivalent to what {@link IIdCompressorCore.takeUnfinalizedCreationRange} would\n\t * have returned) plus any IDs generated after this call.\n\t *\n\t * Unlike {@link IIdCompressorCore.takeUnfinalizedCreationRange}, this method does not produce or return a range,\n\t * and does not advance the internal range counter. It is useful when the caller wants to\n\t * defer the actual range submission to the next natural {@link IIdCompressorCore.takeNextCreationRange} call.\n\t */\n\tresetUnfinalizedCreationRange(): void;\n\n\t/**\n\t * Finalizes the supplied range of IDs (which may be from either a remote or local session).\n\t * @param range - the range of session-local IDs to finalize.\n\t */\n\tfinalizeCreationRange(range: IdCreationRange): void;\n\n\t/**\n\t * Run a callback that is performed from the perspective of a special \"ghost\" session.\n\t * Any ids generated by this session will be immediately finalized on the local client as if\n\t * they were created by a remote client with `ghostSessionId`.\n\t *\n\t * *WARNING:* This API requires an external consensus mechanism to safely use:\n\t * In an attached container (i.e. multiple clients may have the document loaded), all clients must guarantee that:\n\t * - They invoke this API starting from the same finalized creation ranges\n\t * - This API is invoked with the same ghost session id\n\t * - `ghostSessionCallback` deterministically mints the same number of ids on each client within the ghost session\n\t * Failure to meet these requirement will result in divergence across clients and eventual consistency errors.\n\t * While the ghost sesion callback is running, IdCompressor does not support serialization.\n\t * @remarks This API is primarily intended for data migration scenarios which are able to deterministically transform\n\t * data in some format into data in a new format.\n\t * The first requirement (that all clients must invoke the API with the same finalized creation ranges) is guaranteed\n\t * for this scenario because the data transformation callback occurs at a specific ack within the op stream on all\n\t * clients, and clients don't finalize creation ranges for local changes they might have at this point in time.\n\t * @param ghostSessionId - The session id that minted ids generated within `ghostSessionCallback` should be attributed to.\n\t * @param ghostSessionCallback - Callback which mints ids attributed to the ghost session.\n\t */\n\tbeginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void;\n\n\t/**\n\t * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.\n\t * This includes finalized state as well as un-finalized state and is therefore suitable for use in offline scenarios.\n\t */\n\tserialize(withSession: true): SerializedIdCompressorWithOngoingSession;\n\n\t/**\n\t * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.\n\t * This only includes finalized state and is therefore suitable for use in summaries.\n\t */\n\tserialize(withSession: false): SerializedIdCompressorWithNoSession;\n}\n\n/**\n * A distributed UUID generator and compressor.\n * `IdCompressor` offers the ability to generate arbitrary non-colliding v4 UUIDs, called stable IDs, while compressing them into small integers\n * for efficient storage and transmission. It also provides the ability to decompress these integers back into their original UUIDs.\n *\n * The compressor is designed to be used in a distributed environment, where multiple clients may be generating IDs concurrently.\n * IDs generated by a compressor, via calls to `generateCompressedId`, are created in the compressor's \"local\" session.\n * These IDs are unique within the session, but may not be unique across sessions. In the context of Fluid, the scope of a session\n * is the same as the scope of a container. This means that anytime IDs are transferred between sessions, they must be translated\n * through a process called \"normalization\":\n * - The scope of a local session (in which local IDs are unique) is called the \"session space\" of the client.\n * - The context of persisted state (in Fluid, this is the context of ops and summaries) is called \"op space\".\n * - `SessionSpaceCompressedId`s, generated via calls to `generateCompressedId`, should NEVER be serialized directly.\n * In Fluid, this means they should not be included in ops or summaries.\n * - Before serialization, IDs must be normalized to op space to ensure they are interpretable by other clients.\n * - Upon receipt, IDs should be normalized back to session space before use.\n *\n * Example Usage:\n *\n * ### Client A (Sender)\n *\n * ```typescript\n * // Generate several local IDs\n * const localId1 = idCompressor.generateCompressedId();\n * const localId2 = idCompressor.generateCompressedId();\n * const localId3 = idCompressor.generateCompressedId();\n *\n * // Normalize these IDs to op space for inclusion in a message\n * const opSpaceId1 = idCompressor.normalizeToOpSpace(localId1);\n * const opSpaceId2 = idCompressor.normalizeToOpSpace(localId2);\n * const opSpaceId3 = idCompressor.normalizeToOpSpace(localId3);\n *\n * // Create and send a message containing these op space IDs along with the sender's session ID\n * // In Fluid, this would be an op or summary\n * const message = {\n * sessionID: idCompressor.localSessionId,\n * ids: [opSpaceId1, opSpaceId2, opSpaceId3]\n * };\n * ```\n *\n * ### Client B (Receiver)\n *\n * ```typescript\n * // Receive the message from Client A\n * const receivedMessage = ...; // In Fluid, this would be an op or summary\n *\n * // Normalize the received IDs back to session space, utilizing the sender's session ID\n * const sessionSpaceId1 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[0], receivedMessage.sessionID);\n * const sessionSpaceId2 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[1], receivedMessage.sessionID);\n * const sessionSpaceId3 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[2], receivedMessage.sessionID);\n * ```\n * @public\n */\nexport interface IIdCompressor {\n\t/**\n\t * The local session ID.\n\t */\n\tlocalSessionId: SessionId;\n\n\t/**\n\t * Generates a new compressed ID.\n\t * The returned ID is in session space and should not be serialized directly. See `IIdCompressor` for more details.\n\t * @returns A new local ID in session space.\n\t */\n\tgenerateCompressedId(): SessionSpaceCompressedId;\n\n\t/**\n\t * Generates a new ID that is guaranteed to be unique across all sessions known to this compressor without the need for any\n\t * normalization. The returned ID is not guaranteed to be a compressed ID (small number); it may be a stable ID (UUID string).\n\t * In Fluid, the likelihood of generating the bulkier stable ID is dictated by network conditions and is highly probably in\n\t * scenarios such as offline. This is still useful for use cases where simplicity is more important than performance and\n\t * this approach will often be superior to generating a UUID.\n\t * If small numbers are a requirement, `generateCompressedId` and normalization should be used instead.\n\t * See `IIdCompressor` for more details.\n\t * @returns A new local ID in session space.\n\t */\n\tgenerateDocumentUniqueId(): (SessionSpaceCompressedId & OpSpaceCompressedId) | StableId;\n\n\t/**\n\t * Normalizes a session space ID into op space.\n\t * The returned ID is in op space and can be safely serialized. However, it should be normalized back to session space before use.\n\t * See `IIdCompressor` for more details.\n\t * @param id - The local ID to normalize.\n\t * @returns The ID in op space.\n\t */\n\tnormalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;\n\n\t/**\n\t * Normalizes an ID into session space.\n\t * @param id - The ID to normalize.\n\t * @param originSessionId - The session from which `id` originated. This should be the ID of the client that normalized `id` to op space.\n\t * This means that it may not be the client that created `id` in the first place, but rather the client that serialized it.\n\t * This is an important distinction in the case of a reference, where a client might refer to an ID created by another client.\n\t * @returns The session-space ID in the local session corresponding to `id`.\n\t */\n\tnormalizeToSessionSpace(\n\t\tid: OpSpaceCompressedId,\n\t\toriginSessionId: SessionId,\n\t): SessionSpaceCompressedId;\n\n\t/**\n\t * Decompresses a previously compressed ID into a UUID.\n\t * @param id - The compressed ID to be decompressed.\n\t * @returns The UUID associated with the compressed ID.\n\t * @throws If the ID was not generated by any session known to this compressor.\n\t */\n\tdecompress(id: SessionSpaceCompressedId): StableId;\n\n\t/**\n\t * Recompresses a UUID.\n\t * @param uncompressed - The UUID to recompress.\n\t * @returns The `CompressedId` associated with `uncompressed`.\n\t * @throws If the UUID was not generated by any session known to this compressor.\n\t */\n\trecompress(uncompressed: StableId): SessionSpaceCompressedId;\n\n\t/**\n\t * Attempts to recompress a UUID.\n\t * @param uncompressed - The UUID to recompress.\n\t * @returns The `CompressedId` associated with `uncompressed` or undefined if the UUID was not generated by any session known to this compressor.\n\t */\n\ttryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;\n}\n"]} |
+16
-11
| { | ||
| "name": "@fluidframework/id-compressor", | ||
| "version": "2.93.0", | ||
| "version": "2.100.0", | ||
| "description": "ID compressor", | ||
@@ -84,6 +84,6 @@ "homepage": "https://fluidframework.com", | ||
| "dependencies": { | ||
| "@fluid-internal/client-utils": "~2.93.0", | ||
| "@fluidframework/core-interfaces": "~2.93.0", | ||
| "@fluidframework/core-utils": "~2.93.0", | ||
| "@fluidframework/telemetry-utils": "~2.93.0", | ||
| "@fluid-internal/client-utils": "~2.100.0", | ||
| "@fluidframework/core-interfaces": "~2.100.0", | ||
| "@fluidframework/core-utils": "~2.100.0", | ||
| "@fluidframework/telemetry-utils": "~2.100.0", | ||
| "@tylerbu/sorted-btree-es6": "^2.1.1", | ||
@@ -95,8 +95,8 @@ "uuid": "^11.1.0" | ||
| "@biomejs/biome": "~2.4.5", | ||
| "@fluid-internal/mocha-test-setup": "~2.93.0", | ||
| "@fluid-private/stochastic-test-utils": "~2.93.0", | ||
| "@fluid-tools/benchmark": "^0.55.0", | ||
| "@fluid-tools/build-cli": "^0.64.0", | ||
| "@fluid-internal/mocha-test-setup": "~2.100.0", | ||
| "@fluid-private/stochastic-test-utils": "~2.100.0", | ||
| "@fluid-tools/benchmark": "^0.58.0", | ||
| "@fluid-tools/build-cli": "^0.65.0", | ||
| "@fluidframework/build-common": "^2.0.3", | ||
| "@fluidframework/build-tools": "^0.64.0", | ||
| "@fluidframework/build-tools": "^0.65.0", | ||
| "@fluidframework/eslint-config-fluid": "^9.0.0", | ||
@@ -119,3 +119,8 @@ "@fluidframework/id-compressor-previous": "npm:@fluidframework/id-compressor@2.92.0", | ||
| "typeValidation": { | ||
| "broken": {}, | ||
| "broken": { | ||
| "Interface_IIdCompressorCore": { | ||
| "forwardCompat": false, | ||
| "backCompat": false | ||
| } | ||
| }, | ||
| "entrypoint": "legacy" | ||
@@ -122,0 +127,0 @@ }, |
+17
-50
@@ -9,7 +9,10 @@ /*! | ||
| import { assert } from "@fluidframework/core-utils/internal"; | ||
| import type { TelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal"; | ||
| import { | ||
| type ITelemetryLoggerExt, | ||
| LoggingError, | ||
| createChildLogger, | ||
| extractTelemetryLoggerExt, | ||
| } from "@fluidframework/telemetry-utils/internal"; | ||
| // eslint-disable-next-line import-x/no-internal-modules -- Needed to avoid specialized /internal ITelemetryLoggerExt | ||
| import type { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/legacy"; | ||
@@ -44,3 +47,2 @@ import { FinalSpace } from "./finalSpace.js"; | ||
| IIdCompressor, | ||
| // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API | ||
| IIdCompressorCore, | ||
@@ -82,3 +84,2 @@ IdCreationRange, | ||
| */ | ||
| // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API | ||
| export class IdCompressor implements IIdCompressor, IIdCompressorCore { | ||
@@ -135,3 +136,3 @@ /** | ||
| localSessionIdOrDeserialized: SessionId | Sessions, | ||
| private readonly logger: ITelemetryLoggerExt | undefined, | ||
| private readonly logger: TelemetryLoggerExt | undefined, | ||
| ) { | ||
@@ -629,3 +630,3 @@ if (typeof localSessionIdOrDeserialized === "string") { | ||
| serialized: SerializedIdCompressorWithOngoingSession; | ||
| logger?: ITelemetryLoggerExt | undefined; | ||
| logger?: TelemetryLoggerExt | undefined; | ||
| newSessionId?: never; | ||
@@ -636,3 +637,3 @@ } | ||
| newSessionId: SessionId; | ||
| logger?: ITelemetryLoggerExt | undefined; | ||
| logger?: TelemetryLoggerExt | undefined; | ||
| }, | ||
@@ -664,3 +665,3 @@ ): IdCompressor { | ||
| sessionId: SessionId | undefined, | ||
| logger: ITelemetryLoggerExt | undefined, | ||
| logger: TelemetryLoggerExt | undefined, | ||
| ): IdCompressor { | ||
@@ -749,14 +750,5 @@ const hasLocalState = readBoolean(index); | ||
| * | ||
| * @remarks | ||
| * The returned compressor previously also implemented {@link IIdCompressorCore}, but that | ||
| * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return | ||
| * type in a future release. Consumers should type variables as {@link IIdCompressor} and | ||
| * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly. | ||
| * | ||
| * @legacy @beta | ||
| */ | ||
| export function createIdCompressor( | ||
| logger?: ITelemetryBaseLogger, | ||
| // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API | ||
| ): IIdCompressor & IIdCompressorCore; | ||
| export function createIdCompressor(logger?: ITelemetryBaseLogger): IIdCompressor; | ||
| /** | ||
@@ -766,8 +758,2 @@ * Create a new {@link IIdCompressor}. | ||
| * | ||
| * @remarks | ||
| * The returned compressor previously also implemented {@link IIdCompressorCore}, but that | ||
| * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return | ||
| * type in a future release. Consumers should type variables as {@link IIdCompressor} and | ||
| * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly. | ||
| * | ||
| * @legacy @beta | ||
@@ -778,8 +764,6 @@ */ | ||
| logger?: ITelemetryBaseLogger, | ||
| // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API | ||
| ): IIdCompressor & IIdCompressorCore; | ||
| ): IIdCompressor; | ||
| export function createIdCompressor( | ||
| sessionIdOrLogger?: SessionId | ITelemetryBaseLogger, | ||
| loggerOrUndefined?: ITelemetryBaseLogger, | ||
| // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API | ||
| ): IIdCompressor & IIdCompressorCore { | ||
@@ -809,8 +793,2 @@ let localSessionId: SessionId; | ||
| * | ||
| * @remarks | ||
| * The returned compressor previously also implemented {@link IIdCompressorCore}, but that | ||
| * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return | ||
| * type in a future release. Consumers should type variables as {@link IIdCompressor} and | ||
| * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly. | ||
| * | ||
| * @legacy @beta | ||
@@ -821,13 +799,6 @@ */ | ||
| logger?: ITelemetryLoggerExt, | ||
| // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API | ||
| ): IIdCompressor & IIdCompressorCore; | ||
| ): IIdCompressor; | ||
| /** | ||
| * Deserializes the supplied state into an ID compressor. | ||
| * | ||
| * @remarks | ||
| * The returned compressor previously also implemented {@link IIdCompressorCore}, but that | ||
| * interface is {@link IIdCompressorCore | deprecated} and will be removed from the return | ||
| * type in a future release. Consumers should type variables as {@link IIdCompressor} and | ||
| * use {@link (serializeIdCompressor:1)} for serialization instead of calling `serialize()` directly. | ||
| * | ||
| * @legacy @beta | ||
@@ -839,4 +810,3 @@ */ | ||
| logger?: ITelemetryLoggerExt, | ||
| // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API | ||
| ): IIdCompressor & IIdCompressorCore; | ||
| ): IIdCompressor; | ||
| export function deserializeIdCompressor( | ||
@@ -846,3 +816,2 @@ serialized: SerializedIdCompressor | SerializedIdCompressorWithNoSession, | ||
| loggerOrUndefined?: ITelemetryLoggerExt, | ||
| // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API | ||
| ): IIdCompressor & IIdCompressorCore { | ||
@@ -852,3 +821,3 @@ if (typeof sessionIdOrLogger === "string") { | ||
| serialized: serialized as SerializedIdCompressorWithNoSession, | ||
| logger: loggerOrUndefined, | ||
| logger: extractTelemetryLoggerExt<{ PossiblyUndefined: true }>(loggerOrUndefined), | ||
| newSessionId: sessionIdOrLogger, | ||
@@ -864,3 +833,3 @@ }); | ||
| serialized: serialized as SerializedIdCompressorWithOngoingSession, | ||
| logger: sessionIdOrLogger, | ||
| logger: extractTelemetryLoggerExt<{ PossiblyUndefined: true }>(sessionIdOrLogger), | ||
| }); | ||
@@ -905,5 +874,5 @@ } | ||
| * always implement both {@link IIdCompressor} and {@link IIdCompressorCore}, but their | ||
| * return types will be narrowed to {@link IIdCompressor} to keep {@link IIdCompressorCore} | ||
| * out of the `@legacy` API surface. Internal consumers that need access to core | ||
| * compressor operations (serialization, range management, etc.) should use this function. | ||
| * public return type is narrowed to {@link IIdCompressor}. Internal consumers that | ||
| * need access to core compressor operations (serialization, range management, etc.) | ||
| * use this function to recover the {@link IIdCompressorCore} surface. | ||
| * | ||
@@ -917,3 +886,2 @@ * @param compressor - A compressor created by `createIdCompressor` or | ||
| compressor: IIdCompressor, | ||
| // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API | ||
| ): IIdCompressor & IIdCompressorCore { | ||
@@ -924,4 +892,3 @@ assert( | ||
| ); | ||
| // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API | ||
| return compressor as IIdCompressor & IIdCompressorCore; | ||
| } |
@@ -9,2 +9,2 @@ /*! | ||
| export const pkgName = "@fluidframework/id-compressor"; | ||
| export const pkgVersion = "2.93.0"; | ||
| export const pkgVersion = "2.100.0"; |
@@ -33,2 +33,3 @@ /*! | ||
| createIdCompressor, | ||
| toIdCompressorWithCore, | ||
| } from "../index.js"; | ||
@@ -1091,3 +1092,3 @@ import { SessionSpaceNormalizer } from "../sessionSpaceNormalizer.js"; | ||
| (compressor as IdCompressor).startGhostSession(sessionId); | ||
| return compressor; | ||
| return toIdCompressorWithCore(compressor); | ||
| } |
@@ -99,2 +99,3 @@ /*! | ||
| */ | ||
| // @ts-expect-error compatibility expected to be broken | ||
| declare type old_as_current_for_Interface_IIdCompressorCore = requireAssignableTo<TypeOnly<old.IIdCompressorCore>, TypeOnly<current.IIdCompressorCore>> | ||
@@ -109,2 +110,3 @@ | ||
| */ | ||
| // @ts-expect-error compatibility expected to be broken | ||
| declare type current_as_old_for_Interface_IIdCompressorCore = requireAssignableTo<TypeOnly<current.IIdCompressorCore>, TypeOnly<old.IIdCompressorCore>> | ||
@@ -111,0 +113,0 @@ |
@@ -79,15 +79,3 @@ /*! | ||
| * | ||
| * @privateremarks To be made internal in 2.100.0 | ||
| * | ||
| * @deprecated `IIdCompressorCore` will be removed from the public API in 2.100.0. | ||
| * | ||
| * - If you use `serialize()`, use the free function | ||
| * {@link (serializeIdCompressor:1) | serializeIdCompressor(compressor, withSession)} instead. | ||
| * | ||
| * - `takeNextCreationRange`, `takeUnfinalizedCreationRange`, `finalizeCreationRange`, and | ||
| * `beginGhostSession` are internal runtime operations. External consumers should not call | ||
| * them directly. If you depend on these APIs, please file an issue on the FluidFramework | ||
| * repository describing your use case. | ||
| * | ||
| * @legacy @beta | ||
| * @internal | ||
| */ | ||
@@ -94,0 +82,0 @@ export interface IIdCompressorCore { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1457730
-0.31%11764
-0.99%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed