@@ -214,42 +214,42 @@ where
214214impl StorageFactory for OpenDalStorageFactory {
215215 #[ allow( unused_variables) ]
216216 fn build ( & self , config : & StorageConfig ) -> Result < Arc < dyn Storage > > {
217- let client = OpenDalClientConfig :: from_properties ( config. props ( ) ) ?;
217+ let client_config = OpenDalClientConfig :: from_properties ( config. props ( ) ) ?;
218218 match self {
219219 #[ cfg( feature = "opendal-memory" ) ]
220220 OpenDalStorageFactory :: Memory => Ok ( Arc :: new ( OpenDalStorage :: Memory {
221221 operator : memory_config_build ( ) ?,
222- client ,
222+ client_config ,
223223 } ) ) ,
224224 #[ cfg( feature = "opendal-fs" ) ]
225- OpenDalStorageFactory :: Fs => Ok ( Arc :: new ( OpenDalStorage :: LocalFs { client } ) ) ,
225+ OpenDalStorageFactory :: Fs => Ok ( Arc :: new ( OpenDalStorage :: LocalFs { client_config } ) ) ,
226226 #[ cfg( feature = "opendal-s3" ) ]
227227 OpenDalStorageFactory :: S3 {
228228 customized_credential_load,
229229 } => Ok ( Arc :: new ( OpenDalStorage :: S3 {
230230 config : s3_config_parse ( config. props ( ) . clone ( ) ) ?. into ( ) ,
231231 customized_credential_load : customized_credential_load. clone ( ) ,
232- client ,
232+ client_config ,
233233 } ) ) ,
234234 #[ cfg( feature = "opendal-gcs" ) ]
235235 OpenDalStorageFactory :: Gcs => Ok ( Arc :: new ( OpenDalStorage :: Gcs {
236236 config : gcs_config_parse ( config. props ( ) . clone ( ) ) ?. into ( ) ,
237- client ,
237+ client_config ,
238238 } ) ) ,
239239 #[ cfg( feature = "opendal-oss" ) ]
240240 OpenDalStorageFactory :: Oss => Ok ( Arc :: new ( OpenDalStorage :: Oss {
241241 config : oss_config_parse ( config. props ( ) . clone ( ) ) ?. into ( ) ,
242- client ,
242+ client_config ,
243243 } ) ) ,
244244 #[ cfg( feature = "opendal-azdls" ) ]
245245 OpenDalStorageFactory :: Azdls => Ok ( Arc :: new ( OpenDalStorage :: Azdls {
246246 config : azdls_config_parse ( config. props ( ) . clone ( ) ) ?. into ( ) ,
247- client ,
247+ client_config ,
248248 } ) ) ,
249249 #[ cfg( feature = "opendal-hf" ) ]
250250 OpenDalStorageFactory :: Hf => Ok ( Arc :: new ( OpenDalStorage :: Hf {
251251 config : hf_config_parse ( config. props ( ) . clone ( ) ) ?. into ( ) ,
252- client ,
252+ client_config ,
253253 } ) ) ,
254254 #[ cfg( all(
255255 not( feature = "opendal-memory" ) ,
@@ -285,14 +285,14 @@ pub enum OpenDalStorage {
285285 operator : Operator ,
286286 /// Backend-independent client settings.
287287 #[ serde( default ) ]
288- client : OpenDalClientConfig ,
288+ client_config : OpenDalClientConfig ,
289289 } ,
290290 /// Local filesystem storage variant.
291291 #[ cfg( feature = "opendal-fs" ) ]
292292 LocalFs {
293293 /// Backend-independent client settings.
294294 #[ serde( default ) ]
295- client : OpenDalClientConfig ,
295+ client_config : OpenDalClientConfig ,
296296 } ,
297297 /// S3 storage variant.
298298 ///
@@ -307,7 +307,7 @@ pub enum OpenDalStorage {
307307 customized_credential_load : Option < CustomAwsCredentialLoader > ,
308308 /// Backend-independent client settings.
309309 #[ serde( default ) ]
310- client : OpenDalClientConfig ,
310+ client_config : OpenDalClientConfig ,
311311 } ,
312312 /// GCS storage variant.
313313 #[ cfg( feature = "opendal-gcs" ) ]
@@ -316,7 +316,7 @@ pub enum OpenDalStorage {
316316 config : Arc < GcsConfig > ,
317317 /// Backend-independent client settings.
318318 #[ serde( default ) ]
319- client : OpenDalClientConfig ,
319+ client_config : OpenDalClientConfig ,
320320 } ,
321321 /// OSS storage variant.
322322 #[ cfg( feature = "opendal-oss" ) ]
@@ -325,7 +325,7 @@ pub enum OpenDalStorage {
325325 config : Arc < OssConfig > ,
326326 /// Backend-independent client settings.
327327 #[ serde( default ) ]
328- client : OpenDalClientConfig ,
328+ client_config : OpenDalClientConfig ,
329329 } ,
330330 /// Azure Data Lake Storage variant.
331331 ///
@@ -339,7 +339,7 @@ pub enum OpenDalStorage {
339339 config : Arc < AzdlsConfig > ,
340340 /// Backend-independent client settings.
341341 #[ serde( default ) ]
342- client : OpenDalClientConfig ,
342+ client_config : OpenDalClientConfig ,
343343 } ,
344344 /// HuggingFace Hub storage variant.
345345 ///
@@ -352,7 +352,7 @@ pub enum OpenDalStorage {
352352 config : Arc < HfConfig > ,
353353 /// Backend-independent client settings.
354354 #[ serde( default ) ]
355- client : OpenDalClientConfig ,
355+ client_config : OpenDalClientConfig ,
356356 } ,
357357}
358358
@@ -479,29 +479,29 @@ impl OpenDalStorage {
479479 let operator = operator
480480 . layer (
481481 TimeoutLayer :: new ( )
482- . with_io_timeout ( Duration :: from_millis ( self . client ( ) . io_timeout_ms ( ) ) ) ,
482+ . with_io_timeout ( Duration :: from_millis ( self . client_config ( ) . io_timeout_ms ( ) ) ) ,
483483 )
484484 . layer ( RetryLayer :: new ( ) ) ;
485485 Ok ( ( operator, relative_path) )
486486 }
487487
488488 /// Client settings for this backend.
489- pub fn client ( & self ) -> & OpenDalClientConfig {
489+ pub fn client_config ( & self ) -> & OpenDalClientConfig {
490490 match self {
491491 #[ cfg( feature = "opendal-memory" ) ]
492- OpenDalStorage :: Memory { client , .. } => client ,
492+ OpenDalStorage :: Memory { client_config , .. } => client_config ,
493493 #[ cfg( feature = "opendal-fs" ) ]
494- OpenDalStorage :: LocalFs { client } => client ,
494+ OpenDalStorage :: LocalFs { client_config } => client_config ,
495495 #[ cfg( feature = "opendal-s3" ) ]
496- OpenDalStorage :: S3 { client , .. } => client ,
496+ OpenDalStorage :: S3 { client_config , .. } => client_config ,
497497 #[ cfg( feature = "opendal-gcs" ) ]
498- OpenDalStorage :: Gcs { client , .. } => client ,
498+ OpenDalStorage :: Gcs { client_config , .. } => client_config ,
499499 #[ cfg( feature = "opendal-oss" ) ]
500- OpenDalStorage :: Oss { client , .. } => client ,
500+ OpenDalStorage :: Oss { client_config , .. } => client_config ,
501501 #[ cfg( feature = "opendal-azdls" ) ]
502- OpenDalStorage :: Azdls { client , .. } => client ,
502+ OpenDalStorage :: Azdls { client_config , .. } => client_config ,
503503 #[ cfg( feature = "opendal-hf" ) ]
504- OpenDalStorage :: Hf { client , .. } => client ,
504+ OpenDalStorage :: Hf { client_config , .. } => client_config ,
505505 // Only compiled when every backend feature is off and the enum has no variants.
506506 // Gating it this way makes a new variant without an arm a compile error.
507507 #[ cfg( all(
@@ -835,13 +835,16 @@ mod tests {
835835 fn test_default_io_timeout_matches_opendal ( ) {
836836 // `TimeoutLayer` has no getters, so compare through `Debug`. An OpenDAL upgrade that
837837 // changes its default fails here instead of silently diverging from it.
838- assert_eq ! (
839- format! ( "{:?}" , TimeoutLayer :: new ( ) ) ,
838+ let opendal_default = format ! ( "{:?}" , TimeoutLayer :: new ( ) ) ;
839+ let with_io_timeout = |ms| {
840840 format ! (
841841 "{:?}" ,
842- TimeoutLayer :: new( ) . with_io_timeout( Duration :: from_millis( DEFAULT_IO_TIMEOUT_MS ) )
843- ) ,
844- ) ;
842+ TimeoutLayer :: new( ) . with_io_timeout( Duration :: from_millis( ms) )
843+ )
844+ } ;
845+ assert_eq ! ( opendal_default, with_io_timeout( DEFAULT_IO_TIMEOUT_MS ) ) ;
846+ // If `Debug` stopped printing `io_timeout`, the check above would pass vacuously.
847+ assert_ne ! ( opendal_default, with_io_timeout( DEFAULT_IO_TIMEOUT_MS + 1 ) ) ;
845848 }
846849
847850 #[ cfg( feature = "opendal-s3" ) ]
@@ -850,17 +853,20 @@ mod tests {
850853 let storage = OpenDalStorage :: S3 {
851854 config : Arc :: new ( S3Config :: default ( ) ) ,
852855 customized_credential_load : None ,
853- client : client_config ( "45000" ) . unwrap ( ) ,
856+ client_config : client_config ( "45000" ) . unwrap ( ) ,
854857 } ;
855858
856859 let mut value = serde_json:: to_value ( & storage) . unwrap ( ) ;
857860 let restored: OpenDalStorage = serde_json:: from_value ( value. clone ( ) ) . unwrap ( ) ;
858- assert_eq ! ( restored. client ( ) . io_timeout_ms( ) , 45_000 ) ;
861+ assert_eq ! ( restored. client_config ( ) . io_timeout_ms( ) , 45_000 ) ;
859862
860- // A payload without `client ` falls back to the default.
861- value[ "S3" ] . as_object_mut ( ) . unwrap ( ) . remove ( "client " ) ;
863+ // A payload without `client_config ` falls back to the default.
864+ value[ "S3" ] . as_object_mut ( ) . unwrap ( ) . remove ( "client_config " ) ;
862865 let restored: OpenDalStorage = serde_json:: from_value ( value) . unwrap ( ) ;
863- assert_eq ! ( restored. client( ) . io_timeout_ms( ) , DEFAULT_IO_TIMEOUT_MS ) ;
866+ assert_eq ! (
867+ restored. client_config( ) . io_timeout_ms( ) ,
868+ DEFAULT_IO_TIMEOUT_MS
869+ ) ;
864870 }
865871
866872 #[ cfg( feature = "opendal-memory" ) ]
@@ -919,7 +925,7 @@ mod tests {
919925 // path. The counter in `OpenDalWriter` is what covers services that don't, such as S3.
920926 let storage = Arc :: new ( OpenDalStorage :: Memory {
921927 operator : default_memory_operator ( ) ,
922- client : OpenDalClientConfig :: default ( ) ,
928+ client_config : OpenDalClientConfig :: default ( ) ,
923929 } ) ;
924930 let path = "memory:///stored-size" ;
925931 for plaintext in [
@@ -950,7 +956,7 @@ mod tests {
950956 fn test_relativize_path_memory ( ) {
951957 let storage = OpenDalStorage :: Memory {
952958 operator : default_memory_operator ( ) ,
953- client : OpenDalClientConfig :: default ( ) ,
959+ client_config : OpenDalClientConfig :: default ( ) ,
954960 } ;
955961
956962 assert_eq ! (
@@ -968,7 +974,7 @@ mod tests {
968974 #[ test]
969975 fn test_relativize_path_fs ( ) {
970976 let storage = OpenDalStorage :: LocalFs {
971- client : OpenDalClientConfig :: default ( ) ,
977+ client_config : OpenDalClientConfig :: default ( ) ,
972978 } ;
973979
974980 assert_eq ! (
@@ -989,7 +995,7 @@ mod tests {
989995 let storage = OpenDalStorage :: S3 {
990996 config : Arc :: new ( S3Config :: default ( ) ) ,
991997 customized_credential_load : None ,
992- client : OpenDalClientConfig :: default ( ) ,
998+ client_config : OpenDalClientConfig :: default ( ) ,
993999 } ;
9941000
9951001 // All S3-family schemes are accepted by the same storage instance.
@@ -1010,7 +1016,7 @@ mod tests {
10101016 fn test_relativize_path_gcs ( ) {
10111017 let storage = OpenDalStorage :: Gcs {
10121018 config : Arc :: new ( GcsConfig :: default ( ) ) ,
1013- client : OpenDalClientConfig :: default ( ) ,
1019+ client_config : OpenDalClientConfig :: default ( ) ,
10141020 } ;
10151021
10161022 assert_eq ! (
@@ -1026,7 +1032,7 @@ mod tests {
10261032 fn test_relativize_path_gcs_invalid_scheme ( ) {
10271033 let storage = OpenDalStorage :: Gcs {
10281034 config : Arc :: new ( GcsConfig :: default ( ) ) ,
1029- client : OpenDalClientConfig :: default ( ) ,
1035+ client_config : OpenDalClientConfig :: default ( ) ,
10301036 } ;
10311037
10321038 assert ! (
@@ -1041,7 +1047,7 @@ mod tests {
10411047 fn test_relativize_path_oss ( ) {
10421048 let storage = OpenDalStorage :: Oss {
10431049 config : Arc :: new ( OssConfig :: default ( ) ) ,
1044- client : OpenDalClientConfig :: default ( ) ,
1050+ client_config : OpenDalClientConfig :: default ( ) ,
10451051 } ;
10461052
10471053 assert_eq ! (
@@ -1057,7 +1063,7 @@ mod tests {
10571063 fn test_relativize_path_oss_invalid_scheme ( ) {
10581064 let storage = OpenDalStorage :: Oss {
10591065 config : Arc :: new ( OssConfig :: default ( ) ) ,
1060- client : OpenDalClientConfig :: default ( ) ,
1066+ client_config : OpenDalClientConfig :: default ( ) ,
10611067 } ;
10621068
10631069 assert ! (
@@ -1076,7 +1082,7 @@ mod tests {
10761082 endpoint : Some ( "https://myaccount.dfs.core.windows.net" . to_string ( ) ) ,
10771083 ..Default :: default ( )
10781084 } ) ,
1079- client : OpenDalClientConfig :: default ( ) ,
1085+ client_config : OpenDalClientConfig :: default ( ) ,
10801086 } ;
10811087
10821088 assert_eq ! (
0 commit comments