@@ -25,52 +25,11 @@ use async_trait::async_trait;
2525use bytes:: Bytes ;
2626use url:: Url ;
2727
28+ // Re-export traits from storage module
29+ pub use super :: storage:: { Storage , StorageBuilder } ;
30+ use crate :: io:: StorageBuilderRegistry ;
2831use crate :: { Error , ErrorKind , Result } ;
2932
30- /// Trait for storage operations in Iceberg
31- #[ async_trait]
32- pub trait Storage : Debug + Send + Sync {
33- /// Check if a file exists at the given path
34- async fn exists ( & self , path : & str ) -> Result < bool > ;
35-
36- /// Get metadata from an input path
37- async fn metadata ( & self , path : & str ) -> Result < FileMetadata > ;
38-
39- /// Read bytes from a path
40- async fn read ( & self , path : & str ) -> Result < Bytes > ;
41-
42- /// Get FileRead from a path
43- async fn reader ( & self , path : & str ) -> Result < Box < dyn FileRead > > ;
44-
45- /// Write bytes to an output path
46- async fn write ( & self , path : & str , bs : Bytes ) -> Result < ( ) > ;
47-
48- /// Get FileWrite from a path
49- async fn writer ( & self , path : & str ) -> Result < Box < dyn FileWrite > > ;
50-
51- /// Delete a file at the given path
52- async fn delete ( & self , path : & str ) -> Result < ( ) > ;
53-
54- /// Remove a directory and all its contents recursively
55- async fn remove_dir_all ( & self , path : & str ) -> Result < ( ) > ;
56-
57- /// Create a new input file for reading
58- fn new_input ( & self , path : & str ) -> Result < InputFile > ;
59-
60- /// Create a new output file for writing
61- fn new_output ( & self , path : & str ) -> Result < OutputFile > ;
62- }
63-
64- /// Common interface for all storage builders.
65- pub trait StorageBuilder : Debug + Send + Sync {
66- /// Create a new storage instance with the given properties and extensions.
67- fn build (
68- & self ,
69- props : HashMap < String , String > ,
70- extensions : Extensions ,
71- ) -> Result < Arc < dyn Storage > > ;
72- }
73-
7433/// FileIO implementation, used to manipulate files in underlying storage.
7534///
7635/// # Note
@@ -133,8 +92,6 @@ impl FileIO {
13392 ///
13493 /// * path: It should be *absolute* path starting with scheme string used to construct [`FileIO`].
13594 pub async fn delete ( & self , path : impl AsRef < str > ) -> Result < ( ) > {
136- // let (op, relative_path) = self.inner.create_operator(&path)?;
137- // Ok(op.delete(relative_path).await?)
13895 self . inner . delete ( path. as_ref ( ) ) . await
13996 }
14097
@@ -299,11 +256,11 @@ impl FileIOBuilder {
299256 pub fn build ( self ) -> Result < FileIO > {
300257 // Use the scheme to determine the storage type
301258 let scheme = self . scheme_str . clone ( ) . unwrap_or_default ( ) ;
302-
259+
303260 // Create registry and get builder
304- let registry = crate :: io :: StorageBuilderRegistry :: new ( ) ;
261+ let registry = StorageBuilderRegistry :: new ( ) ;
305262 let builder = registry. get_builder ( scheme. as_str ( ) ) ?;
306-
263+
307264 // Build storage with props and extensions
308265 let storage = builder. build ( self . props . clone ( ) , self . extensions . clone ( ) ) ?;
309266
0 commit comments