[−][src]Trait libunftp::storage::StorageBackend
The StorageBackend
trait defines a common interface to different storage backends for our FTP
Server
, e.g. for a Filesystem
or Google Cloud Storage.
Associated Types
type File: AsyncRead + Sync + Send + Unpin
The concrete type of the FTP File returned by this storage backend.
type Metadata: Metadata + Sync + Send
The concrete type of the metadata used by this storage backend.
Required methods
#[must_use]fn metadata<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<Self::Metadata>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<Self::Metadata>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Returns the Metadata
for the given file.
#[must_use]fn list<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<Vec<Fileinfo<PathBuf, Self::Metadata>>>> + Send + 'async_trait>> where
Self::Metadata: Metadata,
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<Vec<Fileinfo<PathBuf, Self::Metadata>>>> + Send + 'async_trait>> where
Self::Metadata: Metadata,
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Returns the list of files in the given directory.
#[must_use]fn get<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
user: &'life1 Option<U>,
path: P,
start_pos: u64
) -> Pin<Box<dyn Future<Output = Result<Self::File>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
user: &'life1 Option<U>,
path: P,
start_pos: u64
) -> Pin<Box<dyn Future<Output = Result<Self::File>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Returns the content of the given file from offset start_pos. The starting position can only be greater than zero if the storage back-end implementation advertises to support partial reads through the supported_features method i.e. the result from supported_features yield 1 if a logical and operation is applied with FEATURE_RESTART.
#[must_use]fn put<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send, R: AsyncRead + Send + Sync + Unpin + 'static>(
&'life0 self,
user: &'life1 Option<U>,
input: R,
path: P,
start_pos: u64
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
P: 'async_trait,
R: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
user: &'life1 Option<U>,
input: R,
path: P,
start_pos: u64
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
P: 'async_trait,
R: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Writes bytes from the given reader to the specified path starting at offset start_pos in the file
#[must_use]fn del<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Deletes the file at the given path.
#[must_use]fn mkd<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Creates the given directory.
#[must_use]fn rename<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
user: &'life1 Option<U>,
from: P,
to: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
user: &'life1 Option<U>,
from: P,
to: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Renames the given file to the given new filename.
#[must_use]fn rmd<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Deletes the given directory.
#[must_use]fn cwd<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Changes the working directory to the given path.
Provided methods
fn supported_features(&self) -> u32
Tells which optional features are supported by the storage back-end Return a value with bits set according to the FEATURE_* constants.
#[must_use]fn list_fmt<'life0, 'life1, 'async_trait, P>(
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<Cursor<Vec<u8>>, Error>> + Send + 'async_trait>> where
P: AsRef<Path> + Send,
Self::Metadata: Metadata + 'static,
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<Cursor<Vec<u8>>, Error>> + Send + 'async_trait>> where
P: AsRef<Path> + Send,
Self::Metadata: Metadata + 'static,
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Returns some bytes that make up a directory listing that can immediately be sent to the client.
#[must_use]fn nlst<'life0, 'life1, 'async_trait, P>(
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<Cursor<Vec<u8>>, Error>> + Send + 'async_trait>> where
P: AsRef<Path> + Send,
Self::Metadata: Metadata + 'static,
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
&'life0 self,
user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<Cursor<Vec<u8>>, Error>> + Send + 'async_trait>> where
P: AsRef<Path> + Send,
Self::Metadata: Metadata + 'static,
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Returns some bytes that make up a NLST directory listing (only the basename) that can immediately be sent to the client.
Implementors
impl<U: Send + Sync> StorageBackend<U> for Filesystem
[src]
type File = File
type Metadata = Metadata
fn supported_features(&self) -> u32
[src]
fn metadata<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
_user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<Self::Metadata>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
_user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<Self::Metadata>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn list<'life0, 'life1, 'async_trait, P>(
&'life0 self,
_user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<Vec<Fileinfo<PathBuf, Self::Metadata>>>> + Send + 'async_trait>> where
P: AsRef<Path> + Send,
Self::Metadata: Metadata,
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
_user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<Vec<Fileinfo<PathBuf, Self::Metadata>>>> + Send + 'async_trait>> where
P: AsRef<Path> + Send,
Self::Metadata: Metadata,
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
_user: &'life1 Option<U>,
path: P,
start_pos: u64
) -> Pin<Box<dyn Future<Output = Result<Self::File>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
_user: &'life1 Option<U>,
path: P,
start_pos: u64
) -> Pin<Box<dyn Future<Output = Result<Self::File>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn put<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send, R: AsyncRead + Send + Sync + 'static + Unpin>(
&'life0 self,
_user: &'life1 Option<U>,
bytes: R,
path: P,
start_pos: u64
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
P: 'async_trait,
R: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
_user: &'life1 Option<U>,
bytes: R,
path: P,
start_pos: u64
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
P: 'async_trait,
R: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn del<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
_user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
_user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn rmd<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
_user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
_user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn mkd<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
_user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
_user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn rename<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
_user: &'life1 Option<U>,
from: P,
to: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
_user: &'life1 Option<U>,
from: P,
to: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn cwd<'life0, 'life1, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
_user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
_user: &'life1 Option<U>,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,