diff options
author | msherbakov <msherbakov@yandex-team.ru> | 2022-02-10 16:49:16 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:16 +0300 |
commit | c224a621661ddd69699f9476922eb316607ef57e (patch) | |
tree | 33f4d878aa0a9faa964005e06bfab0272313aa71 /library/cpp/grpc/client/grpc_common.h | |
parent | 29d0b2eeae154d04156e0698067c0c21a97ea61d (diff) | |
download | ydb-c224a621661ddd69699f9476922eb316607ef57e.tar.gz |
Restoring authorship annotation for <msherbakov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/grpc/client/grpc_common.h')
-rw-r--r-- | library/cpp/grpc/client/grpc_common.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/library/cpp/grpc/client/grpc_common.h b/library/cpp/grpc/client/grpc_common.h index ffcdafe045..12a3f7c28e 100644 --- a/library/cpp/grpc/client/grpc_common.h +++ b/library/cpp/grpc/client/grpc_common.h @@ -1,7 +1,7 @@ #pragma once #include <grpc++/grpc++.h> -#include <grpc++/resource_quota.h> +#include <grpc++/resource_quota.h> #include <util/datetime/base.h> #include <unordered_map> @@ -9,19 +9,19 @@ constexpr ui64 DEFAULT_GRPC_MESSAGE_SIZE_LIMIT = 64000000; -namespace NGrpc { +namespace NGrpc { struct TGRpcClientConfig { TString Locator; // format host:port TDuration Timeout = TDuration::Max(); // request timeout ui64 MaxMessageSize = DEFAULT_GRPC_MESSAGE_SIZE_LIMIT; // Max request and response size - ui64 MaxInboundMessageSize = 0; // overrides MaxMessageSize for incoming requests - ui64 MaxOutboundMessageSize = 0; // overrides MaxMessageSize for outgoing requests + ui64 MaxInboundMessageSize = 0; // overrides MaxMessageSize for incoming requests + ui64 MaxOutboundMessageSize = 0; // overrides MaxMessageSize for outgoing requests ui32 MaxInFlight = 0; bool EnableSsl = false; TString SslCaCert; //Implicitly enables Ssl if not empty grpc_compression_algorithm CompressionAlgoritm = GRPC_COMPRESS_NONE; - ui64 MemQuota = 0; + ui64 MemQuota = 0; std::unordered_map<TString, TString> StringChannelParams; std::unordered_map<TString, int> IntChannelParams; TString LoadBalancingPolicy = { }; @@ -48,10 +48,10 @@ struct TGRpcClientConfig { inline std::shared_ptr<grpc::ChannelInterface> CreateChannelInterface(const TGRpcClientConfig& config, grpc_socket_mutator* mutator = nullptr){ grpc::ChannelArguments args; - args.SetMaxReceiveMessageSize(config.MaxInboundMessageSize ? config.MaxInboundMessageSize : config.MaxMessageSize); - args.SetMaxSendMessageSize(config.MaxOutboundMessageSize ? config.MaxOutboundMessageSize : config.MaxMessageSize); + args.SetMaxReceiveMessageSize(config.MaxInboundMessageSize ? config.MaxInboundMessageSize : config.MaxMessageSize); + args.SetMaxSendMessageSize(config.MaxOutboundMessageSize ? config.MaxOutboundMessageSize : config.MaxMessageSize); args.SetCompressionAlgorithm(config.CompressionAlgoritm); - + for (const auto& kvp: config.StringChannelParams) { args.SetString(kvp.first, kvp.second); } @@ -60,11 +60,11 @@ inline std::shared_ptr<grpc::ChannelInterface> CreateChannelInterface(const TGRp args.SetInt(kvp.first, kvp.second); } - if (config.MemQuota) { - grpc::ResourceQuota quota; - quota.Resize(config.MemQuota); - args.SetResourceQuota(quota); - } + if (config.MemQuota) { + grpc::ResourceQuota quota; + quota.Resize(config.MemQuota); + args.SetResourceQuota(quota); + } if (mutator) { args.SetSocketMutator(mutator); } @@ -81,4 +81,4 @@ inline std::shared_ptr<grpc::ChannelInterface> CreateChannelInterface(const TGRp } } -} // namespace NGRpc +} // namespace NGRpc |