Infrequent Access

最近更新时间:2020-04-03 09:52:31

Infrequent Access


Interface Description

KS3 standard infrequent access is used to store infrequently accessed data which also requires fast access when needed.

Users can specify the storage class through the HTTP header during the file upload process. Correspondingly, we will indicate the storage class of the file through the HTTP response header during the file download process.

In addition, the storage class information of the file is returned when the user enumerates the file.

Upload Interface

Put Object (Upload Files)

During user upload, you can specify the storage class by setting the x-kss-storage-class header. Valid values are: STANDARD or STANDARD_IA. KS3 rejects this request for an invalid storage class.

Request Syntax:

PUT /{ObjectKey} HTTP/1.1
Host: {BucketName}.{endpoint}
Date: {date}
Authorization: {SignatureValue}
x-kss-storage-class: {StorageClass}

Attention:

SDK Sample Code:

PutObjectRequest request = new PutObjectRequest(bucketName, key, file);
request.setStorageClass(StorageClass.StandardInfrequentAccess);
PutObjectResult result = client.putObject(request); // Assume it has been properly initialized Ks3Client

Post Object (Upload Files)

Users can specify the storage class by setting the x-kss-storage-class field in the form field. Valid values are: STANDARD or STANDARD_IA. KS3 rejects this request for an invalid storage class.

The Java SDK does not support POST file upload.

Initiate Multipart Upload (Initialize Block Upload)

The user can set the storage class of the file through the x-kss-storage-class request header when initializing block upload. Valid values are: STANDARD or STANDARD_IA. KS3 rejects this request for an invalid storage class.

Request Syntax:

POST /{ObjectKey}?uploads HTTP/1.1
Host: {BucketName}.{endpoint}
Date: {date}
Authorization: {SignatureValue}
x-kss-storage-class: {StorageClass}

Attention:

SDK Sample Code:

InitiateMultipartUploadRequest request = new InitiateMultipartUploadRequest(bucketName, key);
request.setStorageClass(StorageClass.StandardInfrequentAccess);
InitiateMultipartUploadResult result = client.initiateMultipartUpload(request); // Assume it has been properly initialized Ks3Client

All subsequent block upload operations (Upload Part、Complete、Abort) will no longer accept the x-kss-storage-class request header.

Put Object Copy (Copy File)

KS3 does not currently support reassigning storage classes for replicated files. The storage class of the destination file must be the same as the storage class of the source file. If the copied source file is standard infrequent access storage, the x-kss-storage-class request header must be set, and its value must be STANDARD_IA. If the storage class of the source file is inconsistent with the storage class of the destination file, an error will be reported. Prompt InvalidStorageClass.

Upload Part Copy (Replication Block)

For replication chunking, KS3 does not currently support reassigning storage classes. The storage class of the destination file must be the same as the storage class of the source file. For replication chunking, KS3 ignores the x-kss-storage-class request header. If the storage class of the source file is inconsistent with the storage class of the destination file, an error will be reported. Prompt InvalidStorageClass.

Download Interface

Get Object (Download File)

GetObjectRequest request = new GetObjectRequest(bucketName, key);
GetObjectResult result = client.getObject(request);
Ks3Object object = result.getObject();
object.getObjectContent();

Head Object (View File Meta Information)

In the Java SDK, you can view the storage class by obtaining the meta information. The example code is as follows:

HeadObjectRequest request = new HeadObjectRequest(bucketName, key);
HeadObjectResult result =client.headObject(request);
String storageClass = result.getObjectMetadata().getStorageClass();

For standard storage files,getStorageClass returns null
For standard infrequent access storage files,getStorageClass returns STANDARD_IA
For archive storage files,getStorageClass returns ARCHIVE

Enumeration Interface

Get Bucket (Enumerate All Files under Bucket)

When a user obtains a file under a bucket, KS3 returns its storage class for each file.

SDK Sample Code:

ListObjectsRequest request = new ListObjectsRequest(bucketName);
ObjectListing listing = client.listObjects(request);
for (Ks3ObjectSummary summary : listing.getObjectSummaries()) {
    String storageClas = summary.getStorageClass();
}

For standard storage files,getStorageClass returns STANDARD
For standard infrequent access storage files,getStorageClass returns STANDARD_IA
For archive storage files,getStorageClass returns ARCHIVE.

List Multipart Uploads (View Block Upload under Bucket)

When users view all the block upload requests under the current bucket, KS3 will return its storage class for each block upload

SDK Sample Code:

ListMultipartUploadsRequest request = new ListMultipartUploadsRequest(bucketName);
ListMultipartUploadsResult result = client.listMultipartUploads(request);
for (MultiPartUploadInfo uploadInfo : result.getUploads()) {
    String storageClass = uploadInfo.getStorageClass();
}

For standard storage files,getStorageClass returns STANDARD
For standard infrequent access storage files,getStorageClass returns STANDARD_IA
For archive storage files,getStorageClass returns ARCHIVE.

List Parts (View Uploaded Blocks)

When the user lists the uploaded blocks of a block upload, KS3 will return the storage class of the current block upload.

SDK Sample Code:

ListPartsRequest reqest = new ListPartsRequest(bucketName, key, result.getUploadId());
ListPartsResult result = client.listParts(reqest);
String storageClass = result.getStorageClass();

For standard storage files,getStorageClass returns STANDARD
For standard infrequent access storage files,getStorageClass returns STANDARD_IA
For archive storage files,getStorageClass returns ARCHIVE.

金山云,开启您的云计算之旅

注册有礼