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

Method getNodeById

src/db/queries.ts:1173–1193  ·  view source on GitHub ↗

* Get a node by ID

(id: string)

Source from the content-addressed store, hash-verified

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