JCLOUDS-1494: Add S3 Deep Archive tier

Also test Glacier tier now that Amazon allows creating objects with
this storage class.
This commit is contained in:
Andrew Gaul 2019-04-06 18:42:03 +09:00
parent 1588ef7f7e
commit 65dd5e3204
3 changed files with 3 additions and 9 deletions

View File

@ -266,8 +266,6 @@ public class S3BlobStore extends BaseBlobStore {
if (overrides.getBlobAccess() == BlobAccess.PUBLIC_READ) { if (overrides.getBlobAccess() == BlobAccess.PUBLIC_READ) {
options = options.withAcl(CannedAccessPolicy.PUBLIC_READ); options = options.withAcl(CannedAccessPolicy.PUBLIC_READ);
} }
// TODO: S3 does not allow putObject if Tier.ARCHIVE. Instead, copyBlob
// after putBlob when the former supports tiers.
return sync.putObject(container, blob2Object.apply(blob), options); return sync.putObject(container, blob2Object.apply(blob), options);
} }

View File

@ -38,7 +38,8 @@ public interface ObjectMetadata extends Comparable<ObjectMetadata> {
STANDARD_IA(Tier.INFREQUENT), STANDARD_IA(Tier.INFREQUENT),
ONEZONE_IA(Tier.INFREQUENT), ONEZONE_IA(Tier.INFREQUENT),
REDUCED_REDUNDANCY(Tier.STANDARD), REDUCED_REDUNDANCY(Tier.STANDARD),
GLACIER(Tier.ARCHIVE); GLACIER(Tier.ARCHIVE),
DEEP_ARCHIVE(Tier.ARCHIVE);
private final Tier tier; private final Tier tier;
@ -50,7 +51,7 @@ public interface ObjectMetadata extends Comparable<ObjectMetadata> {
switch (tier) { switch (tier) {
case STANDARD: return StorageClass.STANDARD; case STANDARD: return StorageClass.STANDARD;
case INFREQUENT: return StorageClass.STANDARD_IA; case INFREQUENT: return StorageClass.STANDARD_IA;
case ARCHIVE: return StorageClass.GLACIER; case ARCHIVE: return StorageClass.DEEP_ARCHIVE;
} }
throw new IllegalArgumentException("invalid tier: " + tier); throw new IllegalArgumentException("invalid tier: " + tier);
} }

View File

@ -67,11 +67,6 @@ public class AWSS3ClientLiveTest extends S3ClientLiveTest {
AWSS3Client s3Client = getApi(); AWSS3Client s3Client = getApi();
try { try {
for (StorageClass storageClass : StorageClass.values()) { for (StorageClass storageClass : StorageClass.values()) {
if (storageClass == StorageClass.GLACIER) {
// AWS does not allow creation of Glacier objects
continue;
}
String blobName = "test-" + storageClass; String blobName = "test-" + storageClass;
BlobStore blobStore = view.getBlobStore(); BlobStore blobStore = view.getBlobStore();
blobStore.createContainerInLocation(null, containerName); blobStore.createContainerInLocation(null, containerName);