@@ -16,7 +16,6 @@ use std::env;
1616use std:: io:: Error ;
1717use std:: io:: ErrorKind ;
1818use std:: io:: Result ;
19- use std:: str:: FromStr ;
2019use std:: sync:: LazyLock ;
2120use std:: time:: Duration ;
2221
@@ -53,13 +52,13 @@ use opendal::layers::AsyncBacktraceLayer;
5352use opendal:: layers:: ConcurrentLimitLayer ;
5453use opendal:: layers:: FastraceLayer ;
5554use opendal:: layers:: HttpClientLayer ;
55+ use opendal:: layers:: ImmutableIndexLayer ;
5656use opendal:: layers:: LoggingLayer ;
5757use opendal:: layers:: RetryInterceptor ;
5858use opendal:: layers:: RetryLayer ;
5959use opendal:: layers:: TimeoutLayer ;
6060use opendal:: raw:: HttpClient ;
6161use opendal:: services;
62- use opendal_layer_immutable_index:: ImmutableIndexLayer ;
6362
6463use crate :: StorageConfig ;
6564use crate :: StorageHttpClient ;
@@ -404,8 +403,8 @@ fn init_s3_operator(cfg: &StorageS3Config) -> Result<impl Builder> {
404403 . session_token ( & cfg. security_token )
405404 . role_arn ( & cfg. role_arn )
406405 . external_id ( & cfg. external_id )
407- // Don't enable it otherwise we will get Permission in stat unknown files
408- // .allow_anonymous()
406+ // It's safe to allow anonymous since opendal will perform the check first.
407+ . allow_anonymous ( )
409408 // Root.
410409 . root ( & cfg. root ) ;
411410
@@ -666,76 +665,3 @@ impl OperatorRegistry for iceberg::io::FileIO {
666665 Ok ( ( file_io. get_operator ( ) . clone ( ) , & location[ pos..] ) )
667666 }
668667}
669-
670- #[ derive( Copy , Clone , Debug , PartialEq , Eq , Hash ) ]
671- pub enum Scheme {
672- Azblob ,
673- Gcs ,
674- Hdfs ,
675- Ipfs ,
676- S3 ,
677- Oss ,
678- Obs ,
679- Cos ,
680- Http ,
681- Fs ,
682- Webhdfs ,
683- Huggingface ,
684- Custom ( & ' static str ) ,
685- }
686-
687- impl Scheme {
688- /// Convert self into static str.
689- pub fn into_static ( self ) -> & ' static str {
690- self . into ( )
691- }
692- }
693-
694- impl From < Scheme > for & ' static str {
695- fn from ( v : Scheme ) -> Self {
696- match v {
697- Scheme :: Azblob => "azblob" ,
698- Scheme :: Gcs => "gcs" ,
699- Scheme :: Hdfs => "hdfs" ,
700- Scheme :: Ipfs => "ipfs" ,
701- Scheme :: S3 => "s3" ,
702- Scheme :: Oss => "oss" ,
703- Scheme :: Obs => "obs" ,
704- Scheme :: Cos => "cos" ,
705- Scheme :: Http => "http" ,
706- Scheme :: Fs => "fs" ,
707- Scheme :: Webhdfs => "webhdfs" ,
708- Scheme :: Huggingface => "huggingface" ,
709- Scheme :: Custom ( s) => s,
710- }
711- }
712- }
713-
714- impl FromStr for Scheme {
715- type Err = Error ;
716-
717- fn from_str ( s : & str ) -> Result < Self > {
718- let s = s. to_lowercase ( ) ;
719- match s. as_str ( ) {
720- "azblob" => Ok ( Scheme :: Azblob ) ,
721- "gcs" => Ok ( Scheme :: Gcs ) ,
722- "hdfs" => Ok ( Scheme :: Hdfs ) ,
723- "ipfs" => Ok ( Scheme :: Ipfs ) ,
724- "s3" | "s3a" => Ok ( Scheme :: S3 ) ,
725- "oss" => Ok ( Scheme :: Oss ) ,
726- "obs" => Ok ( Scheme :: Obs ) ,
727- "cos" => Ok ( Scheme :: Cos ) ,
728- "http" | "https" => Ok ( Scheme :: Http ) ,
729- "fs" => Ok ( Scheme :: Fs ) ,
730- "webhdfs" => Ok ( Scheme :: Webhdfs ) ,
731- "huggingface" | "hf" => Ok ( Scheme :: Huggingface ) ,
732- _ => Ok ( Scheme :: Custom ( Box :: leak ( s. into_boxed_str ( ) ) ) ) ,
733- }
734- }
735- }
736-
737- impl std:: fmt:: Display for Scheme {
738- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
739- write ! ( f, "{}" , self . into_static( ) )
740- }
741- }
0 commit comments