Google Cloud Bigtable C++ Client  0.11.0
A C++ Client Library for Google Cloud Bigtable
Public Member Functions | Static Public Member Functions | Friends | List of all members
google::cloud::bigtable::v0::ClientOptions Class Reference

Configuration options for the Bigtable Client. More...

#include <google/cloud/bigtable/client_options.h>

Public Member Functions

 ClientOptions ()
 Initialize the client options with the default credentials. More...
 
 ClientOptions (std::shared_ptr< grpc::ChannelCredentials > creds)
 Connect to the production instance of Cloud Bigtable using creds. More...
 
std::string const & data_endpoint () const
 Return the current endpoint for data RPCs. More...
 
ClientOptionsset_data_endpoint (std::string endpoint)
 
std::string const & admin_endpoint () const
 Return the current endpoint for admin RPCs. More...
 
ClientOptionsset_admin_endpoint (std::string endpoint)
 
ClientOptionsset_connection_pool_name (std::string name)
 Set the name of the connection pool. More...
 
std::string const & connection_pool_name () const
 Return the name of the connection pool. More...
 
ClientOptionsset_connection_pool_size (std::size_t size)
 
std::size_t connection_pool_size () const
 
std::shared_ptr< grpc::ChannelCredentials > credentials () const
 Return the current credentials. More...
 
ClientOptionsSetCredentials (std::shared_ptr< grpc::ChannelCredentials > credentials)
 
grpc::ChannelArguments channel_arguments () const
 Access all the channel arguments. More...
 
ClientOptionsset_channel_arguments (grpc::ChannelArguments const &channel_arguments)
 Set all the channel arguments. More...
 
void SetCompressionAlgorithm (grpc_compression_algorithm algorithm)
 Set compression algorithm for channel. More...
 
template<typename Rep , typename Period >
google::cloud::Status SetGrpclbFallbackTimeout (std::chrono::duration< Rep, Period > fallback_timeout)
 Set the grpclb fallback timeout with the timestamp fallback_timeout for the channel. More...
 
void SetUserAgentPrefix (grpc::string const &user_agent_prefix)
 Set the string to prepend to the user agent. More...
 
void SetResourceQuota (grpc::ResourceQuota const &resource_quota)
 Set the buffer pool to be attached to the constructed channel. More...
 
void SetMaxReceiveMessageSize (int size)
 Set the max receive message size in bytes. More...
 
void SetMaxSendMessageSize (int size)
 Set the max send message size in bytes. More...
 
void SetLoadBalancingPolicyName (grpc::string const &lb_policy_name)
 Set LB policy name. More...
 
void SetServiceConfigJSON (grpc::string const &service_config_json)
 Set service config in JSON form. More...
 
void SetSslTargetNameOverride (grpc::string const &name)
 Set target name override for SSL host name checking. More...
 

Static Public Member Functions

static std::string UserAgentPrefix ()
 Return the user agent prefix used by the library. More...
 

Friends

struct ClientOptionsTestTraits
 

Detailed Description

Configuration options for the Bigtable Client.

Applications typically configure the client class using:

auto client =
bigtable::Client(bigtable::ClientOptions().SetCredentials(...));

Definition at line 40 of file client_options.h.

Constructor & Destructor Documentation

◆ ClientOptions() [1/2]

google::cloud::bigtable::v0::ClientOptions::ClientOptions ( )

Initialize the client options with the default credentials.

Configure the client to connect to the Cloud Bigtable service, using the default Google credentials for authentication.

Environment Variables
If the BIGTABLE_EMULATOR_HOST environment variable is set, the default configuration changes in important ways:
  • The credentials are initialized to grpc::InsecureCredentials().
  • Any client created with these objects will connect to the endpoint (typically just a host:port string) set in the environment variable.

This makes it easy to test applications using the Cloud Bigtable Emulator.

See also
The Google Cloud Platform introduction to application default credentials
grpc::GoogleDefaultCredentials in the grpc documentation
The documentation for the Cloud Bigtable Emulator.

Definition at line 60 of file client_options.cc.

◆ ClientOptions() [2/2]

google::cloud::bigtable::v0::ClientOptions::ClientOptions ( std::shared_ptr< grpc::ChannelCredentials >  creds)
explicit

