diff --git a/bin/oli/Cargo.toml b/bin/oli/Cargo.toml index 14888c18727..6cc20ce7355 100644 --- a/bin/oli/Cargo.toml +++ b/bin/oli/Cargo.toml @@ -27,6 +27,26 @@ name = "oli" repository = "https://github.com/apache/incubator-opendal" version = "0.30.3" +[features] +# Enable services dashmap support +services-dashmap = ["opendal/services-dashmap"] +# Enable services ftp support +services-ftp = ["opendal/services-ftp"] +# Enable services hdfs support +services-hdfs = ["opendal/services-hdfs"] +# Enable services ipfs support +services-ipfs = ["opendal/services-ipfs"] +# Enable services memcached support +services-memcached = ["opendal/services-memcached"] +# Enable services moka support +services-moka = ["opendal/services-moka"] +# Enable services redis support +services-redis = ["opendal/services-redis"] +# Enable services rocksdb support +services-rocksdb = ["opendal/services-rocksdb"] +# Enable services sled support +services-sled = ["opendal/services-sled"] + [dependencies] anyhow = "1" clap = { version = "4", features = ["cargo", "string"] } diff --git a/bin/oli/src/config/mod.rs b/bin/oli/src/config/mod.rs index ce41ba7e36c..e35848e660e 100644 --- a/bin/oli/src/config/mod.rs +++ b/bin/oli/src/config/mod.rs @@ -85,14 +85,96 @@ impl Config { .ok_or_else(|| anyhow!("missing 'type' in profile"))?; let scheme = Scheme::from_str(svc)?; match scheme { - Scheme::S3 => Ok(( - Operator::from_map::(profile.clone())?.finish(), + Scheme::Azblob => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + Scheme::Azdfs => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + #[cfg(feature = "services-dashmap")] + Scheme::Dashmap => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + Scheme::Gcs => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + Scheme::Ghac => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + #[cfg(feature = "services-hdfs")] + Scheme::Hdfs => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + Scheme::Http => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + #[cfg(feature = "services-ftp")] + Scheme::Ftp => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + #[cfg(feature = "services-ipfs")] + Scheme::Ipfs => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + Scheme::Ipmfs => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + #[cfg(feature = "services-memcached")] + Scheme::Memcached => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + // ignore the memory backend + #[cfg(feature = "services-moka")] + Scheme::Moka => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + Scheme::Obs => Ok(( + Operator::from_map::(profile.clone())?.finish(), path, )), Scheme::Oss => Ok(( Operator::from_map::(profile.clone())?.finish(), path, )), + #[cfg(feature = "services-redis")] + Scheme::Redis => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + #[cfg(feature = "services-rocksdb")] + Scheme::Rocksdb => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + Scheme::S3 => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + #[cfg(feature = "services-sled")] + Scheme::Sled => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + Scheme::Webdav => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), + Scheme::Webhdfs => Ok(( + Operator::from_map::(profile.clone())?.finish(), + path, + )), _ => Err(anyhow!("invalid profile")), } }