pub struct GenericStorage { /* private fields */ }Expand description
Generic S3-compatible storage backend
Implementations§
Source§impl GenericStorage
impl GenericStorage
Sourcepub fn new(
endpoint: Url,
credentials: Credentials,
bucket: String,
) -> Result<Self>
pub fn new( endpoint: Url, credentials: Credentials, bucket: String, ) -> Result<Self>
Create a new generic S3-compatible storage backend
§Errors
Returns an error if configuration is invalid
Sourcepub async fn create_bucket(&self) -> Result<()>
pub async fn create_bucket(&self) -> Result<()>
Sourcepub async fn delete_bucket(&self) -> Result<()>
pub async fn delete_bucket(&self) -> Result<()>
Trait Implementations§
Source§impl CloudStorage for GenericStorage
impl CloudStorage for GenericStorage
Source§fn upload<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
data: Bytes,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn upload<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
data: Bytes,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Upload data to the storage
Source§fn upload_with_options<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
data: Bytes,
options: UploadOptions,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn upload_with_options<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
data: Bytes,
options: UploadOptions,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Upload with options
Source§fn download<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn download<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Download data from storage
Source§fn download_range<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
start: u64,
end: u64,
) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn download_range<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
start: u64,
end: u64,
) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Download a byte range
Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ObjectInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ObjectInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List objects with a prefix
Source§fn list_paginated<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
continuation_token: Option<String>,
max_keys: usize,
) -> Pin<Box<dyn Future<Output = Result<ListResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_paginated<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
continuation_token: Option<String>,
max_keys: usize,
) -> Pin<Box<dyn Future<Output = Result<ListResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List objects with pagination
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> 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,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete an object
Source§fn delete_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
keys: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<DeleteResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
keys: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<DeleteResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete multiple objects
Source§fn get_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ObjectMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ObjectMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get object metadata
Source§fn update_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
_metadata: HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
_metadata: HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update object metadata
Source§fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if object exists
Source§fn copy<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source_key: &'life1 str,
dest_key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn copy<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source_key: &'life1 str,
dest_key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Copy object
Source§fn presigned_download_url<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
expires_in_secs: u64,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn presigned_download_url<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
expires_in_secs: u64,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate a presigned URL for download
Source§fn presigned_upload_url<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
expires_in_secs: u64,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn presigned_upload_url<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
expires_in_secs: u64,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate a presigned URL for upload
Auto Trait Implementations§
impl Freeze for GenericStorage
impl !RefUnwindSafe for GenericStorage
impl Send for GenericStorage
impl Sync for GenericStorage
impl Unpin for GenericStorage
impl UnsafeUnpin for GenericStorage
impl !UnwindSafe for GenericStorage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.