pub trait StorageService: Send + Sync {
Show 21 methods
// Required methods
fn upload_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
data: Bytes,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn upload_reader<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
reader: Box<dyn AsyncRead + Send + Unpin>,
size: Option<u64>,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn upload_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
local_path: &'life2 str,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn download_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn download_writer<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
writer: Box<dyn AsyncWrite + Send + Unpin>,
options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn download_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
local_path: &'life2 str,
options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn stream_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
range: Option<ByteRange>,
) -> Pin<Box<dyn Future<Output = StorageResult<Box<dyn Stream<Item = StorageResult<Bytes>> + Send + Unpin>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn file_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn copy_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from_path: &'life1 str,
to_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn move_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from_path: &'life1 str,
to_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn list_files<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
limit: Option<u32>,
continuation_token: Option<String>,
) -> Pin<Box<dyn Future<Output = StorageResult<FileListResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn generate_presigned_url<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
options: PresignedUrlOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_file_url<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
expiry_seconds: Option<u64>,
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn update_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
metadata: HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageStats>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn test_connection<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn backend_type(&self) -> StorageBackend;
fn bucket(&self) -> &str;
fn config(&self) -> &StorageConfig;
}Expand description
Generic storage service trait
Required Methods§
Sourcefn upload_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
data: Bytes,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn upload_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
data: Bytes,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Upload a file from bytes
Sourcefn upload_reader<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
reader: Box<dyn AsyncRead + Send + Unpin>,
size: Option<u64>,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn upload_reader<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
reader: Box<dyn AsyncRead + Send + Unpin>,
size: Option<u64>,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Upload a file from a reader
Sourcefn upload_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
local_path: &'life2 str,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn upload_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
local_path: &'life2 str,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Upload a file from local path
Sourcefn download_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn download_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Download a file to bytes
Sourcefn download_writer<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
writer: Box<dyn AsyncWrite + Send + Unpin>,
options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn download_writer<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
writer: Box<dyn AsyncWrite + Send + Unpin>,
options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Download a file to a writer
Sourcefn download_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
local_path: &'life2 str,
options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn download_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
local_path: &'life2 str,
options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Download a file to local path
Sourcefn stream_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
range: Option<ByteRange>,
) -> Pin<Box<dyn Future<Output = StorageResult<Box<dyn Stream<Item = StorageResult<Bytes>> + Send + Unpin>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stream_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
range: Option<ByteRange>,
) -> Pin<Box<dyn Future<Output = StorageResult<Box<dyn Stream<Item = StorageResult<Bytes>> + Send + Unpin>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stream a file (useful for large files)
Sourcefn get_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get file metadata
Sourcefn file_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn file_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if file exists
Sourcefn delete_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a file
Sourcefn copy_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from_path: &'life1 str,
to_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn copy_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from_path: &'life1 str,
to_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Copy a file
Sourcefn move_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from_path: &'life1 str,
to_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn move_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from_path: &'life1 str,
to_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Move a file
Sourcefn list_files<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
limit: Option<u32>,
continuation_token: Option<String>,
) -> Pin<Box<dyn Future<Output = StorageResult<FileListResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_files<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
limit: Option<u32>,
continuation_token: Option<String>,
) -> Pin<Box<dyn Future<Output = StorageResult<FileListResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List files in a directory/prefix
Sourcefn generate_presigned_url<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
options: PresignedUrlOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate_presigned_url<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
options: PresignedUrlOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate presigned URL for file operations
Sourcefn get_file_url<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
expiry_seconds: Option<u64>,
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_file_url<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
expiry_seconds: Option<u64>,
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get file URL (public access or presigned)
Sourcefn update_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
metadata: HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
metadata: HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update file metadata
Sourcefn get_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get storage statistics
Sourcefn test_connection<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn test_connection<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Test storage connection
Sourcefn backend_type(&self) -> StorageBackend
fn backend_type(&self) -> StorageBackend
Get storage backend type
Sourcefn config(&self) -> &StorageConfig
fn config(&self) -> &StorageConfig
Get configuration
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".