Connect to the production instance of Cloud Bigtable using creds.

This constructor always connects to the production instance of Cloud Bigtable, and can be used when the application default credentials are not configured in the environment where the application is running.

Definition at line 46 of file client_options.cc.

Member Function Documentation

◆ admin_endpoint()

std::string const& google::cloud::bigtable::v0::ClientOptions::admin_endpoint ( ) const
inline

Return the current endpoint for admin RPCs.

Definition at line 85 of file client_options.h.

◆ channel_arguments()

grpc::ChannelArguments google::cloud::bigtable::v0::ClientOptions::channel_arguments ( ) const
inline

Access all the channel arguments.

Definition at line 134 of file client_options.h.

◆ connection_pool_name()

std::string const& google::cloud::bigtable::v0::ClientOptions::connection_pool_name ( ) const
inline

Return the name of the connection pool.

Definition at line 110 of file client_options.h.

◆ connection_pool_size()

std::size_t google::cloud::bigtable::v0::ClientOptions::connection_pool_size ( ) const
inline

Definition at line 121 of file client_options.h.

◆ credentials()

std::shared_ptr<grpc::ChannelCredentials> google::cloud::bigtable::v0::ClientOptions::credentials ( ) const
inline

Return the current credentials.

Definition at line 124 of file client_options.h.

◆ data_endpoint()

std::string const& google::cloud::bigtable::v0::ClientOptions::data_endpoint ( ) const
inline

Return the current endpoint for data RPCs.

Definition at line 78 of file client_options.h.

◆ set_admin_endpoint()

ClientOptions& google::cloud::bigtable::v0::ClientOptions::set_admin_endpoint ( std::string  endpoint)
inline

Definition at line 86 of file client_options.h.

◆ set_channel_arguments()

ClientOptions& google::cloud::bigtable::v0::ClientOptions::set_channel_arguments ( grpc::ChannelArguments const &  channel_arguments)
inline

Set all the channel arguments.

Definition at line 139 of file client_options.h.

◆ set_connection_pool_name()

ClientOptions& google::cloud::bigtable::v0::ClientOptions::set_connection_pool_name ( std::string  name)
inline

Set the name of the connection pool.

gRPC typically opens a single connection for each destination. To improve performance, the Cloud Bigtable C++ client can open multiple connections to a given destination, but these connections are shared by all threads in the application. Sometimes the application may want even more segregation, for example, the application may want to use a different pool for high-priority requests vs. lower priority ones. Using different names creates segregated pools.

Definition at line 105 of file client_options.h.

◆ set_connection_pool_size()

ClientOptions & google::cloud::bigtable::v0::ClientOptions::set_connection_pool_size ( std::size_t  size)

Definition at line 75 of file client_options.cc.

◆ set_data_endpoint()

ClientOptions& google::cloud::bigtable::v0::ClientOptions::set_data_endpoint ( std::string  endpoint)
inline

Definition at line 79 of file client_options.h.

◆ SetCompressionAlgorithm()

void google::cloud::bigtable::v0::ClientOptions::SetCompressionAlgorithm ( grpc_compression_algorithm  algorithm)
inline

Set compression algorithm for channel.

Please see the docs for grpc::ChannelArguments::SetCompressionAlgorithm() on https://grpc.io/grpc/cpp/classgrpc_1_1_channel_arguments.html for more details.

Definition at line 153 of file client_options.h.

◆ SetCredentials()

ClientOptions& google::cloud::bigtable::v0::ClientOptions::SetCredentials ( std::shared_ptr< grpc::ChannelCredentials >  credentials)
inline

Definition at line 127 of file client_options.h.

◆ SetGrpclbFallbackTimeout()

template<typename Rep , typename Period >
google::cloud::Status google::cloud::bigtable::v0::ClientOptions::SetGrpclbFallbackTimeout ( std::chrono::duration< Rep, Period >  fallback_timeout)
inline

Set the grpclb fallback timeout with the timestamp fallback_timeout for the channel.

For example:

