import { Node } from "../node.js"; import { NodeDB } from "./node-db.js"; //#region src/storage/node-iterator.d.ts /** * NodeIterator provides depth-first traversal of a tree starting from a root node. * Unlike TreeIterator which iterates key-value pairs, NodeIterator traverses nodes themselves. * * This is primarily used for: * - Orphan detection (comparing trees at different versions) * - Tree structure traversal * - Node-level operations */ declare class NodeIterator { private nodesToVisit; private readonly ndb; private err; /** * Creates a new NodeIterator starting from the given root node key. * * @param rootKey - The node key to start iteration from (null for empty tree) * @param ndb - NodeDB instance for loading child nodes */ private constructor(); /** * Factory method to create a new NodeIterator. * Must be async to load the initial root node from storage. * * @param rootKey - The node key to start iteration from (null for empty tree) * @param ndb - NodeDB instance for loading child nodes * @returns A new NodeIterator instance */ static create(rootKey: Uint8Array | null, ndb: NodeDB): Promise; /** * Returns the current node being visited. * * @returns The current node (last in the nodesToVisit stack) */ getNode(): Node; /** * Checks if the iterator is still valid (has nodes to visit and no errors). * * @returns true if iterator can continue, false otherwise */ valid(): boolean; /** * Returns any error that occurred during iteration. * * @returns The error if any, null otherwise */ error(): Error | null; /** * Moves to the next node in depth-first order. * * If isSkipped is true, the subtree under the current node is skipped entirely. * Otherwise, the current node's children are added to the traversal stack. * * Traversal order: current node -> left subtree -> right subtree (DFS pre-order) * * @param isSkipped - If true, skip the current node's subtree */ next(isSkipped: boolean): Promise; } //#endregion export { NodeIterator }; //# sourceMappingURL=node-iterator.d.ts.map