File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,9 @@ pub trait Connection: Send + Sync {
179179 profile : & str ,
180180 cache : & str ,
181181 ) -> Vec < ( ArtifactIdNumber , i32 ) > ;
182+
183+ /// Removes all data associated with the given artifact.
184+ async fn purge_artifact ( & self , aid : & ArtifactId ) ;
182185}
183186
184187#[ async_trait:: async_trait]
Original file line number Diff line number Diff line change @@ -1380,4 +1380,14 @@ where
13801380 _ => panic ! ( "unknown artifact type: {:?}" , ty) ,
13811381 }
13821382 }
1383+
1384+ async fn purge_artifact ( & self , aid : & ArtifactId ) {
1385+ // Once we delete the artifact, all data associated with it should also be deleted
1386+ // thanks to ON DELETE CASCADE.
1387+ let info = aid. info ( ) ;
1388+ self . conn ( )
1389+ . execute ( "delete from artifact where name = $1" , & [ & info. name ] )
1390+ . await
1391+ . unwrap ( ) ;
1392+ }
13831393}
Original file line number Diff line number Diff line change @@ -1231,4 +1231,13 @@ impl Connection for SqliteConnection {
12311231 . collect :: < Result < _ , _ > > ( )
12321232 . unwrap ( )
12331233 }
1234+
1235+ async fn purge_artifact ( & self , aid : & ArtifactId ) {
1236+ // Once we delete the artifact, all data associated with it should also be deleted
1237+ // thanks to ON DELETE CASCADE.
1238+ let info = aid. info ( ) ;
1239+ self . raw_ref ( )
1240+ . execute ( "delete from artifact where name = ?1" , [ info. name ] )
1241+ . unwrap ( ) ;
1242+ }
12341243}
You can’t perform that action at this time.
0 commit comments