diff options
author | heretic <heretic@yandex-team.ru> | 2022-02-10 16:45:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:46 +0300 |
commit | 81eddc8c0b55990194e112b02d127b87d54164a9 (patch) | |
tree | 9142afc54d335ea52910662635b898e79e192e49 /contrib/libs/grpc/test/cpp/util/cli_call.h | |
parent | 397cbe258b9e064f49c4ca575279f02f39fef76e (diff) | |
download | ydb-81eddc8c0b55990194e112b02d127b87d54164a9.tar.gz |
Restoring authorship annotation for <heretic@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/grpc/test/cpp/util/cli_call.h')
-rw-r--r-- | contrib/libs/grpc/test/cpp/util/cli_call.h | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/contrib/libs/grpc/test/cpp/util/cli_call.h b/contrib/libs/grpc/test/cpp/util/cli_call.h index a01279cb74..79d00d99f4 100644 --- a/contrib/libs/grpc/test/cpp/util/cli_call.h +++ b/contrib/libs/grpc/test/cpp/util/cli_call.h @@ -25,16 +25,16 @@ #include <grpcpp/support/status.h> #include <grpcpp/support/string_ref.h> -#include <map> +#include <map> namespace grpc { -class ClientContext; - -struct CliArgs { - double timeout = -1; -}; - +class ClientContext; + +struct CliArgs { + double timeout = -1; +}; + namespace testing { // CliCall handles the sending and receiving of generic messages given the name @@ -42,40 +42,40 @@ namespace testing { // and thread-unsafe methods should not be used together. class CliCall final { public: - typedef std::multimap<TString, TString> OutgoingMetadataContainer; + typedef std::multimap<TString, TString> OutgoingMetadataContainer; typedef std::multimap<grpc::string_ref, grpc::string_ref> IncomingMetadataContainer; CliCall(const std::shared_ptr<grpc::Channel>& channel, - const TString& method, const OutgoingMetadataContainer& metadata, - CliArgs args); - CliCall(const std::shared_ptr<grpc::Channel>& channel, - const TString& method, const OutgoingMetadataContainer& metadata) - : CliCall(channel, method, metadata, CliArgs{}) {} - + const TString& method, const OutgoingMetadataContainer& metadata, + CliArgs args); + CliCall(const std::shared_ptr<grpc::Channel>& channel, + const TString& method, const OutgoingMetadataContainer& metadata) + : CliCall(channel, method, metadata, CliArgs{}) {} + ~CliCall(); // Perform an unary generic RPC. - static Status Call(const std::shared_ptr<grpc::Channel>& channel, - const TString& method, const TString& request, - TString* response, + static Status Call(const std::shared_ptr<grpc::Channel>& channel, + const TString& method, const TString& request, + TString* response, const OutgoingMetadataContainer& metadata, IncomingMetadataContainer* server_initial_metadata, IncomingMetadataContainer* server_trailing_metadata); // Send a generic request message in a synchronous manner. NOT thread-safe. - void Write(const TString& request); + void Write(const TString& request); // Send a generic request message in a synchronous manner. NOT thread-safe. void WritesDone(); // Receive a generic response message in a synchronous manner.NOT thread-safe. - bool Read(TString* response, + bool Read(TString* response, IncomingMetadataContainer* server_initial_metadata); // Thread-safe write. Must be used with ReadAndMaybeNotifyWrite. Send out a // generic request message and wait for ReadAndMaybeNotifyWrite to finish it. - void WriteAndWait(const TString& request); + void WriteAndWait(const TString& request); // Thread-safe WritesDone. Must be used with ReadAndMaybeNotifyWrite. Send out // WritesDone for gereneric request messages and wait for @@ -85,17 +85,17 @@ class CliCall final { // Thread-safe Read. Blockingly receive a generic response message. Notify // writes if they are finished when this read is waiting for a resposne. bool ReadAndMaybeNotifyWrite( - TString* response, + TString* response, IncomingMetadataContainer* server_initial_metadata); // Finish the RPC. Status Finish(IncomingMetadataContainer* server_trailing_metadata); - TString peer() const { return ctx_.peer(); } - + TString peer() const { return ctx_.peer(); } + private: std::unique_ptr<grpc::GenericStub> stub_; - grpc::ClientContext ctx_; + grpc::ClientContext ctx_; std::unique_ptr<grpc::GenericClientAsyncReaderWriter> call_; grpc::CompletionQueue cq_; gpr_mu write_mu_; |