Struct openssh_sftp_client::WriteEnd
source · [−]pub struct WriteEnd<Buffer, Auxiliary = ()> { /* private fields */ }
Expand description
It is recommended to create at most one WriteEnd
per thread
using WriteEnd::clone
.
Implementations
pub fn send_open_file_request(
&mut self,
id: Id<Buffer>,
params: OpenFileRequest<'_>
) -> Result<AwaitableHandle<Buffer>, Error>
pub fn send_open_file_request(
&mut self,
id: Id<Buffer>,
params: OpenFileRequest<'_>
) -> Result<AwaitableHandle<Buffer>, Error>
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_close_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_close_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>
) -> Result<AwaitableStatus<Buffer>, Error>
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
buffer
- If set toNone
or the buffer is not long enough, thencrate::Data::AllocatedBox
will be returned.
Return crate::Data::Buffer
or crate::Data::AllocatedBox
if not EOF,
otherwise returns crate::Data::Eof
.
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_remove_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_remove_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableStatus<Buffer>, Error>
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_rename_request(
&mut self,
id: Id<Buffer>,
oldpath: Cow<'_, Path>,
newpath: Cow<'_, Path>
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_rename_request(
&mut self,
id: Id<Buffer>,
oldpath: Cow<'_, Path>,
newpath: Cow<'_, Path>
) -> Result<AwaitableStatus<Buffer>, Error>
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_mkdir_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>,
attrs: FileAttrs
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_mkdir_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>,
attrs: FileAttrs
) -> Result<AwaitableStatus<Buffer>, Error>
attrs
-FileAttrs::get_size
must be equal toNone
.
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_rmdir_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_rmdir_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableStatus<Buffer>, Error>
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_opendir_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableHandle<Buffer>, Error>
pub fn send_opendir_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableHandle<Buffer>, Error>
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_readdir_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>
) -> Result<AwaitableNameEntries<Buffer>, Error>
pub fn send_readdir_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>
) -> Result<AwaitableNameEntries<Buffer>, Error>
Return all entries in the directory specified by the handle
, including
.
and ..
.
The filename
only contains the basename.
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_stat_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableAttrs<Buffer>, Error>
pub fn send_stat_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableAttrs<Buffer>, Error>
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_lstat_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableAttrs<Buffer>, Error>
pub fn send_lstat_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableAttrs<Buffer>, Error>
Does not follow symlink
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_fstat_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>
) -> Result<AwaitableAttrs<Buffer>, Error>
pub fn send_fstat_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>
) -> Result<AwaitableAttrs<Buffer>, Error>
handle
- Must be opened withFileMode::READ
.
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_setstat_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>,
attrs: FileAttrs
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_setstat_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>,
attrs: FileAttrs
) -> Result<AwaitableStatus<Buffer>, Error>
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_fsetstat_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>,
attrs: FileAttrs
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_fsetstat_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>,
attrs: FileAttrs
) -> Result<AwaitableStatus<Buffer>, Error>
handle
- Must be opened withOpenOptions::write
set.
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_readlink_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableName<Buffer>, Error>
pub fn send_readlink_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableName<Buffer>, Error>
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_realpath_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableName<Buffer>, Error>
pub fn send_realpath_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableName<Buffer>, Error>
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_symlink_request(
&mut self,
id: Id<Buffer>,
targetpath: Cow<'_, Path>,
linkpath: Cow<'_, Path>
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_symlink_request(
&mut self,
id: Id<Buffer>,
targetpath: Cow<'_, Path>,
linkpath: Cow<'_, Path>
) -> Result<AwaitableStatus<Buffer>, Error>
Create symlink
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
pub fn send_limits_request(
&mut self,
id: Id<Buffer>
) -> Result<AwaitableLimits<Buffer>, Error>
pub fn send_limits_request(
&mut self,
id: Id<Buffer>
) -> Result<AwaitableLimits<Buffer>, Error>
Return limits of the server
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
Precondition
Requires Extensions::limits
to be true.
pub fn send_expand_path_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableName<Buffer>, Error>
pub fn send_expand_path_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>
) -> Result<AwaitableName<Buffer>, Error>
This supports canonicalisation of relative paths and those that need tilde-expansion, i.e. “~”, “~/…” and “~user/…”.
These paths are expanded using shell-like rules and the resultant path
is canonicalised similarly to WriteEnd::send_realpath_request
.
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
Precondition
Requires Extensions::expand_path
to be true.
pub fn send_fsync_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_fsync_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>
) -> Result<AwaitableStatus<Buffer>, Error>
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
Precondition
Requires Extensions::fsync
to be true.
pub fn send_hardlink_request(
&mut self,
id: Id<Buffer>,
oldpath: Cow<'_, Path>,
newpath: Cow<'_, Path>
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_hardlink_request(
&mut self,
id: Id<Buffer>,
oldpath: Cow<'_, Path>,
newpath: Cow<'_, Path>
) -> Result<AwaitableStatus<Buffer>, Error>
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
Precondition
Requires Extensions::hardlink
to be true.
pub fn send_posix_rename_request(
&mut self,
id: Id<Buffer>,
oldpath: Cow<'_, Path>,
newpath: Cow<'_, Path>
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_posix_rename_request(
&mut self,
id: Id<Buffer>,
oldpath: Cow<'_, Path>,
newpath: Cow<'_, Path>
) -> Result<AwaitableStatus<Buffer>, Error>
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
Precondition
Requires Extensions::posix_rename
to be true.
Write will extend the file if writing beyond the end of the file.
It is legal to write way beyond the end of the file, the semantics are to write zeroes from the end of the file to the specified offset and then the data.
On most operating systems, such writes do not allocate disk space but instead leave “holes” in the file.
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
This function is only suitable for writing small data since it needs to copy the
entire data
into buffer.
For writing large data, it is recommended to use
WriteEnd::send_write_request_direct
.
Write will extend the file if writing beyond the end of the file.
It is legal to write way beyond the end of the file, the semantics are to write zeroes from the end of the file to the specified offset and then the data.
On most operating systems, such writes do not allocate disk space but instead leave “holes” in the file.
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
This function is only suitable for writing small data since it needs to copy the
entire data
into buffer.
For writing large data, it is recommended to use
WriteEnd::send_write_request_direct
.
Write will extend the file if writing beyond the end of the file.
It is legal to write way beyond the end of the file, the semantics are to write zeroes from the end of the file to the specified offset and then the data.
On most operating systems, such writes do not allocate disk space but instead leave “holes” in the file.
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
This function is only suitable for writing small data since it needs to copy the
entire data
into buffer.
For writing large data, it is recommended to use
WriteEnd::send_write_request_direct
.
Write will extend the file if writing beyond the end of the file.
It is legal to write way beyond the end of the file, the semantics are to write zeroes from the end of the file to the specified offset and then the data.
On most operating systems, such writes do not allocate disk space but instead leave “holes” in the file.
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
This function is zero-copy.
Write will extend the file if writing beyond the end of the file.
It is legal to write way beyond the end of the file, the semantics are to write zeroes from the end of the file to the specified offset and then the data.
On most operating systems, such writes do not allocate disk space but instead leave “holes” in the file.
NOTE that this merely add the request to the buffer, you need to call
SharedData::flush
to actually send the requests.
This function is zero-copy.
Write will extend the file if writing beyond the end of the file.
It is legal to write way beyond the end of the file, the semantics are to write zeroes from the end of the file to the specified offset and then the data.
On most operating systems, such writes do not allocate disk space but instead leave “holes” in the file.
This function sends write requests directly, without any buffering, thus it is not cancel safe.
Cancel Safety
This function is only cancel safe if the data
is no more than 1024
long.
Otherwise it is not cancel safe, dropping the future returned might cause the data to paritaly written, and thus the sftp-server might demonstrate undefined behavior.
Write will extend the file if writing beyond the end of the file.
It is legal to write way beyond the end of the file, the semantics are to write zeroes from the end of the file to the specified offset and then the data.
On most operating systems, such writes do not allocate disk space but instead leave “holes” in the file.
This function sends vectored write requests directly, without any buffering, thus it is not cancel safe.
Cancel Safety
This function is only cancel safe if the data
is no more than 1024
long.
Otherwise it is not cancel safe, dropping the future returned might cause the data to paritaly written, and thus the sftp-server might demonstrate undefined behavior.
Methods from Deref<Target = SharedData<Buffer, Auxiliary>>
SharedData
is a newtype wrapper for Arc<SharedDataInner>
,
so this function returns how many Arc
there are that referred
to the shared data.
Create a useable response id.
Return true if reserve succeeds, false otherwise.
Return true if reserve succeeds, false otherwise.
Flush the write buffer.
If another thread is flushing, then Ok(false)
will be returned.
Cancel Safety
This function is only cancel safe if WriteEnd::send_write_request_direct
or
WriteEnd::send_write_request_direct_vectored
is not called when this
future is cancelled.
Upon cancel, it might only partially flushed out the data, which can be restarted by another thread.
However, if WriteEnd::send_write_request_direct
or
WriteEnd::send_write_request_direct_vectored
is called, then the write data
will be interleaved and thus produce undefined behavior.
Flush the write buffer.
If another thread is flushing, then this function would wait until the other thread is done.
Cancel Safety
This function is only cancel safe if WriteEnd::send_write_request_direct
or
WriteEnd::send_write_request_direct_vectored
is not called when this
future is cancelled.
Upon cancel, it might only partially flushed out the data, which can be restarted by another thread.
However, if WriteEnd::send_write_request_direct
or
WriteEnd::send_write_request_direct_vectored
is called, then the write data
will be interleaved and thus produce undefined behavior.
Trait Implementations
Auto Trait Implementations
impl<Buffer, Auxiliary = ()> !RefUnwindSafe for WriteEnd<Buffer, Auxiliary>
impl<Buffer, Auxiliary> Send for WriteEnd<Buffer, Auxiliary> where
Auxiliary: Send + Sync,
Buffer: Send,
impl<Buffer, Auxiliary> Sync for WriteEnd<Buffer, Auxiliary> where
Auxiliary: Send + Sync,
Buffer: Send,
impl<Buffer, Auxiliary = ()> !UnwindSafe for WriteEnd<Buffer, Auxiliary>
Blanket Implementations
Mutably borrows from an owned value. Read more