This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch refactor-test
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/refactor-test by this push:
     new 908fa4fc4 Fix azdls test
908fa4fc4 is described below

commit 908fa4fc41ef25afd76238d2e8010e62fb0bbfd9
Author: Xuanwo <[email protected]>
AuthorDate: Tue Oct 17 21:10:07 2023 +0800

    Fix azdls test
    
    Signed-off-by: Xuanwo <[email protected]>
---
 core/src/services/azdls/writer.rs | 22 ++++++++++++++++++++++
 core/src/types/scheme.rs          |  2 +-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/core/src/services/azdls/writer.rs 
b/core/src/services/azdls/writer.rs
index bc0201fbf..e9e57cd97 100644
--- a/core/src/services/azdls/writer.rs
+++ b/core/src/services/azdls/writer.rs
@@ -106,6 +106,28 @@ impl oio::AppendObjectWrite for AzdlsWriter {
     }
 
     async fn append(&self, offset: u64, size: u64, body: AsyncBody) -> 
Result<()> {
+        if offset == 0 {
+            let mut req =
+                self.core
+                    .azdls_create_request(&self.path, "file", &self.op, 
AsyncBody::Empty)?;
+
+            self.core.sign(&mut req).await?;
+
+            let resp = self.core.send(req).await?;
+
+            let status = resp.status();
+            match status {
+                StatusCode::CREATED | StatusCode::OK => {
+                    resp.into_body().consume().await?;
+                }
+                _ => {
+                    return Err(parse_error(resp)
+                        .await?
+                        .with_operation("Backend::azdls_create_request"));
+                }
+            }
+        }
+
         let mut req = self
             .core
             .azdls_update_request(&self.path, Some(size), offset, body)?;
diff --git a/core/src/types/scheme.rs b/core/src/types/scheme.rs
index 16692e53c..b627d596a 100644
--- a/core/src/types/scheme.rs
+++ b/core/src/types/scheme.rs
@@ -211,7 +211,7 @@ impl From<Scheme> for &'static str {
         match v {
             Scheme::Atomicserver => "atomicserver",
             Scheme::Azblob => "azblob",
-            Scheme::Azdls => "Azdls",
+            Scheme::Azdls => "azdls",
             Scheme::Cacache => "cacache",
             Scheme::Cos => "cos",
             Scheme::D1 => "d1",

Reply via email to