NobodyXu commented on code in PR #2192:
URL: 
https://github.com/apache/incubator-opendal/pull/2192#discussion_r1185782773


##########
core/src/services/sftp/utils.rs:
##########
@@ -16,65 +16,83 @@
 // under the License.
 
 use std::io::SeekFrom;
-use std::path::PathBuf;
 use std::pin::Pin;
 use std::task::Context;
 use std::task::Poll;
 
 use async_compat::Compat;
-use bb8::PooledConnection;
-use futures::executor::block_on;
+use futures::AsyncBufRead;
+use futures::AsyncRead;
+use futures::AsyncSeek;
+use openssh_sftp_client::file::File;
 use openssh_sftp_client::file::TokioCompatFile;
 use openssh_sftp_client::metadata::MetaData as SftpMeta;
-use owning_ref::OwningHandle;
 
-use super::backend::Manager;
+use super::backend::Connection;
 use crate::raw::oio;
 use crate::raw::oio::into_reader::FdReader;
 use crate::raw::oio::ReadExt;
 use crate::EntryMode;
 use crate::Metadata;
 use crate::Result;
 
-pub struct SftpReader {
-    // similar situation to connection struct
-    // We can make sure the file can live as long as the connection.
-    file: OwningHandle<
-        Box<PooledConnection<'static, Manager>>,
-        Box<FdReader<Compat<TokioCompatFile<'static>>>>,
-    >,
+pub struct SftpReaderInner {
+    file: Pin<Box<Compat<TokioCompatFile>>>,
+    _conn: Connection,

Review Comment:
   You don't need to keep `_conn` alive, if you already use 
`Sftp::new_with_auxiliary`.
   
   The session and remote-child is stored with in an `Arc` referenced by every 
other sftp file/fs/dir created from that sftp instance.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to