File tree Expand file tree Collapse file tree 4 files changed +46
-0
lines changed
Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 790790 "command" : " codeQL.trimCache" ,
791791 "title" : " CodeQL: Trim Cache"
792792 },
793+ {
794+ "command" : " codeQL.trimOverlayBaseCache" ,
795+ "title" : " CodeQL: Trim Overlay Base Cache"
796+ },
793797 {
794798 "command" : " codeQL.installPackDependencies" ,
795799 "title" : " CodeQL: Install Pack Dependencies"
Original file line number Diff line number Diff line change @@ -284,6 +284,8 @@ export class DatabaseUI extends DisposableObject {
284284 this . handleUpgradeCurrentDatabase . bind ( this ) ,
285285 "codeQL.clearCache" : this . handleClearCache . bind ( this ) ,
286286 "codeQL.trimCache" : this . handleTrimCache . bind ( this ) ,
287+ "codeQL.trimOverlayBaseCache" :
288+ this . queryServer . handleTrimOverlayBaseCache . bind ( this ) ,
287289 "codeQLDatabases.chooseDatabaseFolder" :
288290 this . handleChooseDatabaseFolder . bind ( this ) ,
289291 "codeQLDatabases.chooseDatabaseArchive" :
@@ -688,6 +690,24 @@ export class DatabaseUI extends DisposableObject {
688690 ) ;
689691 }
690692
693+ private async handleTrimOverlayBaseCache ( ) : Promise < void > {
694+ return withProgress (
695+ async ( ) => {
696+ if (
697+ this . queryServer !== undefined &&
698+ this . databaseManager . currentDatabaseItem !== undefined
699+ ) {
700+ await this . queryServer . trimOverlayBaseCacheInDatabase (
701+ this . databaseManager . currentDatabaseItem ,
702+ ) ;
703+ }
704+ } ,
705+ {
706+ title : "Removing all overlay-dependent data from cache" ,
707+ } ,
708+ ) ;
709+ }
710+
691711 private async handleGetCurrentDatabase ( ) : Promise < string | undefined > {
692712 const dbItem = await this . getDatabaseItemInternal ( undefined ) ;
693713 return dbItem ?. databaseUri . fsPath ;
Original file line number Diff line number Diff line change @@ -193,6 +193,14 @@ export const trimCache = new RequestType<
193193 ClearCacheResult ,
194194 void
195195> ( "evaluation/trimCache" ) ;
196+ /**
197+ * Trim the cache of a dataset
198+ */
199+ export const trimOverlayBaseCache = new RequestType <
200+ WithProgressId < TrimCacheParams > ,
201+ ClearCacheResult ,
202+ void
203+ > ( "evaluation/trimOverlayBaseCache" ) ;
196204
197205/**
198206 * Clear the pack cache
Original file line number Diff line number Diff line change @@ -142,6 +142,20 @@ export class QueryRunner {
142142 await this . qs . sendRequest ( trimCache , params ) ;
143143 }
144144
145+ async trimOverlayBaseCacheInDatabase ( dbItem : DatabaseItem ) : Promise < void > {
146+ if ( dbItem . contents === undefined ) {
147+ throw new Error (
148+ "Can't trim the overlay base cache in an invalid database." ,
149+ ) ;
150+ }
151+
152+ const db = dbItem . databaseUri . fsPath ;
153+ const params : TrimCacheParams = {
154+ db,
155+ } ;
156+ await this . qs . sendRequest ( trimOverlayBaseCache , params ) ;
157+ }
158+
145159 public async compileAndRunQueryAgainstDatabaseCore (
146160 dbPath : string ,
147161 queries : CoreQueryTarget [ ] ,
You can’t perform that action at this time.
0 commit comments