@fluidframework/id-compressor 2.0.0-internal.7.4.0 → 2.0.0-internal.8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-report/id-compressor.api.md +1 -5
  3. package/dist/id-compressor-alpha.d.ts +20 -11
  4. package/dist/id-compressor-beta.d.ts +0 -2
  5. package/dist/id-compressor-public.d.ts +0 -2
  6. package/dist/id-compressor-untrimmed.d.ts +20 -16
  7. package/dist/idCompressor.d.ts +8 -9
  8. package/dist/idCompressor.d.ts.map +1 -1
  9. package/dist/idCompressor.js +25 -32
  10. package/dist/idCompressor.js.map +1 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1 -3
  14. package/dist/index.js.map +1 -1
  15. package/dist/packageVersion.d.ts +1 -1
  16. package/dist/packageVersion.js +1 -1
  17. package/dist/packageVersion.js.map +1 -1
  18. package/dist/types/index.d.ts +1 -1
  19. package/dist/types/index.d.ts.map +1 -1
  20. package/dist/types/index.js +0 -3
  21. package/dist/types/index.js.map +1 -1
  22. package/dist/types/persisted-types/0.0.1.d.ts +12 -6
  23. package/dist/types/persisted-types/0.0.1.d.ts.map +1 -1
  24. package/dist/types/persisted-types/0.0.1.js +0 -7
  25. package/dist/types/persisted-types/0.0.1.js.map +1 -1
  26. package/dist/types/persisted-types/index.d.ts +1 -1
  27. package/dist/types/persisted-types/index.d.ts.map +1 -1
  28. package/dist/types/persisted-types/index.js +0 -3
  29. package/dist/types/persisted-types/index.js.map +1 -1
  30. package/lib/id-compressor-alpha.d.ts +20 -11
  31. package/lib/id-compressor-beta.d.ts +0 -2
  32. package/lib/id-compressor-public.d.ts +0 -2
  33. package/lib/id-compressor-untrimmed.d.ts +20 -16
  34. package/lib/idCompressor.d.ts +8 -9
  35. package/lib/idCompressor.d.ts.map +1 -1
  36. package/lib/idCompressor.js +25 -32
  37. package/lib/idCompressor.js.map +1 -1
  38. package/lib/index.d.ts +1 -1
  39. package/lib/index.d.ts.map +1 -1
  40. package/lib/index.js +0 -1
  41. package/lib/index.js.map +1 -1
  42. package/lib/packageVersion.d.ts +1 -1
  43. package/lib/packageVersion.js +1 -1
  44. package/lib/packageVersion.js.map +1 -1
  45. package/lib/types/index.d.ts +1 -1
  46. package/lib/types/index.d.ts.map +1 -1
  47. package/lib/types/index.js +1 -1
  48. package/lib/types/index.js.map +1 -1
  49. package/lib/types/persisted-types/0.0.1.d.ts +12 -6
  50. package/lib/types/persisted-types/0.0.1.d.ts.map +1 -1
  51. package/lib/types/persisted-types/0.0.1.js +1 -6
  52. package/lib/types/persisted-types/0.0.1.js.map +1 -1
  53. package/lib/types/persisted-types/index.d.ts +1 -1
  54. package/lib/types/persisted-types/index.d.ts.map +1 -1
  55. package/lib/types/persisted-types/index.js +1 -1
  56. package/lib/types/persisted-types/index.js.map +1 -1
  57. package/package.json +7 -7
  58. package/src/idCompressor.ts +28 -32
  59. package/src/index.ts +0 -1
  60. package/src/packageVersion.ts +1 -1
  61. package/src/types/index.ts +0 -1
  62. package/src/types/persisted-types/0.0.1.ts +14 -7
  63. package/src/types/persisted-types/index.ts +0 -1
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/id-compressor";
11
- exports.pkgVersion = "2.0.0-internal.7.4.0";
11
+ exports.pkgVersion = "2.0.0-internal.8.0.0";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
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,sBAAsB,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.0.0-internal.7.4.0\";\n"]}
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,sBAAsB,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.0.0-internal.8.0.0\";\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { IdCreationRange, SerializedIdCompressor, SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession, initialClusterCapacity, } from "./persisted-types";
5
+ export { IdCreationRange, SerializedIdCompressor, SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession, } from "./persisted-types";
6
6
  export { IIdCompressorCore, IIdCompressor } from "./idCompressor";
