Google Cloud Bigtable C++ Client  2.4.0
A C++ Client Library for Google Cloud Bigtable
options.h
Go to the documentation of this file.
1 // Copyright 2021 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_OPTIONS_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_OPTIONS_H
17 
18 /**
19  * @file
20  *
21  * This file defines options to be used with instances of
22  * `google::cloud::Options`. By convention options are named with an "Option"
23  * suffix. As the name would imply, all options are optional, and leaving them
24  * unset will result in a reasonable default being chosen.
25  *
26  * Not all options are meaningful to all functions that accept a
27  * `google::cloud::Options` instance. Each function that accepts a
28  * `google::cloud::Options` should document which options it expects. This is
29  * typically done by indicating lists of options using "OptionList" aliases.
30  * For example, a function may indicate that users may set any option in
31  * `ClientOptionList`.
32  *
33  * @note Unrecognized options are allowed and will be ignored. To debug issues
34  * with options set `GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes` in the environment
35  * and unexpected options will be logged.
36  *
37  * @see `google::cloud::CommonOptionList`
38  * @see `google::cloud::GrpcOptionList`
39  */
40 
41 #include "google/cloud/bigtable/idempotent_mutation_policy.h"
42 #include "google/cloud/bigtable/rpc_retry_policy.h"
43 #include "google/cloud/bigtable/version.h"
44 #include "google/cloud/backoff_policy.h"
45 #include "google/cloud/options.h"
46 #include <chrono>
47 #include <string>
48 
49 namespace google {
50 namespace cloud {
51 namespace bigtable {
53 
54 /**
55  * The application profile id.
56  *
57  * An application profile, or app profile, stores settings that tell your Cloud
58  * Bigtable instance how to handle incoming requests from an application. When
59  * an applications connects to a Bigtable instance, it can specify an app
60  * profile, and Bigtable uses that app profile for requests that the application
61  * sends over that connection.
62  *
63  * This option is always used in conjunction with a `bigtable::Table`. The app
64  * profile belongs to the table's instance, with an id given by the value of
65  * this option.
66  *
67  * @see https://cloud.google.com/bigtable/docs/app-profiles for an overview of
68  * app profiles.
69  *
70  * @see https://cloud.google.com/bigtable/docs/replication-overview#app-profiles
71  * for how app profiles are used to achieve replication.
72  */
74  using Type = std::string;
75 };
76 
77 /**
78  * The endpoint for data operations.
79  *
80  * @deprecated Please use `google::cloud::EndpointOption` instead.
81  */
83  using Type = std::string;
84 };
85 
86 /**
87  * The endpoint for table admin operations.
88  *
89  * @deprecated Please use `google::cloud::EndpointOption` instead.
90  */
92  using Type = std::string;
93 };
94 
95 /**
96  * The endpoint for instance admin operations.
97  *
98  * In most scenarios this should have the same value as `AdminEndpointOption`.
99  * The most common exception is testing, where the emulator for instance admin
100  * operations may be different than the emulator for admin and data operations.
101  *
102  * @deprecated Please use `google::cloud::EndpointOption` instead.
103  */
105  using Type = std::string;
106 };
107 
108 /**
109  * Minimum time in ms to refresh connections.
110  *
111  * The server will not disconnect idle connections before this time.
112  */
114  using Type = std::chrono::milliseconds;
115 };
116 
117 /**
118  * Maximum time in ms to refresh connections.
119  *
120  * The server will disconnect idle connections before this time. The
121  * connections will not be automatically refreshed in the background if this
122  * value is set to `0`.
123  *
124  * @note If this value is less than the value of `MinConnectionRefreshOption`,
125  * it will be set to the value of `MinConnectionRefreshOption`.
126  */
128  using Type = std::chrono::milliseconds;
129 };
130 
131 /// The complete list of options accepted by `bigtable::*Client`
132 using ClientOptionList =
136 
137 using DataRetryPolicy = ::google::cloud::internal::TraitBasedRetryPolicy<
138  bigtable::internal::SafeGrpcRetry>;
139 
140 using DataLimitedTimeRetryPolicy =
141  ::google::cloud::internal::LimitedTimeRetryPolicy<
142  bigtable::internal::SafeGrpcRetry>;
143 
144 using DataLimitedErrorCountRetryPolicy =
145  ::google::cloud::internal::LimitedErrorCountRetryPolicy<
146  bigtable::internal::SafeGrpcRetry>;
147 
148 /// Option to configure the retry policy used by `Table`.
150  using Type = std::shared_ptr<DataRetryPolicy>;
151 };
152 
153 /// Option to configure the backoff policy used by `Table`.
155  using Type = std::shared_ptr<BackoffPolicy>;
156 };
157 
158 /// Option to configure the idempotency policy used by `Table`.
160  using Type = std::shared_ptr<bigtable::IdempotentMutationPolicy>;
161 };
162 
163 using DataPolicyOptionList =
166 
168 } // namespace bigtable
169 } // namespace cloud
170 } // namespace google
171 
172 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_OPTIONS_H