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

Configuration options for the Bigtable Client. More...

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

Public Types

using BackgroundThreadsFactory = ::google::cloud::BackgroundThreadsFactory
 Backwards compatibility alias. More...
 

Public Member Functions

 ClientOptions ()
 Initialize the client options. More...
 
 ClientOptions (Options opts)
 Initialize the client options. 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)
 Set the current endpoint for data RPCs. More...
 
std::string const & admin_endpoint () const
 Return the current endpoint for admin RPCs. More...
 
ClientOptionsset_admin_endpoint (std::string endpoint)
 Set the current endpoint for admin RPCs. More...
 
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)
 Set the size of the connection pool. More...
 
std::size_t connection_pool_size () const
 Return the size of the connection pool. More...
 
std::shared_ptr< grpc::ChannelCredentials > credentials () const
 Return the current credentials. More...
 
ClientOptionsSetCredentials (std::shared_ptr< grpc::ChannelCredentials > credentials)
 Set the current credentials. More...
 
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...
 
bool tracing_enabled (std::string const &component) const
 Return whether tracing is enabled for the given component. More...
 
ClientOptionsenable_tracing (std::string const &component)
 Enable tracing for component in clients configured with this object. More...
 
ClientOptionsdisable_tracing (std::string const &component)
 Disable tracing for component in clients configured with this object. More...
 
TracingOptions const & tracing_options () const
 Return the options for use when tracing RPCs. More...
 
std::chrono::milliseconds max_conn_refresh_period ()
 Maximum connection refresh period, as set via set_max_conn_refresh_period More...
 
ClientOptionsset_max_conn_refresh_period (std::chrono::milliseconds period)
 If set to a positive number, the client will refresh connections at random moments not more apart from each other than this duration. More...
 
std::chrono::milliseconds min_conn_refresh_period ()
 Minimum connection refresh period, as set via set_min_conn_refresh_period More...
 
ClientOptionsset_min_conn_refresh_period (std::chrono::milliseconds period)
 Configures the minimum connection refresh period. More...
 
ClientOptionsset_background_thread_pool_size (std::size_t s)
 Set the number of background threads. More...
 
std::size_t background_thread_pool_size () const
 Return the number of background threads. More...
 
ClientOptionsDisableBackgroundThreads (google::cloud::CompletionQueue const &cq)
 Configure the connection to use cq for all background work. More...
 
BackgroundThreadsFactory background_threads_factory () const
 

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(...));
ClientOptions & SetCredentials(std::shared_ptr< grpc::ChannelCredentials > credentials)
Set the current credentials.
Deprecated:
Please use google::cloud::Options instead.

Definition at line 55 of file client_options.h.

Member Typedef Documentation

◆ BackgroundThreadsFactory

Backwards compatibility alias.

Deprecated:
Consider using google::cloud::BackgroundThreadsFactory directly

Definition at line 601 of file client_options.h.

Constructor & Destructor Documentation

◆ ClientOptions() [1/3]

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

Initialize the client options.

Configure the client to connect to the Cloud Bigtable service, using the default options.

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.
Deprecated:
Please use google::cloud::Options instead.

◆ ClientOptions() [2/3]

google::cloud::bigtable::ClientOptions::ClientOptions ( Options  opts)
explicit

Initialize the client options.

Expected options are any of the types in the following option lists.

Note
Unrecognized options will be ignored. To debug issues with options set GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes in the environment and unexpected options will be logged.
Parameters
opts(optional) configuration options
Deprecated:
Please use google::cloud::Options directly instead.

◆ ClientOptions() [3/3]

google::cloud::bigtable::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.

Parameters
credsgRPC authentication credentials
Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcCredentialOption instead.

Member Function Documentation

◆ admin_endpoint()

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

Return the current endpoint for admin RPCs.

Deprecated:
Please configure google::cloud::Options with bigtable::AdminEndpointOption and bigtable::InstanceAdminEndpointOption instead.

Definition at line 146 of file client_options.h.

◆ background_thread_pool_size()

std::size_t google::cloud::bigtable::ClientOptions::background_thread_pool_size ( ) const
inline

Return the number of background threads.

Note
This value is not used if DisableBackgroundThreads() is called.
Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcBackgroundThreadPoolSizeOption instead.

Definition at line 575 of file client_options.h.

◆ background_threads_factory()

BackgroundThreadsFactory google::cloud::bigtable::ClientOptions::background_threads_factory ( ) const

