6 #ifndef IROHA_GRPC_CHANNEL_BUILDER_HPP 7 #define IROHA_GRPC_CHANNEL_BUILDER_HPP 12 #include <fmt/format.h> 13 #include <grpc++/grpc++.h> 19 std::numeric_limits<int>::max();
21 std::numeric_limits<int>::max();
27 grpc::ChannelArguments args;
28 args.SetServiceConfigJSON(fmt::format(R
"( 36 "initialBackoff": "1s", 38 "backoffMultiplier": 1.2, 39 "retryableStatusCodes": [ 46 "maxRequestMessageBytes": {}, 47 "maxResponseMessageBytes": {}, 51 T::service_full_name(), 52 kClientRequestRetryAttempts, 53 kMaxRequestMessageBytes, 54 kMaxResponseMessageBytes, 55 kClientRequestTimeoutSeconds)); 71 const grpc::string &address,
72 std::shared_ptr<grpc::ChannelCredentials> credentials) {
73 return T::NewStub(grpc::CreateCustomChannel(
74 address, credentials, details::getChannelArguments<T>()));
86 return createClientWithCredentials<T>(address,
87 grpc::InsecureChannelCredentials());
100 const grpc::string &address,
const std::string &root_certificate) {
101 auto options = grpc::SslCredentialsOptions();
102 options.pem_root_certs = root_certificate;
103 auto credentials = grpc::SslCredentials(options);
105 return createClientWithCredentials<T>(address, credentials);
110 #endif // IROHA_GRPC_CHANNEL_BUILDER_HPP constexpr unsigned int kClientRequestRetryAttempts
Definition: grpc_channel_builder.hpp:22
constexpr unsigned int kMaxResponseMessageBytes
Definition: grpc_channel_builder.hpp:20
grpc::ChannelArguments getChannelArguments()
Definition: grpc_channel_builder.hpp:26
std::unique_ptr< typename T::Stub > createSecureClient(const grpc::string &address, const std::string &root_certificate)
Definition: grpc_channel_builder.hpp:99
constexpr unsigned int kClientRequestTimeoutSeconds
Definition: grpc_channel_builder.hpp:23
Definition: block_query.hpp:15
auto createClientWithCredentials(const grpc::string &address, std::shared_ptr< grpc::ChannelCredentials > credentials)
Definition: grpc_channel_builder.hpp:70
auto createClient(const grpc::string &address)
Definition: grpc_channel_builder.hpp:85
constexpr unsigned int kMaxRequestMessageBytes
Definition: grpc_channel_builder.hpp:18