mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 09:58:50 +08:00
clang-format S3BlobStore* files
This commit is contained in:
parent
4666f59c4c
commit
ac274cf479
@ -247,11 +247,10 @@ Reference<S3BlobStoreEndpoint> S3BlobStoreEndpoint::fromString(std::string const
|
||||
StringRef c(cred.get());
|
||||
StringRef key = c.eat(":");
|
||||
StringRef secret = c.eat();
|
||||
creds = S3BlobStoreEndpoint::Credentials{key.toString(), secret.toString()};
|
||||
creds = S3BlobStoreEndpoint::Credentials{ key.toString(), secret.toString() };
|
||||
}
|
||||
|
||||
return makeReference<S3BlobStoreEndpoint>(
|
||||
host.toString(), service.toString(), creds, knobs, extraHeaders);
|
||||
return makeReference<S3BlobStoreEndpoint>(host.toString(), service.toString(), creds, knobs, extraHeaders);
|
||||
|
||||
} catch (std::string& err) {
|
||||
if (error != nullptr)
|
||||
@ -277,7 +276,7 @@ std::string S3BlobStoreEndpoint::getResourceURL(std::string resource, std::strin
|
||||
if (credentials.present()) {
|
||||
credsString = credentials.get().key;
|
||||
if (!lookupSecret) {
|
||||
credsString +=":" + credentials.get().secret;
|
||||
credsString += ":" + credentials.get().secret;
|
||||
}
|
||||
credsString += "@";
|
||||
}
|
||||
@ -527,7 +526,7 @@ ACTOR Future<Void> updateSecret_impl(Reference<S3BlobStoreEndpoint> b) {
|
||||
std::string secret;
|
||||
// Once we find a matching account, use it.
|
||||
if (account.tryGet("secret", secret)) {
|
||||
b->credentials = S3BlobStoreEndpoint::Credentials{accessKey, secret};
|
||||
b->credentials = S3BlobStoreEndpoint::Credentials{ accessKey, secret };
|
||||
return Void();
|
||||
}
|
||||
}
|
||||
@ -1060,7 +1059,7 @@ Future<std::vector<std::string>> S3BlobStoreEndpoint::listBuckets() {
|
||||
return listBuckets_impl(Reference<S3BlobStoreEndpoint>::addRef(this));
|
||||
}
|
||||
|
||||
std::string S3BlobStoreEndpoint::hmac_sha1(Credentials const &creds, std::string const& msg) {
|
||||
std::string S3BlobStoreEndpoint::hmac_sha1(Credentials const& creds, std::string const& msg) {
|
||||
std::string key = creds.secret;
|
||||
|
||||
// Hash key to shorten it if it is longer than SHA1 block size
|
||||
|
@ -95,20 +95,22 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
S3BlobStoreEndpoint(std::string const &host, std::string service, Optional<Credentials> const& creds, BlobKnobs const &knobs = BlobKnobs(), HTTP::Headers extraHeaders = HTTP::Headers())
|
||||
: host(host), service(service), credentials(creds), lookupSecret(creds.present() && creds.get().secret.empty()), knobs(knobs), extraHeaders(extraHeaders),
|
||||
requestRate(new SpeedLimit(knobs.requests_per_second, 1)),
|
||||
requestRateList(new SpeedLimit(knobs.list_requests_per_second, 1)),
|
||||
requestRateWrite(new SpeedLimit(knobs.write_requests_per_second, 1)),
|
||||
requestRateRead(new SpeedLimit(knobs.read_requests_per_second, 1)),
|
||||
requestRateDelete(new SpeedLimit(knobs.delete_requests_per_second, 1)),
|
||||
sendRate(new SpeedLimit(knobs.max_send_bytes_per_second, 1)),
|
||||
recvRate(new SpeedLimit(knobs.max_recv_bytes_per_second, 1)),
|
||||
concurrentRequests(knobs.concurrent_requests),
|
||||
concurrentUploads(knobs.concurrent_uploads),
|
||||
concurrentLists(knobs.concurrent_lists) {
|
||||
S3BlobStoreEndpoint(std::string const& host,
|
||||
std::string service,
|
||||
Optional<Credentials> const& creds,
|
||||
BlobKnobs const& knobs = BlobKnobs(),
|
||||
HTTP::Headers extraHeaders = HTTP::Headers())
|
||||
: host(host), service(service), credentials(creds), lookupSecret(creds.present() && creds.get().secret.empty()),
|
||||
knobs(knobs), extraHeaders(extraHeaders), requestRate(new SpeedLimit(knobs.requests_per_second, 1)),
|
||||
requestRateList(new SpeedLimit(knobs.list_requests_per_second, 1)),
|
||||
requestRateWrite(new SpeedLimit(knobs.write_requests_per_second, 1)),
|
||||
requestRateRead(new SpeedLimit(knobs.read_requests_per_second, 1)),
|
||||
requestRateDelete(new SpeedLimit(knobs.delete_requests_per_second, 1)),
|
||||
sendRate(new SpeedLimit(knobs.max_send_bytes_per_second, 1)),
|
||||
recvRate(new SpeedLimit(knobs.max_recv_bytes_per_second, 1)), concurrentRequests(knobs.concurrent_requests),
|
||||
concurrentUploads(knobs.concurrent_uploads), concurrentLists(knobs.concurrent_lists) {
|
||||
|
||||
if(host.empty())
|
||||
if (host.empty())
|
||||
throw connection_string_invalid();
|
||||
}
|
||||
|
||||
@ -164,7 +166,7 @@ public:
|
||||
Future<Void> updateSecret();
|
||||
|
||||
// Calculates the authentication string from the secret key
|
||||
static std::string hmac_sha1(Credentials const &creds, std::string const &msg);
|
||||
static std::string hmac_sha1(Credentials const& creds, std::string const& msg);
|
||||
|
||||
// Sets headers needed for Authorization (including Date which will be overwritten if present)
|
||||
void setAuthHeaders(std::string const& verb, std::string const& resource, HTTP::Headers& headers);
|
||||
|
Loading…
x
Reference in New Issue
Block a user