◆ channel_arguments()

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

Access all the channel arguments.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcChannelArgumentsOption or google::cloud::GrpcChannelArgumentsNativeOption instead.

Definition at line 246 of file client_options.h.

◆ connection_pool_name()

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

Return the name of the connection pool.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcChannelArgumentsOption or google::cloud::GrpcChannelArgumentsNativeOption instead.

Definition at line 192 of file client_options.h.

◆ connection_pool_size()

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

Return the size of the connection pool.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcNumChannelsOption instead.

Definition at line 213 of file client_options.h.

◆ credentials()

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

Return the current credentials.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcCredentialOption instead.

Definition at line 223 of file client_options.h.

◆ data_endpoint()

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

Return the current endpoint for data RPCs.

Deprecated:
Please configure google::cloud::Options with bigtable::DataEndpointOption instead.

Definition at line 124 of file client_options.h.

◆ disable_tracing()

ClientOptions& google::cloud::bigtable::ClientOptions::disable_tracing ( std::string const &  component)
inline

Disable tracing for component in clients configured with this object.

Deprecated:
Please configure google::cloud::Options with google::cloud::TracingComponentsOption instead.

Definition at line 473 of file client_options.h.

◆ DisableBackgroundThreads()

ClientOptions& google::cloud::bigtable::ClientOptions::DisableBackgroundThreads ( google::cloud::CompletionQueue const &  cq)

Configure the connection to use cq for all background work.

Connections need to perform background work on behalf of the application. Normally they just create a background thread and a CompletionQueue for this work, but the application may need more fine-grained control of their threads. In this case the application can provide the CompletionQueue and it assumes responsibility for creating one or more threads blocked on CompletionQueue::Run().

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcCompletionQueueOption instead.

◆ enable_tracing()

ClientOptions& google::cloud::bigtable::ClientOptions::enable_tracing ( std::string const &  component)
inline

Enable tracing for component in clients configured with this object.

Deprecated:
Please configure google::cloud::Options with google::cloud::TracingComponentsOption instead.

Definition at line 462 of file client_options.h.

◆ max_conn_refresh_period()

std::chrono::milliseconds google::cloud::bigtable::ClientOptions::max_conn_refresh_period ( )
inline

Maximum connection refresh period, as set via set_max_conn_refresh_period

Deprecated:
Please configure google::cloud::Options with bigtable::MinConnectionRefreshOption and bigtable::MaxConnectionRefreshOption instead.

Definition at line 495 of file client_options.h.

◆ min_conn_refresh_period()

std::chrono::milliseconds google::cloud::bigtable::ClientOptions::min_conn_refresh_period ( )
inline

Minimum connection refresh period, as set via set_min_conn_refresh_period

Deprecated:
Please configure google::cloud::Options with bigtable::MinConnectionRefreshOption and bigtable::MaxConnectionRefreshOption instead.

Definition at line 529 of file client_options.h.

◆ set_admin_endpoint()

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

Set the current endpoint for admin RPCs.

Deprecated:
Please configure google::cloud::Options with bigtable::AdminEndpointOption and bigtable::InstanceAdminEndpointOption instead.

Definition at line 157 of file client_options.h.

◆ set_background_thread_pool_size()

ClientOptions& google::cloud::bigtable::ClientOptions::set_background_thread_pool_size ( std::size_t  s)
inline

Set the number of background threads.

Note
This value is not used if DisableBackgroundThreads() is called.
Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcBackgroundThreadPoolSizeOption instead.

Definition at line 562 of file client_options.h.

◆ set_channel_arguments()

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

Set all the channel arguments.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcChannelArgumentsNativeOption instead.

Definition at line 256 of file client_options.h.

◆ set_connection_pool_name()

ClientOptions& google::cloud::bigtable::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.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcChannelArgumentsOption or google::cloud::GrpcChannelArgumentsNativeOption instead.

Definition at line 180 of file client_options.h.

◆ set_connection_pool_size()

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

Set the size of the connection pool.

Specifying 0 for size will set the size of the connection pool to default.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcNumChannelsOption instead.

◆ set_data_endpoint()

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

Set the current endpoint for data RPCs.

Deprecated:
Please configure google::cloud::Options with bigtable::DataEndpointOption instead.

Definition at line 134 of file client_options.h.

◆ set_max_conn_refresh_period()

ClientOptions& google::cloud::bigtable::ClientOptions::set_max_conn_refresh_period ( std::chrono::milliseconds  period)
inline