7
7
  export { SessionSpaceCompressedId, OpSpaceCompressedId, SessionId, StableId } from "./identifiers";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,eAAe,EACf,sBAAsB,EACtB,mCAAmC,EACnC,wCAAwC,EACxC,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,eAAe,EACf,sBAAsB,EACtB,mCAAmC,EACnC,wCAAwC,GACxC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
@@ -4,7 +4,4 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.initialClusterCapacity = void 0;
8
- var persisted_types_1 = require("./persisted-types");
9
- Object.defineProperty(exports, "initialClusterCapacity", { enumerable: true, get: function () { return persisted_types_1.initialClusterCapacity; } });
10
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qDAM2B;AAD1B,yHAAA,sBAAsB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tIdCreationRange,\n\tSerializedIdCompressor,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n\tinitialClusterCapacity,\n} from \"./persisted-types\";\n\nexport { IIdCompressorCore, IIdCompressor } from \"./idCompressor\";\n\nexport { SessionSpaceCompressedId, OpSpaceCompressedId, SessionId, StableId } from \"./identifiers\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tIdCreationRange,\n\tSerializedIdCompressor,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n} from \"./persisted-types\";\n\nexport { IIdCompressorCore, IIdCompressor } from \"./idCompressor\";\n\nexport { SessionSpaceCompressedId, OpSpaceCompressedId, SessionId, StableId } from \"./identifiers\";\n"]}
@@ -33,14 +33,20 @@ export type SerializedIdCompressorWithOngoingSession = SerializedIdCompressor &
33
33
  export interface IdCreationRange {
34
34
  readonly sessionId: SessionId;
35
35
  readonly ids?: {
36
+ /**
37
+ * The gen count of the first ID in the range created by `sessionId.`
38
+ */
36
39
  readonly firstGenCount: number;
40
+ /**
41
+ * The number of IDs created in the range created by `sessionId.`
42
+ */
37
43
  readonly count: number;
44
+ /**
45
+ * The size of the ID cluster to create if `count` overflows the existing cluster for
46
+ * `sessionId`, if one exists. This request will be respected, and the size of the cluster
47
+ * will be equal to overflow + `requestedClusterSize`.
48
+ */
49
+ readonly requestedClusterSize: number;
38
50
  };
39
51
  }
40
- /**
41
- * Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.
42
- * This value must *NOT* change without careful consideration to compatibility.
43
- * @internal
44
- */
45
- export declare const initialClusterCapacity = 512;
46
52
  //# sourceMappingURL=0.0.1.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"0.0.1.d.ts","sourceRoot":"","sources":["../../../src/types/persisted-types/0.0.1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG;IAC7C,QAAQ,CAAC,uBAAuB,EAAE,sCAAsC,CAAC;CACzE,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,mCAAmC,GAAG,sBAAsB,GAAG;IAC1E,QAAQ,CAAC,aAAa,EAAE,sCAAsC,CAAC;CAC/D,CAAC;AAEF;;;GAGG;AACH,MAAM,M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licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.initialClusterCapacity = void 0;
