MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / hasCodeGraphSchema

Function hasCodeGraphSchema

src/directory.ts:193–201  ·  view source on GitHub ↗
(dbPath: string, st: fs.Stats)

Source from the content-addressed store, hash-verified

191const schemaProbeCache = new Map<string, { mtimeMs: number; size: number; ok: boolean }>();
192
193function hasCodeGraphSchema(dbPath: string, st: fs.Stats): boolean {
194 if (!st.isFile() || st.size < SQLITE_HEADER_SIZE) return false;
195 const cached = schemaProbeCache.get(dbPath);
196 if (cached && cached.mtimeMs === st.mtimeMs && cached.size === st.size) return cached.ok;
197 const probe = probeSchema(dbPath);
198 const ok = probe === 'schema' || probe === 'unknown';
199 schemaProbeCache.set(dbPath, { mtimeMs: st.mtimeMs, size: st.size, ok });
200 return ok;
201}
202
203/**
204 * What `codegraph.db` holds, asked of SQLite itself through a read-only

Callers 1

isInitializedFunction · 0.85

Calls 3

probeSchemaFunction · 0.85
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected