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

Method getUnresolvedReferencesBatch

src/db/queries.ts:2082–2105  ·  view source on GitHub ↗

* Get a batch of PENDING unresolved references using LIMIT/OFFSET * pagination. Used to process references in bounded memory chunks; failed * rows are excluded so the batched drain loop terminates once every row * has been attempted.

(offset: number, limit: number)

Source from the content-addressed store, hash-verified

2080 * has been attempted.
2081 */
2082 getUnresolvedReferencesBatch(offset: number, limit: number): UnresolvedReference[] {
2083 if (!this.stmts.getUnresolvedBatch) {
2084 // ORDER BY rowid is load-bearing for the pipelined resolution loop: it
2085 // prefetches batch k+1 at OFFSET batch_k.length while batch k's rows are
2086 // still pending, which is only exact under a stable enumeration. (A plain
2087 // scan and the status index both return rowid order anyway — this pins
2088 // it.)
2089 this.stmts.getUnresolvedBatch = this.db.prepare(
2090 "SELECT * FROM unresolved_refs WHERE status = 'pending' ORDER BY rowid LIMIT ? OFFSET ?"
2091 );
2092 }
2093 const rows = this.stmts.getUnresolvedBatch.all(limit, offset) as UnresolvedRefRow[];
2094 return rows.map((row) => ({
2095 fromNodeId: row.from_node_id,
2096 referenceName: row.reference_name,
2097 referenceKind: row.reference_kind as EdgeKind,
2098 line: row.line,
2099 column: row.col,
2100 candidates: row.candidates ? safeJsonParse(row.candidates, undefined) : undefined,
2101 filePath: row.file_path,
2102 language: row.language as Language,
2103 rowId: row.id,
2104 }));
2105 }
2106
2107 /**
2108 * Keyset variant of {@link getUnresolvedReferencesBatch} for the batched

Callers

nothing calls this directly

Calls 3

safeJsonParseFunction · 0.90
prepareMethod · 0.65
allMethod · 0.65

Tested by

no test coverage detected