变更文件存储等级
更新时间:2024-04-09
变更文件存储等级
上文中已提到,BOS支持为文件赋予STANDARD(标准存储), STANDARD_IA(低频存储)和COLD(冷存储)三种存储类型。同时,BOS C SDK也支持用户对特定文件执行存储类型变更的操作。 涉及到的参数如下:
参数 | 说明 |
---|---|
x-bce-storage-class | 指定Object的存储类型,STANDARD_IA代表低频存储,COLD代表冷存储,不指定时默认是标准存储类型。 |
示例如下:
bos_str_set(&object, TEST_OBJECT_NAME1);
bos_copy_object_params_t *params = NULL;
params = bos_create_copy_object_params(p);
bos_table_t *headers = bos_table_make(p, 2);
apr_table_add(headers, "x-bce-metadata-directive", "replace");
//apr_table_add(headers, "x-bce-storage-class", "ARCHIVE");
apr_table_add(headers, "x-bce-storage-class", "STANDARD_IA");
s = bos_copy_object(options, &bucket, &object, &bucket, &object, headers, &root, &resp_headers);
if (bos_status_is_ok(s)) {
printf("put object copy succeeded\n");
} else {
printf("put object copy failed\n");
}