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

Method getNodeById

src/db/queries.ts:1175–1195  ·  view source on GitHub ↗

* Get a node by ID

(id: string)

Source from the content-addressed store, hash-verified

1173 * Get a node by ID
1174 */
1175 getNodeById(id: string): Node | null {
1176 // Check cache first
1177 if (this.nodeCache.has(id)) {
1178 const cached = this.nodeCache.get(id)!;
1179 // Move to end to implement LRU (delete and re-add)
1180 this.nodeCache.delete(id);
1181 this.nodeCache.set(id, cached);
1182 return cached;
1183 }
1184
1185 if (!this.stmts.getNodeById) {
1186 this.stmts.getNodeById = prepareNodeStatement(this.db, 'SELECT * FROM nodes WHERE id = ?');
1187 }
1188 const node = this.stmts.getNodeById.get(id);
1189 if (!node) {
1190 return null;
1191 }
1192
1193 this.cacheNode(node);
1194 return node;
1195 }
1196
1197 /**
1198 * Batch lookup: fetch many nodes by ID in a single SQL round-trip.

Callers

nothing calls this directly

Calls 6

cacheNodeMethod · 0.95
prepareNodeStatementFunction · 0.85
hasMethod · 0.80
getMethod · 0.65
deleteMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected