pub trait MultipartUploadBackend:
Backend
+ Debug
+ Send
+ Sync
+ 'static {
// Required methods
fn initiate_multipart<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
metadata: &'life2 Metadata,
) -> Pin<Box<dyn Future<Output = Result<InitiateMultipartResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn upload_part<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
upload_id: &'life2 UploadId,
part_number: PartNumber,
content_length: u64,
content_md5: Option<&'life3 str>,
body: ClientStream,
) -> Pin<Box<dyn Future<Output = Result<UploadPartResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn list_parts<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
upload_id: &'life2 UploadId,
max_parts: Option<u32>,
part_number_marker: Option<PartNumber>,
) -> Pin<Box<dyn Future<Output = Result<ListPartsResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn abort_multipart<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
upload_id: &'life2 UploadId,
) -> Pin<Box<dyn Future<Output = Result<AbortMultipartResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn complete_multipart<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
upload_id: &'life2 UploadId,
parts: Vec<CompletedPart>,
) -> Pin<Box<dyn Future<Output = Result<CompleteMultipartResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Trait for backends that support our S3-style multipart upload protocol.
Required Methods§
Sourcefn initiate_multipart<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
metadata: &'life2 Metadata,
) -> Pin<Box<dyn Future<Output = Result<InitiateMultipartResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn initiate_multipart<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
metadata: &'life2 Metadata,
) -> Pin<Box<dyn Future<Output = Result<InitiateMultipartResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Initiates a new multipart upload at id with the given metadata.
Sourcefn upload_part<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
upload_id: &'life2 UploadId,
part_number: PartNumber,
content_length: u64,
content_md5: Option<&'life3 str>,
body: ClientStream,
) -> Pin<Box<dyn Future<Output = Result<UploadPartResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn upload_part<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
upload_id: &'life2 UploadId,
part_number: PartNumber,
content_length: u64,
content_md5: Option<&'life3 str>,
body: ClientStream,
) -> Pin<Box<dyn Future<Output = Result<UploadPartResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Uploads a single part of the upload identified by (id, upload_id).
Sourcefn list_parts<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
upload_id: &'life2 UploadId,
max_parts: Option<u32>,
part_number_marker: Option<PartNumber>,
) -> Pin<Box<dyn Future<Output = Result<ListPartsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn list_parts<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
upload_id: &'life2 UploadId,
max_parts: Option<u32>,
part_number_marker: Option<PartNumber>,
) -> Pin<Box<dyn Future<Output = Result<ListPartsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Lists the parts uploaded so far for (id, upload_id).
Sourcefn abort_multipart<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
upload_id: &'life2 UploadId,
) -> Pin<Box<dyn Future<Output = Result<AbortMultipartResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn abort_multipart<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
upload_id: &'life2 UploadId,
) -> Pin<Box<dyn Future<Output = Result<AbortMultipartResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Aborts the upload identified by (id, upload_id).
Sourcefn complete_multipart<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
upload_id: &'life2 UploadId,
parts: Vec<CompletedPart>,
) -> Pin<Box<dyn Future<Output = Result<CompleteMultipartResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn complete_multipart<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
upload_id: &'life2 UploadId,
parts: Vec<CompletedPart>,
) -> Pin<Box<dyn Future<Output = Result<CompleteMultipartResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Finalizes the upload identified by (id, upload_id) with the given
ordered list of parts.
Note that this returns Result<Option<CompleteMultipartError>>.
It’s therefore possible to get Ok(Some(err)), meaning that at the server level this will
translate to HTTP 200 OK with an error contained in the response body.
We need to do it this way to mirror backends that also behave like this (namely S3 and
GCS).
Implementors§
impl MultipartUploadBackend for GcsBackend
XXX: Any change that affects this implementation should be manually tested against real GCS. That’s because the fork of storage-testbench that we test against has an incomplete implementation of the XML multipart API that likely doesn’t match GCS’s behavior in many cases.