bigtable::ClientOptions::SetGrpclbFallbackTimeout(
std::chrono::milliseconds(5000))
std::chrono::seconds(5))
Template Parameters
Repa placeholder to match the Rep tparam for fallback_timeout, the semantics of this template parameter are documented in std::chrono::duration<> (in brief, the underlying arithmetic type used to store the number of ticks), for our purposes it is simply a formal parameter.
Perioda placeholder to match the Period tparam for fallback_timeout, the semantics of this template parameter are documented in std::chrono::duration<> (in brief, the length of the tick in seconds, expressed as a std::ratio<>), for our purposes it is simply a formal parameter.
See also
std::chrono::duration<> for more details.

Please see the docs for grpc::ChannelArguments::SetGrpclbFallbackTimeout() on https://grpc.io/grpc/cpp/classgrpc_1_1_channel_arguments.html for more details.

Definition at line 191 of file client_options.h.

◆ SetLoadBalancingPolicyName()

void google::cloud::bigtable::v0::ClientOptions::SetLoadBalancingPolicyName ( grpc::string const &  lb_policy_name)
inline

Set LB policy name.

Please see the docs for grpc::ChannelArguments::SetLoadBalancingPolicyName() on https://grpc.io/grpc/cpp/classgrpc_1_1_channel_arguments.html for more details.

Definition at line 263 of file client_options.h.

◆ SetMaxReceiveMessageSize()

void google::cloud::bigtable::v0::ClientOptions::SetMaxReceiveMessageSize ( int  size)
inline

Set the max receive message size in bytes.

-1 means unlimited.

Please see the docs for grpc::ChannelArguments::SetMaxReceiveMessageSize() on https://grpc.io/grpc/cpp/classgrpc_1_1_channel_arguments.html for more details.

Definition at line 238 of file client_options.h.

◆ SetMaxSendMessageSize()

void google::cloud::bigtable::v0::ClientOptions::SetMaxSendMessageSize ( int  size)
inline

Set the max send message size in bytes.

-1 means unlimited.

Please see the docs for grpc::ChannelArguments::SetMaxSendMessageSize() on https://grpc.io/grpc/cpp/classgrpc_1_1_channel_arguments.html for more details.

Definition at line 250 of file client_options.h.

◆ SetResourceQuota()

void google::cloud::bigtable::v0::ClientOptions::SetResourceQuota ( grpc::ResourceQuota const &  resource_quota)
inline

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

Please see the docs for grpc::ChannelArguments::SetResourceQuota() on https://grpc.io/grpc/cpp/classgrpc_1_1_channel_arguments.html for more details.

Definition at line 226 of file client_options.h.

◆ SetServiceConfigJSON()

void google::cloud::bigtable::v0::ClientOptions::SetServiceConfigJSON ( grpc::string const &  service_config_json)
inline

Set service config in JSON form.

Please see the docs for grpc::ChannelArguments::SetServiceConfigJSON() on https://grpc.io/grpc/cpp/classgrpc_1_1_channel_arguments.html for more details.

Definition at line 275 of file client_options.h.

◆ SetSslTargetNameOverride()

void google::cloud::bigtable::v0::ClientOptions::SetSslTargetNameOverride ( grpc::string const &  name)
inline

Set target name override for SSL host name checking.

Please see the docs for grpc::ChannelArguments::SetSslTargetNameOverride() on https://grpc.io/grpc/cpp/classgrpc_1_1_channel_arguments.html for more details.

Definition at line 287 of file client_options.h.

◆ SetUserAgentPrefix()

void google::cloud::bigtable::v0::ClientOptions::SetUserAgentPrefix ( grpc::string const &  user_agent_prefix)
inline

Set the string to prepend to the user agent.

Please see the docs for grpc::ChannelArguments::SetUserAgentPrefix() on https://grpc.io/grpc/cpp/classgrpc_1_1_channel_arguments.html for more details.

Definition at line 214 of file client_options.h.

◆ UserAgentPrefix()

std::string google::cloud::bigtable::v0::ClientOptions::UserAgentPrefix ( )
static

Return the user agent prefix used by the library.

Definition at line 84 of file client_options.cc.

Friends And Related Function Documentation

◆ ClientOptionsTestTraits

friend struct ClientOptionsTestTraits
friend

Definition at line 296 of file client_options.h.