StorageProvider

Trait StorageProvider 

Source
pub trait StorageProvider: Send + Sync {
    // Required methods
    fn save_file<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        building_id: Uuid,
        filename: &'life1 str,
        content: &'life2 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn read_file<'life0, 'life1, 'async_trait>(
        &'life0 self,
        relative_path: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_file<'life0, 'life1, 'async_trait>(
        &'life0 self,
        relative_path: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn file_exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        relative_path: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Abstraction over the document storage backend.

Required Methods§

Source

fn save_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, building_id: Uuid, filename: &'life1 str, content: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Persist a file and return the relative path that can later be used to read/delete it.

Source

fn read_file<'life0, 'life1, 'async_trait>( &'life0 self, relative_path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve the raw bytes and return them as a vector.

Source

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

Delete a file if it exists.

Source

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

Check if a file exists in the storage backend.

Implementors§