@fluidframework/container-runtime 2.0.0-internal.7.3.0 → 2.0.0-internal.7.4.1

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 (264) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/api-extractor-lint.json +13 -0
  3. package/api-extractor.json +9 -1
  4. package/api-report/container-runtime.api.md +124 -107
  5. package/dist/blobManager.d.ts +4 -4
  6. package/dist/blobManager.d.ts.map +1 -1
  7. package/dist/blobManager.js.map +1 -1
  8. package/dist/container-runtime-alpha.d.ts +1473 -0
  9. package/dist/container-runtime-beta.d.ts +300 -0
  10. package/dist/container-runtime-public.d.ts +300 -0
  11. package/dist/container-runtime-untrimmed.d.ts +1836 -0
  12. package/dist/containerRuntime.d.ts +30 -30
  13. package/dist/containerRuntime.d.ts.map +1 -1
  14. package/dist/containerRuntime.js +62 -40
  15. package/dist/containerRuntime.js.map +1 -1
  16. package/dist/dataStoreRegistry.d.ts +1 -1
  17. package/dist/dataStoreRegistry.js +1 -1
  18. package/dist/dataStoreRegistry.js.map +1 -1
  19. package/dist/dataStores.d.ts +10 -15
  20. package/dist/dataStores.d.ts.map +1 -1
  21. package/dist/dataStores.js +77 -40
  22. package/dist/dataStores.js.map +1 -1
  23. package/dist/gc/garbageCollection.d.ts +41 -13
  24. package/dist/gc/garbageCollection.d.ts.map +1 -1
  25. package/dist/gc/garbageCollection.js +215 -78
  26. package/dist/gc/garbageCollection.js.map +1 -1
  27. package/dist/gc/gcConfigs.d.ts.map +1 -1
  28. package/dist/gc/gcConfigs.js +34 -37
  29. package/dist/gc/gcConfigs.js.map +1 -1
  30. package/dist/gc/gcDefinitions.d.ts +121 -46
  31. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  32. package/dist/gc/gcDefinitions.js +26 -18
  33. package/dist/gc/gcDefinitions.js.map +1 -1
  34. package/dist/gc/gcHelpers.d.ts +18 -25
  35. package/dist/gc/gcHelpers.d.ts.map +1 -1
  36. package/dist/gc/gcHelpers.js +29 -45
  37. package/dist/gc/gcHelpers.js.map +1 -1
  38. package/dist/gc/gcTelemetry.d.ts +0 -5
  39. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  40. package/dist/gc/gcTelemetry.js +14 -42
  41. package/dist/gc/gcTelemetry.js.map +1 -1
  42. package/dist/gc/gcUnreferencedStateTracker.d.ts +11 -5
  43. package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
  44. package/dist/gc/gcUnreferencedStateTracker.js +43 -19
  45. package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
  46. package/dist/gc/index.d.ts +1 -1
  47. package/dist/gc/index.d.ts.map +1 -1
  48. package/dist/gc/index.js +4 -5
  49. package/dist/gc/index.js.map +1 -1
  50. package/dist/index.d.ts +14 -2
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +16 -5
  53. package/dist/index.js.map +1 -1
  54. package/dist/messageTypes.d.ts +15 -7
  55. package/dist/messageTypes.d.ts.map +1 -1
  56. package/dist/messageTypes.js +6 -1
  57. package/dist/messageTypes.js.map +1 -1
  58. package/dist/opLifecycle/definitions.d.ts +1 -1
  59. package/dist/opLifecycle/definitions.js.map +1 -1
  60. package/dist/packageVersion.d.ts +1 -1
  61. package/dist/packageVersion.js +1 -1
  62. package/dist/packageVersion.js.map +1 -1
  63. package/dist/pendingStateManager.d.ts +1 -0
  64. package/dist/pendingStateManager.d.ts.map +1 -1
  65. package/dist/pendingStateManager.js +1 -0
  66. package/dist/pendingStateManager.js.map +1 -1
  67. package/dist/summary/orderedClientElection.d.ts +1 -1
  68. package/dist/summary/orderedClientElection.js.map +1 -1
  69. package/dist/summary/runWhileConnectedCoordinator.d.ts +2 -2
  70. package/dist/summary/runWhileConnectedCoordinator.js +1 -1
  71. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  72. package/dist/summary/summarizer.d.ts +1 -1
  73. package/dist/summary/summarizer.js +1 -1
  74. package/dist/summary/summarizer.js.map +1 -1
  75. package/dist/summary/summarizerTypes.d.ts +30 -30
  76. package/dist/summary/summarizerTypes.js.map +1 -1
  77. package/dist/summary/summaryCollection.d.ts +10 -10
  78. package/dist/summary/summaryCollection.js +1 -1
  79. package/dist/summary/summaryCollection.js.map +1 -1
  80. package/dist/summary/summaryFormat.d.ts +3 -3
  81. package/dist/summary/summaryFormat.js.map +1 -1
  82. package/lib/blobManager.d.ts +4 -4
  83. package/lib/blobManager.d.ts.map +1 -1
  84. package/lib/blobManager.js.map +1 -1
  85. package/lib/container-runtime-alpha.d.ts +1473 -0
  86. package/lib/container-runtime-beta.d.ts +300 -0
  87. package/lib/container-runtime-public.d.ts +300 -0
  88. package/lib/container-runtime-untrimmed.d.ts +1836 -0
  89. package/lib/containerRuntime.d.ts +30 -30
  90. package/lib/containerRuntime.d.ts.map +1 -1
  91. package/lib/containerRuntime.js +64 -42
  92. package/lib/containerRuntime.js.map +1 -1
  93. package/lib/dataStoreRegistry.d.ts +1 -1
  94. package/lib/dataStoreRegistry.js +1 -1
  95. package/lib/dataStoreRegistry.js.map +1 -1
  96. package/lib/dataStores.d.ts +10 -15
  97. package/lib/dataStores.d.ts.map +1 -1
  98. package/lib/dataStores.js +80 -43
  99. package/lib/dataStores.js.map +1 -1
  100. package/lib/gc/garbageCollection.d.ts +41 -13
  101. package/lib/gc/garbageCollection.d.ts.map +1 -1
  102. package/lib/gc/garbageCollection.js +217 -80
  103. package/lib/gc/garbageCollection.js.map +1 -1
  104. package/lib/gc/gcConfigs.d.ts.map +1 -1
  105. package/lib/gc/gcConfigs.js +37 -40
  106. package/lib/gc/gcConfigs.js.map +1 -1
  107. package/lib/gc/gcDefinitions.d.ts +121 -46
  108. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  109. package/lib/gc/gcDefinitions.js +25 -17
  110. package/lib/gc/gcDefinitions.js.map +1 -1
  111. package/lib/gc/gcHelpers.d.ts +18 -25
  112. package/lib/gc/gcHelpers.d.ts.map +1 -1
  113. package/lib/gc/gcHelpers.js +27 -43
  114. package/lib/gc/gcHelpers.js.map +1 -1
  115. package/lib/gc/gcTelemetry.d.ts +0 -5
  116. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  117. package/lib/gc/gcTelemetry.js +15 -43
  118. package/lib/gc/gcTelemetry.js.map +1 -1
  119. package/lib/gc/gcUnreferencedStateTracker.d.ts +11 -5
  120. package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
  121. package/lib/gc/gcUnreferencedStateTracker.js +43 -19
  122. package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
  123. package/lib/gc/index.d.ts +1 -1
  124. package/lib/gc/index.d.ts.map +1 -1
  125. package/lib/gc/index.js +1 -1
  126. package/lib/gc/index.js.map +1 -1
  127. package/lib/index.d.ts +14 -2
  128. package/lib/index.d.ts.map +1 -1
  129. package/lib/index.js +15 -1
  130. package/lib/index.js.map +1 -1
  131. package/lib/messageTypes.d.ts +15 -7
  132. package/lib/messageTypes.d.ts.map +1 -1
  133. package/lib/messageTypes.js +6 -1
  134. package/lib/messageTypes.js.map +1 -1
  135. package/lib/opLifecycle/definitions.d.ts +1 -1
  136. package/lib/opLifecycle/definitions.js.map +1 -1
  137. package/lib/packageVersion.d.ts +1 -1
  138. package/lib/packageVersion.js +1 -1
  139. package/lib/packageVersion.js.map +1 -1
  140. package/lib/pendingStateManager.d.ts +1 -0
  141. package/lib/pendingStateManager.d.ts.map +1 -1
  142. package/lib/pendingStateManager.js +1 -0
  143. package/lib/pendingStateManager.js.map +1 -1
  144. package/lib/summary/orderedClientElection.d.ts +1 -1
  145. package/lib/summary/orderedClientElection.js.map +1 -1
  146. package/lib/summary/runWhileConnectedCoordinator.d.ts +2 -2
  147. package/lib/summary/runWhileConnectedCoordinator.js +1 -1
  148. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
  149. package/lib/summary/summarizer.d.ts +1 -1
  150. package/lib/summary/summarizer.js +1 -1
  151. package/lib/summary/summarizer.js.map +1 -1
  152. package/lib/summary/summarizerTypes.d.ts +30 -30
  153. package/lib/summary/summarizerTypes.js.map +1 -1
  154. package/lib/summary/summaryCollection.d.ts +10 -10
  155. package/lib/summary/summaryCollection.js +1 -1
  156. package/lib/summary/summaryCollection.js.map +1 -1
  157. package/lib/summary/summaryFormat.d.ts +3 -3
  158. package/lib/summary/summaryFormat.js.map +1 -1
  159. package/package.json +42 -19
  160. package/src/blobManager.ts +5 -5
  161. package/src/containerRuntime.ts +86 -56
  162. package/src/dataStoreRegistry.ts +1 -1
  163. package/src/dataStores.ts +140 -69
  164. package/src/gc/garbageCollection.md +14 -15
  165. package/src/gc/garbageCollection.ts +256 -96
  166. package/src/gc/gcConfigs.ts +50 -52
  167. package/src/gc/gcDefinitions.ts +137 -52
  168. package/src/gc/gcHelpers.ts +31 -52
  169. package/src/gc/gcTelemetry.ts +16 -57
  170. package/src/gc/gcUnreferencedStateTracker.ts +61 -22
  171. package/src/gc/index.ts +6 -4
  172. package/src/index.ts +19 -1
  173. package/src/messageTypes.ts +19 -4
  174. package/src/opLifecycle/definitions.ts +1 -1
  175. package/src/packageVersion.ts +1 -1
  176. package/src/pendingStateManager.ts +1 -0
  177. package/src/summary/orderedClientElection.ts +1 -1
  178. package/src/summary/runWhileConnectedCoordinator.ts +2 -2
  179. package/src/summary/summarizer.ts +1 -1
  180. package/src/summary/summarizerTypes.ts +30 -30
  181. package/src/summary/summaryCollection.ts +10 -10
  182. package/src/summary/summaryFormat.ts +3 -3
  183. package/dist/id-compressor/appendOnlySortedMap.d.ts +0 -124
  184. package/dist/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
  185. package/dist/id-compressor/appendOnlySortedMap.js +0 -318
  186. package/dist/id-compressor/appendOnlySortedMap.js.map +0 -1
  187. package/dist/id-compressor/finalSpace.d.ts +0 -29
  188. package/dist/id-compressor/finalSpace.d.ts.map +0 -1
  189. package/dist/id-compressor/finalSpace.js +0 -62
  190. package/dist/id-compressor/finalSpace.js.map +0 -1
  191. package/dist/id-compressor/idCompressor.d.ts +0 -54
  192. package/dist/id-compressor/idCompressor.d.ts.map +0 -1
  193. package/dist/id-compressor/idCompressor.js +0 -495
  194. package/dist/id-compressor/idCompressor.js.map +0 -1
  195. package/dist/id-compressor/identifiers.d.ts +0 -32
  196. package/dist/id-compressor/identifiers.d.ts.map +0 -1
  197. package/dist/id-compressor/identifiers.js +0 -15
  198. package/dist/id-compressor/identifiers.js.map +0 -1
  199. package/dist/id-compressor/index.d.ts +0 -13
  200. package/dist/id-compressor/index.d.ts.map +0 -1
  201. package/dist/id-compressor/index.js +0 -32
  202. package/dist/id-compressor/index.js.map +0 -1
  203. package/dist/id-compressor/persistanceUtilities.d.ts +0 -22
  204. package/dist/id-compressor/persistanceUtilities.d.ts.map +0 -1
  205. package/dist/id-compressor/persistanceUtilities.js +0 -43
  206. package/dist/id-compressor/persistanceUtilities.js.map +0 -1
  207. package/dist/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
  208. package/dist/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
  209. package/dist/id-compressor/sessionSpaceNormalizer.js +0 -80
  210. package/dist/id-compressor/sessionSpaceNormalizer.js.map +0 -1
  211. package/dist/id-compressor/sessions.d.ts +0 -115
  212. package/dist/id-compressor/sessions.d.ts.map +0 -1
  213. package/dist/id-compressor/sessions.js +0 -305
  214. package/dist/id-compressor/sessions.js.map +0 -1
  215. package/dist/id-compressor/utilities.d.ts +0 -52
  216. package/dist/id-compressor/utilities.d.ts.map +0 -1
  217. package/dist/id-compressor/utilities.js +0 -169
  218. package/dist/id-compressor/utilities.js.map +0 -1
  219. package/lib/id-compressor/appendOnlySortedMap.d.ts +0 -124
  220. package/lib/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
  221. package/lib/id-compressor/appendOnlySortedMap.js +0 -314
  222. package/lib/id-compressor/appendOnlySortedMap.js.map +0 -1
  223. package/lib/id-compressor/finalSpace.d.ts +0 -29
  224. package/lib/id-compressor/finalSpace.d.ts.map +0 -1
  225. package/lib/id-compressor/finalSpace.js +0 -58
  226. package/lib/id-compressor/finalSpace.js.map +0 -1
  227. package/lib/id-compressor/idCompressor.d.ts +0 -54
  228. package/lib/id-compressor/idCompressor.d.ts.map +0 -1
  229. package/lib/id-compressor/idCompressor.js +0 -491
  230. package/lib/id-compressor/idCompressor.js.map +0 -1
  231. package/lib/id-compressor/identifiers.d.ts +0 -32
  232. package/lib/id-compressor/identifiers.d.ts.map +0 -1
  233. package/lib/id-compressor/identifiers.js +0 -11
  234. package/lib/id-compressor/identifiers.js.map +0 -1
  235. package/lib/id-compressor/index.d.ts +0 -13
  236. package/lib/id-compressor/index.d.ts.map +0 -1
  237. package/lib/id-compressor/index.js +0 -13
  238. package/lib/id-compressor/index.js.map +0 -1
  239. package/lib/id-compressor/persistanceUtilities.d.ts +0 -22
  240. package/lib/id-compressor/persistanceUtilities.d.ts.map +0 -1
  241. package/lib/id-compressor/persistanceUtilities.js +0 -34
  242. package/lib/id-compressor/persistanceUtilities.js.map +0 -1
  243. package/lib/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
  244. package/lib/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
  245. package/lib/id-compressor/sessionSpaceNormalizer.js +0 -76
  246. package/lib/id-compressor/sessionSpaceNormalizer.js.map +0 -1
  247. package/lib/id-compressor/sessions.d.ts +0 -115
  248. package/lib/id-compressor/sessions.d.ts.map +0 -1
  249. package/lib/id-compressor/sessions.js +0 -290
  250. package/lib/id-compressor/sessions.js.map +0 -1
  251. package/lib/id-compressor/utilities.d.ts +0 -52
  252. package/lib/id-compressor/utilities.d.ts.map +0 -1
  253. package/lib/id-compressor/utilities.js +0 -151
  254. package/lib/id-compressor/utilities.js.map +0 -1
  255. package/src/id-compressor/README.md +0 -3
  256. package/src/id-compressor/appendOnlySortedMap.ts +0 -366
  257. package/src/id-compressor/finalSpace.ts +0 -67
  258. package/src/id-compressor/idCompressor.ts +0 -630
  259. package/src/id-compressor/identifiers.ts +0 -42
  260. package/src/id-compressor/index.ts +0 -26
  261. package/src/id-compressor/persistanceUtilities.ts +0 -58
  262. package/src/id-compressor/sessionSpaceNormalizer.ts +0 -83
  263. package/src/id-compressor/sessions.ts +0 -405
  264. package/src/id-compressor/utilities.ts +0 -190
