Google Cloud Bigtable C++ Client 2.13.0
A C++ Client Library for Google Cloud Bigtable
Loading...
Searching...
No Matches
options.h
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
49namespace google {
50namespace cloud {
51namespace bigtable {
52GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
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 *
73 * @ingroup bigtable-options
74 */
75struct AppProfileIdOption {
76 using Type = std::string;
77};
78
79/**
80 * The endpoint for data operations.
81 *
82 * @deprecated Please use `google::cloud::EndpointOption` instead.
83 */
84struct DataEndpointOption {
85 using Type = std::string;
86};
87
88/**
89 * The endpoint for table admin operations.
90 *
91 * @deprecated Please use `google::cloud::EndpointOption` instead.
92 */
94 using Type = std::string;
95};
96
97/**
98 * The endpoint for instance admin operations.
99 *
100 * In most scenarios this should have the same value as `AdminEndpointOption`.
101 * The most common exception is testing, where the emulator for instance admin
102 * operations may be different than the emulator for admin and data operations.
103 *
104 * @deprecated Please use `google::cloud::EndpointOption` instead.
105 */
107 using Type = std::string;
108};
109
110/**
111 * Minimum time in ms to refresh connections.
112 *
113 * The server will not disconnect idle connections before this time.
114 *
115 * @ingroup bigtable-options
116 */
118 using Type = std::chrono::milliseconds;
119};
120
121/**
122 * Maximum time in ms to refresh connections.
123 *
124 * The server will disconnect idle connections before this time. The
125 * connections will not be automatically refreshed in the background if this
126 * value is set to `0`.
127 *
128 * @note If this value is less than the value of `MinConnectionRefreshOption`,
129 * it will be set to the value of `MinConnectionRefreshOption`.
130 *
131 * @ingroup bigtable-options
132 */
134 using Type = std::chrono::milliseconds;
135};
136
137/// The complete list of options accepted by `bigtable::*Client`
138using ClientOptionList =
142
143using DataRetryPolicy = ::google::cloud::internal::TraitBasedRetryPolicy<
144 bigtable::internal::SafeGrpcRetry>;
145
146using DataLimitedTimeRetryPolicy =
147 ::google::cloud::internal::LimitedTimeRetryPolicy<
148 bigtable::internal::SafeGrpcRetry>;
149
150using DataLimitedErrorCountRetryPolicy =
151 ::google::cloud::internal::LimitedErrorCountRetryPolicy<
152 bigtable::internal::SafeGrpcRetry>;
153
154/**
155 * Option to configure the retry policy used by `Table`.
156 *
157 * @ingroup bigtable-options
158 */
160 using Type = std::shared_ptr<DataRetryPolicy>;
161};
162
163/**
164 * Option to configure the backoff policy used by `Table`.
165 *
166 * @ingroup bigtable-options
167 */
169 using Type = std::shared_ptr<BackoffPolicy>;
170};
171
172/**
173 * Option to configure the idempotency policy used by `Table`.
174 *
175 * @ingroup bigtable-options
176 */
178 using Type = std::shared_ptr<bigtable::IdempotentMutationPolicy>;
179};
180
181using DataPolicyOptionList =
184
185GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
186} // namespace bigtable
187} // namespace cloud
188} // namespace google
189
190#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_OPTIONS_H
Defines the interface to control which mutations are idempotent and therefore can be re-tried.
Definition: idempotent_mutation_policy.h:31
Contains all the Cloud Bigtable C++ client APIs.
Definition: admin_client.h:28
The endpoint for table admin operations.
Definition: options.h:93
The application profile id.
Definition: options.h:75
Option to configure the backoff policy used by Table.
Definition: options.h:168
The endpoint for data operations.
Definition: options.h:84
Option to configure the retry policy used by Table.
Definition: options.h:159
Option to configure the idempotency policy used by Table.
Definition: options.h:177
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