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

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new 0ea074af77e Add `MultipartUpload` blanket implementation for `Box<W>` 
(#5919)
0ea074af77e is described below

commit 0ea074af77ef03371ec0c1b1ebf626390059baa2
Author: Faiaz Sanaulla <[email protected]>
AuthorDate: Sun Jun 23 09:40:35 2024 +0200

    Add `MultipartUpload` blanket implementation for `Box<W>` (#5919)
    
    * add impl for box
    
    * update
    
    * another update
    
    * small fix
---
 object_store/src/upload.rs | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/object_store/src/upload.rs b/object_store/src/upload.rs
index e5f683a034a..dc499e2e0e5 100644
--- a/object_store/src/upload.rs
+++ b/object_store/src/upload.rs
@@ -92,6 +92,21 @@ pub trait MultipartUpload: Send + std::fmt::Debug {
     async fn abort(&mut self) -> Result<()>;
 }
 
+#[async_trait]
+impl<W: MultipartUpload + ?Sized> MultipartUpload for Box<W> {
+    fn put_part(&mut self, data: PutPayload) -> UploadPart {
+        (**self).put_part(data)
+    }
+
+    async fn complete(&mut self) -> Result<PutResult> {
+        (**self).complete().await
+    }
+
+    async fn abort(&mut self) -> Result<()> {
+        (**self).abort().await
+    }
+}
+
 /// A synchronous write API for uploading data in parallel in fixed size chunks
 ///
 /// Uses multiple tokio tasks in a [`JoinSet`] to multiplex upload tasks in 
parallel

Reply via email to