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

Function identify

src/ui-server/api/session.ts:52–76  ·  view source on GitHub ↗
(dbPath: string)

Source from the content-addressed store, hash-verified

50}
51
52function identify(dbPath: string): FileIdentity | null {
53 try {
54 const st = fs.statSync(dbPath);
55 let walSize = 0;
56 let walMtimeMs = 0;
57 try {
58 const wal = fs.statSync(`${dbPath}-wal`);
59 walSize = wal.size;
60 walMtimeMs = wal.mtimeMs;
61 } catch {
62 // No WAL sidecar: either not in WAL mode, or fully checkpointed. Both are
63 // "nothing pending", which is what zeroes mean here.
64 }
65 return {
66 ino: st.ino,
67 birthtimeMs: st.birthtimeMs,
68 size: st.size,
69 mtimeMs: st.mtimeMs,
70 walSize,
71 walMtimeMs,
72 };
73 } catch {
74 return null;
75 }
76}
77
78function sameFile(a: FileIdentity | null, b: FileIdentity | null): boolean {
79 if (a === null || b === null) return false;

Callers 1

acquireMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected