pub trait Attachments: Send + Sync {
// Required methods
fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
field: &'life3 str,
file: UploadedFile,
) -> Pin<Box<dyn Future<Output = Result<Attachment, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn get<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
field: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Attachment>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn list<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Attachment>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
storage_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
field: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn delete_all<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
A pluggable attachment backend: stores the bytes somewhere and records the metadata so it can be listed and served back.
Required Methods§
Sourcefn put<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
field: &'life3 str,
file: UploadedFile,
) -> Pin<Box<dyn Future<Output = Result<Attachment, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
field: &'life3 str,
file: UploadedFile,
) -> Pin<Box<dyn Future<Output = Result<Attachment, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Store (or replace) the file attached to owner_type/owner_id under
field, returning the stored metadata.
Sourcefn get<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
field: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Attachment>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
field: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Attachment>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
The attachment stored under a single field, if any.
Sourcefn list<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Attachment>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn list<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Attachment>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Every attachment for a record, across all fields.
Sourcefn read<'life0, 'life1, 'async_trait>(
&'life0 self,
storage_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
storage_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch the raw bytes for a stored attachment.
Sourcefn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
field: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
field: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Remove one field’s attachment (bytes and metadata). A no-op if absent.
Sourcefn delete_all<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_all<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner_type: &'life1 str,
owner_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove all attachments for a record. Called when the record itself is deleted, so blobs don’t outlive their owner.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".