15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_CLIENT_OPTIONS_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_CLIENT_OPTIONS_H
18#include "google/cloud/bigtable/options.h"
19#include "google/cloud/bigtable/version.h"
20#include "google/cloud/background_threads.h"
21#include "google/cloud/common_options.h"
22#include "google/cloud/completion_queue.h"
23#include "google/cloud/grpc_options.h"
24#include "google/cloud/internal/algorithm.h"
25#include "google/cloud/options.h"
26#include "google/cloud/status.h"
27#include "google/cloud/tracing_options.h"
28#include "absl/strings/str_split.h"
29#include <grpcpp/grpcpp.h>
30#include <grpcpp/resource_quota.h>
38GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
45
46
47
48
49
50
51
52
53
54
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83 GOOGLE_CLOUD_CPP_DEPRECATED(
"use `google::cloud::Options` instead")
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103 GOOGLE_CLOUD_CPP_DEPRECATED(
"use `google::cloud::Options` directly instead")
107
108
109
110
111
112
113
114
115
116
117
118 GOOGLE_CLOUD_CPP_DEPRECATED(
119 "use `google::cloud::Options` with `google::cloud::GrpcCredentialOption` "
121 explicit ClientOptions(std::shared_ptr<grpc::ChannelCredentials> creds);
124
125
126
127
128
129 GOOGLE_CLOUD_CPP_DEPRECATED(
130 "use `google::cloud::Options` with `google::cloud::EndpointOption` "
137
138
139
140
141
142 GOOGLE_CLOUD_CPP_DEPRECATED(
143 "use `google::cloud::Options` with `google::cloud::EndpointOption` "
151
152
153
154
155
156 GOOGLE_CLOUD_CPP_DEPRECATED(
157 "use `google::cloud::Options` with `google::cloud::EndpointOption` "
164
165
166
167
168
169 GOOGLE_CLOUD_CPP_DEPRECATED(
170 "use `google::cloud::Options` with `google::cloud::EndpointOption` "
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195 GOOGLE_CLOUD_CPP_DEPRECATED(
196 "use `google::cloud::Options` with "
197 "`google::cloud::GrpcChannelArgumentsOption` or "
198 "`google::cloud::GrpcChannelArgumentsNativeOption` instead")
200 connection_pool_name_ = std::move(name);
205
206
207
208
209
210
211 GOOGLE_CLOUD_CPP_DEPRECATED(
212 "use `google::cloud::Options` with "
213 "`google::cloud::GrpcChannelArgumentsOption` or "
214 "`google::cloud::GrpcChannelArgumentsNativeOption` instead")
216 return connection_pool_name_;
220
221
222
223
224
225
226
227
228 GOOGLE_CLOUD_CPP_DEPRECATED(
229 "use `google::cloud::Options` with "
230 "`google::cloud::GrpcNumChannelsOption` instead")
234
235
236
237
238
239 GOOGLE_CLOUD_CPP_DEPRECATED(
240 "use `google::cloud::Options` with "
241 "`google::cloud::GrpcNumChannelsOption` instead")
247
248
249
250
251
252 GOOGLE_CLOUD_CPP_DEPRECATED(
253 "use `google::cloud::Options` with "
254 "`google::cloud::GrpcCredentialOption` instead")
255 std::shared_ptr<grpc::ChannelCredentials>
credentials()
const {
260
261
262
263
264
265 GOOGLE_CLOUD_CPP_DEPRECATED(
266 "use `google::cloud::Options` with "
267 "`google::cloud::GrpcCredentialOption` instead")
269 std::shared_ptr<grpc::ChannelCredentials> credentials) {
275
276
277
278
279
280
281 GOOGLE_CLOUD_CPP_DEPRECATED(
282 "use `google::cloud::Options` with "
283 "`google::cloud::GrpcChannelArgumentsOption` or "
284 "`google::cloud::GrpcChannelArgumentsNativeOption` instead")
286 return ::
google::
cloud::internal::MakeChannelArguments(opts_);
290
291
292
293
294
295 GOOGLE_CLOUD_CPP_DEPRECATED(
296 "use `google::cloud::Options` with "
297 "`google::cloud::GrpcChannelArgumentsNativeOption` instead")
299 grpc::ChannelArguments
const& channel_arguments) {
305
306
307
308
309
310
311
312
313
314 GOOGLE_CLOUD_CPP_DEPRECATED(
315 "use `google::cloud::Options` with "
316 "`google::cloud::GrpcChannelArgumentsNativeOption` instead")
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358 template <
typename Rep,
typename Period>
359 GOOGLE_CLOUD_CPP_DEPRECATED(
360 "use `google::cloud::Options` with "
361 "`google::cloud::GrpcChannelArgumentsNativeOption` instead")
363 std::chrono::duration<Rep, Period> fallback_timeout) {
364 std::chrono::milliseconds ft_ms =
365 std::chrono::duration_cast<std::chrono::milliseconds>(fallback_timeout);
367 if (ft_ms.count() > std::numeric_limits<
int>::max()) {
369 "The supplied duration is larger than the "
370 "maximum value allowed by gRPC (INT_MAX)");
372 auto fallback_timeout_ms =
static_cast<
int>(ft_ms.count());
374 fallback_timeout_ms);
379
380
381
382
383
384
385
386
387
388
389 GOOGLE_CLOUD_CPP_DEPRECATED(
390 "use `google::cloud::Options` with "
391 "`google::cloud::UserAgentProductsOption` "
392 "`google::cloud::GrpcChannelArgumentsNativeOption` instead")
399
400
401
402
403
404
405
406
407
408 GOOGLE_CLOUD_CPP_DEPRECATED(
409 "use `google::cloud::Options` with "
410 "`google::cloud::GrpcChannelArgumentsNativeOption` instead")
417
418
419
420
421
422
423
424
425
426
427 GOOGLE_CLOUD_CPP_DEPRECATED(
428 "use `google::cloud::Options` with "
429 "`google::cloud::GrpcChannelArgumentsNativeOption` instead")
436
437
438
439
440
441
442
443
444
445 GOOGLE_CLOUD_CPP_DEPRECATED(
446 "use `google::cloud::Options` with "
447 "`google::cloud::GrpcChannelArgumentsNativeOption` instead")
454
455
456
457
458
459
460
461
462
463
464 GOOGLE_CLOUD_CPP_DEPRECATED(
465 "use `google::cloud::Options` with "
466 "`google::cloud::GrpcChannelArgumentsNativeOption` instead")
473
474
475
476
477
478
479
480
481
482 GOOGLE_CLOUD_CPP_DEPRECATED(
483 "use `google::cloud::Options` with "
484 "`google::cloud::GrpcChannelArgumentsNativeOption` instead")
487 service_config_json);
491
492
493
494
495
496
497
498
499
500 GOOGLE_CLOUD_CPP_DEPRECATED(
501 "use `google::cloud::Options` with "
502 "`google::cloud::GrpcChannelArgumentsNativeOption` instead")
509 GOOGLE_CLOUD_CPP_DEPRECATED(
"Not intended for use in application code")
513
514
515
516
517
518
519
520
521
522 GOOGLE_CLOUD_CPP_DEPRECATED(
523 "use `google::cloud::Options` with "
524 "`google::cloud::TracingComponentsOption` instead")
531
532
533
534
535
536 GOOGLE_CLOUD_CPP_DEPRECATED(
537 "use `google::cloud::Options` with "
538 "`google::cloud::TracingComponentsOption` instead")
545
546
547
548
549
550 GOOGLE_CLOUD_CPP_DEPRECATED(
551 "use `google::cloud::Options` with "
552 "`google::cloud::TracingComponentsOption` instead")
559
560
561
562
563
564 GOOGLE_CLOUD_CPP_DEPRECATED(
565 "use `google::cloud::Options` with "
566 "`google::cloud::GrpcTracingOptionsOption` instead")
572
573
574
575
576
577
578 GOOGLE_CLOUD_CPP_DEPRECATED(
579 "use `google::cloud::Options` with `MinConnectionRefreshOption` and "
580 "`MaxConnectionRefreshOption` instead")
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601 GOOGLE_CLOUD_CPP_DEPRECATED(
602 "use `google::cloud::Options` with `MinConnectionRefreshOption` and "
603 "`MaxConnectionRefreshOption` instead")
607 min_conn_refresh_period = (std::min)(min_conn_refresh_period, period);
612
613
614
615
616
617
618 GOOGLE_CLOUD_CPP_DEPRECATED(
619 "use `google::cloud::Options` with `MinConnectionRefreshOption` and "
620 "`MaxConnectionRefreshOption` instead")
626
627
628
629
630
631
632
633
634
635
636
637
638
639 GOOGLE_CLOUD_CPP_DEPRECATED(
640 "use `google::cloud::Options` with `MinConnectionRefreshOption` and "
641 "`MaxConnectionRefreshOption` instead")
645 max_conn_refresh_period = (std::max)(max_conn_refresh_period, period);
650
651
652
653
654
655
656
657 GOOGLE_CLOUD_CPP_DEPRECATED(
658 "use `google::cloud::Options` with "
659 "`google::cloud::GrpcBackgroundThreadPoolSizeOption` instead")
666
667
668
669
670
671
672
673 GOOGLE_CLOUD_CPP_DEPRECATED(
674 "use `google::cloud::Options` with "
675 "`google::cloud::GrpcBackgroundThreadPoolSizeOption` instead")
681
682
683
684
685
686
687
688
689
690
691
692
693 GOOGLE_CLOUD_CPP_DEPRECATED(
694 "use `google::cloud::Options` with "
695 "`google::cloud::GrpcCompletionQueueOption` instead")
700
701
702
703
704
705 using BackgroundThreadsFactory = ::
google::
cloud::BackgroundThreadsFactory;
709 GOOGLE_CLOUD_CPP_DEPRECATED(
710 "Not intended for applications to use. There is no alternative "
711 "implemented or planned")
715 friend struct ClientOptionsTestTraits;
719 std::string
const& instance_admin_endpoint()
const {
723 std::string connection_pool_name_;
727GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
ValueTypeT< T > const & get() const
ValueTypeT< T > & lookup(ValueTypeT< T > value={})
Options & set(ValueTypeT< T > v)
Status(StatusCode code, std::string message, ErrorInfo info={})
Configuration options for the Bigtable Client.
Definition: client_options.h:55
static std::string UserAgentPrefix()
Return the user agent prefix used by the library.
ClientOptions & set_admin_endpoint(std::string endpoint)
Set the current endpoint for admin RPCs.
Definition: client_options.h:172
std::chrono::milliseconds max_conn_refresh_period()
Maximum connection refresh period, as set via set_max_conn_refresh_period
Definition: client_options.h:581
TracingOptions const & tracing_options() const
Return the options for use when tracing RPCs.
Definition: client_options.h:567
ClientOptions & set_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 fro...
Definition: client_options.h:604
ClientOptions & disable_tracing(std::string const &component)
Disable tracing for component in clients configured with this object.
Definition: client_options.h:553
void SetMaxReceiveMessageSize(int size)
Set the max receive message size in bytes.
Definition: client_options.h:430
void SetResourceQuota(grpc::ResourceQuota const &resource_quota)
Set the buffer pool to be attached to the constructed channel.
Definition: client_options.h:411
ClientOptions & set_channel_arguments(grpc::ChannelArguments const &channel_arguments)
Set all the channel arguments.
Definition: client_options.h:298
ClientOptions()
Initialize the client options.
std::shared_ptr< grpc::ChannelCredentials > credentials() const
Return the current credentials.
Definition: client_options.h:255
void SetCompressionAlgorithm(grpc_compression_algorithm algorithm)
Set compression algorithm for channel.
Definition: client_options.h:317
ClientOptions & DisableBackgroundThreads(google::cloud::CompletionQueue const &cq)
Configure the connection to use cq for all background work.
grpc::ChannelArguments channel_arguments() const
Access all the channel arguments.
Definition: client_options.h:285
std::size_t connection_pool_size() const
Return the size of the connection pool.
Definition: client_options.h:242
bool tracing_enabled(std::string const &component) const
Return whether tracing is enabled for the given component.
Definition: client_options.h:525
ClientOptions(std::shared_ptr< grpc::ChannelCredentials > creds)
Connect to the production instance of Cloud Bigtable using creds.
ClientOptions & set_connection_pool_name(std::string name)
Set the name of the connection pool.
Definition: client_options.h:199
std::chrono::milliseconds min_conn_refresh_period()
Minimum connection refresh period, as set via set_min_conn_refresh_period
Definition: client_options.h:621
void SetMaxSendMessageSize(int size)
Set the max send message size in bytes.
Definition: client_options.h:448
std::string const & data_endpoint() const
Return the current endpoint for data RPCs.
Definition: client_options.h:132
ClientOptions & set_min_conn_refresh_period(std::chrono::milliseconds period)
Configures the minimum connection refresh period.
Definition: client_options.h:642
BackgroundThreadsFactory background_threads_factory() const
std::string const & admin_endpoint() const
Return the current endpoint for admin RPCs.
Definition: client_options.h:159
void SetSslTargetNameOverride(grpc::string const &name)
Set target name override for SSL host name checking.
Definition: client_options.h:503
ClientOptions(Options opts)
Initialize the client options.
std::size_t background_thread_pool_size() const
Return the number of background threads.
Definition: client_options.h:676
ClientOptions & set_background_thread_pool_size(std::size_t s)
Set the number of background threads.
Definition: client_options.h:660
void SetLoadBalancingPolicyName(grpc::string const &lb_policy_name)
Set LB policy name.
Definition: client_options.h:467
void SetServiceConfigJSON(grpc::string const &service_config_json)
Set service config in JSON form.
Definition: client_options.h:485
ClientOptions & set_data_endpoint(std::string endpoint)
Set the current endpoint for data RPCs.
Definition: client_options.h:145
ClientOptions & enable_tracing(std::string const &component)
Enable tracing for component in clients configured with this object.
Definition: client_options.h:539
std::string const & connection_pool_name() const
Return the name of the connection pool.
Definition: client_options.h:215
void SetUserAgentPrefix(grpc::string const &user_agent_prefix)
Set the string to prepend to the user agent.
Definition: client_options.h:393
ClientOptions & set_connection_pool_size(std::size_t size)
Set the size of the connection pool.
google::cloud::Status SetGrpclbFallbackTimeout(std::chrono::duration< Rep, Period > fallback_timeout)
Set the grpclb fallback timeout with the timestamp fallback_timeout for the channel.
Definition: client_options.h:362
ClientOptions & SetCredentials(std::shared_ptr< grpc::ChannelCredentials > credentials)
Set the current credentials.
Definition: client_options.h:268
Contains all the Cloud Bigtable C++ client APIs.
Definition: admin_client.h:28
The endpoint for table admin operations.
Definition: options.h:93
The endpoint for data operations.
Definition: options.h:84
The endpoint for instance admin operations.
Definition: options.h:106
Maximum time in ms to refresh connections.
Definition: options.h:133
Minimum time in ms to refresh connections.
Definition: options.h:117