/** * SQLite Manager with optimized settings for local indexing workloads */ import Database from "better-sqlite3"; export interface SQLiteConfig { dbPath?: string; projectPath?: string; readOnly?: boolean; verbose?: boolean; dbMode?: "single" | "per-project"; /** Memory-mapped I/O size in bytes (default: 1GB). Set to 0 to disable. */ mmapSize?: number; /** Cache size in KB (default: 64MB) */ cacheSizeKb?: number; } export declare class SQLiteManager { private db; private dbPath; private isReadOnly; private mmapSize; private cacheSizeKb; constructor(config?: SQLiteConfig); private ensureDirectoryExists; /** * Load sqlite-vec extension for vector search */ private loadVectorExtension; /** * Create sqlite-vec virtual tables for vector search with specified dimensions * Public method called when embedding provider dimensions are known */ createVecTablesWithDimensions(dimensions: number): void; /** * Apply performance optimizations */ private optimizeDatabase; /** * Initialize database schema from schema.sql */ private initializeSchema; private isLegacySchema; private dropAllTables; /** * Apply database migrations for existing databases */ private applyMigrations; /** * Get the underlying database instance */ getDatabase(): Database.Database; /** * Execute a transaction */ transaction(fn: () => T): T; /** * Prepare a statement */ prepare(sql: string): Database.Statement; /** * Execute SQL directly */ exec(sql: string): void; /** * Close the database connection */ close(): void; /** * Get database statistics */ getStats(): { dbPath: string; fileSize: number; pageCount: number; pageSize: number; wal: { enabled: boolean; size: number | null; }; }; /** * Get database file path */ getDbPath(): string; /** * Vacuum the database to reclaim space */ vacuum(): void; /** * Analyze the database for query optimization */ analyze(): void; /** * Checkpoint the WAL file */ checkpoint(): void; /** * Get current schema version */ getSchemaVersion(): number; } /** * Get a SQLiteManager instance for the given config. * Instances are cached by dbPath to avoid re-opening the same database. */ export declare function getSQLiteManager(config?: SQLiteConfig): SQLiteManager; /** * Reset all cached SQLiteManager instances. * Useful for testing or when switching projects. */ export declare function resetSQLiteManager(): void; /** * Reset a specific SQLiteManager instance by path. */ export declare function resetSQLiteManagerByPath(dbPath: string): void; //# sourceMappingURL=SQLiteManager.d.ts.map