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
ConstructorsConstructorDescriptionMultipartStore(boolean retainFilesOnExit, ObjectStore objectStore, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
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, MultipartUploadInfo uploadInfo, String location) 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.createMultipartUpload(BucketMetadata bucket, String key, UUID id, String contentType, Map<String, String> storeHeaders, Owner owner, Owner initiator, Map<String, String> userMetadata, Map<String, String> encryptionHeaders, StorageClass storageClass, String checksum, ChecksumAlgorithm checksumAlgorithm) Prepares everything to store an object uploaded as multipart upload.getMultipartUpload(BucketMetadata bucketMetadata, String uploadId) Get MultipartUpload, if it was not completed.getMultipartUploadInfo(BucketMetadata bucketMetadata, String uploadId) getMultipartUploadParts(BucketMetadata bucket, UUID id, String uploadId) Get all multipart upload parts.listMultipartUploads(BucketMetadata bucketMetadata, String prefix) Lists all not-yet completed parts of multipart uploads in a bucket.putPart(BucketMetadata bucket, UUID id, String uploadId, String partNumber, Path path, Map<String, String> encryptionHeaders) Uploads a part of a multipart upload.
-
Constructor Details
-
MultipartStore
public MultipartStore(boolean retainFilesOnExit, ObjectStore objectStore, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
createMultipartUpload
public MultipartUpload createMultipartUpload(BucketMetadata bucket, String key, UUID id, String contentType, Map<String, String> storeHeaders, Owner owner, Owner initiator, Map<String, String> userMetadata, Map<String, String> encryptionHeaders, StorageClass storageClass, String checksum, ChecksumAlgorithm checksumAlgorithm) 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 storeowner- 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:
bucketMetadata- the bucket to use as a filterprefix- the prefix use as a filter- Returns:
- the list of not-yet completed multipart uploads.
-
getMultipartUploadInfo
-
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, Path path, 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 storepath- file data to be stored- Returns:
- the md5 digest of this part
-
completeMultipartUpload
public CompleteMultipartUploadResult completeMultipartUpload(BucketMetadata bucket, String key, UUID id, String uploadId, List<CompletedPart> parts, Map<String, String> encryptionHeaders, MultipartUploadInfo uploadInfo, String location) 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.
-