/** * Nexus DB handle pool — LRU cache for per-project graph DB handles (T9150 ADR-072). * * Cross-project queries open multiple per-project nexus-graph/.db files. * This module provides a soft-cap LRU pool of 32 Database handles to bound * file descriptor usage regardless of project count. * * When the 33rd handle is requested, the least-recently-used handle is closed * first. This provides O(1) amortized access with bounded resource usage. * * Usage: * ```ts * const pool = getNexusHandlePool(); * const db = pool.acquire('/path/to/nexus-graph/projId.db'); * // use db... * // pool.release() is a no-op — the pool manages lifecycle * ``` * * @task T9150 * @see ADR-072 docs/adr/ADR-072-nexus-db-split.md */ import { DatabaseSync } from 'node:sqlite'; /** * LRU pool of `DatabaseSync` handles for per-project nexus-graph files. * * Thread-safety note: Node.js is single-threaded; concurrent `await` calls * do not interleave synchronous sections. The pool is safe for async workloads. */ export declare class NexusHandlePool { private readonly cap; private readonly map; private head; private tail; constructor(softCap?: number); /** * Acquire a `DatabaseSync` handle for the given path. * * If the handle is already in the pool, it is promoted to MRU position. * If the pool is full, the LRU handle is closed and evicted first. */ acquire(dbPath: string): DatabaseSync; /** * Explicitly close and evict a handle (e.g. after a project is unregistered). */ evict(dbPath: string): void; /** Close all handles and clear the pool. */ closeAll(): void; /** Number of open handles. */ get size(): number; private evictLru; private insertHead; private promoteToHead; private removeNode; } /** Return the global singleton LRU handle pool. */ export declare function getNexusHandlePool(): NexusHandlePool; /** Reset the singleton (for testing). */ export declare function resetNexusHandlePool(): void; //# sourceMappingURL=store.d.ts.map