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

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

commit ba757e4f90a224d735669a261b7ea6f18bec7875
Author: Xuanwo <[email protected]>
AuthorDate: Wed Aug 30 18:50:00 2023 +0800

    Migrate
    
    Signed-off-by: Xuanwo <[email protected]>
---
 core/src/services/wasabi/core.rs   |  4 ++--
 core/src/services/wasabi/writer.rs | 19 ++++++-------------
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/core/src/services/wasabi/core.rs b/core/src/services/wasabi/core.rs
index 23506c260..46ede6b26 100644
--- a/core/src/services/wasabi/core.rs
+++ b/core/src/services/wasabi/core.rs
@@ -301,7 +301,7 @@ impl WasabiCore {
     pub fn put_object_request(
         &self,
         path: &str,
-        size: Option<usize>,
+        size: Option<u64>,
         content_type: Option<&str>,
         content_disposition: Option<&str>,
         cache_control: Option<&str>,
@@ -637,7 +637,7 @@ impl WasabiCore {
     pub async fn put_object(
         &self,
         path: &str,
-        size: Option<usize>,
+        size: Option<u64>,
         content_type: Option<&str>,
         content_disposition: Option<&str>,
         cache_control: Option<&str>,
diff --git a/core/src/services/wasabi/writer.rs 
b/core/src/services/wasabi/writer.rs
index 04f9bcb80..d043d44fd 100644
--- a/core/src/services/wasabi/writer.rs
+++ b/core/src/services/wasabi/writer.rs
@@ -37,17 +37,20 @@ impl WasabiWriter {
     pub fn new(core: Arc<WasabiCore>, op: OpWrite, path: String) -> Self {
         WasabiWriter { core, op, path }
     }
+}
 
-    async fn write(&mut self, bs: Bytes) -> Result<()> {
+#[async_trait]
+impl oio::Write for WasabiWriter {
+    async fn write(&mut self, s: oio::Streamer) -> Result<()> {
         let resp = self
             .core
             .put_object(
                 &self.path,
-                Some(bs.len()),
+                Some(s.size()),
                 self.op.content_type(),
                 self.op.content_disposition(),
                 self.op.cache_control(),
-                AsyncBody::Bytes(bs),
+                AsyncBody::Stream(s),
             )
             .await?;
 
@@ -59,16 +62,6 @@ impl WasabiWriter {
             _ => Err(parse_error(resp).await?),
         }
     }
-}
-
-#[async_trait]
-impl oio::Write for WasabiWriter {
-    async fn write(&mut self, _s: oio::Streamer) -> Result<()> {
-        Err(Error::new(
-            ErrorKind::Unsupported,
-            "Write::sink is not supported",
-        ))
-    }
 
     async fn abort(&mut self) -> Result<()> {
         Ok(())

Reply via email to