userver: userver/ugrpc/client/client_factory_settings.hpp Source File
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
client_factory_settings.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/ugrpc/client/client_factory_settings.hpp
4/// @brief @copybrief ugrpc::client::ClientFactorySettings
5
6#include <memory>
7#include <optional>
8#include <string>
9#include <unordered_map>
10
11#include <grpcpp/security/credentials.h>
12#include <grpcpp/support/channel_arguments.h>
13
14USERVER_NAMESPACE_BEGIN
15
16namespace ugrpc::client {
17
18/// Settings relating to the ClientFactory
19struct ClientFactorySettings final {
20 /// gRPC channel credentials, none by default
21 std::shared_ptr<grpc::ChannelCredentials> credentials{grpc::InsecureChannelCredentials()};
22
23 /// gRPC channel credentials by client_name. If not set, default `credentials`
24 /// is used instead.
26
27 /// Optional grpc-core channel args
28 /// @see https://grpc.github.io/grpc/core/group__grpc__arg__keys.html
29 grpc::ChannelArguments channel_args{};
30
31 /// service config
32 /// @see https://github.com/grpc/grpc/blob/master/doc/service_config.md
33 std::optional<std::string> default_service_config;
34
35 /// Number of underlying channels that will be created for every client
36 /// in this factory.
37 std::size_t channel_count{1};
38};
39
40std::shared_ptr<grpc::ChannelCredentials>
41GetClientCredentials(const ClientFactorySettings& client_factory_settings, const std::string& client_name);
42
43} // namespace ugrpc::client
44
45USERVER_NAMESPACE_END