8
- /**
9
- * Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.
10
- * This value must *NOT* change without careful consideration to compatibility.
11
- * @internal
12
- */
13
- exports.initialClusterCapacity = 512;
14
7
  //# sourceMappingURL=0.0.1.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"0.0.1.js","sourceRoot":"","sources":["../../../src/types/persisted-types/0.0.1.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA0CH;;;;GAIG;AACU,QAAA,sBAAsB,GAAG,GAAG,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SessionId } from \"../identifiers\";\n\n/**\n * The serialized contents of an IdCompressor, suitable for persistence in a summary.\n * @alpha\n */\nexport type SerializedIdCompressor = string & {\n\treadonly _serializedIdCompressor: \"8c73c57c-1cf4-4278-8915-6444cb4f6af5\";\n};\n\n/**\n * The serialized contents of an IdCompressor, suitable for persistence in a summary.\n * @alpha\n */\nexport type SerializedIdCompressorWithNoSession = SerializedIdCompressor & {\n\treadonly _noLocalState: \"3aa2e1e8-cc28-4ea7-bc1a-a11dc3f26dfb\";\n};\n\n/**\n * The serialized contents of an IdCompressor, suitable for persistence in a summary.\n * @alpha\n */\nexport type SerializedIdCompressorWithOngoingSession = SerializedIdCompressor & {\n\treadonly _hasLocalState: \"1281acae-6d14-47e7-bc92-71c8ee0819cb\";\n};\n\n/**\n * Data describing a range of session-local IDs (from a remote or local session).\n *\n * A range is composed of local IDs that were generated.\n * @alpha\n */\nexport interface IdCreationRange {\n\treadonly sessionId: SessionId;\n\treadonly ids?: {\n\t\treadonly firstGenCount: number;\n\t\treadonly count: number;\n\t};\n}\n\n/**\n * Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.\n * This value must *NOT* change without careful consideration to compatibility.\n * @internal\n */\nexport const initialClusterCapacity = 512;\n"]}
