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

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


The following commit(s) were added to refs/heads/remove_writer_copy_from by 
this push:
     new fb7ffa1c5 Fix typo
fb7ffa1c5 is described below

commit fb7ffa1c5440d4829caffd2f06f8f7734c0ea818
Author: Xuanwo <[email protected]>
AuthorDate: Wed Sep 6 22:57:10 2023 +0800

    Fix typo
    
    Signed-off-by: Xuanwo <[email protected]>
---
 core/src/docs/rfcs/3017_remove_write_copy_from.md | 25 +++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/core/src/docs/rfcs/3017_remove_write_copy_from.md 
b/core/src/docs/rfcs/3017_remove_write_copy_from.md
index 4862880bb..c7112ef94 100644
--- a/core/src/docs/rfcs/3017_remove_write_copy_from.md
+++ b/core/src/docs/rfcs/3017_remove_write_copy_from.md
@@ -47,11 +47,32 @@ Given these constraints, the proposal is to remove 
`oio::Write::copy_from` until
 
 # Guide-level explanation
 
-The `Writer::sink()` and `Writer::copy()` methods will be deprecated. As a 
substitute, users can utilize `AsyncWrite` to copy a file or stream. Additional 
helper functions like `Writer::copy_from(r: &dyn AsyncRead)` may be provided if 
necessary.
+The `Writer::sink()` and `Writer::copy()` methods will be kept, but it's 
internal implementation will be changed to use `AsyncWrite` instead. For 
example:
+
+```diff
+pub async fn copy<R>(&mut self, size: u64, read_from: R) -> Result<u64>
+where
+    R: futures::AsyncRead + Send + Sync + Unpin + 'static,
+{
+    if let State::Idle(Some(w)) = &mut self.state {
+        let r = Box::new(oio::into_streamable_read(
+            oio::into_read_from_file(read_from, 0, size),
+            64 * 1024,
+        ));
+-       w.copy_from(size, r).await
++       futures::io::copy(&mut r, w).await
+    } else {
+        unreachable!(
+            "writer state invalid while copy, expect Idle, actual {}",
+            self.state
+        );
+    }
+}
+```
 
 # Reference-level explanation
 
-The method `oio::Write::copy_from` will be deprecated.
+The method `oio::Write::copy_from` will be removed.
 
 # Drawbacks
 

Reply via email to