MCPcopy
hub / github.com/colbymchenry/codegraph / getExistingNodeIds

Method getExistingNodeIds

src/db/queries.ts:490–507  ·  view source on GitHub ↗
(ids: readonly string[])

Source from the content-addressed store, hash-verified

488 }
489
490 private getExistingNodeIds(ids: readonly string[]): Set<string> {
491 const out = new Set<string>();
492 if (ids.length === 0) return out;
493
494 const uniqueIds = [...new Set(ids)];
495 for (let i = 0; i < uniqueIds.length; i += SQLITE_PARAM_CHUNK_SIZE) {
496 const chunk = uniqueIds.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
497 const placeholders = chunk.map(() => '?').join(',');
498 const rows = this.db
499 .prepare(`SELECT id FROM nodes WHERE id IN (${placeholders})`)
500 .all(...chunk) as { id: string }[];
501 for (const row of rows) {
502 out.add(row.id);
503 }
504 }
505
506 return out;
507 }
508
509 /**
510 * Add a node to the cache, evicting oldest if needed

Callers 1

insertEdgesMethod · 0.95

Calls 3

joinMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65

Tested by

no test coverage detected