pub trait ObjectStorage: Send + Sync {
// Required methods
fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
body: Bytes,
content_type: &'life2 str,
) -> Pin<Box<dyn Future<Output = BucketResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = BucketResult<Bytes>> + 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 = BucketResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn head<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = BucketResult<ObjectMeta>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn presigned_get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = BucketResult<Url>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn presigned_put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
ttl: Duration,
content_type: &'life2 str,
) -> Pin<Box<dyn Future<Output = BucketResult<Url>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn public_url(&self, key: &str) -> Option<Url>;
}Expand description
Object storage backend contract.
Beta scope is buffered reads via get; streaming Body::from_stream
variants are planned post-beta (see docs/serving.md).
Required Methods§
Sourcefn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
body: Bytes,
content_type: &'life2 str,
) -> Pin<Box<dyn Future<Output = BucketResult<()>> + 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,
body: Bytes,
content_type: &'life2 str,
) -> Pin<Box<dyn Future<Output = BucketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Upload an object under key with the given content type.
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = BucketResult<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 = BucketResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Download the full object body (buffered).
Sourcefn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = BucketResult<()>> + 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 = BucketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove the object. Idempotent: absent keys return Ok(()).
Sourcefn head<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = BucketResult<ObjectMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn head<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = BucketResult<ObjectMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stat the object without fetching the body.
Sourcefn presigned_get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = BucketResult<Url>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn presigned_get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = BucketResult<Url>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Short-lived signed URL for direct GET.
Used by mode-B redirect serving and by mode-C direct clients.
Sourcefn presigned_put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
ttl: Duration,
content_type: &'life2 str,
) -> Pin<Box<dyn Future<Output = BucketResult<Url>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn presigned_put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
ttl: Duration,
content_type: &'life2 str,
) -> Pin<Box<dyn Future<Output = BucketResult<Url>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Short-lived signed URL for direct PUT (browser direct-upload flow).
Sourcefn public_url(&self, key: &str) -> Option<Url>
fn public_url(&self, key: &str) -> Option<Url>
Public URL for keys that map to the configured public bucket / prefix,
or None when the backend has no public side or the key doesn’t qualify.
Consumed by mode-A fast-path callers that want to bypass the service hop.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".