Tiny fixes for storage s3

This commit is contained in:
alesapin 2020-06-04 16:48:20 +03:00
parent bba558d68e
commit 22235c1951
2 changed files with 8 additions and 8 deletions

View File

@ -66,22 +66,22 @@ class S3AuthSigner : public Aws::Client::AWSAuthV4Signer
{
public:
S3AuthSigner(
const Aws::Client::ClientConfiguration & clientConfiguration,
const Aws::Client::ClientConfiguration & client_configuration,
const Aws::Auth::AWSCredentials & credentials,
const DB::HeaderCollection & headers_)
: Aws::Client::AWSAuthV4Signer(
std::make_shared<Aws::Auth::SimpleAWSCredentialsProvider>(credentials),
"s3",
clientConfiguration.region,
client_configuration.region,
Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never,
false)
, headers(headers_)
{
}
bool SignRequest(Aws::Http::HttpRequest & request, const char * region, bool signBody) const override
bool SignRequest(Aws::Http::HttpRequest & request, const char * region, bool sign_body) const override
{
auto result = Aws::Client::AWSAuthV4Signer::SignRequest(request, region, signBody);
auto result = Aws::Client::AWSAuthV4Signer::SignRequest(request, region, sign_body);
for (const auto & header : headers)
request.SetHeaderValue(header.name, header.value);
return result;
@ -91,9 +91,9 @@ public:
Aws::Http::HttpRequest & request,
const char * region,
const char * serviceName,
long long expirationTimeInSeconds) const override // NOLINT
long long expiration_time_sec) const override // NOLINT
{
auto result = Aws::Client::AWSAuthV4Signer::PresignRequest(request, region, serviceName, expirationTimeInSeconds);
auto result = Aws::Client::AWSAuthV4Signer::PresignRequest(request, region, serviceName, expiration_time_sec);
for (const auto & header : headers)
request.SetHeaderValue(header.name, header.value);
return result;

View File

@ -13,7 +13,7 @@ namespace ErrorCodes
void StorageS3Settings::loadFromConfig(const String & config_elem, const Poco::Util::AbstractConfiguration & config)
{
auto lock = std::unique_lock(mutex);
std::lock_guard lock(mutex);
settings.clear();
if (!config.has(config_elem))
return;
@ -48,7 +48,7 @@ void StorageS3Settings::loadFromConfig(const String & config_elem, const Poco::U
S3AuthSettings StorageS3Settings::getSettings(const String & endpoint) const
{
auto lock = std::unique_lock(mutex);
std::lock_guard lock(mutex);
if (auto setting = settings.find(endpoint); setting != settings.end())
return setting->second;
return {};