1
+ {"version":3,"file":"0.0.1.js","sourceRoot":"","sources":["../../../src/types/persisted-types/0.0.1.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 { SessionId } from \"../identifiers\";\n\n/**\n * The serialized contents of an IdCompressor, suitable for persistence in a summary.\n * @alpha\n */\nexport type SerializedIdCompressor = string & {\n\treadonly _serializedIdCompressor: \"8c73c57c-1cf4-4278-8915-6444cb4f6af5\";\n};\n\n/**\n * The serialized contents of an IdCompressor, suitable for persistence in a summary.\n * @alpha\n */\nexport type SerializedIdCompressorWithNoSession = SerializedIdCompressor & {\n\treadonly _noLocalState: \"3aa2e1e8-cc28-4ea7-bc1a-a11dc3f26dfb\";\n};\n\n/**\n * The serialized contents of an IdCompressor, suitable for persistence in a summary.\n * @alpha\n */\nexport type SerializedIdCompressorWithOngoingSession = SerializedIdCompressor & {\n\treadonly _hasLocalState: \"1281acae-6d14-47e7-bc92-71c8ee0819cb\";\n};\n\n/**\n * Data describing a range of session-local IDs (from a remote or local session).\n *\n * A range is composed of local IDs that were generated.\n * @alpha\n */\nexport interface IdCreationRange {\n\treadonly sessionId: SessionId;\n\treadonly ids?: {\n\t\t/**\n\t\t * The gen count of the first ID in the range created by `sessionId.`\n\t\t */\n\t\treadonly firstGenCount: number;\n\n\t\t/**\n\t\t * The number of IDs created in the range created by `sessionId.`\n\t\t */\n\t\treadonly count: number;\n\n\t\t/**\n\t\t * The size of the ID cluster to create if `count` overflows the existing cluster for\n\t\t * `sessionId`, if one exists. This request will be respected, and the size of the cluster\n\t\t * will be equal to overflow + `requestedClusterSize`.\n\t\t */\n\t\treadonly requestedClusterSize: number;\n\t};\n}\n"]}
@@ -2,5 +2,5 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { IdCreationRange, SerializedIdCompressor, SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession, initialClusterCapacity, } from "./0.0.1";
5
+ export { IdCreationRange, SerializedIdCompressor, SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession, } from "./0.0.1";
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/persisted-types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,eAAe,EACf,sBAAsB,EACtB,mCAAmC,EACnC,wCAAwC,EACxC,sBAAsB,GACtB,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/persisted-types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,eAAe,EACf,sBAAsB,EACtB,mCAAmC,EACnC,wCAAwC,GACxC,MAAM,SAAS,CAAC"}
@@ -4,7 +4,4 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.initialClusterCapacity = void 0;
8
- var _0_0_1_1 = require("./0.0.1");
9
- Object.defineProperty(exports, "initialClusterCapacity", { enumerable: true, get: function () { return _0_0_1_1.initialClusterCapacity; } });
10
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/persisted-types/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kCAMiB;AADhB,gHAAA,sBAAsB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tIdCreationRange,\n\tSerializedIdCompressor,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n\tinitialClusterCapacity,\n} from \"./0.0.1\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/persisted-types/index.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tIdCreationRange,\n\tSerializedIdCompressor,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n} from \"./0.0.1\";\n"]}
@@ -54,9 +54,15 @@ export declare class IdCompressor implements IIdCompressor, IIdCompressorCore {
54
54
  private readonly normalizer;
55
55
  private localGenCount;
56
56
  private nextRangeBaseGenCount;
57
- private newClusterCapacity;
58
57
  private readonly sessions;
59
58
  private readonly finalSpace;
59
+ /**
60
+ * Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.
61
+ * Eventually, this can be adjusted dynamically to have cluster reservation policies that
62
+ * optimize the number of eager finals.
63
+ * It is not readonly as it is accessed by tests for clear-box testing.
64
+ */
65
+ private nextRequestedClusterSize;
60
66
  private telemetryLocalIdCount;
61
67
  private telemetryEagerFinalIdCount;
62
68
  private constructor();
@@ -68,17 +74,10 @@ export declare class IdCompressor implements IIdCompressor, IIdCompressorCore {
68
74
  * @deprecated Use `createIdCompressor` instead.
69
75
  */
70
76
  static create(sessionId: SessionId, logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore;
71
- /**
72
- * The size of each newly created ID cluster.
73
- *
74
- * @remarks Must only be set with a value upon which consensus has been reached.
75
- * Value must be greater than zero and less than {@link IdCompressor.maxClusterSize}.
76
- */
77
- get clusterCapacity(): number;
78
- set clusterCapacity(value: number);
79
77
  generateCompressedId(): SessionSpaceCompressedId;
80
78
  private generateNextLocalId;
81
79
  takeNextCreationRange(): IdCreationRange;
80
+ private static assertValidRange;
82
81
  finalizeCreationRange(range: IdCreationRange): void;
83
82
  private addEmptyCluster;
84
83
  normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;
@@ -102,8 +101,20 @@ export declare class IdCompressor implements IIdCompressor, IIdCompressorCore {
102
101
  export declare interface IdCreationRange {
103
102
  readonly sessionId: SessionId;
104
103
  readonly ids?: {
104
+ /**
105
+ * The gen count of the first ID in the range created by `sessionId.`
106
+ */
105
107
  readonly firstGenCount: number;
108
+ /**
109
+ * The number of IDs created in the range created by `sessionId.`
110
+ */
106
111
  readonly count: number;
112
+ /**
113
+ * The size of the ID cluster to create if `count` overflows the existing cluster for
114
+ * `sessionId`, if one exists. This request will be respected, and the size of the cluster
115
+ * will be equal to overflow + `requestedClusterSize`.
116
+ */
117
+ readonly requestedClusterSize: number;
107
118
  };
108
119
  }
109
120
 
@@ -241,8 +252,6 @@ export declare interface IIdCompressorCore {
241
252
  serialize(withSession: false): SerializedIdCompressorWithNoSession;
242
253
  }
243
254
 
244
- /* Excluded from this release type: initialClusterCapacity */
245
-
246
255
  /* Excluded from this release type: isStableId */
247
256
 
248
257
  /**
@@ -18,8 +18,6 @@ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
18
18
 
19
19
  /* Excluded from this release type: IIdCompressorCore */
20
20
 
21
- /* Excluded from this release type: initialClusterCapacity */
22
-
23
21
  /* Excluded from this release type: isStableId */
24
22
 
25
23
  /* Excluded from this release type: ITelemetryBaseLogger */
@@ -18,8 +18,6 @@ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
18
18
 
19
19
  /* Excluded from this release type: IIdCompressorCore */
20
20
 
21
- /* Excluded from this release type: initialClusterCapacity */
22
-
23
21
  /* Excluded from this release type: isStableId */
24
22
 
25
23
  /* Excluded from this release type: ITelemetryBaseLogger */
@@ -62,9 +62,15 @@ export declare class IdCompressor implements IIdCompressor, IIdCompressorCore {
62
62
  private readonly normalizer;
63
63
  private localGenCount;
64
64
  private nextRangeBaseGenCount;
65
- private newClusterCapacity;
66
65
  private readonly sessions;
67
66
  private readonly finalSpace;
67
+ /**
68
+ * Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.
69
+ * Eventually, this can be adjusted dynamically to have cluster reservation policies that
70
+ * optimize the number of eager finals.
71
+ * It is not readonly as it is accessed by tests for clear-box testing.
72
+ */
73
+ private nextRequestedClusterSize;
68
74
  private telemetryLocalIdCount;
69
75
  private telemetryEagerFinalIdCount;
70
76
  private constructor();
@@ -76,17 +82,10 @@ export declare class IdCompressor implements IIdCompressor, IIdCompressorCore {
76
82
  * @deprecated Use `createIdCompressor` instead.
77
83
  */
78
84
  static create(sessionId: SessionId, logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore;
79
- /**
80
- * The size of each newly created ID cluster.
81
- *
82
- * @remarks Must only be set with a value upon which consensus has been reached.
83
- * Value must be greater than zero and less than {@link IdCompressor.maxClusterSize}.
84
- */
85
- get clusterCapacity(): number;
86
- set clusterCapacity(value: number);
87
85
  generateCompressedId(): SessionSpaceCompressedId;
88
86
  private generateNextLocalId;
89
87
  takeNextCreationRange(): IdCreationRange;
88
+ private static assertValidRange;
90
89
  finalizeCreationRange(range: IdCreationRange): void;
91
90
  private addEmptyCluster;
92
91
  normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;
@@ -110,8 +109,20 @@ export declare class IdCompressor implements IIdCompressor, IIdCompressorCore {
110
109
  export declare interface IdCreationRange {
111
110
  readonly sessionId: SessionId;
112
111
  readonly ids?: {
112
+ /**
113
+ * The gen count of the first ID in the range created by `sessionId.`
114
+ */
113
115
  readonly firstGenCount: number;
116
+ /**
117
+ * The number of IDs created in the range created by `sessionId.`
118
+ */
114
119
  readonly count: number;
120
+ /**
121
+ * The size of the ID cluster to create if `count` overflows the existing cluster for
122
+ * `sessionId`, if one exists. This request will be respected, and the size of the cluster
123
+ * will be equal to overflow + `requestedClusterSize`.
124
+ */
125
+ readonly requestedClusterSize: number;
115
126
  };
116
127
  }
117
128
 
@@ -249,13 +260,6 @@ export declare interface IIdCompressorCore {
249
260
  serialize(withSession: false): SerializedIdCompressorWithNoSession;
250
261
  }
251
262
 
252
- /**
253
- * Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.
254
- * This value must *NOT* change without careful consideration to compatibility.
255
- * @internal
256
- */
257
- export declare const initialClusterCapacity = 512;
258
-
259
263
  /**
260
264
  * Returns true iff the given string is a valid Version 4, variant 2 UUID
261
265
  * 'xxxxxxxx-xxxx-4xxx-vxxx-xxxxxxxxxxxx'
@@ -23,9 +23,15 @@ export declare class IdCompressor implements IIdCompressor, IIdCompressorCore {
23
23
  private readonly normalizer;
24
24
  private localGenCount;
25
25
  private nextRangeBaseGenCount;
26
- private newClusterCapacity;
27
26
  private readonly sessions;
28
27
  private readonly finalSpace;
28
+ /**
29
+ * Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.
30
+ * Eventually, this can be adjusted dynamically to have cluster reservation policies that
31
+ * optimize the number of eager finals.
32
+ * It is not readonly as it is accessed by tests for clear-box testing.
33
+ */
34
+ private nextRequestedClusterSize;
29
35
  private telemetryLocalIdCount;
30
36
  private telemetryEagerFinalIdCount;
31
37
  private constructor();
@@ -37,17 +43,10 @@ export declare class IdCompressor implements IIdCompressor, IIdCompressorCore {
37
43
  * @deprecated Use `createIdCompressor` instead.
38
44
  */
39
45
  static create(sessionId: SessionId, logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore;
40
- /**
41
- * The size of each newly created ID cluster.
42
- *
43
- * @remarks Must only be set with a value upon which consensus has been reached.
44
- * Value must be greater than zero and less than {@link IdCompressor.maxClusterSize}.
45
- */
46
- get clusterCapacity(): number;
47
- set clusterCapacity(value: number);
48
46
  generateCompressedId(): SessionSpaceCompressedId;
49
47
  private generateNextLocalId;
50
48
  takeNextCreationRange(): IdCreationRange;
49
+ private static assertValidRange;
51
50
  finalizeCreationRange(range: IdCreationRange): void;
52
51
  private addEmptyCluster;
53
52
  normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;
@@ -1 +1 @@
1
- {"version":3,"file":"idCompressor.d.ts","sourceRoot":"","sources":["../src/idCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAA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G,QAAQ;IAwClD,UAAU,CAAC,YAAY,EAAE,QAAQ,GAAG,wBAAwB;IAQ5D,aAAa,CAAC,YAAY,EAAE,QAAQ,GAAG,wBAAwB,GAAG,SAAS;IAwC3E,SAAS,CAAC,WAAW,EAAE,IAAI,GAAG,wCAAwC;IACtE,SAAS,CAAC,WAAW,EAAE,KAAK,GAAG,mCAAmC;WAuE3D,WAAW,CAAC,UAAU,EAAE,wCAAwC,GAAG,YAAY;WAC/E,WAAW,CACxB,UAAU,EAAE,mCAAmC,EAC/C,YAAY,EAAE,SAAS,GACrB,YAAY;IAyER,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,OAAO,GAAG,OAAO;CAgBvE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CACjC,MAAM,CAAC,EAAE,oBAAoB,GAC3B,aAAa,GAAG,iBAAiB,CAAC;AACrC;;;;GAIG;AACH,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,SAAS,EACpB,MAAM,CAAC,EAAE,oBAAoB,GAC3B,aAAa,GAAG,iBAAiB,CAAC;AAQrC;;;GAGG;AACH,wBAAgB,uBAAuB,CACtC,UAAU,EAAE,wCAAwC,GAClD,aAAa,GAAG,iBAAiB,CAAC;AACrC;;;GAGG;AACH,wBAAgB,uBAAuB,CACtC,UAAU,EAAE,mCAAmC,EAC/C,YAAY,EAAE,SAAS,GACrB,aAAa,GAAG,iBAAiB,CAAC"}
@@ -5,7 +5,6 @@
5
5
  import { assert } from "@fluidframework/core-utils";
6
6
  import { bufferToString, stringToBuffer } from "@fluid-internal/client-utils";
7
7
  import { createChildLogger } from "@fluidframework/telemetry-utils";
8
- import { initialClusterCapacity, } from "./types";
9
8
  import { isFinalId } from "./identifiers";
10
9
  import { createSessionId, localIdFromGenCount, genCountFromLocalId, numericUuidFromStableId, offsetNumericUuid, stableIdFromNumericUuid, subtractNumericUuids, } from "./utilities";
11
10
  import { readBoolean, readNumber, readNumericUuid, writeBoolean, writeNumber, writeNumericUuid, } from "./persistanceUtilities";
@@ -37,12 +36,18 @@ export class IdCompressor {
37
36
  // The gen count to be annotated on the range returned by the next call to `takeNextCreationRange`.
38
37
  // This is updated to be equal to `generatedIdCount` + 1 each time it is called.
39
38
  this.nextRangeBaseGenCount = 1;
40
- // The capacity of the next cluster to be created
41
- this.newClusterCapacity = initialClusterCapacity;
42
39
  this.sessions = new Sessions();
43
40
  this.finalSpace = new FinalSpace();
44
41
  // #endregion
45
- // #region Telemetry state
42
+ // #region Ephemeral state
43
+ /**
44
+ * Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.
45
+ * Eventually, this can be adjusted dynamically to have cluster reservation policies that
46
+ * optimize the number of eager finals.
47
+ * It is not readonly as it is accessed by tests for clear-box testing.
48
+ */
49
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly
50
+ this.nextRequestedClusterSize = 512;
46
51
  // The number of local IDs generated since the last telemetry was sent.
47
52
  this.telemetryLocalIdCount = 0;
48
53
  // The number of eager final IDs generated since the last telemetry was sent.
@@ -81,24 +86,6 @@ export class IdCompressor {
81
86
  const compressor = new IdCompressor(localSessionId, logger === undefined ? undefined : createChildLogger({ logger }));
82
87
  return compressor;
83
88
  }
84
- /**
85
- * The size of each newly created ID cluster.
86
- *
87
- * @remarks Must only be set with a value upon which consensus has been reached.
88
- * Value must be greater than zero and less than {@link IdCompressor.maxClusterSize}.
89
- */
90
- get clusterCapacity() {
91
- return this.newClusterCapacity;
92
- }
93
- set clusterCapacity(value) {
94
- if (value <= 0) {
95
- throw new Error("Clusters must have a positive capacity.");
96
- }
97
- if (value > IdCompressor.maxClusterSize) {
98
- throw new Error("Clusters must not exceed max cluster size.");
99
- }
100
- this.newClusterCapacity = value;
101
- }
102
89
  generateCompressedId() {
103
90
  this.localGenCount++;
104
91
  const lastCluster = this.localSession.getLastCluster();
@@ -139,19 +126,30 @@ export class IdCompressor {
139
126
  ids: {
140
127
  firstGenCount: this.nextRangeBaseGenCount,
141
128
  count,
129
+ requestedClusterSize: this.nextRequestedClusterSize,
142
130
  },
143
131
  };
144
132
  this.nextRangeBaseGenCount = this.localGenCount + 1;
133
+ IdCompressor.assertValidRange(range);
145
134
  return range;
146
135
  }
136
+ static assertValidRange(range) {
137
+ if (range.ids === undefined) {
138
+ return;
139
+ }
140
+ const { count, requestedClusterSize } = range.ids;
141
+ assert(count > 0, 0x755 /* Malformed ID Range. */);
142
+ assert(requestedClusterSize > 0, 0x876 /* Clusters must have a positive capacity. */);
143
+ assert(requestedClusterSize <= IdCompressor.maxClusterSize, 0x877 /* Clusters must not exceed max cluster size. */);
144
+ }
147
145
  finalizeCreationRange(range) {
148
146
  // Check if the range has IDs
149
147
  if (range.ids === undefined) {
150
148
  return;
151
149
  }
152
- assert(range.ids.count > 0, 0x755 /* Malformed ID Range. */);
150
+ IdCompressor.assertValidRange(range);
153
151
  const { sessionId, ids } = range;
154
- const { count, firstGenCount } = ids;
152
+ const { count, firstGenCount, requestedClusterSize } = ids;
155
153
  const session = this.sessions.getOrCreate(sessionId);
156
154
  const isLocal = session === this.localSession;
157
155
  const rangeBaseLocal = localIdFromGenCount(firstGenCount);
@@ -161,7 +159,7 @@ export class IdCompressor {
161
159
  if (rangeBaseLocal !== -1) {
162
160
  throw new Error("Ranges finalized out of order.");
163
161
  }
164
- lastCluster = this.addEmptyCluster(session, this.clusterCapacity + count);
162
+ lastCluster = this.addEmptyCluster(session, requestedClusterSize + count);
165
163
  if (isLocal) {
166
164
  this.logger?.sendTelemetryEvent({
167
165
  eventName: "RuntimeIdCompressor:FirstCluster",
@@ -179,7 +177,7 @@ export class IdCompressor {
179
177
  }
180
178
  else {
181
179
  const overflow = count - remainingCapacity;
182
- const newClaimedFinalCount = overflow + this.clusterCapacity;
180
+ const newClaimedFinalCount = overflow + requestedClusterSize;
183
181
  if (lastCluster === this.finalSpace.getLastCluster()) {
184
182
  // The last cluster in the sessions chain is the last cluster globally, so it can be expanded.
185
183
  lastCluster.capacity += newClaimedFinalCount;
@@ -379,7 +377,6 @@ export class IdCompressor {
379
377
  // Layout size, in 8 byte increments
380
378
  const totalSize = 1 + // version
381
379
  1 + // hasLocalState
382
- 1 + // cluster capacity
383
380
  1 + // session count
384
381
  1 + // cluster count
385
382
  sessionIndexMap.size * 2 + // session IDs
@@ -390,7 +387,6 @@ export class IdCompressor {
390
387
  let index = 0;
391
388
  index = writeNumber(serializedFloat, index, currentWrittenVersion);
392
389
  index = writeBoolean(serializedFloat, index, hasLocalState);
393
- index = writeNumber(serializedFloat, index, this.clusterCapacity);
394
390
  index = writeNumber(serializedFloat, index, sessionIndexMap.size);
395
391
  index = writeNumber(serializedFloat, index, finalSpace.clusters.length);
396
392
  for (const [session] of sessionIndexMap.entries()) {
@@ -429,7 +425,6 @@ export class IdCompressor {
429
425
  const version = readNumber(index);
430
426
  assert(version === currentWrittenVersion, 0x75c /* Unknown serialized version. */);
431
427
  const hasLocalState = readBoolean(index);
432
- const clusterCapacity = readNumber(index);
433
428
  const sessionCount = readNumber(index);
434
429
  const clusterCount = readNumber(index);
435
430
  // Sessions
@@ -450,7 +445,6 @@ export class IdCompressor {
450
445
  sessions.push([numeric, new Session(numeric)]);
451
446
  }
452
447
  const compressor = new IdCompressor(new Sessions(sessions));
453
- compressor.clusterCapacity = clusterCapacity;
454
448
  // Clusters
455
449
  let baseFinalId = 0;
456
450
  for (let i = 0; i < clusterCount; i++) {
@@ -483,8 +477,7 @@ export class IdCompressor {
483
477
  this.localGenCount !== other.localGenCount)) {
484
478
  return false;
485
479
  }
486
- return (this.newClusterCapacity === other.newClusterCapacity &&
487
- this.sessions.equals(other.sessions, includeLocalState) &&
480
+ return (this.sessions.equals(other.sessions, includeLocalState) &&
488
481
  this.finalSpace.equals(other.finalSpace));
489
482
  }
490
483
  }