Struct openssh_sftp_client::SftpOptions
source · [−]pub struct SftpOptions { /* private fields */ }
Expand description
Options when creating super::Sftp
.
Implementations
sourceimpl 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.
Trait Implementations
sourceimpl Clone for SftpOptions
impl Clone for SftpOptions
sourcefn clone(&self) -> SftpOptions
fn clone(&self) -> SftpOptions
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more