diff options
author | krasnobaev <krasnobaev@yandex-team.ru> | 2022-02-10 16:50:19 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:19 +0300 |
commit | 57d5924cfae7600e91d372034c64914e0a0b6396 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/grpc | |
parent | 408b62b8b2bb0540f9251bb682b01b4d585d3754 (diff) | |
download | ydb-57d5924cfae7600e91d372034c64914e0a0b6396.tar.gz |
Restoring authorship annotation for <krasnobaev@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/grpc')
-rw-r--r-- | library/cpp/grpc/client/grpc_common.h | 26 | ||||
-rw-r--r-- | library/cpp/grpc/server/grpc_async_ctx_base.h | 8 | ||||
-rw-r--r-- | library/cpp/grpc/server/grpc_request.h | 8 | ||||
-rw-r--r-- | library/cpp/grpc/server/grpc_request_base.h | 10 | ||||
-rw-r--r-- | library/cpp/grpc/server/grpc_server.cpp | 4 | ||||
-rw-r--r-- | library/cpp/grpc/server/grpc_server.h | 16 |
6 files changed, 36 insertions, 36 deletions
diff --git a/library/cpp/grpc/client/grpc_common.h b/library/cpp/grpc/client/grpc_common.h index 35faabfca5..ffcdafe045 100644 --- a/library/cpp/grpc/client/grpc_common.h +++ b/library/cpp/grpc/client/grpc_common.h @@ -3,7 +3,7 @@ #include <grpc++/grpc++.h> #include <grpc++/resource_quota.h> -#include <util/datetime/base.h> +#include <util/datetime/base.h> #include <unordered_map> #include <util/generic/string.h> @@ -20,7 +20,7 @@ struct TGRpcClientConfig { ui32 MaxInFlight = 0; bool EnableSsl = false; TString SslCaCert; //Implicitly enables Ssl if not empty - grpc_compression_algorithm CompressionAlgoritm = GRPC_COMPRESS_NONE; + grpc_compression_algorithm CompressionAlgoritm = GRPC_COMPRESS_NONE; ui64 MemQuota = 0; std::unordered_map<TString, TString> StringChannelParams; std::unordered_map<TString, int> IntChannelParams; @@ -34,7 +34,7 @@ struct TGRpcClientConfig { TGRpcClientConfig& operator=(TGRpcClientConfig&&) = default; TGRpcClientConfig(const TString& locator, TDuration timeout = TDuration::Max(), - ui64 maxMessageSize = DEFAULT_GRPC_MESSAGE_SIZE_LIMIT, ui32 maxInFlight = 0, TString caCert = "", + ui64 maxMessageSize = DEFAULT_GRPC_MESSAGE_SIZE_LIMIT, ui32 maxInFlight = 0, TString caCert = "", grpc_compression_algorithm compressionAlgorithm = GRPC_COMPRESS_NONE, bool enableSsl = false) : Locator(locator) , Timeout(timeout) @@ -42,7 +42,7 @@ struct TGRpcClientConfig { , MaxInFlight(maxInFlight) , EnableSsl(enableSsl) , SslCaCert(caCert) - , CompressionAlgoritm(compressionAlgorithm) + , CompressionAlgoritm(compressionAlgorithm) {} }; @@ -50,16 +50,16 @@ inline std::shared_ptr<grpc::ChannelInterface> CreateChannelInterface(const TGRp grpc::ChannelArguments args; args.SetMaxReceiveMessageSize(config.MaxInboundMessageSize ? config.MaxInboundMessageSize : config.MaxMessageSize); args.SetMaxSendMessageSize(config.MaxOutboundMessageSize ? config.MaxOutboundMessageSize : config.MaxMessageSize); - args.SetCompressionAlgorithm(config.CompressionAlgoritm); + args.SetCompressionAlgorithm(config.CompressionAlgoritm); + + for (const auto& kvp: config.StringChannelParams) { + args.SetString(kvp.first, kvp.second); + } + + for (const auto& kvp: config.IntChannelParams) { + args.SetInt(kvp.first, kvp.second); + } - for (const auto& kvp: config.StringChannelParams) { - args.SetString(kvp.first, kvp.second); - } - - for (const auto& kvp: config.IntChannelParams) { - args.SetInt(kvp.first, kvp.second); - } - if (config.MemQuota) { grpc::ResourceQuota quota; quota.Resize(config.MemQuota); diff --git a/library/cpp/grpc/server/grpc_async_ctx_base.h b/library/cpp/grpc/server/grpc_async_ctx_base.h index 8fbce61f94..51356d4ce5 100644 --- a/library/cpp/grpc/server/grpc_async_ctx_base.h +++ b/library/cpp/grpc/server/grpc_async_ctx_base.h @@ -69,10 +69,10 @@ public: return values; } - grpc_compression_level GetCompressionLevel() const { - return Context.compression_level(); - } - + grpc_compression_level GetCompressionLevel() const { + return Context.compression_level(); + } + void Shutdown() override { // Shutdown may only be called after request has started successfully if (Context.c_call()) diff --git a/library/cpp/grpc/server/grpc_request.h b/library/cpp/grpc/server/grpc_request.h index 345637e86d..5bd8d3902b 100644 --- a/library/cpp/grpc/server/grpc_request.h +++ b/library/cpp/grpc/server/grpc_request.h @@ -167,10 +167,10 @@ public: return TBaseAsyncContext<TService>::GetPeerMetaValues(key); } - grpc_compression_level GetCompressionLevel() const override { - return TBaseAsyncContext<TService>::GetCompressionLevel(); - } - + grpc_compression_level GetCompressionLevel() const override { + return TBaseAsyncContext<TService>::GetCompressionLevel(); + } + //! Get pointer to the request's message. const NProtoBuf::Message* GetRequest() const override { return Request_; diff --git a/library/cpp/grpc/server/grpc_request_base.h b/library/cpp/grpc/server/grpc_request_base.h index 5d5e11239e..fcfce1c181 100644 --- a/library/cpp/grpc/server/grpc_request_base.h +++ b/library/cpp/grpc/server/grpc_request_base.h @@ -3,8 +3,8 @@ #include <google/protobuf/message.h> #include <library/cpp/threading/future/future.h> -#include <grpc++/server_context.h> - +#include <grpc++/server_context.h> + namespace grpc { class ByteBuffer; } @@ -79,9 +79,9 @@ public: //! Returns peer optional metavalue virtual TVector<TStringBuf> GetPeerMetaValues(TStringBuf key) const = 0; - //! Returns request compression level - virtual grpc_compression_level GetCompressionLevel() const = 0; - + //! Returns request compression level + virtual grpc_compression_level GetCompressionLevel() const = 0; + //! Returns protobuf arena allocator associated with current request //! Lifetime of the arena is lifetime of the context virtual google::protobuf::Arena* GetArena() = 0; diff --git a/library/cpp/grpc/server/grpc_server.cpp b/library/cpp/grpc/server/grpc_server.cpp index 07dca78a37..7437b7a8f5 100644 --- a/library/cpp/grpc/server/grpc_server.cpp +++ b/library/cpp/grpc/server/grpc_server.cpp @@ -142,8 +142,8 @@ void TGRpcServer::Start() { */ Cerr << "GRpc memory quota temporarily disabled due to issues with grpc quoter" << Endl; } - Options_.ServerBuilderMutator(builder); - builder.SetDefaultCompressionLevel(Options_.DefaultCompressionLevel); + Options_.ServerBuilderMutator(builder); + builder.SetDefaultCompressionLevel(Options_.DefaultCompressionLevel); Server_ = builder.BuildAndStart(); if (!Server_) { diff --git a/library/cpp/grpc/server/grpc_server.h b/library/cpp/grpc/server/grpc_server.h index a43cdef142..d6814a90a0 100644 --- a/library/cpp/grpc/server/grpc_server.h +++ b/library/cpp/grpc/server/grpc_server.h @@ -85,14 +85,14 @@ struct TServerOptions { //! GRPC auth DECLARE_FIELD(UseAuth, bool, false); - - //! Default compression level. Used when no compression options provided by client. - // Mapping to particular compression algorithm depends on client. - DECLARE_FIELD(DefaultCompressionLevel, grpc_compression_level, GRPC_COMPRESS_LEVEL_NONE); - - //! Custom configurator for ServerBuilder. - DECLARE_FIELD(ServerBuilderMutator, std::function<void(grpc::ServerBuilder&)>, [](grpc::ServerBuilder&){}); - + + //! Default compression level. Used when no compression options provided by client. + // Mapping to particular compression algorithm depends on client. + DECLARE_FIELD(DefaultCompressionLevel, grpc_compression_level, GRPC_COMPRESS_LEVEL_NONE); + + //! Custom configurator for ServerBuilder. + DECLARE_FIELD(ServerBuilderMutator, std::function<void(grpc::ServerBuilder&)>, [](grpc::ServerBuilder&){}); + DECLARE_FIELD(ExternalListener, IExternalListener::TPtr, nullptr); //! Logger which will be used to write logs about requests handling (iff appropriate log level is enabled). |