pub struct S3Backend {
pub bucket: String,
pub prefix: String,
pub region: Option<String>,
pub endpoint: Option<String>,
pub sse: SseConfig,
pub storage_class: S3StorageClass,
pub transfer_acceleration: bool,
pub multipart_threshold: usize,
pub multipart_chunk_size: usize,
pub timeout: Duration,
pub retry_config: RetryConfig,
pub credentials: Option<Credentials>,
}Expand description
Enhanced S3 storage backend
Fields§
§bucket: StringS3 bucket name
prefix: StringKey prefix (path within bucket)
region: Option<String>AWS region
endpoint: Option<String>Endpoint URL (for S3-compatible services)
sse: SseConfigServer-side encryption
storage_class: S3StorageClassStorage class
transfer_acceleration: boolEnable transfer acceleration
multipart_threshold: usizeMultipart upload threshold (bytes)
multipart_chunk_size: usizeMultipart chunk size (bytes)
timeout: DurationRequest timeout
retry_config: RetryConfigRetry configuration
credentials: Option<Credentials>Credentials
Implementations§
Source§impl S3Backend
impl S3Backend
Sourcepub const DEFAULT_MULTIPART_THRESHOLD: usize
pub const DEFAULT_MULTIPART_THRESHOLD: usize
Default multipart upload threshold (5 MB)
Sourcepub const DEFAULT_MULTIPART_CHUNK_SIZE: usize
pub const DEFAULT_MULTIPART_CHUNK_SIZE: usize
Default multipart chunk size (5 MB)
Sourcepub fn new(bucket: impl Into<String>, prefix: impl Into<String>) -> Self
pub fn new(bucket: impl Into<String>, prefix: impl Into<String>) -> Self
Creates a new S3 storage backend
§Arguments
bucket- The S3 bucket nameprefix- Optional key prefix (path within the bucket)
Sourcepub fn with_region(self, region: impl Into<String>) -> Self
pub fn with_region(self, region: impl Into<String>) -> Self
Sets the AWS region
Sourcepub fn with_endpoint(self, endpoint: impl Into<String>) -> Self
pub fn with_endpoint(self, endpoint: impl Into<String>) -> Self
Sets a custom endpoint URL (for S3-compatible services like MinIO)
Sourcepub fn with_storage_class(self, storage_class: S3StorageClass) -> Self
pub fn with_storage_class(self, storage_class: S3StorageClass) -> Self
Sets storage class
Sourcepub fn with_transfer_acceleration(self, enabled: bool) -> Self
pub fn with_transfer_acceleration(self, enabled: bool) -> Self
Enables transfer acceleration
Sourcepub fn with_multipart_threshold(self, threshold: usize) -> Self
pub fn with_multipart_threshold(self, threshold: usize) -> Self
Sets multipart upload threshold
Sourcepub fn with_multipart_chunk_size(self, size: usize) -> Self
pub fn with_multipart_chunk_size(self, size: usize) -> Self
Sets multipart chunk size
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sets request timeout
Sourcepub fn with_retry_config(self, config: RetryConfig) -> Self
pub fn with_retry_config(self, config: RetryConfig) -> Self
Sets retry configuration
Sourcepub fn with_credentials(self, credentials: Credentials) -> Self
pub fn with_credentials(self, credentials: Credentials) -> Self
Sets credentials
Trait Implementations§
Source§impl CloudStorageBackend for S3Backend
impl CloudStorageBackend for S3Backend
Source§fn get<'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 get<'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,
Gets an object from storage
Source§fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Puts an object to storage
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,
Deletes an object from storage
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,
Checks if an object exists
Source§fn list_prefix<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_prefix<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Lists objects with a given prefix
Source§fn is_readonly(&self) -> bool
fn is_readonly(&self) -> bool
Returns whether this backend is read-only
Auto Trait Implementations§
impl Freeze for S3Backend
impl RefUnwindSafe for S3Backend
impl Send for S3Backend
impl Sync for S3Backend
impl Unpin for S3Backend
impl UnsafeUnpin for S3Backend
impl UnwindSafe for S3Backend
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.