import type { Database } from "./database.js"; import type { FileRecord } from "../types/index.js"; export declare class FileStore { private db; private insertStmt; private getByPathStmt; private getAllStmt; private deleteStmt; private updatePagerankStmt; private getLanguagesStmt; private cachedAll; private cacheHits; private cacheMisses; constructor(db: Database); upsert(path: string, language: string | null, hash: string, lastModified: number, sizeBytes: number): number; getByPath(path: string): FileRecord | undefined; /** * Lenient lookup: try the path verbatim, then strip leading "./", * then try as a suffix (handles cases where callers pass a path * prefixed with the project name like "sverklo/src/foo.ts" against * an index that stores "src/foo.ts"). Returns the first match. * Suffix lookup requires a `/` boundary before the suffix to avoid * "foo.ts" accidentally matching "barfoo.ts". * * Dogfood T5 (architectural review 2026-05-13): path-format * inconsistency across deps / refs / impact tools made the suggested * input format from one tool fail in another. */ findByPath(path: string): FileRecord | undefined; getAll(): FileRecord[]; /** * Return cache hit/miss counters so sverklo_status can surface them. * Hit rate = hits / (hits + misses) is the most actionable single * number — high rate means the cache is doing its job; near-zero * means callers are invalidating it too aggressively (or the cache * isn't being reached because of architecture above it). */ getCacheStats(): { hits: number; misses: number; hitRate: number; }; delete(path: string): void; updatePagerank(id: number, score: number): void; /** * Drop the snapshot. Call after bulk operations (transactions, * migrations) that mutate the files table without going through the * upsert/delete/updatePagerank methods. Cheap no-op if already null. */ invalidateCache(): void; getLanguages(): string[]; count(): number; }