@@ -1,124 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- /**
6
- * A map in which entries are always added in key-sorted order.
7
- * Supports appending and searching.
8
- */
9
- export declare class AppendOnlySortedMap<K, V> {
10
- protected readonly comparator: (a: K, b: K) => number;
11
- protected readonly elements: (K | V)[];
12
- /**
13
- * @param comparator - a comparator for keys
14
- */
15
- constructor(comparator: (a: K, b: K) => number);
16
- /**
17
- * @returns the number of entries in this map
18
- */
19
- get size(): number;
20
- /**
21
- * @returns the min key in the map.
22
- */
23
- minKey(): K | undefined;
24
- /**
25
- * @returns the max key in the map.
26
- */
27
- maxKey(): K | undefined;
28
- /**
29
- * @returns the min value in the map.
30
- */
31
- minValue(): V | undefined;
32
- /**
33
- * @returns the min value in the map.
34
- */
35
- maxValue(): V | undefined;
36
- /**
37
- * @returns the min key in the map.
38
- */
39
- first(): [K, V] | undefined;
40
- /**
41
- * @returns the max key in the map.
42
- */
43
- last(): [K, V] | undefined;
44
- /**
45
- * Returns the element at the insertion index.
46
- */
47
- getAtIndex(index: number): [K, V] | undefined;
48
- /**
49
- * @returns an iterable of the entries in the map.
50
- */
51
- entries(): IterableIterator<readonly [K, V]>;
52
- /**
53
- * @returns an iterable of the keys in the map.
54
- */
55
- keys(): IterableIterator<K>;
56
- /**
57
- * @returns an iterable of the values in the map.
58
- */
59
- values(): IterableIterator<V>;
60
- /**
61
- * @returns an iterable of the entries in the map, reversed.
62
- */
63
- entriesReversed(): IterableIterator<readonly [K, V]>;
64
- /**
65
- * Adds a new key/value pair to the map. `key` must be > to all keys in the map.
66
- * @param key - the key to add.
67
- * @param value - the value to add.
68
- */
69
- append(key: K, value: V): void;
70
- /**
71
- * Replaces the last key/value pair with the given one. If the map is empty, it simply appends.
72
- * `key` must be > to all keys in the map prior to the one replaced.
73
- * @param key - the key to add.
74
- * @param value - the value to add.
75
- */
76
- replaceLast(key: K, value: V): void;
77
- /**
78
- * @param key - the key to lookup.
79
- * @returns the value associated with `key` if such an entry exists, and undefined otherwise.
80
- */
81
- get(key: K): V | undefined;
82
- /**
83
- * @param key - the key to lookup.
84
- * @returns the entry associated with `key` if such an entry exists, the entry associated with the next lower key if such an entry
85
- * exists, and undefined otherwise.
86
- */
87
- getPairOrNextLower(key: K): readonly [K, V] | undefined;
88
- /**
89
- * @param key - the key to lookup.
90
- * @returns the entry associated with `key` if such an entry exists, the entry associated with the next higher key if such an entry
91
- * exists, and undefined otherwise.
92
- */
93
- getPairOrNextHigher(key: K): readonly [K, V] | undefined;
94
- /**
95
- * Compares two `AppendOnlySortedMap`s.
96
- */
97
- equals(other: AppendOnlySortedMap<K, V>, compareValues: (a: V, b: V) => boolean): boolean;
98
- /**
99
- * Test-only expensive assertions to check the internal validity of the data structure.
100
- */
101
- assertValid(): void;
102
- /**
103
- * Queries a range of entries.
104
- * @param from - the key to start the range query at, inclusive.
105
- * @param to - the key to end the range query at, inclusive.
106
- * @returns the range of entries.
107
- */
108
- getRange(from: K, to: K): IterableIterator<readonly [K, V]>;
109
- protected getPairOrNextLowerBy<T>(search: T, comparator: (search: T, key: K, value: V) => number): readonly [K, V] | undefined;
110
- private getKeyIndexOfOrNextLower;
111
- protected getPairOrNextHigherBy<T>(search: T, comparator: (search: T, key: K, value: V) => number): readonly [K, V] | undefined;
112
- private getKeyIndexOfOrNextHigher;
113
- /**
114
- * The value xor'd with the result index when a search fails.
115
- */
116
- static readonly failureXor = -1;
117
- /**
118
- * Performs a binary search on the sorted array.
119
- * @returns the index of the key for `search`, or (if not present) the index it would have been inserted into xor'd
120
- * with `failureXor`. Note that negating is not an adequate solution as that could result in -0.
121
- */
122
- static keyIndexOf<T, K, V>(elements: readonly (K | V)[], search: T, comparator: (search: T, key: K, value: V) => number): number;
123
- }
124
- //# sourceMappingURL=appendOnlySortedMap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appendOnlySortedMap.d.ts","sourceRoot":"","sources":["../../src/id-compressor/appendOnlySortedMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;GAGG;AACH,qBAAa,mBAAmB,CAAC,CAAC,EAAE,CAAC;IAMjB,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM;IALxE,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAM;IAE5C;;OAEG;gBACmC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM;IAExE;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACI,MAAM,IAAI,CAAC,GAAG,SAAS;IAI9B;;OAEG;IACI,MAAM,IAAI,CAAC,GAAG,SAAS;IAI9B;;OAEG;IACI,QAAQ,IAAI,CAAC,GAAG,SAAS;IAIhC;;OAEG;IACI,QAAQ,IAAI,CAAC,GAAG,SAAS;IAIhC;;OAEG;IACI,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS;IASlC;;OAEG;IACI,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS;IAUjC;;OAEG;IACI,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS;IASpD;;OAEG;IACK,OAAO,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAOpD;;OAEG;IACK,IAAI,IAAI,gBAAgB,CAAC,CAAC,CAAC;IAOnC;;OAEG;IACK,MAAM,IAAI,gBAAgB,CAAC,CAAC,CAAC;IAOrC;;OAEG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AM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,MAAM,GACjD,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS;IAS9B,OAAO,CAAC,yBAAyB;IAoBjC;;OAEG;IACH,gBAAuB,UAAU,MAAM;IAEvC;;;;OAIG;WACW,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC/B,QAAQ,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAC5B,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,MAAM,GACjD,MAAM;CAqBT"}
@@ -1,314 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- /* eslint-disable tsdoc/syntax */
6
- /* eslint-disable no-bitwise */
7
- import { assert } from "@fluidframework/core-utils";
8
- /**
9
- * A map in which entries are always added in key-sorted order.
10
- * Supports appending and searching.
11
- */
12
- export class AppendOnlySortedMap {
13
- /**
14
- * @param comparator - a comparator for keys
15
- */
16
- constructor(comparator) {
17
- this.comparator = comparator;
18
- this.elements = [];
19
- }
20
- /**
21
- * @returns the number of entries in this map
22
- */
23
- get size() {
24
- return this.elements.length / 2;
25
- }
26
- /**
27
- * @returns the min key in the map.
28
- */
29
- minKey() {
30
- return this.elements[0];
31
- }
32
- /**
33
- * @returns the max key in the map.
34
- */
35
- maxKey() {
36
- return this.elements[this.elements.length - 2];
37
- }
38
- /**
39
- * @returns the min value in the map.
40
- */
41
- minValue() {
42
- return this.elements[1];
43
- }
44
- /**
45
- * @returns the min value in the map.
46
- */
47
- maxValue() {
48
- return this.elements[this.elements.length - 1];
49
- }
50
- /**
51
- * @returns the min key in the map.
52
- */
53
- first() {
54
- const { elements } = this;
55
- const { length } = elements;
56
- if (length === 0) {
57
- return undefined;
58
- }
59
- return [elements[0], elements[1]];
60
- }
61
- /**
62
- * @returns the max key in the map.
63
- */
64
- last() {
65
- const { elements } = this;
66
- const { length } = elements;
67
- if (length === 0) {
68
- return undefined;
69
- }
70
- const lastKeyIndex = length - 2;
71
- return [elements[lastKeyIndex], elements[lastKeyIndex + 1]];
72
- }
73
- /**
74
- * Returns the element at the insertion index.
75
- */
76
- getAtIndex(index) {
77
- const realIndex = index * 2;
78
- const { elements } = this;
79
- if (realIndex < 0 || realIndex > elements.length - 1) {
80
- return undefined;
81
- }
82
- return [elements[realIndex], elements[realIndex + 1]];
83
- }
84
- /**
85
- * @returns an iterable of the entries in the map.
86
- */
87
- *entries() {
88
- const { elements } = this;
89
- for (let i = 0; i < elements.length; i += 2) {
90
- yield [elements[i], elements[i + 1]];
91
- }
92
- }
93
- /**
94
- * @returns an iterable of the keys in the map.
95
- */
96
- *keys() {
97
- const { elements } = this;
98
- for (let i = 0; i < elements.length; i += 2) {
99
- yield elements[i];
100
- }
101
- }
102
- /**
103
- * @returns an iterable of the values in the map.
104
- */
105
- *values() {
106
- const { elements } = this;
107
- for (let i = 0; i < elements.length; i += 2) {
108
- yield elements[i + 1];
109
- }
110
- }
111
- /**
112
- * @returns an iterable of the entries in the map, reversed.
113
- */
114
- *entriesReversed() {
115
- const { elements } = this;
116
- for (let i = elements.length - 2; i >= 0; i -= 2) {
117
- yield [elements[i], elements[i + 1]];
118
- }
119
- }
120
- /**
121
- * Adds a new key/value pair to the map. `key` must be > to all keys in the map.
122
- * @param key - the key to add.
123
- * @param value - the value to add.
124
- */
125
- append(key, value) {
126
- const { elements } = this;
127
- const { length } = elements;
128
- if (length !== 0 && this.comparator(key, this.maxKey()) <= 0) {
129
- throw new Error("Inserted key must be > all others in the map.");
130
- }
131
- elements.push(key);
132
- elements.push(value);
133
- }
134
- /**
135
- * Replaces the last key/value pair with the given one. If the map is empty, it simply appends.
136
- * `key` must be > to all keys in the map prior to the one replaced.
137
- * @param key - the key to add.
138
- * @param value - the value to add.
139
- */
140
- replaceLast(key, value) {
141
- const { elements, comparator } = this;
142
- const { length } = elements;
143
- if (length !== 0) {
144
- elements.pop();
145
- elements.pop();
146
- if (comparator(key, this.maxKey()) <= 0) {
147
- throw new Error("Inserted key must be > all others in the map.");
148
- }
149
- }
150
- elements.push(key);
151
- elements.push(value);
152
- }
153
- /**
154
- * @param key - the key to lookup.
155
- * @returns the value associated with `key` if such an entry exists, and undefined otherwise.
156
- */
157
- get(key) {
158
- const index = AppendOnlySortedMap.keyIndexOf(this.elements, key, this.comparator);
159
- if (index < 0) {
160
- return undefined;
161
- }
162
- return this.elements[index + 1];
163
- }
164
- /**
165
- * @param key - the key to lookup.
166
- * @returns the entry associated with `key` if such an entry exists, the entry associated with the next lower key if such an entry
167
- * exists, and undefined otherwise.
168
- */
169
- getPairOrNextLower(key) {
170
- return this.getPairOrNextLowerBy(key, this.comparator);
171
- }
172
- /**
173
- * @param key - the key to lookup.
174
- * @returns the entry associated with `key` if such an entry exists, the entry associated with the next higher key if such an entry
175
- * exists, and undefined otherwise.
176
- */
177
- getPairOrNextHigher(key) {
178
- return this.getPairOrNextHigherBy(key, this.comparator);
179
- }
180
- /**
181
- * Compares two `AppendOnlySortedMap`s.
182
- */
183
- equals(other, compareValues) {
184
- if (other === this) {
185
- return true;
186
- }
187
- if (this.elements.length !== other.elements.length) {
188
- return false;
189
- }
190
- for (let i = this.elements.length - 2; i >= 0; i -= 2) {
191
- const keyThis = this.elements[i];
192
- const valueThis = this.elements[i + 1];
193
- const keyOther = other.elements[i];
194
- const valueOther = other.elements[i + 1];
195
- if (this.comparator(keyThis, keyOther) !== 0) {
196
- return false;
197
- }
198
- if (!compareValues(valueThis, valueOther)) {
199
- return false;
200
- }
201
- }
202
- return true;
203
- }
204
- /**
205
- * Test-only expensive assertions to check the internal validity of the data structure.
206
- */
207
- assertValid() {
208
- let prev;
209
- for (const kv of this.entries()) {
210
- if (prev !== undefined) {
211
- assert(this.comparator(kv[0], prev[0]) > 0, 0x752 /* Keys in map must be sorted. */);
212
- }
213
- prev = kv;
214
- }
215
- }
216
- /**
217
- * Queries a range of entries.
218
- * @param from - the key to start the range query at, inclusive.
219
- * @param to - the key to end the range query at, inclusive.
220
- * @returns the range of entries.
221
- */
222
- *getRange(from, to) {
223
- const keyIndexFrom = this.getKeyIndexOfOrNextHigher(from, this.comparator);
224
- if (keyIndexFrom === undefined) {
225
- return;
226
- }
227
- const keyIndexTo = this.getKeyIndexOfOrNextLower(to, this.comparator);
228
- if (keyIndexTo === undefined) {
229
- return;
230
- }
231
- for (let i = keyIndexFrom; i <= keyIndexTo; i += 2) {
232
- yield [this.elements[i], this.elements[i + 1]];
233
- }
234
- }
235
- getPairOrNextLowerBy(search, comparator) {
236
- const keyIndex = this.getKeyIndexOfOrNextLower(search, comparator);
237
- if (keyIndex === undefined) {
238
- return undefined;
239
- }
240
- return [this.elements[keyIndex], this.elements[keyIndex + 1]];
241
- }
242
- getKeyIndexOfOrNextLower(search, comparator) {
243
- const { elements } = this;
244
- if (elements.length === 0) {
245
- return undefined;
246
- }
247
- let keyIndex = AppendOnlySortedMap.keyIndexOf(elements, search, comparator);
248
- if (keyIndex < 0) {
249
- keyIndex ^= AppendOnlySortedMap.failureXor;
250
- if (keyIndex > 0) {
251
- return keyIndex - 2;
252
- }
253
- return undefined;
254
- }
255
- return keyIndex;
256
- }
257
- getPairOrNextHigherBy(search, comparator) {
258
- const keyIndex = this.getKeyIndexOfOrNextHigher(search, comparator);
259
- if (keyIndex === undefined) {
260
- return undefined;
261
- }
262
- return [this.elements[keyIndex], this.elements[keyIndex + 1]];
263
- }
264
- getKeyIndexOfOrNextHigher(search, comparator) {
265
- const { elements } = this;
266
- const { length } = elements;
267
- if (length === 0) {
268
- return undefined;
269
- }
270
- let keyIndex = AppendOnlySortedMap.keyIndexOf(elements, search, comparator);
271
- if (keyIndex < 0) {
272
- keyIndex ^= AppendOnlySortedMap.failureXor;
273
- if (keyIndex < length) {
274
- return keyIndex;
275
- }
276
- return undefined;
277
- }
278
- return keyIndex;
279
- }
280
- /**
281
- * Performs a binary search on the sorted array.
282
- * @returns the index of the key for `search`, or (if not present) the index it would have been inserted into xor'd
283
- * with `failureXor`. Note that negating is not an adequate solution as that could result in -0.
284
- */
285
- static keyIndexOf(elements, search, comparator) {
286
- // Low, high, and mid are addresses of [K,V] pairs and *not* key indices
287
- let low = 0;
288
- let high = elements.length / 2;
289
- let mid = high >> 1;
290
- while (low < high) {
291
- const keyIndex = mid * 2;
292
- const c = comparator(search, elements[keyIndex], elements[keyIndex + 1]);
293
- if (c > 0) {
294
- low = mid + 1;
295
- }
296
- else if (c < 0) {
297
- high = mid;
298
- }
299
- else if (c === 0) {
300
- return keyIndex;
301
- }
302
- else {
303
- throw new Error("Invalid comparator.");
304
- }
305
- mid = (low + high) >> 1;
306
- }
307
- return (mid * 2) ^ AppendOnlySortedMap.failureXor;
308
- }
309
- }
310
- /**
311
- * The value xor'd with the result index when a search fails.
312
- */
313
- AppendOnlySortedMap.failureXor = -1;
314
- //# sourceMappingURL=appendOnlySortedMap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appendOnlySortedMap.js","sourceRoot":"","sources":["../../src/id-compressor/appendOnlySortedMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,iCAAiC;AACjC,+BAA+B;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAG/B;;OAEG;IACH,YAAsC,UAAkC;QAAlC,eAAU,GAAV,UAAU,CAAwB;QALrD,aAAQ,GAAc,EAAE,CAAC;IAK+B,CAAC;IAE5E;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,MAAM;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAkB,CAAC;IAC1C,CAAC;IAED;;OAE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,CAAC;aAChB;YACD,OAAO,SAAS,CAAC;SACjB;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC;IAOD;;;;OAIG;IACI,MAAM,CAAC,UAAU,CACvB,QAA4B,EAC5B,MAAS,EACT,UAAmD;QAEnD,wEAAwE;QACxE,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,IAAI,IAAI,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/B,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC,CAAC;QACpB,OAAO,GAAG,GAAG,IAAI,EAAE;YAClB,MAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC;YACzB,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAM,EAAE,QAAQ,CAAC,QAAQ,GAAG,CAAC,CAAM,CAAC,CAAC;YACnF,IAAI,CAAC,GAAG,CAAC,EAAE;gBACV,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC;aACd;iBAAM,IAAI,CAAC,GAAG,CAAC,EAAE;gBACjB,IAAI,GAAG,GAAG,CAAC;aACX;iBAAM,IAAI,CAAC,KAAK,CAAC,EAAE;gBACnB,OAAO,QAAQ,CAAC;aAChB;iBAAM;gBACN,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;aACvC;YACD,GAAG,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;SACxB;QACD,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,mBAAmB,CAAC,UAAU,CAAC;IACnD,CAAC;;AAlCD;;GAEG;AACoB,8BAAU,GAAG,CAAC,CAAC,AAAL,CAAM","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable tsdoc/syntax */\n/* eslint-disable no-bitwise */\nimport { assert } from \"@fluidframework/core-utils\";\n\n/**\n * A map in which entries are always added in key-sorted order.\n * Supports appending and searching.\n */\nexport class AppendOnlySortedMap<K, V> {\n\tprotected readonly elements: (K | V)[] = [];\n\n\t/**\n\t * @param comparator - a comparator for keys\n\t */\n\tpublic constructor(protected readonly comparator: (a: K, b: K) => number) {}\n\n\t/**\n\t * @returns the number of entries in this map\n\t */\n\tpublic get size(): number {\n\t\treturn this.elements.length / 2;\n\t}\n\n\t/**\n\t * @returns the min key in the map.\n\t */\n\tpublic minKey(): K | undefined {\n\t\treturn this.elements[0] as K | undefined;\n\t}\n\n\t/**\n\t * @returns the max key in the map.\n\t */\n\tpublic maxKey(): K | undefined {\n\t\treturn this.elements[this.elements.length - 2] as K | undefined;\n\t}\n\n\t/**\n\t * @returns the min value in the map.\n\t */\n\tpublic minValue(): V | undefined {\n\t\treturn this.elements[1] as V | undefined;\n\t}\n\n\t/**\n\t * @returns the min value in the map.\n\t */\n\tpublic maxValue(): V | undefined {\n\t\treturn this.elements[this.elements.length - 1] as V | undefined;\n\t}\n\n\t/**\n\t * @returns the min key in the map.\n\t */\n\tpublic first(): [K, V] | undefined {\n\t\tconst { elements } = this;\n\t\tconst { length } = elements;\n\t\tif (length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn [elements[0] as K, elements[1] as V];\n\t}\n\n\t/**\n\t * @returns the max key in the map.\n\t */\n\tpublic last(): [K, V] | undefined {\n\t\tconst { elements } = this;\n\t\tconst { length } = elements;\n\t\tif (length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst lastKeyIndex = length - 2;\n\t\treturn [elements[lastKeyIndex] as K, elements[lastKeyIndex + 1] as V];\n\t}\n\n\t/**\n\t * Returns the element at the insertion index.\n\t */\n\tpublic getAtIndex(index: number): [K, V] | undefined {\n\t\tconst realIndex = index * 2;\n\t\tconst { elements } = this;\n\t\tif (realIndex < 0 || realIndex > elements.length - 1) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn [elements[realIndex] as K, elements[realIndex + 1] as V];\n\t}\n\n\t/**\n\t * @returns an iterable of the entries in the map.\n\t */\n\tpublic *entries(): IterableIterator<readonly [K, V]> {\n\t\tconst { elements } = this;\n\t\tfor (let i = 0; i < elements.length; i += 2) {\n\t\t\tyield [elements[i] as K, elements[i + 1] as V];\n\t\t}\n\t}\n\n\t/**\n\t * @returns an iterable of the keys in the map.\n\t */\n\tpublic *keys(): IterableIterator<K> {\n\t\tconst { elements } = this;\n\t\tfor (let i = 0; i < elements.length; i += 2) {\n\t\t\tyield elements[i] as K;\n\t\t}\n\t}\n\n\t/**\n\t * @returns an iterable of the values in the map.\n\t */\n\tpublic *values(): IterableIterator<V> {\n\t\tconst { elements } = this;\n\t\tfor (let i = 0; i < elements.length; i += 2) {\n\t\t\tyield elements[i + 1] as V;\n\t\t}\n\t}\n\n\t/**\n\t * @returns an iterable of the entries in the map, reversed.\n\t */\n\tpublic *entriesReversed(): IterableIterator<readonly [K, V]> {\n\t\tconst { elements } = this;\n\t\tfor (let i = elements.length - 2; i >= 0; i -= 2) {\n\t\t\tyield [elements[i] as K, elements[i + 1] as V];\n\t\t}\n\t}\n\n\t/**\n\t * Adds a new key/value pair to the map. `key` must be > to all keys in the map.\n\t * @param key - the key to add.\n\t * @param value - the value to add.\n\t */\n\tpublic append(key: K, value: V): void {\n\t\tconst { elements } = this;\n\t\tconst { length } = elements;\n\t\tif (length !== 0 && this.comparator(key, this.maxKey() as K) <= 0) {\n\t\t\tthrow new Error(\"Inserted key must be > all others in the map.\");\n\t\t}\n\t\telements.push(key);\n\t\telements.push(value);\n\t}\n\n\t/**\n\t * Replaces the last key/value pair with the given one. If the map is empty, it simply appends.\n\t * `key` must be > to all keys in the map prior to the one replaced.\n\t * @param key - the key to add.\n\t * @param value - the value to add.\n\t */\n\tpublic replaceLast(key: K, value: V): void {\n\t\tconst { elements, comparator } = this;\n\t\tconst { length } = elements;\n\t\tif (length !== 0) {\n\t\t\telements.pop();\n\t\t\telements.pop();\n\t\t\tif (comparator(key, this.maxKey() as K) <= 0) {\n\t\t\t\tthrow new Error(\"Inserted key must be > all others in the map.\");\n\t\t\t}\n\t\t}\n\t\telements.push(key);\n\t\telements.push(value);\n\t}\n\n\t/**\n\t * @param key - the key to lookup.\n\t * @returns the value associated with `key` if such an entry exists, and undefined otherwise.\n\t */\n\tpublic get(key: K): V | undefined {\n\t\tconst index = AppendOnlySortedMap.keyIndexOf(this.elements, key, this.comparator);\n\t\tif (index < 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.elements[index + 1] as V;\n\t}\n\n\t/**\n\t * @param key - the key to lookup.\n\t * @returns the entry associated with `key` if such an entry exists, the entry associated with the next lower key if such an entry\n\t * exists, and undefined otherwise.\n\t */\n\tpublic getPairOrNextLower(key: K): readonly [K, V] | undefined {\n\t\treturn this.getPairOrNextLowerBy(key, this.comparator);\n\t}\n\n\t/**\n\t * @param key - the key to lookup.\n\t * @returns the entry associated with `key` if such an entry exists, the entry associated with the next higher key if such an entry\n\t * exists, and undefined otherwise.\n\t */\n\tpublic getPairOrNextHigher(key: K): readonly [K, V] | undefined {\n\t\treturn this.getPairOrNextHigherBy(key, this.comparator);\n\t}\n\n\t/**\n\t * Compares two `AppendOnlySortedMap`s.\n\t */\n\tpublic equals(\n\t\tother: AppendOnlySortedMap<K, V>,\n\t\tcompareValues: (a: V, b: V) => boolean,\n\t): boolean {\n\t\tif (other === this) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this.elements.length !== other.elements.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (let i = this.elements.length - 2; i >= 0; i -= 2) {\n\t\t\tconst keyThis = this.elements[i] as K;\n\t\t\tconst valueThis = this.elements[i + 1] as V;\n\t\t\tconst keyOther = other.elements[i] as K;\n\t\t\tconst valueOther = other.elements[i + 1] as V;\n\t\t\tif (this.comparator(keyThis, keyOther) !== 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (!compareValues(valueThis, valueOther)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Test-only expensive assertions to check the internal validity of the data structure.\n\t */\n\tpublic assertValid(): void {\n\t\tlet prev: readonly [K, unknown] | undefined;\n\t\tfor (const kv of this.entries()) {\n\t\t\tif (prev !== undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tthis.comparator(kv[0], prev[0]) > 0,\n\t\t\t\t\t0x752 /* Keys in map must be sorted. */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tprev = kv;\n\t\t}\n\t}\n\n\t/**\n\t * Queries a range of entries.\n\t * @param from - the key to start the range query at, inclusive.\n\t * @param to - the key to end the range query at, inclusive.\n\t * @returns the range of entries.\n\t */\n\tpublic *getRange(from: K, to: K): IterableIterator<readonly [K, V]> {\n\t\tconst keyIndexFrom = this.getKeyIndexOfOrNextHigher(from, this.comparator);\n\t\tif (keyIndexFrom === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst keyIndexTo = this.getKeyIndexOfOrNextLower(to, this.comparator);\n\t\tif (keyIndexTo === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (let i = keyIndexFrom; i <= keyIndexTo; i += 2) {\n\t\t\tyield [this.elements[i] as K, this.elements[i + 1] as V];\n\t\t}\n\t}\n\n\tprotected getPairOrNextLowerBy<T>(\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number,\n\t): readonly [K, V] | undefined {\n\t\tconst keyIndex = this.getKeyIndexOfOrNextLower(search, comparator);\n\t\tif (keyIndex === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn [this.elements[keyIndex] as K, this.elements[keyIndex + 1] as V];\n\t}\n\n\tprivate getKeyIndexOfOrNextLower<T>(\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number,\n\t): number | undefined {\n\t\tconst { elements } = this;\n\t\tif (elements.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tlet keyIndex = AppendOnlySortedMap.keyIndexOf(elements, search, comparator);\n\t\tif (keyIndex < 0) {\n\t\t\tkeyIndex ^= AppendOnlySortedMap.failureXor;\n\t\t\tif (keyIndex > 0) {\n\t\t\t\treturn keyIndex - 2;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\treturn keyIndex;\n\t}\n\n\tprotected getPairOrNextHigherBy<T>(\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number,\n\t): readonly [K, V] | undefined {\n\t\tconst keyIndex = this.getKeyIndexOfOrNextHigher(search, comparator);\n\t\tif (keyIndex === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn [this.elements[keyIndex] as K, this.elements[keyIndex + 1] as V];\n\t}\n\n\tprivate getKeyIndexOfOrNextHigher<T>(\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number,\n\t): number | undefined {\n\t\tconst { elements } = this;\n\t\tconst { length } = elements;\n\t\tif (length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tlet keyIndex = AppendOnlySortedMap.keyIndexOf(elements, search, comparator);\n\t\tif (keyIndex < 0) {\n\t\t\tkeyIndex ^= AppendOnlySortedMap.failureXor;\n\t\t\tif (keyIndex < length) {\n\t\t\t\treturn keyIndex;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\treturn keyIndex;\n\t}\n\n\t/**\n\t * The value xor'd with the result index when a search fails.\n\t */\n\tpublic static readonly failureXor = -1;\n\n\t/**\n\t * Performs a binary search on the sorted array.\n\t * @returns the index of the key for `search`, or (if not present) the index it would have been inserted into xor'd\n\t * with `failureXor`. Note that negating is not an adequate solution as that could result in -0.\n\t */\n\tpublic static keyIndexOf<T, K, V>(\n\t\telements: readonly (K | V)[],\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number,\n\t): number {\n\t\t// Low, high, and mid are addresses of [K,V] pairs and *not* key indices\n\t\tlet low = 0;\n\t\tlet high = elements.length / 2;\n\t\tlet mid = high >> 1;\n\t\twhile (low < high) {\n\t\t\tconst keyIndex = mid * 2;\n\t\t\tconst c = comparator(search, elements[keyIndex] as K, elements[keyIndex + 1] as V);\n\t\t\tif (c > 0) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else if (c < 0) {\n\t\t\t\thigh = mid;\n\t\t\t} else if (c === 0) {\n\t\t\t\treturn keyIndex;\n\t\t\t} else {\n\t\t\t\tthrow new Error(\"Invalid comparator.\");\n\t\t\t}\n\t\t\tmid = (low + high) >> 1;\n\t\t}\n\t\treturn (mid * 2) ^ AppendOnlySortedMap.failureXor;\n\t}\n}\n"]}
@@ -1,29 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { IdCluster } from "./sessions";
6
- import { FinalCompressedId } from "./identifiers";
7
- /**
8
- * All IDs that have been finalized (acked), grouped into clusters sorted by their base final IDs.
9
- * These clusters span the positive integer space and are not sparse, meaning a cluster's base final
10
- * ID will always be one greater than the last final ID in the previous cluster (or 0 if there is not one).
11
- */
12
- export declare class FinalSpace {
13
- private readonly clusterList;
14
- get clusters(): readonly IdCluster[];
15
- getLastCluster(): IdCluster | undefined;
16
- addCluster(newCluster: IdCluster): void;
17
- /**
18
- * @returns the upper bound (exclusive) of finalized IDs in final space, i.e. one greater than the last final ID in the last cluster.
19
- * Note: this does not include allocated but unfinalized space in clusters.
20
- */
21
- getFinalizedIdLimit(): FinalCompressedId;
22
- /**
23
- * @returns the upper bound (exclusive) of allocated IDs in final space, i.e. one greater than the last final ID in the last cluster.
24
- * Note: this does includes all allocated IDs in clusters.
25
- */
26
- getAllocatedIdLimit(): FinalCompressedId;
27
- equals(other: FinalSpace): boolean;
28
- }
29
- //# sourceMappingURL=finalSpace.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"finalSpace.d.ts","sourceRoot":"","sources":["../../src/id-compressor/finalSpace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAyD,MAAM,YAAY,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD;;;;GAIG;AACH,qBAAa,UAAU;IACtB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;IAE/C,IAAW,QAAQ,IAAI,SAAS,SAAS,EAAE,CAE1C;IAEM,cAAc,IAAI,SAAS,GAAG,SAAS;IAIvC,UAAU,CAAC,UAAU,EAAE,SAAS;IAWvC;;;OAGG;IACI,mBAAmB,IAAI,iBAAiB;IAO/C;;;OAGG;IACI,mBAAmB,IAAI,iBAAiB;IAOxC,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO;CAQzC"}
@@ -1,58 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { assert } from "@fluidframework/core-utils";
6
- import { clustersEqual, lastAllocatedFinal, lastFinalizedFinal } from "./sessions";
7
- /**
8
- * All IDs that have been finalized (acked), grouped into clusters sorted by their base final IDs.
9
- * These clusters span the positive integer space and are not sparse, meaning a cluster's base final
10
- * ID will always be one greater than the last final ID in the previous cluster (or 0 if there is not one).
11
- */
12
- export class FinalSpace {
13
- constructor() {
14
- this.clusterList = [];
15
- }
16
- get clusters() {
17
- return this.clusterList;
18
- }
19
- getLastCluster() {
20
- return this.clusterList[this.clusterList.length - 1];
21
- }
22
- addCluster(newCluster) {
23
- const lastCluster = this.getLastCluster();
24
- assert(lastCluster === undefined ||
25
- // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
26
- newCluster.baseFinalId === lastCluster.baseFinalId + lastCluster.capacity, 0x753 /* Cluster insert to final_space is out of order. */);
27
- this.clusterList.push(newCluster);
28
- }
29
- /**
30
- * @returns the upper bound (exclusive) of finalized IDs in final space, i.e. one greater than the last final ID in the last cluster.
31
- * Note: this does not include allocated but unfinalized space in clusters.
32
- */
33
- getFinalizedIdLimit() {
34
- const lastCluster = this.getLastCluster();
35
- return lastCluster === undefined
36
- ? 0
37
- : (lastFinalizedFinal(lastCluster) + 1);
38
- }
39
- /**
40
- * @returns the upper bound (exclusive) of allocated IDs in final space, i.e. one greater than the last final ID in the last cluster.
41
- * Note: this does includes all allocated IDs in clusters.
42
- */
43
- getAllocatedIdLimit() {
44
- const lastCluster = this.getLastCluster();
45
- return lastCluster === undefined
46
- ? 0
47
- : (lastAllocatedFinal(lastCluster) + 1);
48
- }
49
- equals(other) {
50
- for (let i = 0; i < this.clusterList.length; i++) {
51
- if (!clustersEqual(this.clusterList[i], other.clusterList[i])) {
52
- return false;
53
- }
54
- }
55
- return this.clusterList.length === other.clusterList.length;
56
- }
57
- }
58
- //# sourceMappingURL=finalSpace.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"finalSpace.js","sourceRoot":"","sources":["../../src/id-compressor/finalSpace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAa,aAAa,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAG9F;;;;GAIG;AACH,MAAM,OAAO,UAAU;IAAvB;QACkB,gBAAW,GAAgB,EAAE,CAAC;IAmDhD,CAAC;IAjDA,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAEM,cAAc;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IAEM,UAAU,CAAC,UAAqB;QACtC,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC1C,MAAM,CACL,WAAW,KAAK,SAAS;YACxB,qEAAqE;YACrE,UAAU,CAAC,WAAW,KAAK,WAAW,CAAC,WAAW,GAAG,WAAW,CAAC,QAAQ,EAC1E,KAAK,CAAC,oDAAoD,CAC1D,CAAC;QACF,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;IAED;;;OAGG;IACI,mBAAmB;QACzB,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC1C,OAAO,WAAW,KAAK,SAAS;YAC/B,CAAC,CAAE,CAAuB;YAC1B,CAAC,CAAE,CAAE,kBAAkB,CAAC,WAAW,CAAY,GAAG,CAAC,CAAuB,CAAC;IAC7E,CAAC;IAED;;;OAGG;IACI,mBAAmB;QACzB,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC1C,OAAO,WAAW,KAAK,SAAS;YAC/B,CAAC,CAAE,CAAuB;YAC1B,CAAC,CAAE,CAAE,kBAAkB,CAAC,WAAW,CAAY,GAAG,CAAC,CAAuB,CAAC;IAC7E,CAAC;IAEM,MAAM,CAAC,KAAiB;QAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACjD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC9D,OAAO,KAAK,CAAC;aACb;SACD;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC;IAC7D,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IdCluster, clustersEqual, lastAllocatedFinal, lastFinalizedFinal } from \"./sessions\";\nimport { FinalCompressedId } from \"./identifiers\";\n\n/**\n * All IDs that have been finalized (acked), grouped into clusters sorted by their base final IDs.\n * These clusters span the positive integer space and are not sparse, meaning a cluster's base final\n * ID will always be one greater than the last final ID in the previous cluster (or 0 if there is not one).\n */\nexport class FinalSpace {\n\tprivate readonly clusterList: IdCluster[] = [];\n\n\tpublic get clusters(): readonly IdCluster[] {\n\t\treturn this.clusterList;\n\t}\n\n\tpublic getLastCluster(): IdCluster | undefined {\n\t\treturn this.clusterList[this.clusterList.length - 1];\n\t}\n\n\tpublic addCluster(newCluster: IdCluster) {\n\t\tconst lastCluster = this.getLastCluster();\n\t\tassert(\n\t\t\tlastCluster === undefined ||\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n\t\t\t\tnewCluster.baseFinalId === lastCluster.baseFinalId + lastCluster.capacity,\n\t\t\t0x753 /* Cluster insert to final_space is out of order. */,\n\t\t);\n\t\tthis.clusterList.push(newCluster);\n\t}\n\n\t/**\n\t * @returns the upper bound (exclusive) of finalized IDs in final space, i.e. one greater than the last final ID in the last cluster.\n\t * Note: this does not include allocated but unfinalized space in clusters.\n\t */\n\tpublic getFinalizedIdLimit(): FinalCompressedId {\n\t\tconst lastCluster = this.getLastCluster();\n\t\treturn lastCluster === undefined\n\t\t\t? (0 as FinalCompressedId)\n\t\t\t: (((lastFinalizedFinal(lastCluster) as number) + 1) as FinalCompressedId);\n\t}\n\n\t/**\n\t * @returns the upper bound (exclusive) of allocated IDs in final space, i.e. one greater than the last final ID in the last cluster.\n\t * Note: this does includes all allocated IDs in clusters.\n\t */\n\tpublic getAllocatedIdLimit(): FinalCompressedId {\n\t\tconst lastCluster = this.getLastCluster();\n\t\treturn lastCluster === undefined\n\t\t\t? (0 as FinalCompressedId)\n\t\t\t: (((lastAllocatedFinal(lastCluster) as number) + 1) as FinalCompressedId);\n\t}\n\n\tpublic equals(other: FinalSpace): boolean {\n\t\tfor (let i = 0; i < this.clusterList.length; i++) {\n\t\t\tif (!clustersEqual(this.clusterList[i], other.clusterList[i])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn this.clusterList.length === other.clusterList.length;\n\t}\n}\n"]}
@@ -1,54 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { IdCreationRange, IIdCompressor, IIdCompressorCore, OpSpaceCompressedId, SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession, SessionId, SessionSpaceCompressedId, StableId } from "@fluidframework/runtime-definitions";
6
- import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
7
- /**
8
- * See {@link IIdCompressor} and {@link IIdCompressorCore}
9
- */
10
- export declare class IdCompressor implements IIdCompressor, IIdCompressorCore {
11
- private readonly logger?;
12
- /**
13
- * Max allowed initial cluster size.
14
- */
15
- static readonly maxClusterSize: number;
16
- readonly localSessionId: SessionId;
17
- private readonly localSession;
18
- private readonly normalizer;
19
- private localGenCount;
20
- private nextRangeBaseGenCount;
21
- private newClusterCapacity;
22
- private readonly sessions;
23
- private readonly finalSpace;
24
- private telemetryLocalIdCount;
25
- private telemetryEagerFinalIdCount;
26
- private constructor();
27
- static create(logger?: ITelemetryBaseLogger): IdCompressor;
28
- static create(sessionId: SessionId, logger?: ITelemetryBaseLogger): IdCompressor;
29
- /**
30
- * The size of each newly created ID cluster.
31
- */
32
- get clusterCapacity(): number;
33
- /**
34
- * Must only be set with a value upon which consensus has been reached. Value must be greater than zero and less than
35
- * `IdCompressor.maxClusterSize`.
36
- */
37
- set clusterCapacity(value: number);
38
- generateCompressedId(): SessionSpaceCompressedId;
39
- private generateNextLocalId;
40
- takeNextCreationRange(): IdCreationRange;
41
- finalizeCreationRange(range: IdCreationRange): void;
42
- private addEmptyCluster;
43
- normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;
44
- normalizeToSessionSpace(id: OpSpaceCompressedId, originSessionId: SessionId): SessionSpaceCompressedId;
45
- decompress(id: SessionSpaceCompressedId): StableId;
46
- recompress(uncompressed: StableId): SessionSpaceCompressedId;
47
- tryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;
48
- serialize(withSession: true): SerializedIdCompressorWithOngoingSession;
49
- serialize(withSession: false): SerializedIdCompressorWithNoSession;
50
- static deserialize(serialized: SerializedIdCompressorWithOngoingSession): IdCompressor;
51
- static deserialize(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId): IdCompressor;
52
- equals(other: IdCompressor, includeLocalState: boolean): boolean;
53
- }
54
- //# sourceMappingURL=idCompressor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"idCompressor.d.ts","sourceRoot":"","sources":["../../src/id-compressor/idCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EAEnB,mCAAmC,EACnC,wCAAwC,EACxC,SAAS,EACT,wBAAwB,EACxB,QAAQ,EAER,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAsCvE;;GAEG;AACH,qBAAa,YAAa,YAAW,aAAa,EAAE,iBAAiB;IAuCnE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IAtCzB;;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;IAQ1B,OAAO,CAAC,qBAAqB,CAAK;IAElC,OAAO,CAAC,kBAAkB,CAA0B;IACpD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAO/C,OAAO,CAAC,qBAAqB,CAAK;IAElC,OAAO,CAAC,0BAA0B,CAAK;IAIvC,OAAO;WAqBO,MAAM,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,YAAY;WACnD,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,oBAAoB,GAAG,YAAY;IAyBvF;;OAEG;IACH,IAAW,eAAe,IAAI,MAAM,CAEnC;IAED;;;OAGG;IACH,IAAW,eAAe,CAA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