1515// specific language governing permissions and limitations
1616// under the License.
1717
18+ use crate :: Result ;
1819use std:: sync:: Arc ;
20+ use async_trait:: async_trait;
1921use bytes:: Bytes ;
2022use opendal:: layers:: RetryLayer ;
2123#[ cfg( feature = "storage-azdls" ) ]
@@ -67,14 +69,14 @@ pub(crate) enum OpenDALStorage {
6769 } ,
6870}
6971
70- #[ async_trait:: async_trait ]
72+ #[ async_trait]
7173impl Storage for OpenDALStorage {
72- async fn exists ( & self , path : & str ) -> crate :: Result < bool > {
74+ async fn exists ( & self , path : & str ) -> Result < bool > {
7375 let ( op, relative_path) = self . create_operator ( & path) ?;
7476 Ok ( op. exists ( relative_path) . await ?)
7577 }
7678
77- async fn metadata ( & self , path : & str ) -> crate :: Result < FileMetadata > {
79+ async fn metadata ( & self , path : & str ) -> Result < FileMetadata > {
7880 let ( op, relative_path) = self . create_operator ( & path) ?;
7981 let meta = op. stat ( relative_path) . await ?;
8082
@@ -83,35 +85,35 @@ impl Storage for OpenDALStorage {
8385 } )
8486 }
8587
86- async fn read ( & self , path : & str ) -> crate :: Result < Bytes > {
88+ async fn read ( & self , path : & str ) -> Result < Bytes > {
8789 let ( op, relative_path) = self . create_operator ( & path) ?;
8890 Ok ( op. read ( relative_path) . await ?. to_bytes ( ) )
8991 }
9092
91- async fn reader ( & self , path : & str ) -> crate :: Result < Box < dyn FileRead > > {
93+ async fn reader ( & self , path : & str ) -> Result < Box < dyn FileRead > > {
9294 let ( op, relative_path) = self . create_operator ( & path) ?;
9395 Ok ( Box :: new ( op. reader ( relative_path) . await ?) )
9496 }
9597
96- async fn write ( & self , path : & str , bs : Bytes ) -> crate :: Result < ( ) > {
98+ async fn write ( & self , path : & str , bs : Bytes ) -> Result < ( ) > {
9799 let mut writer = self . writer ( path) . await ?;
98100 writer. write ( bs) . await ?;
99101 writer. close ( ) . await
100102 }
101103
102- async fn writer ( & self , path : & str ) -> crate :: Result < Box < dyn FileWrite > > {
104+ async fn writer ( & self , path : & str ) -> Result < Box < dyn FileWrite > > {
103105 let ( op, relative_path) = self . create_operator ( & path) ?;
104106 Ok ( Box :: new (
105107 op. writer ( relative_path) . await ?,
106108 ) )
107109 }
108110
109- async fn delete ( & self , path : & str ) -> crate :: Result < ( ) > {
111+ async fn delete ( & self , path : & str ) -> Result < ( ) > {
110112 let ( op, relative_path) = self . create_operator ( & path) ?;
111113 Ok ( op. delete ( relative_path) . await ?)
112114 }
113115
114- async fn remove_dir_all ( & self , path : & str ) -> crate :: Result < ( ) > {
116+ async fn remove_dir_all ( & self , path : & str ) -> Result < ( ) > {
115117 let ( op, relative_path) = self . create_operator ( & path) ?;
116118 let path = if relative_path. ends_with ( '/' ) {
117119 relative_path. to_string ( )
@@ -121,7 +123,7 @@ impl Storage for OpenDALStorage {
121123 Ok ( op. remove_all ( & path) . await ?)
122124 }
123125
124- fn new_input ( & self , path : & str ) -> crate :: Result < InputFile > {
126+ fn new_input ( & self , path : & str ) -> Result < InputFile > {
125127 let storage = Arc :: new ( self . clone ( ) ) ;
126128 let path = path. to_string ( ) ;
127129 Ok ( InputFile {
@@ -130,7 +132,7 @@ impl Storage for OpenDALStorage {
130132 } )
131133 }
132134
133- fn new_output ( & self , path : & str ) -> crate :: Result < OutputFile > {
135+ fn new_output ( & self , path : & str ) -> Result < OutputFile > {
134136 let storage = Arc :: new ( self . clone ( ) ) ;
135137 let path = path. to_string ( ) ;
136138 Ok ( OutputFile {
@@ -142,7 +144,7 @@ impl Storage for OpenDALStorage {
142144
143145impl OpenDALStorage {
144146 /// Convert iceberg config to opendal config.
145- pub ( crate ) fn build ( file_io_builder : FileIOBuilder ) -> crate :: Result < Self > {
147+ pub ( crate ) fn build ( file_io_builder : FileIOBuilder ) -> Result < Self > {
146148 let ( scheme_str, props, extensions) = file_io_builder. into_parts ( ) ;
147149 let scheme = Self :: parse_scheme ( & scheme_str) ?;
148150
0 commit comments