GRPC C++  1.62.0
Data Structures | Public Member Functions | Friends
grpc::ChannelArguments Class Reference

Options for channel creation. More...

#include <channel_arguments.h>

Public Member Functions

 ChannelArguments ()
 
 ~ChannelArguments ()
 
 ChannelArguments (const ChannelArguments &other)
 
ChannelArgumentsoperator= (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::SecureChannelCredentials
 
class grpc::testing::ChannelArgumentsTest
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ChannelArguments() [1/2]

grpc::ChannelArguments::ChannelArguments ( )

◆ ~ChannelArguments()

grpc::ChannelArguments::~ChannelArguments ( )

◆ ChannelArguments() [2/2]

grpc::ChannelArguments::ChannelArguments ( const ChannelArguments other)

Member Function Documentation

◆ c_channel_args()

grpc_channel_args grpc::ChannelArguments::c_channel_args ( ) const
inline

Return (by value) a C grpc_channel_args structure which points to arguments owned by this ChannelArguments instance.

◆ operator=()

ChannelArguments& grpc::ChannelArguments::operator= ( ChannelArguments  other)
inline

◆ SetChannelArgs()

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.

◆ SetCompressionAlgorithm()

void grpc::ChannelArguments::SetCompressionAlgorithm ( grpc_compression_algorithm  algorithm)

Set the compression algorithm for the channel.

◆ SetGrpclbFallbackTimeout()

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.

◆ SetInt()

void grpc::ChannelArguments::SetInt ( const std::string &  key,
int  value 
)

Set an integer argument value under key.

◆ SetLoadBalancingPolicyName()

void grpc::ChannelArguments::SetLoadBalancingPolicyName ( const std::string &  lb_policy_name)

Set LB policy name.

Note that if the name resolver returns only balancer addresses, the grpclb LB policy will be used, regardless of what is specified here.

◆ SetMaxReceiveMessageSize()

void grpc::ChannelArguments::SetMaxReceiveMessageSize ( int  size)

Set the max receive and send message sizes.

◆ SetMaxSendMessageSize()

void grpc::ChannelArguments::SetMaxSendMessageSize ( int  size)

◆ SetPointer()

void grpc::ChannelArguments::SetPointer ( const std::string &  key,
void *  value 
)

Set a pointer argument value under key.

Ownership is not transferred.

◆ SetPointerWithVtable()

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.

◆ SetResourceQuota()

void grpc::ChannelArguments::SetResourceQuota ( const grpc::ResourceQuota resource_quota)

Set the buffer pool to be attached to the constructed channel.

◆ SetServiceConfigJSON()

void grpc::ChannelArguments::SetServiceConfigJSON ( const std::string &  service_config_json)

Set service config in JSON form.

Primarily meant for use in unit tests.

◆ SetSocketMutator()

void grpc::ChannelArguments::SetSocketMutator ( grpc_socket_mutator mutator)

Set a mutator for the underlying socket.

◆ SetSslTargetNameOverride()

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.

◆ SetString()

void grpc::ChannelArguments::SetString ( const std::string &  key,
const std::string &  value 
)

Set a textual argument value under key.

◆ SetUserAgentPrefix()

void grpc::ChannelArguments::SetUserAgentPrefix ( const std::string &  user_agent_prefix)

Set the string to prepend to the user agent.

◆ Swap()

void grpc::ChannelArguments::Swap ( ChannelArguments other)

Friends And Related Function Documentation

◆ grpc::SecureChannelCredentials

friend class grpc::SecureChannelCredentials
friend

◆ grpc::testing::ChannelArgumentsTest

friend class grpc::testing::ChannelArgumentsTest
friend

The documentation for this class was generated from the following file: