UNPKG

@aurios/jason

Version:

A simple, lightweight, and embeddable JSON document database built on Bun.

38 lines (37 loc) 1.25 kB
type KeyType = string | number | Date; export interface BTreeOptions { order?: number; unique?: boolean; keyParser?: (key: KeyType) => KeyType; } export declare class BTreeIndex { private root; private readonly order; private readonly unique; private readonly keyParser; /** * Creates a new B-tree index instance * @param options - Configuration options for the B-tree * @param options.order - The order (degree) of the B-tree. Default is 3 * @param options.unique - Whether duplicate keys are allowed. Default is false * @param options.keyParser - Custom function to parse/transform keys. Default uses internal parser */ constructor(options?: BTreeOptions); private defaultKeyParser; private createNode; private compare; insert(key: KeyType, docId: string): void; private splitChild; private insertNonFull; delete(key: KeyType, docId: string): void; private deleteRecursive; private deleteInternalNode; private rebalance; search(key: KeyType): string[]; private searchRecursive; searchRange(min: number, max: number): string[]; private searchRangeRecursive; compact(): void; private compactRecursive; } export {};