From 7d0c66e08a1edd6f9540901233613bd06378bc0f Mon Sep 17 00:00:00 2001 From: Eric Vantillard Date: Mon, 22 Jun 2020 15:49:23 +0200 Subject: [PATCH] Add support for glacier storage class. Just a copy of what have been done in PR #271. --- doc/man/s3fs.1 | 2 +- src/curl.cpp | 6 ++++++ src/curl.h | 3 ++- src/s3fs.cpp | 2 ++ src/s3fs_util.cpp | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/man/s3fs.1 b/doc/man/s3fs.1 index 635f5f7..d13dbe8 100644 --- a/doc/man/s3fs.1 +++ b/doc/man/s3fs.1 @@ -83,7 +83,7 @@ delete local file cache when s3fs starts and exits. \fB\-o\fR storage_class (default="standard") store object with specified storage class. this option replaces the old option use_rrs. -Possible values: standard, standard_ia, onezone_ia, reduced_redundancy, and intelligent_tiering. +Possible values: standard, standard_ia, onezone_ia, reduced_redundancy, intelligent_tiering, and glacier. .TP \fB\-o\fR use_rrs (default is disable) use Amazon's Reduced Redundancy Storage. diff --git a/src/curl.cpp b/src/curl.cpp index f13849c..a15f414 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -3280,6 +3280,8 @@ int S3fsCurl::PutHeadRequest(const char* tpath, headers_t& meta, bool is_copy) requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-storage-class", "ONEZONE_IA"); } else if(INTELLIGENT_TIERING == GetStorageClass()) { requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-storage-class", "INTELLIGENT_TIERING"); + } else if(GLACIER == GetStorageClass()) { + requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-storage-class", "GLACIER"); } // SSE if(!is_copy){ @@ -3411,6 +3413,8 @@ int S3fsCurl::PutRequest(const char* tpath, headers_t& meta, int fd) requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-storage-class", "ONEZONE_IA"); } else if(INTELLIGENT_TIERING == GetStorageClass()) { requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-storage-class", "INTELLIGENT_TIERING"); + } else if(GLACIER == GetStorageClass()) { + requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-storage-class", "GLACIER"); } // SSE string ssevalue; @@ -3674,6 +3678,8 @@ int S3fsCurl::PreMultipartPostRequest(const char* tpath, headers_t& meta, string requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-storage-class", "ONEZONE_IA"); } else if(INTELLIGENT_TIERING == GetStorageClass()) { requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-storage-class", "INTELLIGENT_TIERING"); + } else if(GLACIER == GetStorageClass()) { + requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-storage-class", "GLACIER"); } // SSE if(!is_copy){ diff --git a/src/curl.h b/src/curl.h index 99f3859..9d9debe 100644 --- a/src/curl.h +++ b/src/curl.h @@ -202,7 +202,8 @@ enum storage_class_t { STANDARD_IA, ONEZONE_IA, REDUCED_REDUNDANCY, - INTELLIGENT_TIERING + INTELLIGENT_TIERING, + GLACIER }; enum acl_t { diff --git a/src/s3fs.cpp b/src/s3fs.cpp index af3b3b0..d2971b7 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -4626,6 +4626,8 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar S3fsCurl::SetStorageClass(REDUCED_REDUNDANCY); }else if(0 == strcmp(storage_class, "intelligent_tiering")){ S3fsCurl::SetStorageClass(INTELLIGENT_TIERING); + }else if(0 == strcmp(storage_class, "glacier")){ + S3fsCurl::SetStorageClass(GLACIER); }else{ S3FS_PRN_EXIT("unknown value for storage_class: %s", storage_class); return -1; diff --git a/src/s3fs_util.cpp b/src/s3fs_util.cpp index cdfb5e3..392032d 100644 --- a/src/s3fs_util.cpp +++ b/src/s3fs_util.cpp @@ -1153,7 +1153,7 @@ void show_help () "\n" " storage_class (default=\"standard\")\n" " - store object with specified storage class. Possible values:\n" - " standard, standard_ia, onezone_ia, reduced_redundancy and intelligent_tiering.\n" + " standard, standard_ia, onezone_ia, reduced_redundancy, intelligent_tiering and glacier.\n" "\n" " use_rrs (default is disable)\n" " - use Amazon's Reduced Redundancy Storage.\n"