@@ -23,7 +23,7 @@ use futures::{TryStreamExt, stream};
2323
2424use crate :: Result ;
2525use crate :: io:: FileIO ;
26- use crate :: spec :: { ManifestListReader , TableMetadata , TableMetadataRef } ;
26+ use crate :: table :: Table ;
2727
2828const DELETE_CONCURRENCY : usize = 10 ;
2929
@@ -36,22 +36,16 @@ const DELETE_CONCURRENCY: usize = 10;
3636/// Data files within manifests are only deleted if the `gc.enabled` table
3737/// property is `true` (the default), to avoid corrupting other tables that
3838/// may share the same data files.
39- pub async fn drop_table_data (
40- io : & FileIO ,
41- metadata : & TableMetadata ,
42- metadata_location : Option < & str > ,
43- ) -> Result < ( ) > {
39+ pub async fn drop_table_data ( table_info : Table ) -> Result < ( ) > {
4440 let mut manifest_lists_to_delete: HashSet < String > = HashSet :: new ( ) ;
4541 let mut manifests_to_delete: HashSet < String > = HashSet :: new ( ) ;
4642
47- let metadata_ref = TableMetadataRef :: new ( metadata. clone ( ) ) ;
43+ let metadata = table_info. metadata_ref ( ) ;
44+ let io = table_info. file_io ( ) ;
4845 // Load all manifest lists concurrently
4946 let results: Vec < _ > =
5047 futures:: future:: try_join_all ( metadata. snapshots ( ) . map ( |snapshot| async {
51- let manifest_list =
52- ManifestListReader :: new ( snapshot. clone ( ) , io. clone ( ) , metadata_ref. clone ( ) )
53- . load ( )
54- . await ?;
48+ let manifest_list = table_info. manifest_list_reader ( snapshot) . load ( ) . await ?;
5549 Ok :: < _ , crate :: Error > ( ( snapshot. manifest_list ( ) . to_string ( ) , manifest_list) )
5650 } ) )
5751 . await ?;
@@ -101,7 +95,7 @@ pub async fn drop_table_data(
10195 . await ?;
10296
10397 // Delete the current metadata file
104- if let Some ( location) = metadata_location {
98+ if let Some ( location) = table_info . metadata_location ( ) {
10599 io. delete ( location) . await ?;
106100 }
107101
0 commit comments