@@ -160,6 +160,8 @@ pub trait StorageFactory: Debug + Send + Sync {
160160/// OpenDAL-based storage factory.
161161///
162162/// Maps scheme to the corresponding OpenDal storage variant.
163+ ///
164+ /// TODO this is currently not used, we still use OpenDal::build() for now
163165#[ derive( Clone , Debug , Serialize , Deserialize ) ]
164166pub enum OpenDalFactory {
165167 /// Memory storage factory.
@@ -187,15 +189,6 @@ pub enum OpenDalFactory {
187189 /// The configured Azure storage scheme.
188190 configured_scheme : AzureStorageScheme ,
189191 } ,
190- /// Placeholder variant to ensure the enum is always inhabited.
191- /// This variant cannot be constructed and exists only to satisfy
192- /// the compiler when no storage features are enabled.
193- ///
194- /// TODO this should be replaced with cfg(any) to be gated with feature flag
195- /// once we moved it to a different crate
196- #[ doc( hidden) ]
197- #[ serde( skip) ]
198- _Phantom( std:: convert:: Infallible ) ,
199192}
200193
201194#[ typetag:: serde( name = "OpenDalFactory" ) ]
@@ -228,7 +221,18 @@ impl StorageFactory for OpenDalFactory {
228221 configured_scheme : configured_scheme. clone ( ) ,
229222 config : super :: azdls_config_parse ( config. props ( ) . clone ( ) ) ?. into ( ) ,
230223 } ) ) ,
231- OpenDalFactory :: _Phantom( infallible) => match * infallible { } ,
224+ #[ cfg( all(
225+ not( feature = "storage-memory" ) ,
226+ not( feature = "storage-fs" ) ,
227+ not( feature = "storage-s3" ) ,
228+ not( feature = "storage-gcs" ) ,
229+ not( feature = "storage-oss" ) ,
230+ not( feature = "storage-azdls" ) ,
231+ ) ) ]
232+ _ => Err ( Error :: new (
233+ ErrorKind :: FeatureUnsupported ,
234+ "No storage service has been enabled" ,
235+ ) ) ,
232236 }
233237 }
234238}
@@ -275,25 +279,26 @@ pub enum OpenDal {
275279 config : Arc < OssConfig > ,
276280 } ,
277281 /// Azure Data Lake Storage variant.
282+ /// Expects paths of the form
283+ /// `abfs[s]://<filesystem>@<account>.dfs.<endpoint-suffix>/<path>` or
284+ /// `wasb[s]://<container>@<account>.blob.<endpoint-suffix>/<path>`.
278285 #[ cfg( feature = "storage-azdls" ) ]
279286 #[ allow( private_interfaces) ]
280287 Azdls {
281288 /// The configured Azure storage scheme.
289+ /// Because Azdls accepts multiple possible schemes, we store the full
290+ /// passed scheme here to later validate schemes passed via paths.
282291 configured_scheme : AzureStorageScheme ,
283292 /// Azure DLS configuration.
284293 #[ serde( skip) ]
285294 config : Arc < AzdlsConfig > ,
286295 } ,
287- /// Placeholder variant to ensure the enum is always inhabited.
288- /// This variant cannot be constructed and exists only to satisfy
289- /// the compiler when no storage features are enabled.
290- #[ doc( hidden) ]
291- #[ serde( skip) ]
292- _Phantom( std:: convert:: Infallible ) ,
293296}
294297
295298impl OpenDal {
296299 /// Convert iceberg config to opendal config.
300+ ///
301+ /// TODO Switch to use OpenDalFactory::build()
297302 pub ( crate ) fn build ( file_io_builder : FileIOBuilder ) -> Result < Self > {
298303 let ( scheme_str, props, extensions) = file_io_builder. into_parts ( ) ;
299304 let _ = ( & props, & extensions) ;
@@ -423,7 +428,19 @@ impl OpenDal {
423428 configured_scheme,
424429 config,
425430 } => super :: azdls_create_operator ( path, config, configured_scheme) ?,
426- OpenDal :: _Phantom( infallible) => match * infallible { } ,
431+ #[ cfg( all(
432+ not( feature = "storage-s3" ) ,
433+ not( feature = "storage-fs" ) ,
434+ not( feature = "storage-gcs" ) ,
435+ not( feature = "storage-oss" ) ,
436+ not( feature = "storage-azdls" ) ,
437+ ) ) ]
438+ _ => {
439+ return Err ( Error :: new (
440+ ErrorKind :: FeatureUnsupported ,
441+ "No storage service has been enabled" ,
442+ ) ) ;
443+ }
427444 } ;
428445
429446 // Transient errors are common for object stores; however there's no
0 commit comments