Fixed issue #89 - Support for Reduced Redundancy with a patch from

chregu's code stream

Tested the use_rrs=1 option and confirmed that the files in the
bucket are being tagged as using RRS through Amazon's AWS cockpit



git-svn-id: http://s3fs.googlecode.com/svn/trunk@200 df820570-a93a-0410-bd06-b72b767a4274
This commit is contained in:
mooredan@suncup.net 2010-10-18 22:35:14 +00:00
parent b578777851
commit 4a04bd2764

View File

@ -351,6 +351,8 @@ static string service_path = "/";
// if .size()==0 then local file cache is disabled // if .size()==0 then local file cache is disabled
static string use_cache; static string use_cache;
static string use_rrs;
// private, public-read, public-read-write, authenticated-read // private, public-read, public-read-write, authenticated-read
static string default_acl("private"); static string default_acl("private");
@ -712,6 +714,10 @@ put_headers(const char* path, headers_t meta) {
headers.append(key+":"+value); headers.append(key+":"+value);
} }
if (use_rrs.substr(0,1) == "1") {
headers.append("x-amz-storage-class:REDUCED_REDUNDANCY");
}
headers.append("Authorization: AWS "+AWSAccessKeyId+":"+calc_signature("PUT", ContentType, date, headers.get(), resource)); headers.append("Authorization: AWS "+AWSAccessKeyId+":"+calc_signature("PUT", ContentType, date, headers.get(), resource));
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers.get()); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers.get());
@ -776,6 +782,10 @@ put_local_fd(const char* path, headers_t meta, int fd) {
headers.append(key+":"+value); headers.append(key+":"+value);
} }
if (use_rrs.substr(0,1) == "1") {
headers.append("x-amz-storage-class:REDUCED_REDUNDANCY");
}
headers.append("Authorization: AWS "+AWSAccessKeyId+":"+calc_signature("PUT", ContentType, date, headers.get(), resource)); headers.append("Authorization: AWS "+AWSAccessKeyId+":"+calc_signature("PUT", ContentType, date, headers.get(), resource));
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers.get()); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers.get());
@ -1653,6 +1663,10 @@ my_fuse_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs
use_cache = strchr(arg, '=') + 1; use_cache = strchr(arg, '=') + 1;
return 0; return 0;
} }
if (strstr(arg, "use_rrs=") != 0) {
use_rrs = strchr(arg, '=') + 1;
return 0;
}
if (strstr(arg, "host=") != 0) { if (strstr(arg, "host=") != 0) {
host = strchr(arg, '=') + 1; host = strchr(arg, '=') + 1;
return 0; return 0;