pub struct SftpOptions { /* private fields */ }
Expand description
Options when creating super::Sftp
.
Implementations§
Source§impl SftpOptions
impl SftpOptions
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a new SftpOptions
.
Sourcepub const fn flush_interval(self, flush_interval: Duration) -> Self
pub const fn flush_interval(self, flush_interval: Duration) -> Self
Set flush_interval
, default value is 0.5 ms.
flush_interval
decides the maximum time your requests would stay
in the write buffer before it is actually sent to the remote.
If another thread is doing flushing, then the internal flush_task
super::Sftp
started would wait for another flush_interval
.
Setting it to be larger might improve overall performance by grouping
writes and reducing the overhead of packet sent over network, but it
might also increase latency, so be careful when setting the
flush_interval
.
If flush_interval
is set to 0, then every packet
is flushed immediately.
NOTE that it is perfectly OK to set flush_interval
to 0 and
it would not slowdown the program, as flushing is only performed
on daemon.
Sourcepub const fn max_pending_requests(
self,
max_pending_requests: NonZeroU16,
) -> Self
pub const fn max_pending_requests( self, max_pending_requests: NonZeroU16, ) -> Self
Set max_pending_requests
.
If the pending_requests is larger than max_pending_requests, then the
flush task will flush the write buffer without waiting for flush_interval
.
It is set to 100 by default.
Sourcepub const fn requests_buffer_size(self, buffer_size: NonZeroUsize) -> Self
pub const fn requests_buffer_size(self, buffer_size: NonZeroUsize) -> Self
Set the init buffer size for requests.
It is used to store bytes::Bytes
and it will be resized
to fit the pending requests.
NOTE that sftp uses double buffer for efficient flushing without blocking the writers.
It is set to 100 by default.
Sourcepub const fn responses_buffer_size(self, buffer_size: NonZeroUsize) -> Self
pub const fn responses_buffer_size(self, buffer_size: NonZeroUsize) -> Self
Set the init buffer size for responses. If the header of the response is larger than the buffer, then the buffer will be resized to fit the size of the header.
It is set to 1024 by default.
Sourcepub const fn tokio_compat_file_write_limit(self, limit: NonZeroUsize) -> Self
pub const fn tokio_compat_file_write_limit(self, limit: NonZeroUsize) -> Self
Set the write buffer limit for tokio compat file.
If crate::file::TokioCompatFile
has hit the write buffer limit
set here, then it will flush one write buffer and continue
sending (part of) the buffer to the server, which could be buffered.
It is set to 640KB (640 * 1024 bytes) by default.
Trait Implementations§
Source§impl Clone for SftpOptions
impl Clone for SftpOptions
Source§fn clone(&self) -> SftpOptions
fn clone(&self) -> SftpOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SftpOptions
impl Debug for SftpOptions
Source§impl Default for SftpOptions
impl Default for SftpOptions
Source§fn default() -> SftpOptions
fn default() -> SftpOptions
impl Copy for SftpOptions
Auto Trait Implementations§
impl Freeze for SftpOptions
impl RefUnwindSafe for SftpOptions
impl Send for SftpOptions
impl Sync for SftpOptions
impl Unpin for SftpOptions
impl UnwindSafe for SftpOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)