GRPC C++
1.73.0
|
Options for channel creation. More...
#include <channel_arguments.h>
Public Member Functions | |
ChannelArguments () | |
~ChannelArguments () | |
ChannelArguments (const ChannelArguments &other) | |
ChannelArguments & | operator= (ChannelArguments other) |
void | Swap (ChannelArguments &other) |
void | SetChannelArgs (grpc_channel_args *channel_args) const |
Dump arguments in this instance to channel_args. More... | |
void | SetSslTargetNameOverride (const std::string &name) |
Set target name override for SSL host name checking. More... | |
void | SetCompressionAlgorithm (grpc_compression_algorithm algorithm) |
Set the compression algorithm for the channel. More... | |
void | SetGrpclbFallbackTimeout (int fallback_timeout) |
Set the grpclb fallback timeout (in ms) for the channel. More... | |
void | SetSocketMutator (grpc_socket_mutator *mutator) |
Set a mutator for the underlying socket. More... | |
void | SetUserAgentPrefix (const std::string &user_agent_prefix) |
Set the string to prepend to the user agent. More... | |
void | SetResourceQuota (const grpc::ResourceQuota &resource_quota) |
Set the buffer pool to be attached to the constructed channel. More... | |
void | SetMaxReceiveMessageSize (int size) |
Set the max receive and send message sizes. More... | |
void | SetMaxSendMessageSize (int size) |
void | SetLoadBalancingPolicyName (const std::string &lb_policy_name) |
Set LB policy name. More... | |
void | SetServiceConfigJSON (const std::string &service_config_json) |
Set service config in JSON form. More... | |
void | SetInt (const std::string &key, int value) |
Set an integer argument value under key. More... | |
void | SetPointer (const std::string &key, void *value) |
Set a pointer argument value under key. More... | |
void | SetPointerWithVtable (const std::string &key, void *value, const grpc_arg_pointer_vtable *vtable) |
Set a pointer argument value under key, transferring ownership of value to the ChannelArguments object. More... | |
void | SetString (const std::string &key, const std::string &value) |
Set a textual argument value under key. More... | |
grpc_channel_args | c_channel_args () const |
Return (by value) a C grpc_channel_args structure which points to arguments owned by this ChannelArguments instance. More... | |
Friends | |
class | grpc::ChannelCredentials |
class | grpc::testing::ChannelArgumentsTest |
Options for channel creation.
The user can use generic setters to pass key value pairs down to C channel creation code. For gRPC related options, concrete setters are provided.
grpc::ChannelArguments::ChannelArguments | ( | ) |
grpc::ChannelArguments::~ChannelArguments | ( | ) |
grpc::ChannelArguments::ChannelArguments | ( | const ChannelArguments & | other | ) |
|
inline |
Return (by value) a C grpc_channel_args structure which points to arguments owned by this ChannelArguments instance.
|
inline |
void grpc::ChannelArguments::SetChannelArgs | ( | grpc_channel_args * | channel_args | ) | const |
Dump arguments in this instance to channel_args.
Does not take ownership of channel_args.
Note that the underlying arguments are shared. Changes made to either channel_args or this instance would be reflected on both.
void grpc::ChannelArguments::SetCompressionAlgorithm | ( | grpc_compression_algorithm | algorithm | ) |
Set the compression algorithm for the channel.
void grpc::ChannelArguments::SetGrpclbFallbackTimeout | ( | int | fallback_timeout | ) |
Set the grpclb fallback timeout (in ms) for the channel.
If this amount of time has passed but we have not gotten any non-empty serverlist from the balancer, we will fall back to use the backend address(es) returned by the resolver.
void grpc::ChannelArguments::SetInt | ( | const std::string & | key, |
int | value | ||
) |
Set an integer argument value under key.
void grpc::ChannelArguments::SetLoadBalancingPolicyName | ( | const std::string & | lb_policy_name | ) |
Set LB policy name.
Note that this API implicitly provides an empty config for the specified LB policy, so it cannot be used for any policy with required configuration parameters. For those cases, set the LB policy via the service config instead.
void grpc::ChannelArguments::SetMaxReceiveMessageSize | ( | int | size | ) |
Set the max receive and send message sizes.
void grpc::ChannelArguments::SetMaxSendMessageSize | ( | int | size | ) |
void grpc::ChannelArguments::SetPointer | ( | const std::string & | key, |
void * | value | ||
) |
Set a pointer argument value under key.
Ownership is not transferred.
void grpc::ChannelArguments::SetPointerWithVtable | ( | const std::string & | key, |
void * | value, | ||
const grpc_arg_pointer_vtable * | vtable | ||
) |
Set a pointer argument value under key, transferring ownership of value to the ChannelArguments object.
The vtable::Delete function is responsible for value cleanup/destruction when called.
void grpc::ChannelArguments::SetResourceQuota | ( | const grpc::ResourceQuota & | resource_quota | ) |
Set the buffer pool to be attached to the constructed channel.
void grpc::ChannelArguments::SetServiceConfigJSON | ( | const std::string & | service_config_json | ) |
Set service config in JSON form.
Primarily meant for use in unit tests.
void grpc::ChannelArguments::SetSocketMutator | ( | grpc_socket_mutator * | mutator | ) |
Set a mutator for the underlying socket.
void grpc::ChannelArguments::SetSslTargetNameOverride | ( | const std::string & | name | ) |
Set target name override for SSL host name checking.
This option should be used with caution in production.
void grpc::ChannelArguments::SetString | ( | const std::string & | key, |
const std::string & | value | ||
) |
Set a textual argument value under key.
void grpc::ChannelArguments::SetUserAgentPrefix | ( | const std::string & | user_agent_prefix | ) |
Set the string to prepend to the user agent.
void grpc::ChannelArguments::Swap | ( | ChannelArguments & | other | ) |
|
friend |
|
friend |