If set to a positive number, the client will refresh connections at random moments not more apart from each other than this duration.

This is necessary to avoid all connections simultaneously expiring and causing latency spikes.

If needed it changes max_conn_refresh_period() to preserve the invariant:

std::chrono::milliseconds max_conn_refresh_period()
Maximum connection refresh period, as set via set_max_conn_refresh_period
std::chrono::milliseconds min_conn_refresh_period()
Minimum connection refresh period, as set via set_min_conn_refresh_period
Deprecated:
Please configure google::cloud::Options with bigtable::MinConnectionRefreshOption and bigtable::MaxConnectionRefreshOption instead.

Definition at line 515 of file client_options.h.

◆ set_min_conn_refresh_period()

ClientOptions& google::cloud::bigtable::ClientOptions::set_min_conn_refresh_period ( std::chrono::milliseconds  period)
inline

Configures the minimum connection refresh period.

The library will wait at least this long before attempting any refresh operation.

If needed it changes max_conn_refresh_period() to preserve the invariant:

Deprecated:
Please configure google::cloud::Options with bigtable::MinConnectionRefreshOption and bigtable::MaxConnectionRefreshOption instead.

Definition at line 547 of file client_options.h.

◆ SetCompressionAlgorithm()

void google::cloud::bigtable::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.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcChannelArgumentsNativeOption instead.

Definition at line 272 of file client_options.h.

◆ SetCredentials()

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

Set the current credentials.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcCredentialOption instead.

Definition at line 233 of file client_options.h.

◆ SetGrpclbFallbackTimeout()

template<typename Rep , typename Period >
google::cloud::Status google::cloud::bigtable::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:

std::chrono::milliseconds(5000))
std::chrono::seconds(5))
ClientOptions()
Initialize the client options.
google::cloud::Status SetGrpclbFallbackTimeout(std::chrono::duration< Rep, Period > fallback_timeout)
Set the grpclb fallback timeout with the timestamp fallback_timeout for the channel.
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.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcChannelArgumentsNativeOption instead.

Definition at line 314 of file client_options.h.

◆ SetLoadBalancingPolicyName()

void google::cloud::bigtable::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.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcChannelArgumentsNativeOption instead.

Definition at line 403 of file client_options.h.

◆ SetMaxReceiveMessageSize()

void google::cloud::bigtable::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.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcChannelArgumentsNativeOption instead.

Definition at line 372 of file client_options.h.

◆ SetMaxSendMessageSize()

void google::cloud::bigtable::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.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcChannelArgumentsNativeOption instead.

Definition at line 387 of file client_options.h.

◆ SetResourceQuota()

void google::cloud::bigtable::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.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcChannelArgumentsNativeOption instead.

Definition at line 356 of file client_options.h.

◆ SetServiceConfigJSON()

void google::cloud::bigtable::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.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcChannelArgumentsNativeOption instead.

Definition at line 418 of file client_options.h.

◆ SetSslTargetNameOverride()

void google::cloud::bigtable::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.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcChannelArgumentsNativeOption instead.

Definition at line 433 of file client_options.h.

◆ SetUserAgentPrefix()

void google::cloud::bigtable::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.

Deprecated:
Please configure google::cloud::Options with google::cloud::UserAgentProductsOption or google::cloud::GrpcChannelArgumentsNativeOption instead.

Definition at line 341 of file client_options.h.

◆ tracing_enabled()

bool google::cloud::bigtable::ClientOptions::tracing_enabled ( std::string const &  component) const
inline

Return whether tracing is enabled for the given component.

The C++ clients can log interesting events to help library and application developers troubleshoot problems. This flag returns true if tracing should be enabled by clients configured with this option.

Deprecated:
Please configure google::cloud::Options with google::cloud::TracingComponentsOption instead.

Definition at line 451 of file client_options.h.

◆ tracing_options()

TracingOptions const& google::cloud::bigtable::ClientOptions::tracing_options ( ) const
inline

Return the options for use when tracing RPCs.

Deprecated:
Please configure google::cloud::Options with google::cloud::GrpcTracingOptionsOption instead.

Definition at line 484 of file client_options.h.

◆ UserAgentPrefix()

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

Return the user agent prefix used by the library.

Friends And Related Function Documentation

◆ ClientOptionsTestTraits

friend struct ClientOptionsTestTraits
friend

Definition at line 605 of file client_options.h.