This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch cleanup-sink
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
The following commit(s) were added to refs/heads/cleanup-sink by this push:
new c76a0ccf7 Fix sftp
c76a0ccf7 is described below
commit c76a0ccf7c9a05e791aaa7b5a99c2aa9634140df
Author: Xuanwo <[email protected]>
AuthorDate: Thu Aug 31 17:25:34 2023 +0800
Fix sftp
Signed-off-by: Xuanwo <[email protected]>
---
core/src/services/sftp/writer.rs | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/core/src/services/sftp/writer.rs b/core/src/services/sftp/writer.rs
index 76da70da3..6e218044c 100644
--- a/core/src/services/sftp/writer.rs
+++ b/core/src/services/sftp/writer.rs
@@ -20,6 +20,7 @@ use bytes::Bytes;
use openssh_sftp_client::file::File;
use crate::raw::oio;
+use crate::raw::oio::StreamExt;
use crate::Error;
use crate::ErrorKind;
use crate::Result;
@@ -42,11 +43,12 @@ impl oio::Write for SftpWriter {
Ok(())
}
- async fn sink(&mut self, _size: u64, _s: oio::Streamer) -> Result<()> {
- Err(Error::new(
- ErrorKind::Unsupported,
- "Write::sink is not supported",
- ))
+ async fn sink(&mut self, _size: u64, mut s: oio::Streamer) -> Result<()> {
+ while let Some(bs) = s.next().await.transpose()? {
+ self.file.write_all(&bs).await?;
+ }
+
+ Ok(())
}
async fn abort(&mut self) -> Result<()> {