Package com.adobe.testing.s3mock.store
Class MultipartStore
java.lang.Object
com.adobe.testing.s3mock.store.MultipartStore
Stores parts and their metadata created in S3Mock.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabortMultipartUpload(BucketMetadata bucket, UUID id, String uploadId) Aborts the upload.completeMultipartUpload(BucketMetadata bucket, String key, UUID id, String uploadId, List<CompletedPart> parts, Map<String, String> encryptionHeaders) Completes a Multipart Upload for the given ID.copyPart(BucketMetadata bucket, UUID id, org.springframework.http.HttpRange copyRange, String partNumber, BucketMetadata destinationBucket, UUID destinationId, String uploadId, Map<String, String> encryptionHeaders) Copies the range, define by from/to, from the S3 Object, identified by the given key to given destination into the given bucket.getMultipartUpload(String uploadId) Get MultipartUpload, if it was not completed.getMultipartUploadParts(BucketMetadata bucket, UUID id, String uploadId) Get all multipart upload parts.listMultipartUploads(String bucketName, String prefix) Lists all not-yet completed parts of multipart uploads in a bucket.prepareMultipartUpload(BucketMetadata bucket, String key, UUID id, String contentType, Map<String, String> storeHeaders, String uploadId, Owner owner, Owner initiator, Map<String, String> userMetadata, Map<String, String> encryptionHeaders) Prepares everything to store an object uploaded as multipart upload.putPart(BucketMetadata bucket, UUID id, String uploadId, String partNumber, InputStream inputStream, boolean useV4ChunkedWithSigningFormat, Map<String, String> encryptionHeaders) Uploads a part of a multipart upload.
-
Constructor Details
-
MultipartStore
-
-
Method Details
-
prepareMultipartUpload
public MultipartUpload prepareMultipartUpload(BucketMetadata bucket, String key, UUID id, String contentType, Map<String, String> storeHeaders, String uploadId, Owner owner, Owner initiator, Map<String, String> userMetadata, Map<String, String> encryptionHeaders) Prepares everything to store an object uploaded as multipart upload.- Parameters:
bucket- Bucket to upload object inkey- object to uploadid- ID of the objectcontentType- the content typestoreHeaders- various headers to storeuploadId- id of the uploadowner- owner of the uploadinitiator- initiator of the uploaduserMetadata- custom metadata- Returns:
- upload result
-
listMultipartUploads
Lists all not-yet completed parts of multipart uploads in a bucket.- Parameters:
bucketName- the bucket to use as a filterprefix- the prefix use as a filter- Returns:
- the list of not-yet completed multipart uploads.
-
getMultipartUpload
Get MultipartUpload, if it was not completed.- Parameters:
uploadId- id of the upload- Returns:
- the multipart upload, if it exists, throws IllegalArgumentException otherwise.
-
abortMultipartUpload
Aborts the upload.- Parameters:
bucket- to which was uploadedid- of the objectuploadId- of the upload
-
putPart
public String putPart(BucketMetadata bucket, UUID id, String uploadId, String partNumber, InputStream inputStream, boolean useV4ChunkedWithSigningFormat, Map<String, String> encryptionHeaders) Uploads a part of a multipart upload.- Parameters:
bucket- in which to uploadid- of the object to uploaduploadId- id of the uploadpartNumber- number of the part to storeinputStream- file data to be storeduseV4ChunkedWithSigningFormat- Iftrue, V4-style signing is enabled.- Returns:
- the md5 digest of this part
-
completeMultipartUpload
public String completeMultipartUpload(BucketMetadata bucket, String key, UUID id, String uploadId, List<CompletedPart> parts, Map<String, String> encryptionHeaders) Completes a Multipart Upload for the given ID.- Parameters:
bucket- in which to upload.key- of the object to upload.id- id of the objectuploadId- id of the upload.parts- to concatenate.- Returns:
- etag of the uploaded file.
-
getMultipartUploadParts
Get all multipart upload parts.- Parameters:
bucket- name of the bucketid- object IDuploadId- upload identifier- Returns:
- List of Parts
-
copyPart
public String copyPart(BucketMetadata bucket, UUID id, org.springframework.http.HttpRange copyRange, String partNumber, BucketMetadata destinationBucket, UUID destinationId, String uploadId, Map<String, String> encryptionHeaders) Copies the range, define by from/to, from the S3 Object, identified by the given key to given destination into the given bucket.- Parameters:
bucket- The source Bucket.id- Identifies the S3 Object.copyRange- Byte range to copy. Optional.partNumber- The part to copy.destinationBucket- The Bucket the target object (will) reside in.destinationId- The target object ID.uploadId- id of the upload.- Returns:
- etag of the uploaded file.
-