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

Method resolveReferencesBatched

src/index.ts:1228–1255  ·  view source on GitHub ↗

* Resolve references in batches to keep memory bounded on large codebases. * Processes chunks of unresolved refs, persisting results after each batch.

(
    onProgress?: (current: number, total: number) => void,
    onSynthesisProgress?: (done: number, total: number) => void,
    // The WAL valve's writer-side backstop, threaded into the batch loop's
    // pool-idle boundaries. Without it the valve's only lever during
    // resolution is timer-driven passive checkpoints, which the pool's
    // continuous reads keep perpetually partial — the WAL then accretes the
    // whole phase's write volume (22GB on a 4.6GB DB at kernel scale).
    backpressure?: () => Promise<void> | null
  )

Source from the content-addressed store, hash-verified

1226 * Processes chunks of unresolved refs, persisting results after each batch.
1227 */
1228 async resolveReferencesBatched(
1229 onProgress?: (current: number, total: number) => void,
1230 onSynthesisProgress?: (done: number, total: number) => void,
1231 // The WAL valve's writer-side backstop, threaded into the batch loop's
1232 // pool-idle boundaries. Without it the valve's only lever during
1233 // resolution is timer-driven passive checkpoints, which the pool's
1234 // continuous reads keep perpetually partial — the WAL then accretes the
1235 // whole phase's write volume (22GB on a 4.6GB DB at kernel scale).
1236 backpressure?: () => Promise<void> | null
1237 ): Promise<ResolutionResult> {
1238 return this.resolver.resolveAndPersistBatched(onProgress, undefined, onSynthesisProgress, {
1239 dbPath: this.db.getPath(),
1240 // Bulk-edge-load hooks: on big runs the resolver drops the non-unique
1241 // edge indexes for the batch loop and recreates them before synthesis
1242 // (which reads kind-keyed). Concurrent readers (a daemon serving this
1243 // project mid-index) stay CORRECT during the window — target/kind reads
1244 // just degrade to scans until the recreate.
1245 bulkEdgeLoad: {
1246 begin: () => this.db.beginBulkEdgeLoad(),
1247 end: () => this.db.endBulkEdgeLoad(),
1248 },
1249 refIndexLoad: {
1250 begin: () => this.db.beginBulkRefLoad(),
1251 end: () => this.db.endBulkRefLoad(),
1252 },
1253 backpressure,
1254 });
1255 }
1256
1257 /**
1258 * References extracted but never attempted by a resolution pass. Zero on a

Callers 3

indexAllMethod · 0.95
syncMethod · 0.95

Calls 6

getPathMethod · 0.80
beginBulkEdgeLoadMethod · 0.80
endBulkEdgeLoadMethod · 0.80
beginBulkRefLoadMethod · 0.80
endBulkRefLoadMethod · 0.80

Tested by

no test coverage detected