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

Method indexFiles

src/index.ts:521–534  ·  view source on GitHub ↗

* Index specific files * * Uses a mutex to prevent concurrent indexing operations.

(filePaths: string[])

Source from the content-addressed store, hash-verified

519 * Uses a mutex to prevent concurrent indexing operations.
520 */
521 async indexFiles(filePaths: string[]): Promise<IndexResult> {
522 return this.indexMutex.withLock(async () => {
523 try {
524 this.fileLock.acquire();
525 } catch {
526 return { success: false, filesIndexed: 0, filesSkipped: 0, filesErrored: 0, nodesCreated: 0, edgesCreated: 0, errors: [{ message: 'Could not acquire file lock - another process may be indexing', severity: 'error' as const }], durationMs: 0 };
527 }
528 try {
529 return this.orchestrator.indexFiles(filePaths);
530 } finally {
531 this.fileLock.release();
532 }
533 });
534 }
535
536 /**
537 * Sync with current file state (incremental update)

Callers 1

extraction.test.tsFile · 0.45

Calls 3

releaseMethod · 0.80
withLockMethod · 0.45
acquireMethod · 0.45

Tested by

no test coverage detected