Skip to main content

StorageProvider

Trait StorageProvider 

Source
pub trait StorageProvider: Send + Sync {
    // Required methods
    fn upload<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        path: &'life1 str,
        data: Vec<u8>,
        content_type: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn presign_url<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 str,
        expires_secs: u64,
    ) -> Pin<Box<dyn Future<Output = Result<PresignResult, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn upload<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, data: Vec<u8>, content_type: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Upload data to path in the configured bucket. Returns the stored path.

Source

fn presign_url<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, expires_secs: u64, ) -> Pin<Box<dyn Future<Output = Result<PresignResult, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate a presigned GET URL for path valid for expires_secs seconds.

Source

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

Delete the object at path.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§