Skip to main content

FileStore

Trait FileStore 

Source
pub trait FileStore: Send + Sync {
    // Required methods
    fn upload<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        source: &'life1 FileSource,
        key: &'life2 str,
        options: UploadOptions,
    ) -> Pin<Box<dyn Future<Output = AppResult<StoredFile>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn download<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = AppResult<FileSource>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = AppResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn head<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = AppResult<StoredFile>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list<'life0, 'life1, 'async_trait>(
        &'life0 self,
        prefix: &'life1 str,
        limit: Option<usize>,
    ) -> Pin<Box<dyn Future<Output = AppResult<Vec<StoredFile>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn presigned_url<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        expires_in: Duration,
    ) -> Pin<Box<dyn Future<Output = AppResult<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn copy<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        from_key: &'life1 str,
        to_key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = AppResult<StoredFile>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn rename<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        from_key: &'life1 str,
        to_key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = AppResult<StoredFile>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Trait for file storage backends.

Required Methods§

Source

fn upload<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source: &'life1 FileSource, key: &'life2 str, options: UploadOptions, ) -> Pin<Box<dyn Future<Output = AppResult<StoredFile>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Upload a file to the store.

options carries the content type, user metadata, and an optional progress callback; use UploadOptions::new for store defaults.

Source

fn download<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = AppResult<FileSource>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Download a file from the store.

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a file from the store.

Source

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = AppResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a file exists in the store.

Source

fn head<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = AppResult<StoredFile>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get metadata about a stored file without downloading it.

Source

fn list<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 str, limit: Option<usize>, ) -> Pin<Box<dyn Future<Output = AppResult<Vec<StoredFile>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List files with a given prefix.

Source

fn presigned_url<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, expires_in: Duration, ) -> Pin<Box<dyn Future<Output = AppResult<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate a presigned URL for temporary access.

Source

fn copy<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from_key: &'life1 str, to_key: &'life2 str, ) -> Pin<Box<dyn Future<Output = AppResult<StoredFile>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Copy a file within the store.

Source

fn rename<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from_key: &'life1 str, to_key: &'life2 str, ) -> Pin<Box<dyn Future<Output = AppResult<StoredFile>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Rename (move) a file within the store.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§