pub trait FileStorage: Send + Sync {
// Required methods
fn store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
content: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<StoredFileId>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn retrieve<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 StoredFileId,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 StoredFileId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 StoredFileId,
) -> Pin<Box<dyn Future<Output = Result<StoredFileMetadata>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 StoredFileId,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn public_url(&self, _id: &StoredFileId) -> Option<String> { ... }
}Expand description
Trait for file storage operations
Implementations of this trait handle the actual storage and retrieval of file contents, whether that’s local filesystem, cloud storage, etc.
Required Methods§
Sourcefn store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
content: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<StoredFileId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
content: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<StoredFileId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store a file at the given path with the provided content
Sourcefn retrieve<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 StoredFileId,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn retrieve<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 StoredFileId,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve the contents of a file by its ID
Sourcefn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 StoredFileId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 StoredFileId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a file by its ID
Sourcefn metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 StoredFileId,
) -> Pin<Box<dyn Future<Output = Result<StoredFileMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 StoredFileId,
) -> Pin<Box<dyn Future<Output = Result<StoredFileMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get metadata for a file by its ID
Provided Methods§
Sourcefn public_url(&self, _id: &StoredFileId) -> Option<String>
fn public_url(&self, _id: &StoredFileId) -> Option<String>
Get the public URL for a file (if applicable)