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 {
179
179
profile : & str ,
180
180
cache : & str ,
181
181
) -> Vec < ( ArtifactIdNumber , i32 ) > ;
182
+
183
+ /// Removes all data associated with the given artifact.
184
+ async fn purge_artifact ( & self , aid : & ArtifactId ) ;
182
185
}
183
186
184
187
#[ async_trait:: async_trait]
Original file line number Diff line number Diff line change @@ -1380,4 +1380,14 @@ where
1380
1380
_ => panic ! ( "unknown artifact type: {:?}" , ty) ,
1381
1381
}
1382
1382
}
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
+ }
1383
1393
}
Original file line number Diff line number Diff line change @@ -1231,4 +1231,13 @@ impl Connection for SqliteConnection {
1231
1231
. collect :: < Result < _ , _ > > ( )
1232
1232
. unwrap ( )
1233
1233
}
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
+ }
1234
1243
}
You can’t perform that action at this time.
0 commit comments