Class ClientOptions (2.19.0)

Configuration options for the Bigtable Client.

Applications typically configure the client class using: ```cpp auto client = bigtable::Client(bigtable::ClientOptions().SetCredentials(...));


<aside class="deprecated"><b>Deprecated:</b>


Please use [`google::cloud::Options`](xref:classgoogle_1_1cloud_1_1Options) instead. 
</aside>

Constructors

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

See Also

grpc::GoogleDefaultCredentials in the grpc documentation

See Also

The documentation for the Cloud Bigtable Emulator.

Please use google::cloud::Options instead.

ClientOptions(Options)

Initialize the client options.

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

Parameter
NameDescription
opts Options

(optional) configuration options

ClientOptions(std::shared_ptr< grpc::ChannelCredentials >)

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.

Parameter
NameDescription
creds std::shared_ptr< grpc::ChannelCredentials >

gRPC authentication credentials

Functions

data_endpoint() const

Return the current endpoint for data RPCs.

Returns
TypeDescription
std::string const &

set_data_endpoint(std::string)

Set the current endpoint for data RPCs.

Parameter
NameDescription
endpoint std::string
Returns
TypeDescription
ClientOptions &

admin_endpoint() const

Return the current endpoint for admin RPCs.

Returns
TypeDescription
std::string const &

set_admin_endpoint(std::string)

Set the current endpoint for admin RPCs.

Parameter
NameDescription
endpoint std::string
Returns
TypeDescription
ClientOptions &

set_connection_pool_name(std::string)

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.

Parameter
NameDescription
name std::string
Returns
TypeDescription
ClientOptions &

connection_pool_name() const

Return the name of the connection pool.

Returns
TypeDescription
std::string const &

set_connection_pool_size(std::size_t)

Set the size of the connection pool.

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

Parameter
NameDescription
size std::size_t
Returns
TypeDescription
ClientOptions &

connection_pool_size() const

Return the size of the connection pool.

Returns
TypeDescription
std::size_t

credentials() const

Return the current credentials.

Returns
TypeDescription
std::shared_ptr< grpc::ChannelCredentials >

SetCredentials(std::shared_ptr< grpc::ChannelCredentials >)

Set the current credentials.

Parameter
NameDescription
credentials std::shared_ptr< grpc::ChannelCredentials >
Returns
TypeDescription
ClientOptions &

channel_arguments() const

Access all the channel arguments.

Returns
TypeDescription
grpc::ChannelArguments

set_channel_arguments(grpc::ChannelArguments const &)

Set all the channel arguments.

Parameter
NameDescription
channel_arguments grpc::ChannelArguments const &
Returns
TypeDescription
ClientOptions &

SetCompressionAlgorithm(grpc_compression_algorithm)

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.

Parameter
NameDescription
algorithm grpc_compression_algorithm
Returns
TypeDescription
void

SetGrpclbFallbackTimeout(std::chrono::duration< Rep, Period >)

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

For example:

bigtable::ClientOptions::SetGrpclbFallbackTimeout(
    std::chrono::milliseconds(5000))
bigtable::ClientOptions::SetGrpclbFallbackTimeout(
    std::chrono::seconds(5))
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.

Parameters
NameDescription
fallback_timeout std::chrono::duration< Rep, Period >
typename Rep

a 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.

typename Period

a 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.

Returns
TypeDescription
google::cloud::Status

SetUserAgentPrefix(grpc::string const &)

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.

Parameter
NameDescription
user_agent_prefix grpc::string const &
Returns
TypeDescription
void

SetResourceQuota(grpc::ResourceQuota const &)

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.

Parameter
NameDescription
resource_quota grpc::ResourceQuota const &
Returns
TypeDescription
void

SetMaxReceiveMessageSize(int)

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.

Parameter
NameDescription
size int
Returns
TypeDescription
void

SetMaxSendMessageSize(int)

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.

Parameter
NameDescription
size int
Returns
TypeDescription
void

SetLoadBalancingPolicyName(grpc::string const &)

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.

Parameter
NameDescription
lb_policy_name grpc::string const &
Returns
TypeDescription
void

SetServiceConfigJSON(grpc::string const &)

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.

Parameter
NameDescription
service_config_json grpc::string const &
Returns
TypeDescription
void

SetSslTargetNameOverride(grpc::string const &)

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.

Parameter
NameDescription
name grpc::string const &
Returns
TypeDescription
void

tracing_enabled(std::string const &) const

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.

Parameter
NameDescription
component std::string const &
Returns
TypeDescription
bool

enable_tracing(std::string const &)

Enable tracing for component in clients configured with this object.

Parameter
NameDescription
component std::string const &
Returns
TypeDescription
ClientOptions &

disable_tracing(std::string const &)

Disable tracing for component in clients configured with this object.

Parameter
NameDescription
component std::string const &
Returns
TypeDescription
ClientOptions &

tracing_options() const

Return the options for use when tracing RPCs.

Returns
TypeDescription
TracingOptions const &

max_conn_refresh_period()

Maximum connection refresh period, as set via set_max_conn_refresh_period

Returns
TypeDescription
std::chrono::milliseconds

set_max_conn_refresh_period(std::chrono::milliseconds)

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:

assert(min_conn_refresh_period() <= max_conn_refresh_period())
Parameter
NameDescription
period std::chrono::milliseconds
Returns
TypeDescription
ClientOptions &

min_conn_refresh_period()

Minimum connection refresh period, as set via set_min_conn_refresh_period

Returns
TypeDescription
std::chrono::milliseconds

set_min_conn_refresh_period(std::chrono::milliseconds)

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:

assert(min_conn_refresh_period() <= max_conn_refresh_period())
Parameter
NameDescription
period std::chrono::milliseconds
Returns
TypeDescription
ClientOptions &

set_background_thread_pool_size(std::size_t)

Set the number of background threads.

Parameter
NameDescription
s std::size_t
Returns
TypeDescription
ClientOptions &

background_thread_pool_size() const

Return the number of background threads.

Returns
TypeDescription
std::size_t

DisableBackgroundThreads(google::cloud::CompletionQueue const &)

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().

Parameter
NameDescription
cq google::cloud::CompletionQueue const &
Returns
TypeDescription
ClientOptions &

background_threads_factory() const

Returns
TypeDescription
BackgroundThreadsFactory

static UserAgentPrefix()

Return the user agent prefix used by the library.

Returns
TypeDescription
std::string

Type Aliases

BackgroundThreadsFactory

Alias Of: ::google::cloud::BackgroundThreadsFactory

Backwards compatibility alias.