(
tag: IndexTag,
results: RefreshIndexResults,
markComplete: MarkCompleteCallback,
repoName: string | undefined,
)
| 26 | } |
| 27 | |
| 28 | async *update( |
| 29 | tag: IndexTag, |
| 30 | results: RefreshIndexResults, |
| 31 | markComplete: MarkCompleteCallback, |
| 32 | repoName: string | undefined, |
| 33 | ): AsyncGenerator<IndexingProgressUpdate, any, unknown> { |
| 34 | const db = await SqliteDb.get(); |
| 35 | await TestCodebaseIndex._createTables(db); |
| 36 | |
| 37 | for (const item of [...results.compute, ...results.addTag]) { |
| 38 | await db.run( |
| 39 | "INSERT INTO test_index (path, branch, directory) VALUES (?, ?, ?)", |
| 40 | [item.path, tag.branch, tag.directory], |
| 41 | ); |
| 42 | } |
| 43 | |
| 44 | for (const item of [...results.del, ...results.removeTag]) { |
| 45 | await db.run( |
| 46 | "DELETE FROM test_index WHERE path = ? AND branch = ? AND directory = ?", |
| 47 | [item.path, tag.branch, tag.directory], |
| 48 | ); |
| 49 | } |
| 50 | |
| 51 | await markComplete(results.compute, IndexResultType.Compute); |
| 52 | await markComplete(results.addTag, IndexResultType.AddTag); |
| 53 | await markComplete(results.del, IndexResultType.Delete); |
| 54 | await markComplete(results.removeTag, IndexResultType.RemoveTag); |
| 55 | } |
| 56 | |
| 57 | async getIndexedFilesForTags(tags: IndexTag[]): Promise<string[]> { |
| 58 | const db = await SqliteDb.get(); |
nothing calls this directly
no test coverage detected