@@ -73,13 +73,8 @@ cfg_if! {
7373 }
7474}
7575
76- cfg_if ! {
77- if #[ cfg( feature = "opendal-oss" ) ] {
78- mod oss;
79- use opendal:: services:: OssConfig ;
80- use oss:: * ;
81- }
82- }
76+ // When `opendal-oss` is enabled, `oss://` URLs are routed through the S3
77+ // backend (OSS is S3-API-compatible). No native OSS module is needed.
8378
8479cfg_if ! {
8580 if #[ cfg( feature = "opendal-s3" ) ] {
@@ -151,10 +146,6 @@ impl StorageFactory for OpenDalStorageFactory {
151146 config : s3_config_parse ( config. props ( ) . clone ( ) ) ?. into ( ) ,
152147 customized_credential_load : None ,
153148 } ) ) ,
154- #[ cfg( all( feature = "opendal-oss" , not( feature = "opendal-s3" ) ) ) ]
155- OpenDalStorageFactory :: Oss => Ok ( Arc :: new ( OpenDalStorage :: Oss {
156- config : oss_config_parse ( config. props ( ) . clone ( ) ) ?. into ( ) ,
157- } ) ) ,
158149 #[ cfg( feature = "opendal-azdls" ) ]
159150 OpenDalStorageFactory :: Azdls => Ok ( Arc :: new ( OpenDalStorage :: Azdls {
160151 config : azdls_config_parse ( config. props ( ) . clone ( ) ) ?. into ( ) ,
@@ -208,12 +199,6 @@ pub enum OpenDalStorage {
208199 /// GCS configuration.
209200 config : Arc < GcsConfig > ,
210201 } ,
211- /// OSS storage variant.
212- #[ cfg( feature = "opendal-oss" ) ]
213- Oss {
214- /// OSS configuration.
215- config : Arc < OssConfig > ,
216- } ,
217202 /// Azure Data Lake Storage variant.
218203 ///
219204 /// Accepts paths of the form
@@ -303,19 +288,6 @@ impl OpenDalStorage {
303288 ) ) ;
304289 }
305290 }
306- #[ cfg( feature = "opendal-oss" ) ]
307- OpenDalStorage :: Oss { config } => {
308- let op = oss_config_build ( config, path) ?;
309- let prefix = format ! ( "oss://{}/" , op. info( ) . name( ) ) ;
310- if path. starts_with ( & prefix) {
311- ( op, & path[ prefix. len ( ) ..] )
312- } else {
313- return Err ( Error :: new (
314- ErrorKind :: DataInvalid ,
315- format ! ( "Invalid oss url: {path}, should start with {prefix}" ) ,
316- ) ) ;
317- }
318- }
319291 #[ cfg( feature = "opendal-azdls" ) ]
320292 OpenDalStorage :: Azdls { config } => azdls_create_operator ( path, config) ?,
321293 #[ cfg( all(
@@ -389,25 +361,6 @@ impl OpenDalStorage {
389361 ) )
390362 }
391363 }
392- #[ cfg( feature = "opendal-oss" ) ]
393- OpenDalStorage :: Oss { .. } => {
394- let url = url:: Url :: parse ( path) ?;
395- let bucket = url. host_str ( ) . ok_or_else ( || {
396- Error :: new (
397- ErrorKind :: DataInvalid ,
398- format ! ( "Invalid oss url: {path}, missing bucket" ) ,
399- )
400- } ) ?;
401- let prefix = format ! ( "oss://{}/" , bucket) ;
402- if path. starts_with ( & prefix) {
403- Ok ( & path[ prefix. len ( ) ..] )
404- } else {
405- Err ( Error :: new (
406- ErrorKind :: DataInvalid ,
407- format ! ( "Invalid oss url: {path}, should start with {prefix}" ) ,
408- ) )
409- }
410- }
411364 #[ cfg( feature = "opendal-azdls" ) ]
412365 OpenDalStorage :: Azdls { config } => {
413366 let azure_path = path. parse :: < AzureStoragePath > ( ) ?;
@@ -671,35 +624,6 @@ mod tests {
671624 ) ;
672625 }
673626
674- #[ cfg( feature = "opendal-oss" ) ]
675- #[ test]
676- fn test_relativize_path_oss ( ) {
677- let storage = OpenDalStorage :: Oss {
678- config : Arc :: new ( OssConfig :: default ( ) ) ,
679- } ;
680-
681- assert_eq ! (
682- storage
683- . relativize_path( "oss://my-bucket/path/to/file.parquet" )
684- . unwrap( ) ,
685- "path/to/file.parquet"
686- ) ;
687- }
688-
689- #[ cfg( feature = "opendal-oss" ) ]
690- #[ test]
691- fn test_relativize_path_oss_invalid_scheme ( ) {
692- let storage = OpenDalStorage :: Oss {
693- config : Arc :: new ( OssConfig :: default ( ) ) ,
694- } ;
695-
696- assert ! (
697- storage
698- . relativize_path( "s3://my-bucket/path/to/file.parquet" )
699- . is_err( )
700- ) ;
701- }
702-
703627 #[ cfg( feature = "opendal-azdls" ) ]
704628 #[ test]
705629 fn test_relativize_path_azdls ( ) {
0 commit comments