@frostpillar/frostpillar-btree 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-JA.md +95 -73
- package/README.md +96 -74
- package/dist/InMemoryBTree.d.ts +3 -36
- package/dist/btree/autoScale.d.ts +1 -0
- package/dist/btree/entry-lookup.d.ts +8 -0
- package/dist/btree/mutations.d.ts +1 -3
- package/dist/btree/rangeQuery.d.ts +4 -1
- package/dist/btree/rebalance-branch.d.ts +4 -0
- package/dist/btree/rebalance.d.ts +5 -2
- package/dist/btree/serialization.d.ts +3 -1
- package/dist/btree/split.d.ts +3 -0
- package/dist/btree/traversal.d.ts +7 -0
- package/dist/btree/types.d.ts +14 -3
- package/dist/{chunk-OWHENPGJ.js → chunk-UGGWGP4E.js} +659 -392
- package/dist/concurrency/ConcurrentInMemoryBTree.d.ts +3 -14
- package/dist/concurrency/coordinator.d.ts +21 -0
- package/dist/concurrency/syncLogValidation.d.ts +2 -0
- package/dist/core.cjs +659 -392
- package/dist/core.d.ts +2 -2
- package/dist/core.js +1 -1
- package/dist/frostpillar-btree-core.min.js +1 -1
- package/dist/frostpillar-btree.min.js +1 -1
- package/dist/index.cjs +852 -542
- package/dist/index.d.ts +1 -1
- package/dist/index.js +190 -147
- package/package.json +1 -1
package/README-JA.md
CHANGED
|
@@ -399,6 +399,24 @@ tree.forEach((entry) => {
|
|
|
399
399
|
});
|
|
400
400
|
```
|
|
401
401
|
|
|
402
|
+
**`forEachRange(startKey, endKey, callback, options?)`** -- 配列を生成せずに範囲内のエントリを反復します。
|
|
403
|
+
|
|
404
|
+
```ts
|
|
405
|
+
tree.forEachRange(10, 20, (entry) => {
|
|
406
|
+
console.log(entry.key, entry.value);
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
// 排他的境界の指定
|
|
410
|
+
tree.forEachRange(
|
|
411
|
+
10,
|
|
412
|
+
20,
|
|
413
|
+
(entry) => {
|
|
414
|
+
/* ... */
|
|
415
|
+
},
|
|
416
|
+
{ lowerBound: 'exclusive' },
|
|
417
|
+
);
|
|
418
|
+
```
|
|
419
|
+
|
|
402
420
|
**`snapshot()`** -- 全エントリをソート順で取得します。
|
|
403
421
|
|
|
404
422
|
```ts
|
|
@@ -763,11 +781,13 @@ try {
|
|
|
763
781
|
`ConcurrentInMemoryBTree` は共有ストアが**信頼されている**ことを前提としています。悪意を持って細工されたミューテーションペイロードや、異常に大きなペイロードに対する防御機能はありません。
|
|
764
782
|
|
|
765
783
|
**信頼境界:**
|
|
784
|
+
|
|
766
785
|
- ストアはあなたのアプリケーションの管理下にあること。
|
|
767
786
|
- 同一ストアを共有するすべてのインスタンスは同一の設定を使用すること(最初の書き込み時に `init` ミューテーションの設定フィンガープリントで検証されますが、リプレイバッチに `init` が含まれている場合に限ります)。
|
|
768
787
|
- ミューテーションはリプレイ前に構造的に検証されますが、セマンティックな正確性(キー型の整合性など)は呼び出し側の責任です。
|
|
769
788
|
|
|
770
789
|
**共有・マルチテナントデプロイメントにおける堅牢化の推奨事項:**
|
|
790
|
+
|
|
771
791
|
- 認可レイヤーなしに `append` や `getLogEntriesSince` を信頼されていないクライアントに公開しないこと。
|
|
772
792
|
- 格納するミューテーションペイロードのサイズ制限をストアレベルで適用してから `ConcurrentInMemoryBTree` に渡すこと。
|
|
773
793
|
- `maxSyncMutationsPerBatch` を使用して、1回の sync 呼び出しで適用するミューテーション数を制限すること(デフォルト:100,000)。
|
|
@@ -779,42 +799,43 @@ try {
|
|
|
779
799
|
|
|
780
800
|
### InMemoryBTree
|
|
781
801
|
|
|
782
|
-
| メソッド | シグネチャ
|
|
783
|
-
| -------------------- |
|
|
784
|
-
| `put` | `(key: TKey, value: TValue) => EntryId`
|
|
785
|
-
| `putMany` | `(entries: readonly { key: TKey; value: TValue }[]) => EntryId[]`
|
|
786
|
-
| `remove` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null`
|
|
787
|
-
| `removeById` | `(entryId: EntryId) => BTreeEntry<TKey, TValue> \| null`
|
|
788
|
-
| `peekById` | `(entryId: EntryId) => BTreeEntry<TKey, TValue> \| null`
|
|
789
|
-
| `updateById` | `(entryId: EntryId, value: TValue) => BTreeEntry<TKey, TValue> \| null`
|
|
790
|
-
| `popFirst` | `() => BTreeEntry<TKey, TValue> \| null`
|
|
791
|
-
| `popLast` | `() => BTreeEntry<TKey, TValue> \| null`
|
|
792
|
-
| `peekFirst` | `() => BTreeEntry<TKey, TValue> \| null`
|
|
793
|
-
| `peekLast` | `() => BTreeEntry<TKey, TValue> \| null`
|
|
794
|
-
| `findFirst` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null`
|
|
795
|
-
| `findLast` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null`
|
|
796
|
-
| `get` | `(key: TKey) => TValue \| null`
|
|
797
|
-
| `hasKey` | `(key: TKey) => boolean`
|
|
798
|
-
| `count` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => number`
|
|
799
|
-
| `range` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => BTreeEntry<TKey, TValue>[]`
|
|
800
|
-
| `nextHigherKey` | `(key: TKey) => TKey \| null`
|
|
801
|
-
| `nextLowerKey` | `(key: TKey) => TKey \| null`
|
|
802
|
-
| `getPairOrNextLower` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null`
|
|
803
|
-
| `deleteRange` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => number`
|
|
804
|
-
| `entries` | `() => IterableIterator<BTreeEntry<TKey, TValue>>`
|
|
805
|
-
| `entriesReversed` | `() => IterableIterator<BTreeEntry<TKey, TValue>>`
|
|
806
|
-
| `keys` | `() => IterableIterator<TKey>`
|
|
807
|
-
| `values` | `() => IterableIterator<TValue>`
|
|
808
|
-
| `[Symbol.iterator]` | `() => IterableIterator<BTreeEntry<TKey, TValue>>`
|
|
809
|
-
| `forEach` | `(callback: (entry) => void, thisArg?) => void`
|
|
810
|
-
| `
|
|
811
|
-
| `
|
|
812
|
-
| `
|
|
813
|
-
| `
|
|
814
|
-
| `
|
|
815
|
-
| `
|
|
816
|
-
| `
|
|
817
|
-
| `
|
|
802
|
+
| メソッド | シグネチャ | 説明 |
|
|
803
|
+
| -------------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------- |
|
|
804
|
+
| `put` | `(key: TKey, value: TValue) => EntryId` | キーバリューペアを挿入し、`EntryId` を返す。 |
|
|
805
|
+
| `putMany` | `(entries: readonly { key: TKey; value: TValue }[]) => EntryId[]` | ソート済みエントリの一括挿入。空のツリーでは O(n)。非空ツリーではカーソル最適化。 |
|
|
806
|
+
| `remove` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null` | 指定キーに一致する最初のエントリを削除する。 |
|
|
807
|
+
| `removeById` | `(entryId: EntryId) => BTreeEntry<TKey, TValue> \| null` | ID でエントリを削除する。 |
|
|
808
|
+
| `peekById` | `(entryId: EntryId) => BTreeEntry<TKey, TValue> \| null` | ID でエントリを削除せずに参照する。 |
|
|
809
|
+
| `updateById` | `(entryId: EntryId, value: TValue) => BTreeEntry<TKey, TValue> \| null` | ID でエントリの値を更新する。 |
|
|
810
|
+
| `popFirst` | `() => BTreeEntry<TKey, TValue> \| null` | 最小キーのエントリを削除して返す。 |
|
|
811
|
+
| `popLast` | `() => BTreeEntry<TKey, TValue> \| null` | 最大キーのエントリを削除して返す。 |
|
|
812
|
+
| `peekFirst` | `() => BTreeEntry<TKey, TValue> \| null` | 最小キーのエントリを削除せずに返す。 |
|
|
813
|
+
| `peekLast` | `() => BTreeEntry<TKey, TValue> \| null` | 最大のエントリを削除せずに返す。 |
|
|
814
|
+
| `findFirst` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null` | キーに一致する最初のエントリを返す。 |
|
|
815
|
+
| `findLast` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null` | キーに一致する最後のエントリを返す。 |
|
|
816
|
+
| `get` | `(key: TKey) => TValue \| null` | 指定キーの最初の値を返す。キーがない場合は null。 |
|
|
817
|
+
| `hasKey` | `(key: TKey) => boolean` | 指定キーのエントリが 1 件以上存在するか確認する。 |
|
|
818
|
+
| `count` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => number` | 配列割り当てなしで範囲内のエントリ数を返す。境界はデフォルトで包含。 |
|
|
819
|
+
| `range` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => BTreeEntry<TKey, TValue>[]` | startKey から endKey のエントリを返す。境界はデフォルトで包含。 |
|
|
820
|
+
| `nextHigherKey` | `(key: TKey) => TKey \| null` | 指定キーより大きい次のキーを返す。 |
|
|
821
|
+
| `nextLowerKey` | `(key: TKey) => TKey \| null` | 指定キーより小さい次のキーを返す。 |
|
|
822
|
+
| `getPairOrNextLower` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null` | 一致エントリまたはそれより小さい最大のエントリを返す。 |
|
|
823
|
+
| `deleteRange` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => number` | 範囲内のエントリを削除し、削除件数を返す。 |
|
|
824
|
+
| `entries` | `() => IterableIterator<BTreeEntry<TKey, TValue>>` | 昇順で全エントリを遅延イテレーションする。 |
|
|
825
|
+
| `entriesReversed` | `() => IterableIterator<BTreeEntry<TKey, TValue>>` | 降順で全エントリを遅延イテレーションする。 |
|
|
826
|
+
| `keys` | `() => IterableIterator<TKey>` | 昇順で全キーを遅延イテレーションする。 |
|
|
827
|
+
| `values` | `() => IterableIterator<TValue>` | 昇順で全値を遅延イテレーションする。 |
|
|
828
|
+
| `[Symbol.iterator]` | `() => IterableIterator<BTreeEntry<TKey, TValue>>` | `for...of` やスプレッドを有効にする。`entries()` に委譲。 |
|
|
829
|
+
| `forEach` | `(callback: (entry) => void, thisArg?) => void` | 昇順で各エントリを訪問する。 |
|
|
830
|
+
| `forEachRange` | `(startKey: TKey, endKey: TKey, callback: (entry) => void, options?: RangeBounds) => void` | 配列を生成せずに範囲内のエントリを反復する。 |
|
|
831
|
+
| `snapshot` | `() => BTreeEntry<TKey, TValue>[]` | 全エントリをソート順で返す。 |
|
|
832
|
+
| `clear` | `() => void` | 全エントリを削除し、空の状態に O(1) でリセットする。 |
|
|
833
|
+
| `size` | `() => number` | エントリ数を返す。 |
|
|
834
|
+
| `getStats` | `() => BTreeStats` | 構造統計を返す。 |
|
|
835
|
+
| `assertInvariants` | `() => void` | B+ tree の構造的な整合性を検証する。不正な場合はスローする。 |
|
|
836
|
+
| `clone` | `() => InMemoryBTree<TKey, TValue>` | 構造的に独立したコピーを返す(キー・値参照は共有)。 |
|
|
837
|
+
| `toJSON` | `() => BTreeJSON<TKey, TValue>` | バージョン付き JSON 互換ペイロードにシリアライズする。 |
|
|
838
|
+
| `fromJSON` (静的) | `(json, compareKeys) => InMemoryBTree<TKey, TValue>` | `toJSON` ペイロードからツリーを再構築する。 |
|
|
818
839
|
|
|
819
840
|
**コンストラクタ:**
|
|
820
841
|
|
|
@@ -826,43 +847,44 @@ new InMemoryBTree<TKey, TValue>(config: InMemoryBTreeConfig<TKey>)
|
|
|
826
847
|
|
|
827
848
|
`InMemoryBTree` メソッドを `Promise` を返す非同期版として提供します。書き込みは shared store を介して協調し、`readMode` が `'strong'`(デフォルト)の場合は読み取り前に同期します。`readMode` が `'local'` の場合、読み取りは同期なしでローカルツリーに対して実行されます。
|
|
828
849
|
|
|
829
|
-
| メソッド
|
|
830
|
-
|
|
|
831
|
-
| `sync`
|
|
832
|
-
| `put`
|
|
833
|
-
| `putMany`
|
|
834
|
-
| `remove`
|
|
835
|
-
| `removeById`
|
|
836
|
-
| `peekById`
|
|
837
|
-
| `updateById`
|
|
838
|
-
| `popFirst`
|
|
839
|
-
| `popLast`
|
|
840
|
-
| `deleteRange`
|
|
841
|
-
| `clear`
|
|
842
|
-
| `peekFirst`
|
|
843
|
-
| `peekLast`
|
|
844
|
-
| `findFirst`
|
|
845
|
-
| `findLast`
|
|
846
|
-
| `get`
|
|
847
|
-
| `hasKey`
|
|
848
|
-
| `count`
|
|
849
|
-
| `range`
|
|
850
|
-
| `nextHigherKey`
|
|
851
|
-
| `nextLowerKey`
|
|
852
|
-
| `getPairOrNextLower`
|
|
853
|
-
| `entries`
|
|
854
|
-
| `entriesReversed`
|
|
855
|
-
| `keys`
|
|
856
|
-
| `values`
|
|
857
|
-
| `forEach`
|
|
858
|
-
| `
|
|
859
|
-
| `
|
|
860
|
-
| `
|
|
861
|
-
| `
|
|
862
|
-
| `
|
|
863
|
-
| `
|
|
864
|
-
| `
|
|
865
|
-
| `
|
|
850
|
+
| メソッド | シグネチャ | 説明 |
|
|
851
|
+
| ------------------------ | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
|
|
852
|
+
| `sync` | `() => Promise<void>` | shared store の最新ログを取得して適用する。 |
|
|
853
|
+
| `put` | `(key: TKey, value: TValue) => Promise<EntryId>` | 楽観的並行制御で挿入する。 |
|
|
854
|
+
| `putMany` | `(entries: readonly { key: TKey; value: TValue }[]) => Promise<EntryId[]>` | 楽観的並行制御で一括挿入する。 |
|
|
855
|
+
| `remove` | `(key: TKey) => Promise<BTreeEntry<TKey, TValue> \| null>` | 指定キーに一致する最初のエントリを削除する。 |
|
|
856
|
+
| `removeById` | `(entryId: EntryId) => Promise<BTreeEntry<TKey, TValue> \| null>` | ID でエントリを削除する。 |
|
|
857
|
+
| `peekById` | `(entryId: EntryId) => Promise<BTreeEntry<TKey, TValue> \| null>` | ID でエントリを参照する(事前に同期)。 |
|
|
858
|
+
| `updateById` | `(entryId: EntryId, value: TValue) => Promise<BTreeEntry<TKey, TValue> \| null>` | 楽観的並行制御で ID のエントリ値を更新する。 |
|
|
859
|
+
| `popFirst` | `() => Promise<BTreeEntry<TKey, TValue> \| null>` | 最小キーのエントリを削除して返す。 |
|
|
860
|
+
| `popLast` | `() => Promise<BTreeEntry<TKey, TValue> \| null>` | 最大キーのエントリを削除して返す。 |
|
|
861
|
+
| `deleteRange` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => Promise<number>` | 楽観的並行制御で範囲内のエントリを削除する。 |
|
|
862
|
+
| `clear` | `() => Promise<void>` | 楽観的並行制御で全エントリを削除する。 |
|
|
863
|
+
| `peekFirst` | `() => Promise<BTreeEntry<TKey, TValue> \| null>` | 最小キーのエントリを返す(事前に同期)。 |
|
|
864
|
+
| `peekLast` | `() => Promise<BTreeEntry<TKey, TValue> \| null>` | 最大キーのエントリを返す(事前に同期)。 |
|
|
865
|
+
| `findFirst` | `(key: TKey) => Promise<BTreeEntry<TKey, TValue> \| null>` | キーに一致する最初のエントリを返す(事前に同期)。 |
|
|
866
|
+
| `findLast` | `(key: TKey) => Promise<BTreeEntry<TKey, TValue> \| null>` | キーに一致する最後のエントリを返す(事前に同期)。 |
|
|
867
|
+
| `get` | `(key: TKey) => Promise<TValue \| null>` | キーの値を取得する(事前に同期)。 |
|
|
868
|
+
| `hasKey` | `(key: TKey) => Promise<boolean>` | キーの存在を確認する(事前に同期)。 |
|
|
869
|
+
| `count` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => Promise<number>` | 範囲内のエントリ数を返す(事前に同期)。 |
|
|
870
|
+
| `range` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => Promise<BTreeEntry<TKey, TValue>[]>` | 範囲クエリ(事前に同期)。 |
|
|
871
|
+
| `nextHigherKey` | `(key: TKey) => Promise<TKey \| null>` | 指定キーより大きい次のキー(事前に同期)。 |
|
|
872
|
+
| `nextLowerKey` | `(key: TKey) => Promise<TKey \| null>` | 指定キーより小さい次のキー(事前に同期)。 |
|
|
873
|
+
| `getPairOrNextLower` | `(key: TKey) => Promise<BTreeEntry<TKey, TValue> \| null>` | 一致または次に小さいエントリ(事前に同期)。 |
|
|
874
|
+
| `entries` | `() => Promise<BTreeEntry<TKey, TValue>[]>` | 全エントリを配列で返す(事前に同期)。 |
|
|
875
|
+
| `entriesReversed` | `() => Promise<BTreeEntry<TKey, TValue>[]>` | 全エントリを逆順で配列として返す(事前に同期)。 |
|
|
876
|
+
| `keys` | `() => Promise<TKey[]>` | 全キーを配列で返す(事前に同期)。 |
|
|
877
|
+
| `values` | `() => Promise<TValue[]>` | 全値を配列で返す(事前に同期)。 |
|
|
878
|
+
| `forEach` | `(callback: (entry: BTreeEntry<TKey, TValue>) => void) => Promise<void>` | 全エントリを反復する(事前に同期)。 |
|
|
879
|
+
| `forEachRange` | `(startKey, endKey, callback, options?) => Promise<void>` | 範囲内のエントリを反復する(事前に同期)。 |
|
|
880
|
+
| `snapshot` | `() => Promise<BTreeEntry<TKey, TValue>[]>` | 全エントリを返す(事前に同期)。 |
|
|
881
|
+
| `size` | `() => Promise<number>` | エントリ数を返す(事前に同期)。 |
|
|
882
|
+
| `getStats` | `() => Promise<BTreeStats>` | 構造統計を返す(事前に同期)。 |
|
|
883
|
+
| `assertInvariants` | `() => Promise<void>` | 構造的な整合性を検証する(事前に同期)。 |
|
|
884
|
+
| `clone` | `() => Promise<InMemoryBTree<TKey, TValue>>` | 独立したローカルコピーを返す(事前に同期)。 |
|
|
885
|
+
| `toJSON` | `() => Promise<BTreeJSON<TKey, TValue>>` | JSON にシリアライズする(事前に同期)。 |
|
|
886
|
+
| `fromJSON` (static) | `(json: BTreeJSON<TKey, TValue>, compareKeys: KeyComparator<TKey>) => InMemoryBTree<TKey, TValue>` | JSON からデシリアライズする(ローカルツリーを返す)。 |
|
|
887
|
+
| `[Symbol.asyncIterator]` | `() => AsyncIterableIterator<BTreeEntry<TKey, TValue>>` | 全エントリを非同期反復する(事前に同期)。 |
|
|
866
888
|
|
|
867
889
|
**コンストラクタ:**
|
|
868
890
|
|
package/README.md
CHANGED
|
@@ -399,6 +399,24 @@ tree.forEach((entry) => {
|
|
|
399
399
|
});
|
|
400
400
|
```
|
|
401
401
|
|
|
402
|
+
**`forEachRange(startKey, endKey, callback, options?)`** -- iterate over entries in a range without allocating a result array:
|
|
403
|
+
|
|
404
|
+
```ts
|
|
405
|
+
tree.forEachRange(10, 20, (entry) => {
|
|
406
|
+
console.log(entry.key, entry.value);
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
// With exclusive bounds
|
|
410
|
+
tree.forEachRange(
|
|
411
|
+
10,
|
|
412
|
+
20,
|
|
413
|
+
(entry) => {
|
|
414
|
+
/* ... */
|
|
415
|
+
},
|
|
416
|
+
{ lowerBound: 'exclusive' },
|
|
417
|
+
);
|
|
418
|
+
```
|
|
419
|
+
|
|
402
420
|
**`snapshot()`** -- get all entries in sorted order:
|
|
403
421
|
|
|
404
422
|
```ts
|
|
@@ -763,11 +781,13 @@ try {
|
|
|
763
781
|
`ConcurrentInMemoryBTree` assumes the shared store is **trusted**. It does not defend against a store that returns maliciously crafted or arbitrarily large mutation payloads.
|
|
764
782
|
|
|
765
783
|
**Trust boundary:**
|
|
784
|
+
|
|
766
785
|
- The store is under your control or the control of your application.
|
|
767
786
|
- All instances sharing a store must use identical configuration (enforced via config fingerprint on the first write, but only when an `init` mutation is present in the replayed batch).
|
|
768
787
|
- Mutations are structurally validated before replay, but semantic correctness (e.g., key type consistency) is the caller's responsibility.
|
|
769
788
|
|
|
770
789
|
**Hardening recommendations for shared or multi-tenant deployments:**
|
|
790
|
+
|
|
771
791
|
- Do not expose `append` or `getLogEntriesSince` to untrusted clients without an authorization layer.
|
|
772
792
|
- Apply size limits to stored mutation payloads at the store level before they reach `ConcurrentInMemoryBTree`.
|
|
773
793
|
- Use `maxSyncMutationsPerBatch` to cap the number of mutations applied per sync call (default: 100,000).
|
|
@@ -779,42 +799,43 @@ try {
|
|
|
779
799
|
|
|
780
800
|
### InMemoryBTree
|
|
781
801
|
|
|
782
|
-
| Method | Signature
|
|
783
|
-
| -------------------- |
|
|
784
|
-
| `put` | `(key: TKey, value: TValue) => EntryId`
|
|
785
|
-
| `putMany` | `(entries: readonly { key: TKey; value: TValue }[]) => EntryId[]`
|
|
786
|
-
| `remove` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null`
|
|
787
|
-
| `removeById` | `(entryId: EntryId) => BTreeEntry<TKey, TValue> \| null`
|
|
788
|
-
| `peekById` | `(entryId: EntryId) => BTreeEntry<TKey, TValue> \| null`
|
|
789
|
-
| `updateById` | `(entryId: EntryId, value: TValue) => BTreeEntry<TKey, TValue> \| null`
|
|
790
|
-
| `popFirst` | `() => BTreeEntry<TKey, TValue> \| null`
|
|
791
|
-
| `popLast` | `() => BTreeEntry<TKey, TValue> \| null`
|
|
792
|
-
| `peekFirst` | `() => BTreeEntry<TKey, TValue> \| null`
|
|
793
|
-
| `peekLast` | `() => BTreeEntry<TKey, TValue> \| null`
|
|
794
|
-
| `findFirst` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null`
|
|
795
|
-
| `findLast` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null`
|
|
796
|
-
| `get` | `(key: TKey) => TValue \| null`
|
|
797
|
-
| `hasKey` | `(key: TKey) => boolean`
|
|
798
|
-
| `count` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => number`
|
|
799
|
-
| `range` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => BTreeEntry<TKey, TValue>[]`
|
|
800
|
-
| `nextHigherKey` | `(key: TKey) => TKey \| null`
|
|
801
|
-
| `nextLowerKey` | `(key: TKey) => TKey \| null`
|
|
802
|
-
| `getPairOrNextLower` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null`
|
|
803
|
-
| `deleteRange` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => number`
|
|
804
|
-
| `entries` | `() => IterableIterator<BTreeEntry<TKey, TValue>>`
|
|
805
|
-
| `entriesReversed` | `() => IterableIterator<BTreeEntry<TKey, TValue>>`
|
|
806
|
-
| `keys` | `() => IterableIterator<TKey>`
|
|
807
|
-
| `values` | `() => IterableIterator<TValue>`
|
|
808
|
-
| `[Symbol.iterator]` | `() => IterableIterator<BTreeEntry<TKey, TValue>>`
|
|
809
|
-
| `forEach` | `(callback: (entry) => void, thisArg?) => void`
|
|
810
|
-
| `
|
|
811
|
-
| `
|
|
812
|
-
| `
|
|
813
|
-
| `
|
|
814
|
-
| `
|
|
815
|
-
| `
|
|
816
|
-
| `
|
|
817
|
-
| `
|
|
802
|
+
| Method | Signature | Description |
|
|
803
|
+
| -------------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- |
|
|
804
|
+
| `put` | `(key: TKey, value: TValue) => EntryId` | Insert a key-value pair. Returns an `EntryId`. |
|
|
805
|
+
| `putMany` | `(entries: readonly { key: TKey; value: TValue }[]) => EntryId[]` | Bulk insert pre-sorted entries. O(n) on empty tree; cursor-optimized on non-empty tree. |
|
|
806
|
+
| `remove` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null` | Remove the first matching entry by key. |
|
|
807
|
+
| `removeById` | `(entryId: EntryId) => BTreeEntry<TKey, TValue> \| null` | Remove a specific entry by ID. |
|
|
808
|
+
| `peekById` | `(entryId: EntryId) => BTreeEntry<TKey, TValue> \| null` | Look up an entry by ID without removing it. |
|
|
809
|
+
| `updateById` | `(entryId: EntryId, value: TValue) => BTreeEntry<TKey, TValue> \| null` | Update the value of an entry by ID. |
|
|
810
|
+
| `popFirst` | `() => BTreeEntry<TKey, TValue> \| null` | Remove and return the smallest entry. |
|
|
811
|
+
| `popLast` | `() => BTreeEntry<TKey, TValue> \| null` | Remove and return the largest entry. |
|
|
812
|
+
| `peekFirst` | `() => BTreeEntry<TKey, TValue> \| null` | Return the smallest entry without removing it. |
|
|
813
|
+
| `peekLast` | `() => BTreeEntry<TKey, TValue> \| null` | Return the largest entry without removing it. |
|
|
814
|
+
| `findFirst` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null` | Return the first entry matching key, or null. |
|
|
815
|
+
| `findLast` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null` | Return the last entry matching key, or null. |
|
|
816
|
+
| `get` | `(key: TKey) => TValue \| null` | Return the value of the first matching key, or null. |
|
|
817
|
+
| `hasKey` | `(key: TKey) => boolean` | Check if at least one entry exists for the key. |
|
|
818
|
+
| `count` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => number` | Count entries in range without array allocation. Bounds default to inclusive. |
|
|
819
|
+
| `range` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => BTreeEntry<TKey, TValue>[]` | Return entries between startKey and endKey. Bounds default to inclusive. |
|
|
820
|
+
| `nextHigherKey` | `(key: TKey) => TKey \| null` | Return the next key strictly greater than key. |
|
|
821
|
+
| `nextLowerKey` | `(key: TKey) => TKey \| null` | Return the next key strictly less than key. |
|
|
822
|
+
| `getPairOrNextLower` | `(key: TKey) => BTreeEntry<TKey, TValue> \| null` | Return exact match or next lower entry. |
|
|
823
|
+
| `deleteRange` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => number` | Remove entries in range, return count deleted. |
|
|
824
|
+
| `entries` | `() => IterableIterator<BTreeEntry<TKey, TValue>>` | Lazily iterate all entries in ascending key order. |
|
|
825
|
+
| `entriesReversed` | `() => IterableIterator<BTreeEntry<TKey, TValue>>` | Lazily iterate all entries in descending key order. |
|
|
826
|
+
| `keys` | `() => IterableIterator<TKey>` | Lazily iterate all keys in ascending order. |
|
|
827
|
+
| `values` | `() => IterableIterator<TValue>` | Lazily iterate all values in ascending key order. |
|
|
828
|
+
| `[Symbol.iterator]` | `() => IterableIterator<BTreeEntry<TKey, TValue>>` | Enables `for...of` and spread. Delegates to `entries()`. |
|
|
829
|
+
| `forEach` | `(callback: (entry) => void, thisArg?) => void` | Visit each entry in ascending key order. |
|
|
830
|
+
| `forEachRange` | `(startKey: TKey, endKey: TKey, callback: (entry) => void, options?: RangeBounds) => void` | Iterate entries in range without array allocation. |
|
|
831
|
+
| `snapshot` | `() => BTreeEntry<TKey, TValue>[]` | Return all entries in sorted order. |
|
|
832
|
+
| `clear` | `() => void` | Remove all entries and reset to empty state in O(1). |
|
|
833
|
+
| `size` | `() => number` | Return the total number of entries. |
|
|
834
|
+
| `getStats` | `() => BTreeStats` | Return structural statistics. |
|
|
835
|
+
| `assertInvariants` | `() => void` | Assert B+ tree structural integrity. Throws if invalid. |
|
|
836
|
+
| `clone` | `() => InMemoryBTree<TKey, TValue>` | Return a structurally independent copy (shared key/value refs). |
|
|
837
|
+
| `toJSON` | `() => BTreeJSON<TKey, TValue>` | Serialize to a versioned JSON-safe payload. |
|
|
838
|
+
| `fromJSON` (static) | `(json, compareKeys) => InMemoryBTree<TKey, TValue>` | Reconstruct a tree from a `toJSON` payload. |
|
|
818
839
|
|
|
819
840
|
**Constructor:**
|
|
820
841
|
|
|
@@ -826,43 +847,44 @@ new InMemoryBTree<TKey, TValue>(config: InMemoryBTreeConfig<TKey>)
|
|
|
826
847
|
|
|
827
848
|
Exposes `InMemoryBTree` methods as async equivalents returning `Promise`. Writes coordinate through the shared store; reads sync before returning when `readMode` is `'strong'` (the default). When `readMode` is `'local'`, reads execute against the local tree without syncing.
|
|
828
849
|
|
|
829
|
-
| Method
|
|
830
|
-
|
|
|
831
|
-
| `sync`
|
|
832
|
-
| `put`
|
|
833
|
-
| `putMany`
|
|
834
|
-
| `remove`
|
|
835
|
-
| `removeById`
|
|
836
|
-
| `peekById`
|
|
837
|
-
| `updateById`
|
|
838
|
-
| `popFirst`
|
|
839
|
-
| `popLast`
|
|
840
|
-
| `deleteRange`
|
|
841
|
-
| `clear`
|
|
842
|
-
| `peekFirst`
|
|
843
|
-
| `peekLast`
|
|
844
|
-
| `findFirst`
|
|
845
|
-
| `findLast`
|
|
846
|
-
| `get`
|
|
847
|
-
| `hasKey`
|
|
848
|
-
| `count`
|
|
849
|
-
| `range`
|
|
850
|
-
| `nextHigherKey`
|
|
851
|
-
| `nextLowerKey`
|
|
852
|
-
| `getPairOrNextLower`
|
|
853
|
-
| `entries`
|
|
854
|
-
| `entriesReversed`
|
|
855
|
-
| `keys`
|
|
856
|
-
| `values`
|
|
857
|
-
| `forEach`
|
|
858
|
-
| `
|
|
859
|
-
| `
|
|
860
|
-
| `
|
|
861
|
-
| `
|
|
862
|
-
| `
|
|
863
|
-
| `
|
|
864
|
-
| `
|
|
865
|
-
| `
|
|
850
|
+
| Method | Signature | Description |
|
|
851
|
+
| ------------------------ | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
852
|
+
| `sync` | `() => Promise<void>` | Fetch and apply the latest log entries from the shared store. |
|
|
853
|
+
| `put` | `(key: TKey, value: TValue) => Promise<EntryId>` | Insert with optimistic concurrency. |
|
|
854
|
+
| `putMany` | `(entries: readonly { key: TKey; value: TValue }[]) => Promise<EntryId[]>` | Batch insert with optimistic concurrency. |
|
|
855
|
+
| `remove` | `(key: TKey) => Promise<BTreeEntry<TKey, TValue> \| null>` | Remove the first matching entry by key. |
|
|
856
|
+
| `removeById` | `(entryId: EntryId) => Promise<BTreeEntry<TKey, TValue> \| null>` | Remove a specific entry by ID. |
|
|
857
|
+
| `peekById` | `(entryId: EntryId) => Promise<BTreeEntry<TKey, TValue> \| null>` | Look up an entry by ID (syncs first). |
|
|
858
|
+
| `updateById` | `(entryId: EntryId, value: TValue) => Promise<BTreeEntry<TKey, TValue> \| null>` | Update an entry by ID with optimistic concurrency. |
|
|
859
|
+
| `popFirst` | `() => Promise<BTreeEntry<TKey, TValue> \| null>` | Remove and return the smallest entry. |
|
|
860
|
+
| `popLast` | `() => Promise<BTreeEntry<TKey, TValue> \| null>` | Remove and return the largest entry. |
|
|
861
|
+
| `deleteRange` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => Promise<number>` | Delete entries in range with optimistic concurrency. |
|
|
862
|
+
| `clear` | `() => Promise<void>` | Remove all entries with optimistic concurrency. |
|
|
863
|
+
| `peekFirst` | `() => Promise<BTreeEntry<TKey, TValue> \| null>` | Return the smallest entry (syncs first). |
|
|
864
|
+
| `peekLast` | `() => Promise<BTreeEntry<TKey, TValue> \| null>` | Return the largest entry (syncs first). |
|
|
865
|
+
| `findFirst` | `(key: TKey) => Promise<BTreeEntry<TKey, TValue> \| null>` | Return the first entry matching key (syncs first). |
|
|
866
|
+
| `findLast` | `(key: TKey) => Promise<BTreeEntry<TKey, TValue> \| null>` | Return the last entry matching key (syncs first). |
|
|
867
|
+
| `get` | `(key: TKey) => Promise<TValue \| null>` | Return value by key (syncs first). |
|
|
868
|
+
| `hasKey` | `(key: TKey) => Promise<boolean>` | Check key existence (syncs first). |
|
|
869
|
+
| `count` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => Promise<number>` | Count entries in range (syncs first). |
|
|
870
|
+
| `range` | `(startKey: TKey, endKey: TKey, options?: RangeBounds) => Promise<BTreeEntry<TKey, TValue>[]>` | Range query (syncs first). |
|
|
871
|
+
| `nextHigherKey` | `(key: TKey) => Promise<TKey \| null>` | Next key strictly greater (syncs first). |
|
|
872
|
+
| `nextLowerKey` | `(key: TKey) => Promise<TKey \| null>` | Next key strictly less (syncs first). |
|
|
873
|
+
| `getPairOrNextLower` | `(key: TKey) => Promise<BTreeEntry<TKey, TValue> \| null>` | Exact match or next lower (syncs first). |
|
|
874
|
+
| `entries` | `() => Promise<BTreeEntry<TKey, TValue>[]>` | Return all entries as array (syncs first). |
|
|
875
|
+
| `entriesReversed` | `() => Promise<BTreeEntry<TKey, TValue>[]>` | Return all entries in reverse as array (syncs first). |
|
|
876
|
+
| `keys` | `() => Promise<TKey[]>` | Return all keys as array (syncs first). |
|
|
877
|
+
| `values` | `() => Promise<TValue[]>` | Return all values as array (syncs first). |
|
|
878
|
+
| `forEach` | `(callback: (entry: BTreeEntry<TKey, TValue>) => void) => Promise<void>` | Iterate all entries (syncs first). |
|
|
879
|
+
| `forEachRange` | `(startKey, endKey, callback, options?) => Promise<void>` | Iterate entries in range (syncs first). |
|
|
880
|
+
| `snapshot` | `() => Promise<BTreeEntry<TKey, TValue>[]>` | Return all entries (syncs first). |
|
|
881
|
+
| `size` | `() => Promise<number>` | Return entry count (syncs first). |
|
|
882
|
+
| `getStats` | `() => Promise<BTreeStats>` | Return structural statistics (syncs first). |
|
|
883
|
+
| `assertInvariants` | `() => Promise<void>` | Assert structural integrity (syncs first). |
|
|
884
|
+
| `clone` | `() => Promise<InMemoryBTree<TKey, TValue>>` | Return an independent local copy (syncs first). |
|
|
885
|
+
| `toJSON` | `() => Promise<BTreeJSON<TKey, TValue>>` | Serialize to JSON (syncs first). |
|
|
886
|
+
| `fromJSON` (static) | `(json: BTreeJSON<TKey, TValue>, compareKeys: KeyComparator<TKey>) => InMemoryBTree<TKey, TValue>` | Deserialize from JSON (returns local tree). |
|
|
887
|
+
| `[Symbol.asyncIterator]` | `() => AsyncIterableIterator<BTreeEntry<TKey, TValue>>` | Async iteration over all entries (syncs first). |
|
|
866
888
|
|
|
867
889
|
**Constructor:**
|
|
868
890
|
|
|
@@ -886,7 +908,7 @@ new ConcurrentInMemoryBTree<TKey, TValue>(config: ConcurrentInMemoryBTreeConfig<
|
|
|
886
908
|
| `ConcurrentInMemoryBTreeConfig<TKey, TValue>` | Extends `InMemoryBTreeConfig<TKey>` with `store: SharedTreeStore<TKey, TValue>`, `maxRetries?: number`, `maxSyncMutationsPerBatch?: number`, and `readMode?: ReadMode`. |
|
|
887
909
|
| `SharedTreeStore<TKey, TValue>` | Interface with `getLogEntriesSince(version)` and `append(expectedVersion, mutations)`. |
|
|
888
910
|
| `SharedTreeLog<TKey, TValue>` | `{ version: bigint; mutations: BTreeMutation<TKey, TValue>[] }` |
|
|
889
|
-
| `BTreeMutation<TKey, TValue>` | Discriminated union: `init`, `put`, `putMany`, `remove`, `removeById`, `updateById`, `popFirst`, `popLast`, `deleteRange`, `clear`.
|
|
911
|
+
| `BTreeMutation<TKey, TValue>` | Discriminated union: `init`, `put`, `putMany`, `remove`, `removeById`, `updateById`, `popFirst`, `popLast`, `deleteRange`, `clear`. |
|
|
890
912
|
| `BTreeValidationError` | Error thrown for comparator or config violations. |
|
|
891
913
|
| `BTreeInvariantError` | Error thrown for tree structural integrity violations. |
|
|
892
914
|
| `BTreeConcurrencyError` | Error thrown for concurrency conflicts or store contract violations. |
|
package/dist/InMemoryBTree.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type BTreeJSON } from './btree/serialization.js';
|
|
2
|
-
import { type BTreeEntry, type BTreeStats, type DuplicateKeyPolicy, type EntryId, type InMemoryBTreeConfig, type KeyComparator, type RangeBounds } from './btree/types.js';
|
|
3
|
-
export type { BTreeJSON };
|
|
4
|
-
export type { BTreeEntry, BTreeStats, DuplicateKeyPolicy, EntryId, InMemoryBTreeConfig, RangeBounds };
|
|
2
|
+
import { type BTreeEntry, type BTreeStats, type DeleteRebalancePolicy, type DuplicateKeyPolicy, type EntryId, type InMemoryBTreeConfig, type KeyComparator, type RangeBounds } from './btree/types.js';
|
|
3
|
+
export type { BTreeEntry, BTreeJSON, BTreeStats, DeleteRebalancePolicy, DuplicateKeyPolicy, EntryId, InMemoryBTreeConfig, RangeBounds, };
|
|
5
4
|
export declare class InMemoryBTree<TKey, TValue> {
|
|
6
5
|
private readonly state;
|
|
7
6
|
constructor(config: InMemoryBTreeConfig<TKey>);
|
|
@@ -22,37 +21,11 @@ export declare class InMemoryBTree<TKey, TValue> {
|
|
|
22
21
|
get(key: TKey): TValue | null;
|
|
23
22
|
hasKey(key: TKey): boolean;
|
|
24
23
|
findFirst(key: TKey): BTreeEntry<TKey, TValue> | null;
|
|
25
|
-
/**
|
|
26
|
-
* Returns the last entry whose key matches `key`, or `null` if not found.
|
|
27
|
-
* Useful when `duplicateKeys` is `'allow'` and multiple entries share the same key.
|
|
28
|
-
*/
|
|
29
24
|
findLast(key: TKey): BTreeEntry<TKey, TValue> | null;
|
|
30
|
-
/**
|
|
31
|
-
* Returns the smallest key in the tree that is strictly greater than `key`,
|
|
32
|
-
* or `null` if no such key exists.
|
|
33
|
-
*/
|
|
34
25
|
nextHigherKey(key: TKey): TKey | null;
|
|
35
|
-
/**
|
|
36
|
-
* Returns the largest key in the tree that is strictly less than `key`,
|
|
37
|
-
* or `null` if no such key exists.
|
|
38
|
-
*/
|
|
39
26
|
nextLowerKey(key: TKey): TKey | null;
|
|
40
|
-
/**
|
|
41
|
-
* Returns the entry for `key` if it exists; otherwise returns the entry with
|
|
42
|
-
* the largest key strictly less than `key`. Returns `null` when the tree is
|
|
43
|
-
* empty or every key is greater than `key`.
|
|
44
|
-
*/
|
|
45
27
|
getPairOrNextLower(key: TKey): BTreeEntry<TKey, TValue> | null;
|
|
46
|
-
/**
|
|
47
|
-
* Returns the number of entries whose keys fall within [`startKey`, `endKey`].
|
|
48
|
-
* Pass `options` to make either bound exclusive.
|
|
49
|
-
*/
|
|
50
28
|
count(startKey: TKey, endKey: TKey, options?: RangeBounds): number;
|
|
51
|
-
/**
|
|
52
|
-
* Deletes all entries whose keys fall within [`startKey`, `endKey`].
|
|
53
|
-
* Pass `options` to make either bound exclusive.
|
|
54
|
-
* @returns The number of entries deleted.
|
|
55
|
-
*/
|
|
56
29
|
deleteRange(startKey: TKey, endKey: TKey, options?: RangeBounds): number;
|
|
57
30
|
range(startKey: TKey, endKey: TKey, options?: RangeBounds): BTreeEntry<TKey, TValue>[];
|
|
58
31
|
entries(): IterableIterator<BTreeEntry<TKey, TValue>>;
|
|
@@ -60,15 +33,9 @@ export declare class InMemoryBTree<TKey, TValue> {
|
|
|
60
33
|
keys(): IterableIterator<TKey>;
|
|
61
34
|
values(): IterableIterator<TValue>;
|
|
62
35
|
[Symbol.iterator](): IterableIterator<BTreeEntry<TKey, TValue>>;
|
|
36
|
+
forEachRange(startKey: TKey, endKey: TKey, callback: (entry: BTreeEntry<TKey, TValue>) => void, options?: RangeBounds): void;
|
|
63
37
|
forEach(callback: (entry: BTreeEntry<TKey, TValue>) => void, thisArg?: unknown): void;
|
|
64
38
|
snapshot(): BTreeEntry<TKey, TValue>[];
|
|
65
|
-
/**
|
|
66
|
-
* Returns a structurally independent `InMemoryBTree` with identical
|
|
67
|
-
* configuration and entries. The tree structure (nodes, links, entry IDs)
|
|
68
|
-
* is fully independent, but stored key and value references are shared
|
|
69
|
-
* with the source tree.
|
|
70
|
-
* Note: `EntryId` values are reassigned in the clone — IDs from the source tree are not valid for the clone.
|
|
71
|
-
*/
|
|
72
39
|
clone(): InMemoryBTree<TKey, TValue>;
|
|
73
40
|
toJSON(): BTreeJSON<TKey, TValue>;
|
|
74
41
|
static fromJSON<TKey, TValue>(json: BTreeJSON<TKey, TValue>, compareKeys: KeyComparator<TKey>): InMemoryBTree<TKey, TValue>;
|
|
@@ -8,3 +8,4 @@ export declare const computeNextAutoScaleThreshold: (entryCount: number) => numb
|
|
|
8
8
|
export declare const createInitialState: <TKey, TValue>(config: InMemoryBTreeConfig<TKey>) => BTreeState<TKey, TValue>;
|
|
9
9
|
export declare const maybeAutoScale: <TKey, TValue>(state: BTreeState<TKey, TValue>) => void;
|
|
10
10
|
export declare const applyAutoScaleCapacitySnapshot: <TKey, TValue>(state: BTreeState<TKey, TValue>, maxLeafEntries: number, maxBranchChildren: number) => void;
|
|
11
|
+
export declare const resetAutoScaleToTier0: <TKey, TValue>(state: BTreeState<TKey, TValue>) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type BTreeEntry, type BTreeState, type EntryId, type LeafNode } from './types.js';
|
|
2
|
+
export declare const findLeafEntryBySequence: <TKey, TValue>(state: BTreeState<TKey, TValue>, userKey: TKey, sequence: number) => {
|
|
3
|
+
leaf: LeafNode<TKey, TValue>;
|
|
4
|
+
index: number;
|
|
5
|
+
} | null;
|
|
6
|
+
export declare const peekEntryById: <TKey, TValue>(state: BTreeState<TKey, TValue>, entryId: EntryId) => BTreeEntry<TKey, TValue> | null;
|
|
7
|
+
export declare const updateEntryById: <TKey, TValue>(state: BTreeState<TKey, TValue>, entryId: EntryId, newValue: TValue) => BTreeEntry<TKey, TValue> | null;
|
|
8
|
+
export declare const removeEntryById: <TKey, TValue>(state: BTreeState<TKey, TValue>, entryId: EntryId) => BTreeEntry<TKey, TValue> | null;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { type BTreeEntry, type BTreeState, type EntryId } from './types.js';
|
|
2
|
+
export { peekEntryById, removeEntryById, updateEntryById, } from './entry-lookup.js';
|
|
2
3
|
export declare const putEntry: <TKey, TValue>(state: BTreeState<TKey, TValue>, key: TKey, value: TValue) => EntryId;
|
|
3
4
|
export declare const popFirstEntry: <TKey, TValue>(state: BTreeState<TKey, TValue>) => BTreeEntry<TKey, TValue> | null;
|
|
4
5
|
export declare const popLastEntry: <TKey, TValue>(state: BTreeState<TKey, TValue>) => BTreeEntry<TKey, TValue> | null;
|
|
5
6
|
export declare const removeFirstMatchingEntry: <TKey, TValue>(state: BTreeState<TKey, TValue>, key: TKey) => BTreeEntry<TKey, TValue> | null;
|
|
6
|
-
export declare const removeEntryById: <TKey, TValue>(state: BTreeState<TKey, TValue>, entryId: EntryId) => BTreeEntry<TKey, TValue> | null;
|
|
7
|
-
export declare const peekEntryById: <TKey, TValue>(state: BTreeState<TKey, TValue>, entryId: EntryId) => BTreeEntry<TKey, TValue> | null;
|
|
8
|
-
export declare const updateEntryById: <TKey, TValue>(state: BTreeState<TKey, TValue>, entryId: EntryId, newValue: TValue) => BTreeEntry<TKey, TValue> | null;
|
|
9
7
|
export declare const putManyEntries: <TKey, TValue>(state: BTreeState<TKey, TValue>, entries: readonly {
|
|
10
8
|
key: TKey;
|
|
11
9
|
value: TValue;
|