import type { BPTreeUnknownNode, SerializableData, SerializeStrategyHead } from '../types'; /** * Abstraction for B+Tree node access operations. * Both MVCC-based (BPTreeSyncTransaction) and strategy-direct (BPTreePure) * implementations provide this interface to the shared algorithm functions. */ export interface BPTreeNodeOps { getNode(id: string): BPTreeUnknownNode; createNode(leaf: boolean, keys: string[] | K[][], values: V[], parent?: string | null, next?: string | null, prev?: string | null): BPTreeUnknownNode; updateNode(node: BPTreeUnknownNode): void; deleteNode(node: BPTreeUnknownNode): void; readHead(): SerializeStrategyHead | null; writeHead(head: SerializeStrategyHead): void; } /** * Mutable algorithm context passed to B+Tree algorithm functions. * `rootId` is mutable because tree mutations (insert, delete) may change the root. */ export interface BPTreeAlgoContext { rootId: string; order: number; readonly headData: () => SerializableData; } /** * Async version of BPTreeNodeOps for async B+Tree operations. */ export interface BPTreeNodeOpsAsync { getNode(id: string): Promise>; createNode(leaf: boolean, keys: string[] | K[][], values: V[], parent?: string | null, next?: string | null, prev?: string | null): Promise>; updateNode(node: BPTreeUnknownNode): Promise; deleteNode(node: BPTreeUnknownNode): Promise; readHead(): Promise; writeHead(head: SerializeStrategyHead): Promise; }