You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2024/02/22 06:40:18 UTC

Re: [PR] Service: adding ocios support [opendal]

Xuanwo commented on code in PR #4189:
URL: https://github.com/apache/opendal/pull/4189#discussion_r1498715078


##########
core/src/types/scheme.rs:
##########
@@ -249,6 +251,8 @@ impl Scheme {
             Scheme::Postgresql,
             #[cfg(feature = "services-gdrive")]
             Scheme::Gdrive,
+            #[cfg(feature = "services-ocios")]
+            Scheme::OciOs,

Review Comment:
   Please use `Ocios` instead. We following the same pattern across the whole project:
   
   - `Ocios` -> `ocios`
   - `OciOs` -> `oci_os`



##########
core/src/services/ocios/backend.rs:
##########
@@ -0,0 +1,278 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use std::fmt::Debug;
+use std::fmt::Formatter;
+use std::sync::Arc;
+
+use async_trait::async_trait;
+use http::StatusCode;
+use log::debug;
+use reqsign::OCIAPIKeySigner;
+use reqsign::OCILoader;
+
+use super::core::*;
+use super::error::parse_error;
+use super::lister::OciOsLister;
+use crate::raw::*;
+use crate::*;
+
+/// Oracle Cloud Infrastructure Object Storage support
+#[doc = include_str!("docs.md")]
+#[derive(Default)]
+pub struct OciOsBuilder {

Review Comment:
   Please add an `OciosConfig`.



##########
core/src/services/ocios/backend.rs:
##########
@@ -0,0 +1,278 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use std::fmt::Debug;
+use std::fmt::Formatter;
+use std::sync::Arc;
+
+use async_trait::async_trait;
+use http::StatusCode;
+use log::debug;
+use reqsign::OCIAPIKeySigner;
+use reqsign::OCILoader;
+
+use super::core::*;
+use super::error::parse_error;
+use super::lister::OciOsLister;
+use crate::raw::*;
+use crate::*;
+
+/// Oracle Cloud Infrastructure Object Storage support
+#[doc = include_str!("docs.md")]
+#[derive(Default)]
+pub struct OciOsBuilder {
+    root: Option<String>,
+
+    region: String,
+    namespace: String,
+    endpoint: String,
+    bucket: String,
+
+    http_client: Option<HttpClient>,
+}
+
+impl Debug for OciOsBuilder {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut d = f.debug_struct("Builder");
+        d.field("root", &self.root)
+            .field("region", &self.region)
+            .field("bucket", &self.bucket)
+            .field("namespace", &self.namespace)
+            .field("endpoint", &self.endpoint);
+
+        d.finish_non_exhaustive()
+    }
+}
+
+impl OciOsBuilder {
+    /// Set root of this backend.
+    ///
+    /// All operations will happen under this root.
+    pub fn root(&mut self, root: &str) -> &mut Self {
+        self.root = if root.is_empty() {
+            None
+        } else {
+            Some(root.to_string())
+        };
+
+        self
+    }
+
+    /// Set bucket name of this backend.
+    pub fn bucket(&mut self, bucket: &str) -> &mut Self {
+        self.bucket = bucket.to_string();
+
+        self
+    }
+
+    /// Set namespace of this backend.
+    pub fn namespace(&mut self, ns: &str) -> &mut Self {
+        self.namespace = ns.to_string();
+
+        self
+    }
+
+    /// Specify the http client that used by this service.
+    ///
+    /// # Notes
+    ///
+    /// This API is part of OpenDAL's Raw API. `HttpClient` could be changed
+    /// during minor updates.
+    pub fn http_client(&mut self, client: HttpClient) -> &mut Self {
+        self.http_client = Some(client);
+        self
+    }
+}
+
+impl Builder for OciOsBuilder {
+    const SCHEME: Scheme = Scheme::OciOs;
+    type Accessor = OciOsBackend;
+
+    fn from_map(_map: HashMap<String, String>) -> Self {
+        OciOsBuilder::default()
+    }
+
+    fn build(&mut self) -> Result<Self::Accessor> {
+        debug!("backend build started: {:?}", &self);
+
+        let root = normalize_root(&self.root.clone().unwrap_or_default());
+        debug!("backend use root {}", &root);
+
+        let region = match self.region.is_empty() {
+            false => Ok(&self.region),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The region is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let bucket = match self.bucket.is_empty() {
+            false => Ok(&self.bucket),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The bucket is misconfigured")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let namespace = match self.namespace.is_empty() {
+            false => Ok(&self.namespace),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The namespace is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let client = if let Some(client) = self.http_client.take() {
+            client
+        } else {
+            HttpClient::new().map_err(|err| {
+                err.with_operation("Builder::build")
+                    .with_context("service", Scheme::OciOs)
+            })?
+        };
+
+        let loader = OCILoader::default();
+
+        let signer = OCIAPIKeySigner::default();

Review Comment:
   Will we have different signer from oci?



##########
core/src/services/ocios/core.rs:
##########
@@ -0,0 +1,309 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+
+use http::Request;
+use http::Response;
+use reqsign::OCIAPIKeySigner;
+use reqsign::OCICredential;
+use reqsign::OCILoader;
+use serde::Deserialize;
+use serde::Serialize;
+
+use crate::raw::*;
+use crate::*;
+
+mod constants {
+    pub const QUERY_LIST_PREFIXY: &str = "prefix";
+}
+
+pub struct OciOsCore {
+    pub region: String,
+    pub root: String,
+    pub bucket: String,
+    pub namespace: String,
+
+    pub client: HttpClient,
+    pub loader: OCILoader,
+    pub signer: OCIAPIKeySigner,
+}
+
+impl Debug for OciOsCore {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        f.debug_struct("Backend")
+            .field("root", &self.root)
+            .field("bucket", &self.bucket)
+            .field("namespace", &self.namespace)
+            .finish_non_exhaustive()
+    }
+}
+
+impl OciOsCore {
+    async fn load_credential(&self) -> Result<Option<OCICredential>> {
+        let cred = self
+            .loader
+            .load()
+            .await
+            .map_err(new_request_credential_error)?;
+
+        if let Some(cred) = cred {
+            Ok(Some(cred))
+        } else {
+            // Mark this error as temporary since it could be caused by Aliyun STS.

Review Comment:
   wrong comment.



##########
core/src/services/ocios/backend.rs:
##########
@@ -0,0 +1,278 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use std::fmt::Debug;
+use std::fmt::Formatter;
+use std::sync::Arc;
+
+use async_trait::async_trait;
+use http::StatusCode;
+use log::debug;
+use reqsign::OCIAPIKeySigner;
+use reqsign::OCILoader;
+
+use super::core::*;
+use super::error::parse_error;
+use super::lister::OciOsLister;
+use crate::raw::*;
+use crate::*;
+
+/// Oracle Cloud Infrastructure Object Storage support
+#[doc = include_str!("docs.md")]
+#[derive(Default)]
+pub struct OciOsBuilder {
+    root: Option<String>,
+
+    region: String,
+    namespace: String,
+    endpoint: String,
+    bucket: String,
+
+    http_client: Option<HttpClient>,
+}
+
+impl Debug for OciOsBuilder {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut d = f.debug_struct("Builder");
+        d.field("root", &self.root)
+            .field("region", &self.region)
+            .field("bucket", &self.bucket)
+            .field("namespace", &self.namespace)
+            .field("endpoint", &self.endpoint);
+
+        d.finish_non_exhaustive()
+    }
+}
+
+impl OciOsBuilder {
+    /// Set root of this backend.
+    ///
+    /// All operations will happen under this root.
+    pub fn root(&mut self, root: &str) -> &mut Self {
+        self.root = if root.is_empty() {
+            None
+        } else {
+            Some(root.to_string())
+        };
+
+        self
+    }
+
+    /// Set bucket name of this backend.
+    pub fn bucket(&mut self, bucket: &str) -> &mut Self {
+        self.bucket = bucket.to_string();
+
+        self
+    }
+
+    /// Set namespace of this backend.
+    pub fn namespace(&mut self, ns: &str) -> &mut Self {
+        self.namespace = ns.to_string();
+
+        self
+    }
+
+    /// Specify the http client that used by this service.
+    ///
+    /// # Notes
+    ///
+    /// This API is part of OpenDAL's Raw API. `HttpClient` could be changed
+    /// during minor updates.
+    pub fn http_client(&mut self, client: HttpClient) -> &mut Self {
+        self.http_client = Some(client);
+        self
+    }
+}
+
+impl Builder for OciOsBuilder {
+    const SCHEME: Scheme = Scheme::OciOs;
+    type Accessor = OciOsBackend;
+
+    fn from_map(_map: HashMap<String, String>) -> Self {
+        OciOsBuilder::default()
+    }
+
+    fn build(&mut self) -> Result<Self::Accessor> {
+        debug!("backend build started: {:?}", &self);
+
+        let root = normalize_root(&self.root.clone().unwrap_or_default());
+        debug!("backend use root {}", &root);
+
+        let region = match self.region.is_empty() {
+            false => Ok(&self.region),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The region is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let bucket = match self.bucket.is_empty() {
+            false => Ok(&self.bucket),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The bucket is misconfigured")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let namespace = match self.namespace.is_empty() {
+            false => Ok(&self.namespace),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The namespace is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let client = if let Some(client) = self.http_client.take() {
+            client
+        } else {
+            HttpClient::new().map_err(|err| {
+                err.with_operation("Builder::build")
+                    .with_context("service", Scheme::OciOs)
+            })?
+        };
+
+        let loader = OCILoader::default();
+
+        let signer = OCIAPIKeySigner::default();
+
+        debug!("Backend build finished");
+
+        Ok(OciOsBackend {
+            core: Arc::new(OciOsCore {
+                region: region.to_owned(),
+                root,
+                bucket: bucket.to_owned(),
+                namespace: namespace.to_owned(),
+                signer,
+                loader,
+                client,
+            }),
+        })
+    }
+}
+
+#[derive(Debug, Clone)]
+/// Oracle Cloud Infrastructure Object Storage Service backend
+pub struct OciOsBackend {
+    core: Arc<OciOsCore>,
+}
+
+#[async_trait]
+impl Accessor for OciOsBackend {
+    type Reader = IncomingAsyncBody;
+    type Lister = oio::PageLister<OciOsLister>;
+    type Writer = ();
+    type BlockingReader = ();
+    type BlockingWriter = ();
+    type BlockingLister = ();
+
+    fn info(&self) -> AccessorInfo {
+        let mut am = AccessorInfo::default();
+        am.set_scheme(Scheme::OciOs)
+            .set_root(&self.core.root)
+            .set_name(&self.core.bucket)
+            .set_native_capability(Capability {
+                stat: true,
+                stat_with_if_match: true,
+                stat_with_if_none_match: true,
+
+                read: true,
+                read_can_next: true,
+                read_with_range: true,
+                read_with_if_match: true,
+                read_with_if_none_match: true,
+
+                write: false,
+
+                delete: false,
+                copy: false,
+
+                list: true,
+                list_with_limit: true,
+                list_with_start_after: true,
+                list_with_recursive: true,
+
+                presign: false,
+                presign_stat: true,
+                presign_read: true,
+                presign_write: true,
+
+                batch: false,
+
+                ..Default::default()
+            });
+
+        am
+    }
+
+    async fn read(&self, path: &str, args: OpRead) -> Result<(RpRead, Self::Reader)> {
+        let resp = self
+            .core
+            .os_get_object(
+                path,
+                args.range(),
+                args.if_match(),
+                args.if_none_match(),
+                args.override_content_disposition(),
+            )
+            .await?;
+
+        let status = resp.status();
+
+        match status {
+            StatusCode::OK | StatusCode::PARTIAL_CONTENT => {
+                let size = parse_content_length(resp.headers())?;
+                let range = parse_content_range(resp.headers())?;
+                Ok((
+                    RpRead::new().with_size(size).with_range(range),
+                    resp.into_body(),
+                ))
+            }
+            StatusCode::RANGE_NOT_SATISFIABLE => {
+                resp.into_body().consume().await?;
+                Ok((RpRead::new().with_size(Some(0)), IncomingAsyncBody::empty()))
+            }
+            _ => Err(parse_error(resp).await?),
+        }
+    }
+
+    async fn stat(&self, path: &str, args: OpStat) -> Result<RpStat> {
+        let resp = self
+            .core
+            .os_head_object(path, args.if_match(), args.if_none_match())

Review Comment:
   The same.



##########
core/src/services/ocios/core.rs:
##########
@@ -0,0 +1,309 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+
+use http::Request;
+use http::Response;
+use reqsign::OCIAPIKeySigner;
+use reqsign::OCICredential;
+use reqsign::OCILoader;
+use serde::Deserialize;
+use serde::Serialize;
+
+use crate::raw::*;
+use crate::*;
+
+mod constants {

Review Comment:
   We don't need to extract constants that are only used once.



##########
core/src/services/ocios/core.rs:
##########
@@ -0,0 +1,309 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+
+use http::Request;
+use http::Response;
+use reqsign::OCIAPIKeySigner;
+use reqsign::OCICredential;
+use reqsign::OCILoader;
+use serde::Deserialize;
+use serde::Serialize;
+
+use crate::raw::*;
+use crate::*;
+
+mod constants {
+    pub const QUERY_LIST_PREFIXY: &str = "prefix";
+}
+
+pub struct OciOsCore {
+    pub region: String,
+    pub root: String,
+    pub bucket: String,
+    pub namespace: String,
+
+    pub client: HttpClient,
+    pub loader: OCILoader,
+    pub signer: OCIAPIKeySigner,
+}
+
+impl Debug for OciOsCore {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        f.debug_struct("Backend")
+            .field("root", &self.root)
+            .field("bucket", &self.bucket)
+            .field("namespace", &self.namespace)
+            .finish_non_exhaustive()
+    }
+}
+
+impl OciOsCore {
+    async fn load_credential(&self) -> Result<Option<OCICredential>> {
+        let cred = self
+            .loader
+            .load()
+            .await
+            .map_err(new_request_credential_error)?;
+
+        if let Some(cred) = cred {
+            Ok(Some(cred))
+        } else {
+            // Mark this error as temporary since it could be caused by Aliyun STS.
+            Err(Error::new(
+                ErrorKind::PermissionDenied,
+                "no valid credential found, please check configuration or try again",
+            )
+            .set_temporary())
+        }
+    }
+
+    pub async fn sign<T>(&self, req: &mut Request<T>) -> Result<()> {
+        let cred = if let Some(cred) = self.load_credential().await? {
+            cred
+        } else {
+            return Ok(());
+        };
+
+        self.signer.sign(req, &cred).map_err(new_request_sign_error)
+    }
+
+    #[inline]
+    pub async fn send(&self, req: Request<AsyncBody>) -> Result<Response<IncomingAsyncBody>> {
+        self.client.send(req).await
+    }
+}
+
+impl OciOsCore {
+    pub fn os_get_object_request(
+        &self,
+        path: &str,
+        _range: BytesRange,
+        _is_presign: bool,
+        _if_match: Option<&str>,
+        _if_none_match: Option<&str>,
+        _override_content_disposition: Option<&str>,
+    ) -> Result<Request<AsyncBody>> {
+        let p = build_abs_path(&self.root, path);
+        let url = format!(
+            "objectstorage.{}.oraclecloud.com/n/{}/b/{}/o/{}",
+            self.region,
+            self.namespace,
+            self.bucket,
+            percent_encode_path(&p)
+        );
+
+        let req = Request::get(&url)
+            .body(AsyncBody::Empty)
+            .map_err(new_request_build_error)?;
+
+        Ok(req)
+    }
+
+    pub fn os_head_object_request(
+        &self,
+        path: &str,
+        _is_presign: bool,
+        _if_match: Option<&str>,
+        _if_none_match: Option<&str>,
+    ) -> Result<Request<AsyncBody>> {
+        let p = build_abs_path(&self.root, path);
+        let url = format!(
+            "objectstorage.{}.oraclecloud.com/n/{}/b/{}/o/{}",
+            self.region,
+            self.namespace,
+            self.bucket,
+            percent_encode_path(&p)
+        );
+
+        let req = Request::head(&url)
+            .body(AsyncBody::Empty)
+            .map_err(new_request_build_error)?;
+
+        Ok(req)
+    }
+
+    pub fn os_list_object_request(
+        &self,
+        path: &str,
+        _delimiter: &str,
+        _limit: Option<usize>,
+        _start_after: Option<String>,
+    ) -> Result<Request<AsyncBody>> {
+        let p = build_abs_path(&self.root, path);
+        let url = format!(
+            "objectstorage.{}.oraclecloud.com/n/{}/b/{}/o",
+            self.region, self.namespace, self.bucket,
+        );
+
+        // Add query arguments to the URL based on response overrides
+        let mut query_args = Vec::new();
+        query_args.push(format!("{}={}", constants::QUERY_LIST_PREFIXY, p,));

Review Comment:
   `query_args` seems not used?



##########
core/src/services/ocios/backend.rs:
##########
@@ -0,0 +1,278 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use std::fmt::Debug;
+use std::fmt::Formatter;
+use std::sync::Arc;
+
+use async_trait::async_trait;
+use http::StatusCode;
+use log::debug;
+use reqsign::OCIAPIKeySigner;
+use reqsign::OCILoader;
+
+use super::core::*;
+use super::error::parse_error;
+use super::lister::OciOsLister;
+use crate::raw::*;
+use crate::*;
+
+/// Oracle Cloud Infrastructure Object Storage support
+#[doc = include_str!("docs.md")]
+#[derive(Default)]
+pub struct OciOsBuilder {
+    root: Option<String>,
+
+    region: String,
+    namespace: String,
+    endpoint: String,
+    bucket: String,
+
+    http_client: Option<HttpClient>,
+}
+
+impl Debug for OciOsBuilder {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut d = f.debug_struct("Builder");
+        d.field("root", &self.root)
+            .field("region", &self.region)
+            .field("bucket", &self.bucket)
+            .field("namespace", &self.namespace)
+            .field("endpoint", &self.endpoint);
+
+        d.finish_non_exhaustive()
+    }
+}
+
+impl OciOsBuilder {
+    /// Set root of this backend.
+    ///
+    /// All operations will happen under this root.
+    pub fn root(&mut self, root: &str) -> &mut Self {
+        self.root = if root.is_empty() {
+            None
+        } else {
+            Some(root.to_string())
+        };
+
+        self
+    }
+
+    /// Set bucket name of this backend.
+    pub fn bucket(&mut self, bucket: &str) -> &mut Self {
+        self.bucket = bucket.to_string();
+
+        self
+    }
+
+    /// Set namespace of this backend.
+    pub fn namespace(&mut self, ns: &str) -> &mut Self {
+        self.namespace = ns.to_string();
+
+        self
+    }
+
+    /// Specify the http client that used by this service.
+    ///
+    /// # Notes
+    ///
+    /// This API is part of OpenDAL's Raw API. `HttpClient` could be changed
+    /// during minor updates.
+    pub fn http_client(&mut self, client: HttpClient) -> &mut Self {
+        self.http_client = Some(client);
+        self
+    }
+}
+
+impl Builder for OciOsBuilder {
+    const SCHEME: Scheme = Scheme::OciOs;
+    type Accessor = OciOsBackend;
+
+    fn from_map(_map: HashMap<String, String>) -> Self {
+        OciOsBuilder::default()
+    }
+
+    fn build(&mut self) -> Result<Self::Accessor> {
+        debug!("backend build started: {:?}", &self);
+
+        let root = normalize_root(&self.root.clone().unwrap_or_default());
+        debug!("backend use root {}", &root);
+
+        let region = match self.region.is_empty() {
+            false => Ok(&self.region),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The region is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let bucket = match self.bucket.is_empty() {
+            false => Ok(&self.bucket),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The bucket is misconfigured")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let namespace = match self.namespace.is_empty() {
+            false => Ok(&self.namespace),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The namespace is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let client = if let Some(client) = self.http_client.take() {
+            client
+        } else {
+            HttpClient::new().map_err(|err| {
+                err.with_operation("Builder::build")
+                    .with_context("service", Scheme::OciOs)
+            })?
+        };
+
+        let loader = OCILoader::default();
+
+        let signer = OCIAPIKeySigner::default();
+
+        debug!("Backend build finished");
+
+        Ok(OciOsBackend {
+            core: Arc::new(OciOsCore {
+                region: region.to_owned(),
+                root,
+                bucket: bucket.to_owned(),
+                namespace: namespace.to_owned(),
+                signer,
+                loader,
+                client,
+            }),
+        })
+    }
+}
+
+#[derive(Debug, Clone)]
+/// Oracle Cloud Infrastructure Object Storage Service backend
+pub struct OciOsBackend {
+    core: Arc<OciOsCore>,
+}
+
+#[async_trait]
+impl Accessor for OciOsBackend {
+    type Reader = IncomingAsyncBody;
+    type Lister = oio::PageLister<OciOsLister>;
+    type Writer = ();
+    type BlockingReader = ();
+    type BlockingWriter = ();
+    type BlockingLister = ();
+
+    fn info(&self) -> AccessorInfo {
+        let mut am = AccessorInfo::default();
+        am.set_scheme(Scheme::OciOs)
+            .set_root(&self.core.root)
+            .set_name(&self.core.bucket)
+            .set_native_capability(Capability {
+                stat: true,
+                stat_with_if_match: true,
+                stat_with_if_none_match: true,
+
+                read: true,
+                read_can_next: true,
+                read_with_range: true,
+                read_with_if_match: true,
+                read_with_if_none_match: true,
+
+                write: false,

Review Comment:
   Please don't declare `false`.



##########
core/src/services/ocios/backend.rs:
##########
@@ -0,0 +1,278 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use std::fmt::Debug;
+use std::fmt::Formatter;
+use std::sync::Arc;
+
+use async_trait::async_trait;
+use http::StatusCode;
+use log::debug;
+use reqsign::OCIAPIKeySigner;
+use reqsign::OCILoader;
+
+use super::core::*;
+use super::error::parse_error;
+use super::lister::OciOsLister;
+use crate::raw::*;
+use crate::*;
+
+/// Oracle Cloud Infrastructure Object Storage support
+#[doc = include_str!("docs.md")]
+#[derive(Default)]
+pub struct OciOsBuilder {
+    root: Option<String>,
+
+    region: String,
+    namespace: String,
+    endpoint: String,
+    bucket: String,
+
+    http_client: Option<HttpClient>,
+}
+
+impl Debug for OciOsBuilder {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut d = f.debug_struct("Builder");
+        d.field("root", &self.root)
+            .field("region", &self.region)
+            .field("bucket", &self.bucket)
+            .field("namespace", &self.namespace)
+            .field("endpoint", &self.endpoint);
+
+        d.finish_non_exhaustive()
+    }
+}
+
+impl OciOsBuilder {
+    /// Set root of this backend.
+    ///
+    /// All operations will happen under this root.
+    pub fn root(&mut self, root: &str) -> &mut Self {
+        self.root = if root.is_empty() {
+            None
+        } else {
+            Some(root.to_string())
+        };
+
+        self
+    }
+
+    /// Set bucket name of this backend.
+    pub fn bucket(&mut self, bucket: &str) -> &mut Self {
+        self.bucket = bucket.to_string();
+
+        self
+    }
+
+    /// Set namespace of this backend.
+    pub fn namespace(&mut self, ns: &str) -> &mut Self {
+        self.namespace = ns.to_string();
+
+        self
+    }
+
+    /// Specify the http client that used by this service.
+    ///
+    /// # Notes
+    ///
+    /// This API is part of OpenDAL's Raw API. `HttpClient` could be changed
+    /// during minor updates.
+    pub fn http_client(&mut self, client: HttpClient) -> &mut Self {
+        self.http_client = Some(client);
+        self
+    }
+}
+
+impl Builder for OciOsBuilder {
+    const SCHEME: Scheme = Scheme::OciOs;
+    type Accessor = OciOsBackend;
+
+    fn from_map(_map: HashMap<String, String>) -> Self {
+        OciOsBuilder::default()
+    }
+
+    fn build(&mut self) -> Result<Self::Accessor> {
+        debug!("backend build started: {:?}", &self);
+
+        let root = normalize_root(&self.root.clone().unwrap_or_default());
+        debug!("backend use root {}", &root);
+
+        let region = match self.region.is_empty() {
+            false => Ok(&self.region),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The region is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let bucket = match self.bucket.is_empty() {
+            false => Ok(&self.bucket),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The bucket is misconfigured")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let namespace = match self.namespace.is_empty() {
+            false => Ok(&self.namespace),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The namespace is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let client = if let Some(client) = self.http_client.take() {
+            client
+        } else {
+            HttpClient::new().map_err(|err| {
+                err.with_operation("Builder::build")
+                    .with_context("service", Scheme::OciOs)
+            })?
+        };
+
+        let loader = OCILoader::default();

Review Comment:
   Please use `OciLoader` instead. Maybe need changes from `reqsign`.



##########
core/src/services/ocios/backend.rs:
##########
@@ -0,0 +1,278 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use std::fmt::Debug;
+use std::fmt::Formatter;
+use std::sync::Arc;
+
+use async_trait::async_trait;
+use http::StatusCode;
+use log::debug;
+use reqsign::OCIAPIKeySigner;
+use reqsign::OCILoader;
+
+use super::core::*;
+use super::error::parse_error;
+use super::lister::OciOsLister;
+use crate::raw::*;
+use crate::*;
+
+/// Oracle Cloud Infrastructure Object Storage support
+#[doc = include_str!("docs.md")]
+#[derive(Default)]
+pub struct OciOsBuilder {
+    root: Option<String>,
+
+    region: String,
+    namespace: String,
+    endpoint: String,
+    bucket: String,
+
+    http_client: Option<HttpClient>,
+}
+
+impl Debug for OciOsBuilder {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut d = f.debug_struct("Builder");
+        d.field("root", &self.root)
+            .field("region", &self.region)
+            .field("bucket", &self.bucket)
+            .field("namespace", &self.namespace)
+            .field("endpoint", &self.endpoint);
+
+        d.finish_non_exhaustive()
+    }
+}
+
+impl OciOsBuilder {
+    /// Set root of this backend.
+    ///
+    /// All operations will happen under this root.
+    pub fn root(&mut self, root: &str) -> &mut Self {
+        self.root = if root.is_empty() {
+            None
+        } else {
+            Some(root.to_string())
+        };
+
+        self
+    }
+
+    /// Set bucket name of this backend.
+    pub fn bucket(&mut self, bucket: &str) -> &mut Self {
+        self.bucket = bucket.to_string();
+
+        self
+    }
+
+    /// Set namespace of this backend.
+    pub fn namespace(&mut self, ns: &str) -> &mut Self {
+        self.namespace = ns.to_string();
+
+        self
+    }
+
+    /// Specify the http client that used by this service.
+    ///
+    /// # Notes
+    ///
+    /// This API is part of OpenDAL's Raw API. `HttpClient` could be changed
+    /// during minor updates.
+    pub fn http_client(&mut self, client: HttpClient) -> &mut Self {
+        self.http_client = Some(client);
+        self
+    }
+}
+
+impl Builder for OciOsBuilder {
+    const SCHEME: Scheme = Scheme::OciOs;
+    type Accessor = OciOsBackend;
+
+    fn from_map(_map: HashMap<String, String>) -> Self {
+        OciOsBuilder::default()
+    }
+
+    fn build(&mut self) -> Result<Self::Accessor> {
+        debug!("backend build started: {:?}", &self);
+
+        let root = normalize_root(&self.root.clone().unwrap_or_default());
+        debug!("backend use root {}", &root);
+
+        let region = match self.region.is_empty() {
+            false => Ok(&self.region),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The region is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let bucket = match self.bucket.is_empty() {
+            false => Ok(&self.bucket),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The bucket is misconfigured")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let namespace = match self.namespace.is_empty() {
+            false => Ok(&self.namespace),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The namespace is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let client = if let Some(client) = self.http_client.take() {
+            client
+        } else {
+            HttpClient::new().map_err(|err| {
+                err.with_operation("Builder::build")
+                    .with_context("service", Scheme::OciOs)
+            })?
+        };
+
+        let loader = OCILoader::default();
+
+        let signer = OCIAPIKeySigner::default();
+
+        debug!("Backend build finished");
+
+        Ok(OciOsBackend {
+            core: Arc::new(OciOsCore {
+                region: region.to_owned(),
+                root,
+                bucket: bucket.to_owned(),
+                namespace: namespace.to_owned(),
+                signer,
+                loader,
+                client,
+            }),
+        })
+    }
+}
+
+#[derive(Debug, Clone)]
+/// Oracle Cloud Infrastructure Object Storage Service backend
+pub struct OciOsBackend {
+    core: Arc<OciOsCore>,
+}
+
+#[async_trait]
+impl Accessor for OciOsBackend {
+    type Reader = IncomingAsyncBody;
+    type Lister = oio::PageLister<OciOsLister>;
+    type Writer = ();
+    type BlockingReader = ();
+    type BlockingWriter = ();
+    type BlockingLister = ();
+
+    fn info(&self) -> AccessorInfo {
+        let mut am = AccessorInfo::default();
+        am.set_scheme(Scheme::OciOs)
+            .set_root(&self.core.root)
+            .set_name(&self.core.bucket)
+            .set_native_capability(Capability {
+                stat: true,
+                stat_with_if_match: true,
+                stat_with_if_none_match: true,
+
+                read: true,
+                read_can_next: true,
+                read_with_range: true,
+                read_with_if_match: true,
+                read_with_if_none_match: true,
+
+                write: false,
+
+                delete: false,
+                copy: false,
+
+                list: true,
+                list_with_limit: true,
+                list_with_start_after: true,
+                list_with_recursive: true,
+
+                presign: false,
+                presign_stat: true,
+                presign_read: true,
+                presign_write: true,
+
+                batch: false,
+
+                ..Default::default()
+            });
+
+        am
+    }
+
+    async fn read(&self, path: &str, args: OpRead) -> Result<(RpRead, Self::Reader)> {
+        let resp = self
+            .core
+            .os_get_object(
+                path,
+                args.range(),

Review Comment:
   It's better to accept an `OpRead`.



##########
core/src/services/ocios/core.rs:
##########
@@ -0,0 +1,309 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+
+use http::Request;
+use http::Response;
+use reqsign::OCIAPIKeySigner;
+use reqsign::OCICredential;
+use reqsign::OCILoader;
+use serde::Deserialize;
+use serde::Serialize;
+
+use crate::raw::*;
+use crate::*;
+
+mod constants {
+    pub const QUERY_LIST_PREFIXY: &str = "prefix";
+}
+
+pub struct OciOsCore {
+    pub region: String,
+    pub root: String,
+    pub bucket: String,
+    pub namespace: String,
+
+    pub client: HttpClient,
+    pub loader: OCILoader,
+    pub signer: OCIAPIKeySigner,
+}
+
+impl Debug for OciOsCore {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        f.debug_struct("Backend")
+            .field("root", &self.root)
+            .field("bucket", &self.bucket)
+            .field("namespace", &self.namespace)
+            .finish_non_exhaustive()
+    }
+}
+
+impl OciOsCore {
+    async fn load_credential(&self) -> Result<Option<OCICredential>> {
+        let cred = self
+            .loader
+            .load()
+            .await
+            .map_err(new_request_credential_error)?;
+
+        if let Some(cred) = cred {
+            Ok(Some(cred))
+        } else {
+            // Mark this error as temporary since it could be caused by Aliyun STS.
+            Err(Error::new(
+                ErrorKind::PermissionDenied,
+                "no valid credential found, please check configuration or try again",
+            )
+            .set_temporary())
+        }
+    }
+
+    pub async fn sign<T>(&self, req: &mut Request<T>) -> Result<()> {
+        let cred = if let Some(cred) = self.load_credential().await? {
+            cred
+        } else {
+            return Ok(());
+        };
+
+        self.signer.sign(req, &cred).map_err(new_request_sign_error)
+    }
+
+    #[inline]
+    pub async fn send(&self, req: Request<AsyncBody>) -> Result<Response<IncomingAsyncBody>> {
+        self.client.send(req).await
+    }
+}
+
+impl OciOsCore {
+    pub fn os_get_object_request(
+        &self,
+        path: &str,
+        _range: BytesRange,
+        _is_presign: bool,
+        _if_match: Option<&str>,
+        _if_none_match: Option<&str>,
+        _override_content_disposition: Option<&str>,
+    ) -> Result<Request<AsyncBody>> {
+        let p = build_abs_path(&self.root, path);
+        let url = format!(
+            "objectstorage.{}.oraclecloud.com/n/{}/b/{}/o/{}",

Review Comment:
   url without protocol could be wrong.



##########
core/src/services/ocios/backend.rs:
##########
@@ -0,0 +1,278 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use std::fmt::Debug;
+use std::fmt::Formatter;
+use std::sync::Arc;
+
+use async_trait::async_trait;
+use http::StatusCode;
+use log::debug;
+use reqsign::OCIAPIKeySigner;
+use reqsign::OCILoader;
+
+use super::core::*;
+use super::error::parse_error;
+use super::lister::OciOsLister;
+use crate::raw::*;
+use crate::*;
+
+/// Oracle Cloud Infrastructure Object Storage support
+#[doc = include_str!("docs.md")]
+#[derive(Default)]
+pub struct OciOsBuilder {
+    root: Option<String>,
+
+    region: String,
+    namespace: String,
+    endpoint: String,
+    bucket: String,
+
+    http_client: Option<HttpClient>,
+}
+
+impl Debug for OciOsBuilder {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut d = f.debug_struct("Builder");
+        d.field("root", &self.root)
+            .field("region", &self.region)
+            .field("bucket", &self.bucket)
+            .field("namespace", &self.namespace)
+            .field("endpoint", &self.endpoint);
+
+        d.finish_non_exhaustive()
+    }
+}
+
+impl OciOsBuilder {
+    /// Set root of this backend.
+    ///
+    /// All operations will happen under this root.
+    pub fn root(&mut self, root: &str) -> &mut Self {
+        self.root = if root.is_empty() {
+            None
+        } else {
+            Some(root.to_string())
+        };
+
+        self
+    }
+
+    /// Set bucket name of this backend.
+    pub fn bucket(&mut self, bucket: &str) -> &mut Self {
+        self.bucket = bucket.to_string();
+
+        self
+    }
+
+    /// Set namespace of this backend.
+    pub fn namespace(&mut self, ns: &str) -> &mut Self {
+        self.namespace = ns.to_string();
+
+        self
+    }
+
+    /// Specify the http client that used by this service.
+    ///
+    /// # Notes
+    ///
+    /// This API is part of OpenDAL's Raw API. `HttpClient` could be changed
+    /// during minor updates.
+    pub fn http_client(&mut self, client: HttpClient) -> &mut Self {
+        self.http_client = Some(client);
+        self
+    }
+}
+
+impl Builder for OciOsBuilder {
+    const SCHEME: Scheme = Scheme::OciOs;
+    type Accessor = OciOsBackend;
+
+    fn from_map(_map: HashMap<String, String>) -> Self {
+        OciOsBuilder::default()
+    }
+
+    fn build(&mut self) -> Result<Self::Accessor> {
+        debug!("backend build started: {:?}", &self);
+
+        let root = normalize_root(&self.root.clone().unwrap_or_default());
+        debug!("backend use root {}", &root);
+
+        let region = match self.region.is_empty() {
+            false => Ok(&self.region),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The region is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let bucket = match self.bucket.is_empty() {
+            false => Ok(&self.bucket),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The bucket is misconfigured")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let namespace = match self.namespace.is_empty() {
+            false => Ok(&self.namespace),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The namespace is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let client = if let Some(client) = self.http_client.take() {
+            client
+        } else {
+            HttpClient::new().map_err(|err| {
+                err.with_operation("Builder::build")
+                    .with_context("service", Scheme::OciOs)
+            })?
+        };
+
+        let loader = OCILoader::default();
+
+        let signer = OCIAPIKeySigner::default();
+
+        debug!("Backend build finished");
+
+        Ok(OciOsBackend {
+            core: Arc::new(OciOsCore {
+                region: region.to_owned(),
+                root,
+                bucket: bucket.to_owned(),
+                namespace: namespace.to_owned(),
+                signer,
+                loader,
+                client,
+            }),
+        })
+    }
+}
+
+#[derive(Debug, Clone)]
+/// Oracle Cloud Infrastructure Object Storage Service backend
+pub struct OciOsBackend {
+    core: Arc<OciOsCore>,
+}
+
+#[async_trait]
+impl Accessor for OciOsBackend {
+    type Reader = IncomingAsyncBody;
+    type Lister = oio::PageLister<OciOsLister>;
+    type Writer = ();
+    type BlockingReader = ();
+    type BlockingWriter = ();
+    type BlockingLister = ();
+
+    fn info(&self) -> AccessorInfo {
+        let mut am = AccessorInfo::default();
+        am.set_scheme(Scheme::OciOs)
+            .set_root(&self.core.root)
+            .set_name(&self.core.bucket)
+            .set_native_capability(Capability {
+                stat: true,
+                stat_with_if_match: true,
+                stat_with_if_none_match: true,
+
+                read: true,
+                read_can_next: true,
+                read_with_range: true,
+                read_with_if_match: true,
+                read_with_if_none_match: true,
+
+                write: false,
+
+                delete: false,
+                copy: false,
+
+                list: true,
+                list_with_limit: true,
+                list_with_start_after: true,
+                list_with_recursive: true,
+
+                presign: false,
+                presign_stat: true,
+                presign_read: true,
+                presign_write: true,
+
+                batch: false,
+
+                ..Default::default()
+            });
+
+        am
+    }
+
+    async fn read(&self, path: &str, args: OpRead) -> Result<(RpRead, Self::Reader)> {
+        let resp = self
+            .core
+            .os_get_object(
+                path,
+                args.range(),
+                args.if_match(),
+                args.if_none_match(),
+                args.override_content_disposition(),
+            )
+            .await?;
+
+        let status = resp.status();
+
+        match status {
+            StatusCode::OK | StatusCode::PARTIAL_CONTENT => {
+                let size = parse_content_length(resp.headers())?;
+                let range = parse_content_range(resp.headers())?;
+                Ok((
+                    RpRead::new().with_size(size).with_range(range),
+                    resp.into_body(),
+                ))
+            }
+            StatusCode::RANGE_NOT_SATISFIABLE => {
+                resp.into_body().consume().await?;
+                Ok((RpRead::new().with_size(Some(0)), IncomingAsyncBody::empty()))
+            }
+            _ => Err(parse_error(resp).await?),
+        }
+    }
+
+    async fn stat(&self, path: &str, args: OpStat) -> Result<RpStat> {
+        let resp = self
+            .core
+            .os_head_object(path, args.if_match(), args.if_none_match())
+            .await?;
+
+        let status = resp.status();
+
+        match status {
+            StatusCode::OK => parse_into_metadata(path, resp.headers()).map(RpStat::new),
+            _ => Err(parse_error(resp).await?),
+        }
+    }
+
+    async fn list(&self, path: &str, args: OpList) -> Result<(RpList, Self::Lister)> {
+        let l = OciOsLister::new(
+            self.core.clone(),
+            path,
+            args.recursive(),

Review Comment:
   The same. We can accept an `OpList`.



##########
core/src/services/ocios/backend.rs:
##########
@@ -0,0 +1,278 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use std::fmt::Debug;
+use std::fmt::Formatter;
+use std::sync::Arc;
+
+use async_trait::async_trait;
+use http::StatusCode;
+use log::debug;
+use reqsign::OCIAPIKeySigner;
+use reqsign::OCILoader;
+
+use super::core::*;
+use super::error::parse_error;
+use super::lister::OciOsLister;
+use crate::raw::*;
+use crate::*;
+
+/// Oracle Cloud Infrastructure Object Storage support
+#[doc = include_str!("docs.md")]
+#[derive(Default)]
+pub struct OciOsBuilder {
+    root: Option<String>,
+
+    region: String,
+    namespace: String,
+    endpoint: String,
+    bucket: String,
+
+    http_client: Option<HttpClient>,
+}
+
+impl Debug for OciOsBuilder {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut d = f.debug_struct("Builder");
+        d.field("root", &self.root)
+            .field("region", &self.region)
+            .field("bucket", &self.bucket)
+            .field("namespace", &self.namespace)
+            .field("endpoint", &self.endpoint);
+
+        d.finish_non_exhaustive()
+    }
+}
+
+impl OciOsBuilder {
+    /// Set root of this backend.
+    ///
+    /// All operations will happen under this root.
+    pub fn root(&mut self, root: &str) -> &mut Self {
+        self.root = if root.is_empty() {
+            None
+        } else {
+            Some(root.to_string())
+        };
+
+        self
+    }
+
+    /// Set bucket name of this backend.
+    pub fn bucket(&mut self, bucket: &str) -> &mut Self {
+        self.bucket = bucket.to_string();
+
+        self
+    }
+
+    /// Set namespace of this backend.
+    pub fn namespace(&mut self, ns: &str) -> &mut Self {
+        self.namespace = ns.to_string();
+
+        self
+    }
+
+    /// Specify the http client that used by this service.
+    ///
+    /// # Notes
+    ///
+    /// This API is part of OpenDAL's Raw API. `HttpClient` could be changed
+    /// during minor updates.
+    pub fn http_client(&mut self, client: HttpClient) -> &mut Self {
+        self.http_client = Some(client);
+        self
+    }
+}
+
+impl Builder for OciOsBuilder {
+    const SCHEME: Scheme = Scheme::OciOs;
+    type Accessor = OciOsBackend;
+
+    fn from_map(_map: HashMap<String, String>) -> Self {
+        OciOsBuilder::default()
+    }
+
+    fn build(&mut self) -> Result<Self::Accessor> {
+        debug!("backend build started: {:?}", &self);
+
+        let root = normalize_root(&self.root.clone().unwrap_or_default());
+        debug!("backend use root {}", &root);
+
+        let region = match self.region.is_empty() {
+            false => Ok(&self.region),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The region is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let bucket = match self.bucket.is_empty() {
+            false => Ok(&self.bucket),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The bucket is misconfigured")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let namespace = match self.namespace.is_empty() {
+            false => Ok(&self.namespace),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The namespace is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let client = if let Some(client) = self.http_client.take() {
+            client
+        } else {
+            HttpClient::new().map_err(|err| {
+                err.with_operation("Builder::build")
+                    .with_context("service", Scheme::OciOs)
+            })?
+        };
+
+        let loader = OCILoader::default();
+
+        let signer = OCIAPIKeySigner::default();
+
+        debug!("Backend build finished");
+
+        Ok(OciOsBackend {
+            core: Arc::new(OciOsCore {
+                region: region.to_owned(),
+                root,
+                bucket: bucket.to_owned(),
+                namespace: namespace.to_owned(),
+                signer,
+                loader,
+                client,
+            }),
+        })
+    }
+}
+
+#[derive(Debug, Clone)]
+/// Oracle Cloud Infrastructure Object Storage Service backend
+pub struct OciOsBackend {
+    core: Arc<OciOsCore>,
+}
+
+#[async_trait]
+impl Accessor for OciOsBackend {
+    type Reader = IncomingAsyncBody;
+    type Lister = oio::PageLister<OciOsLister>;
+    type Writer = ();
+    type BlockingReader = ();
+    type BlockingWriter = ();
+    type BlockingLister = ();
+
+    fn info(&self) -> AccessorInfo {
+        let mut am = AccessorInfo::default();
+        am.set_scheme(Scheme::OciOs)
+            .set_root(&self.core.root)
+            .set_name(&self.core.bucket)
+            .set_native_capability(Capability {
+                stat: true,
+                stat_with_if_match: true,
+                stat_with_if_none_match: true,
+
+                read: true,
+                read_can_next: true,
+                read_with_range: true,
+                read_with_if_match: true,
+                read_with_if_none_match: true,
+
+                write: false,
+
+                delete: false,
+                copy: false,
+
+                list: true,
+                list_with_limit: true,
+                list_with_start_after: true,
+                list_with_recursive: true,
+
+                presign: false,
+                presign_stat: true,
+                presign_read: true,
+                presign_write: true,
+
+                batch: false,
+
+                ..Default::default()
+            });
+
+        am
+    }
+
+    async fn read(&self, path: &str, args: OpRead) -> Result<(RpRead, Self::Reader)> {
+        let resp = self
+            .core
+            .os_get_object(

Review Comment:
   Please naming it as `ocios_get_object`. `os` makes it confusion.



##########
core/src/services/ocios/backend.rs:
##########
@@ -0,0 +1,278 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use std::fmt::Debug;
+use std::fmt::Formatter;
+use std::sync::Arc;
+
+use async_trait::async_trait;
+use http::StatusCode;
+use log::debug;
+use reqsign::OCIAPIKeySigner;
+use reqsign::OCILoader;
+
+use super::core::*;
+use super::error::parse_error;
+use super::lister::OciOsLister;
+use crate::raw::*;
+use crate::*;
+
+/// Oracle Cloud Infrastructure Object Storage support
+#[doc = include_str!("docs.md")]
+#[derive(Default)]
+pub struct OciOsBuilder {
+    root: Option<String>,
+
+    region: String,
+    namespace: String,
+    endpoint: String,
+    bucket: String,
+
+    http_client: Option<HttpClient>,
+}
+
+impl Debug for OciOsBuilder {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut d = f.debug_struct("Builder");
+        d.field("root", &self.root)
+            .field("region", &self.region)
+            .field("bucket", &self.bucket)
+            .field("namespace", &self.namespace)
+            .field("endpoint", &self.endpoint);
+
+        d.finish_non_exhaustive()
+    }
+}
+
+impl OciOsBuilder {
+    /// Set root of this backend.
+    ///
+    /// All operations will happen under this root.
+    pub fn root(&mut self, root: &str) -> &mut Self {
+        self.root = if root.is_empty() {
+            None
+        } else {
+            Some(root.to_string())
+        };
+
+        self
+    }
+
+    /// Set bucket name of this backend.
+    pub fn bucket(&mut self, bucket: &str) -> &mut Self {
+        self.bucket = bucket.to_string();
+
+        self
+    }
+
+    /// Set namespace of this backend.
+    pub fn namespace(&mut self, ns: &str) -> &mut Self {
+        self.namespace = ns.to_string();
+
+        self
+    }
+
+    /// Specify the http client that used by this service.
+    ///
+    /// # Notes
+    ///
+    /// This API is part of OpenDAL's Raw API. `HttpClient` could be changed
+    /// during minor updates.
+    pub fn http_client(&mut self, client: HttpClient) -> &mut Self {
+        self.http_client = Some(client);
+        self
+    }
+}
+
+impl Builder for OciOsBuilder {
+    const SCHEME: Scheme = Scheme::OciOs;
+    type Accessor = OciOsBackend;
+
+    fn from_map(_map: HashMap<String, String>) -> Self {
+        OciOsBuilder::default()
+    }
+
+    fn build(&mut self) -> Result<Self::Accessor> {
+        debug!("backend build started: {:?}", &self);
+
+        let root = normalize_root(&self.root.clone().unwrap_or_default());
+        debug!("backend use root {}", &root);
+
+        let region = match self.region.is_empty() {
+            false => Ok(&self.region),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The region is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let bucket = match self.bucket.is_empty() {
+            false => Ok(&self.bucket),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The bucket is misconfigured")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let namespace = match self.namespace.is_empty() {
+            false => Ok(&self.namespace),
+            true => Err(
+                Error::new(ErrorKind::ConfigInvalid, "The namespace is not set")
+                    .with_context("service", Scheme::OciOs),
+            ),
+        }?;
+
+        let client = if let Some(client) = self.http_client.take() {
+            client
+        } else {
+            HttpClient::new().map_err(|err| {
+                err.with_operation("Builder::build")
+                    .with_context("service", Scheme::OciOs)
+            })?
+        };
+
+        let loader = OCILoader::default();
+
+        let signer = OCIAPIKeySigner::default();
+
+        debug!("Backend build finished");
+
+        Ok(OciOsBackend {
+            core: Arc::new(OciOsCore {
+                region: region.to_owned(),
+                root,
+                bucket: bucket.to_owned(),
+                namespace: namespace.to_owned(),
+                signer,
+                loader,
+                client,
+            }),
+        })
+    }
+}
+
+#[derive(Debug, Clone)]
+/// Oracle Cloud Infrastructure Object Storage Service backend
+pub struct OciOsBackend {
+    core: Arc<OciOsCore>,
+}
+
+#[async_trait]
+impl Accessor for OciOsBackend {
+    type Reader = IncomingAsyncBody;
+    type Lister = oio::PageLister<OciOsLister>;
+    type Writer = ();
+    type BlockingReader = ();
+    type BlockingWriter = ();
+    type BlockingLister = ();
+
+    fn info(&self) -> AccessorInfo {
+        let mut am = AccessorInfo::default();
+        am.set_scheme(Scheme::OciOs)
+            .set_root(&self.core.root)
+            .set_name(&self.core.bucket)
+            .set_native_capability(Capability {
+                stat: true,
+                stat_with_if_match: true,
+                stat_with_if_none_match: true,
+
+                read: true,
+                read_can_next: true,
+                read_with_range: true,
+                read_with_if_match: true,
+                read_with_if_none_match: true,
+
+                write: false,
+
+                delete: false,
+                copy: false,
+
+                list: true,
+                list_with_limit: true,
+                list_with_start_after: true,
+                list_with_recursive: true,
+
+                presign: false,

Review Comment:
   `presign: false` will shadow all `presign_xxx`.



##########
core/src/services/ocios/core.rs:
##########
@@ -0,0 +1,309 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+
+use http::Request;
+use http::Response;
+use reqsign::OCIAPIKeySigner;
+use reqsign::OCICredential;
+use reqsign::OCILoader;
+use serde::Deserialize;
+use serde::Serialize;
+
+use crate::raw::*;
+use crate::*;
+
+mod constants {
+    pub const QUERY_LIST_PREFIXY: &str = "prefix";
+}
+
+pub struct OciOsCore {
+    pub region: String,
+    pub root: String,
+    pub bucket: String,
+    pub namespace: String,
+
+    pub client: HttpClient,
+    pub loader: OCILoader,
+    pub signer: OCIAPIKeySigner,
+}
+
+impl Debug for OciOsCore {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        f.debug_struct("Backend")
+            .field("root", &self.root)
+            .field("bucket", &self.bucket)
+            .field("namespace", &self.namespace)
+            .finish_non_exhaustive()
+    }
+}
+
+impl OciOsCore {
+    async fn load_credential(&self) -> Result<Option<OCICredential>> {
+        let cred = self
+            .loader
+            .load()
+            .await
+            .map_err(new_request_credential_error)?;
+
+        if let Some(cred) = cred {
+            Ok(Some(cred))
+        } else {
+            // Mark this error as temporary since it could be caused by Aliyun STS.
+            Err(Error::new(
+                ErrorKind::PermissionDenied,
+                "no valid credential found, please check configuration or try again",
+            )
+            .set_temporary())
+        }
+    }
+
+    pub async fn sign<T>(&self, req: &mut Request<T>) -> Result<()> {
+        let cred = if let Some(cred) = self.load_credential().await? {
+            cred
+        } else {
+            return Ok(());
+        };
+
+        self.signer.sign(req, &cred).map_err(new_request_sign_error)
+    }
+
+    #[inline]
+    pub async fn send(&self, req: Request<AsyncBody>) -> Result<Response<IncomingAsyncBody>> {
+        self.client.send(req).await
+    }
+}
+
+impl OciOsCore {
+    pub fn os_get_object_request(
+        &self,
+        path: &str,
+        _range: BytesRange,
+        _is_presign: bool,
+        _if_match: Option<&str>,
+        _if_none_match: Option<&str>,
+        _override_content_disposition: Option<&str>,
+    ) -> Result<Request<AsyncBody>> {
+        let p = build_abs_path(&self.root, path);
+        let url = format!(
+            "objectstorage.{}.oraclecloud.com/n/{}/b/{}/o/{}",
+            self.region,
+            self.namespace,
+            self.bucket,
+            percent_encode_path(&p)
+        );
+
+        let req = Request::get(&url)
+            .body(AsyncBody::Empty)
+            .map_err(new_request_build_error)?;
+
+        Ok(req)
+    }
+
+    pub fn os_head_object_request(
+        &self,
+        path: &str,
+        _is_presign: bool,
+        _if_match: Option<&str>,
+        _if_none_match: Option<&str>,
+    ) -> Result<Request<AsyncBody>> {
+        let p = build_abs_path(&self.root, path);
+        let url = format!(
+            "objectstorage.{}.oraclecloud.com/n/{}/b/{}/o/{}",
+            self.region,
+            self.namespace,
+            self.bucket,
+            percent_encode_path(&p)
+        );
+
+        let req = Request::head(&url)
+            .body(AsyncBody::Empty)
+            .map_err(new_request_build_error)?;
+
+        Ok(req)
+    }
+
+    pub fn os_list_object_request(
+        &self,
+        path: &str,
+        _delimiter: &str,
+        _limit: Option<usize>,
+        _start_after: Option<String>,
+    ) -> Result<Request<AsyncBody>> {
+        let p = build_abs_path(&self.root, path);
+        let url = format!(
+            "objectstorage.{}.oraclecloud.com/n/{}/b/{}/o",
+            self.region, self.namespace, self.bucket,

Review Comment:
   If the endpoint is always the same for all API, we can build this endpoint during build.



##########
core/src/services/ocios/error.rs:
##########
@@ -0,0 +1,108 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use bytes::Buf;
+use http::Response;
+use http::StatusCode;
+use quick_xml::de;
+use serde::Deserialize;
+
+use crate::raw::*;
+use crate::Error;
+use crate::ErrorKind;
+use crate::Result;
+
+/// OssError is the error returned by oss service.
+#[derive(Default, Debug, Deserialize)]
+#[serde(default, rename_all = "PascalCase")]
+struct OssError {
+    code: String,
+    message: String,
+    request_id: String,
+    host_id: String,
+}
+
+/// Parse error response into Error.
+pub async fn parse_error(resp: Response<IncomingAsyncBody>) -> Result<Error> {
+    let (parts, body) = resp.into_parts();
+    let bs = body.bytes().await?;
+
+    let (kind, retryable) = match parts.status {
+        StatusCode::NOT_FOUND => (ErrorKind::NotFound, false),
+        StatusCode::FORBIDDEN => (ErrorKind::PermissionDenied, false),
+        StatusCode::PRECONDITION_FAILED | StatusCode::NOT_MODIFIED => {
+            (ErrorKind::ConditionNotMatch, false)
+        }
+        StatusCode::INTERNAL_SERVER_ERROR
+        | StatusCode::BAD_GATEWAY
+        | StatusCode::SERVICE_UNAVAILABLE
+        | StatusCode::GATEWAY_TIMEOUT => (ErrorKind::Unexpected, true),
+        _ => (ErrorKind::Unexpected, false),
+    };
+
+    let message = match de::from_reader::<_, OssError>(bs.clone().reader()) {
+        Ok(oss_err) => format!("{oss_err:?}"),
+        Err(_) => String::from_utf8_lossy(&bs).into_owned(),
+    };
+
+    let mut err = Error::new(kind, &message);
+
+    err = with_error_response_context(err, parts);
+
+    if retryable {
+        err = err.set_temporary();
+    }
+
+    Ok(err)
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    /// Error response example is from https://www.alibabacloud.com/help/en/object-storage-service/latest/error-responses
+    #[test]
+    fn test_parse_error() {
+        let bs = bytes::Bytes::from(
+            r#"
+<?xml version="1.0" ?>
+<Error xmlns="http://doc.oss-cn-hangzhou.aliyuncs.com">

Review Comment:
   Is this test correct?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org