Implements the APIs to administer Cloud Bigtable instances.
Thread-safety
Instances of this class created via copy-construction or copy-assignment share the underlying pool of connections. Access to these copies via multiple threads is guaranteed to work. Two threads operating concurrently on the same instance of this class is not guaranteed to work.
Cost
Creating a new object of type InstanceAdmin
is comparable to creating a few objects of type std::string
or a few objects of type std::shared_ptr<int>
. The class represents a shallow handle to a remote object.
Error Handling
This class uses StatusOr
<T>
to report errors. When an operation fails to perform its work the returned StatusOr
<T>
contains the error details. If the ok()
member function in the StatusOr
<T>
returns true
then it contains the expected result. Operations that do not return a value simply return a google::cloud::Status
indicating success or the details of the error Please consult the StatusOr<T>
documentation for more details.```cpp
namespace cbt = google:☁️:bigtable;
namespace btadmin = google::bigtable::admin::v2;
cbt::InstanceAdmin admin = ...;
google:☁️:StatusOr<btadmin::Instance> instance = admin.GetInstance(...);
if (!instance) { std::cerr << "Error fetching instance\n"; return; }
// Use instance
as a smart pointer here, e.g.:
std::cout << "The full instance name is " << instance->name() << "\n";
In addition, the [main page](xref:index) contains examples using [`StatusOr`](xref:classgoogle_1_1cloud_1_1StatusOr)`<T>` to handle errors.
###### Retry, Backoff, and Idempotency Policies
The library automatically retries requests that fail with transient errors, and uses [truncated exponential backoff](https://cloud.google.com/storage/docs/exponential-backoff) to backoff between retries. The default policies are to continue retrying for up to 10 minutes. On each transient failure the backoff period is doubled, starting with an initial backoff of 100 milliseconds. The backoff period growth is truncated at 60 seconds. The default idempotency policy is to only retry idempotent operations. Note that most operations that change state are **not** idempotent.
The application can override these policies when constructing objects of this class. The documentation for the constructors show examples of this in action.
###### See Also
[https://cloud.google.com/bigtable/](https://cloud.google.com/bigtable/) for an overview of Cloud Bigtable.
###### See Also
[https://cloud.google.com/bigtable/docs/overview](https://cloud.google.com/bigtable/docs/overview) for an overview of the Cloud Bigtable data model.
###### See Also
[https://cloud.google.com/bigtable/docs/instances-clusters-nodes](https://cloud.google.com/bigtable/docs/instances-clusters-nodes) for an introduction of the main APIs into Cloud Bigtable.
###### See Also
[https://cloud.google.com/bigtable/docs/reference/service-apis-overview](https://cloud.google.com/bigtable/docs/reference/service-apis-overview) for an overview of the underlying Cloud Bigtable API.
###### See Also
[`google::cloud::StatusOr`](xref:classgoogle_1_1cloud_1_1StatusOr) for a description of the error reporting class used by this library.
###### See Also
[`LimitedTimeRetryPolicy`](xref:classgoogle_1_1cloud_1_1bigtable_1_1LimitedTimeRetryPolicy) and [`LimitedErrorCountRetryPolicy`](xref:classgoogle_1_1cloud_1_1bigtable_1_1LimitedErrorCountRetryPolicy) for alternative retry policies.
###### See Also
[`ExponentialBackoffPolicy`](xref:classgoogle_1_1cloud_1_1bigtable_1_1ExponentialBackoffPolicy) to configure different parameters for the exponential backoff policy.
###### See Also
[`SafeIdempotentMutationPolicy`](xref:classgoogle_1_1cloud_1_1bigtable_1_1SafeIdempotentMutationPolicy) and [`AlwaysRetryMutationPolicy`](xref:classgoogle_1_1cloud_1_1bigtable_1_1AlwaysRetryMutationPolicy) for alternative idempotency policies.
Constructors
InstanceAdmin(std::shared_ptr< bigtable_admin::BigtableInstanceAdminConnection >, std::string)
Parameters | |
---|---|
Name | Description |
connection |
std::shared_ptr< bigtable_admin::BigtableInstanceAdminConnection >
|
project |
std::string
|
InstanceAdmin(std::shared_ptr< InstanceAdminClient >)
Parameter | |
---|---|
Name | Description |
client |
std::shared_ptr< InstanceAdminClient >
the interface to create grpc stubs, report errors, etc. |
InstanceAdmin(std::shared_ptr< InstanceAdminClient >, Policies &&...)
Create a new InstanceAdmin using explicit policies to handle RPC errors.
See Also
GenericPollingPolicy, ExponentialBackoffPolicy, LimitedErrorCountRetryPolicy, LimitedTimeRetryPolicy.
Parameters | |
---|---|
Name | Description |
client |
std::shared_ptr< InstanceAdminClient >
the interface to create grpc stubs, report errors, etc. |
policies |
Policies &&...
the set of policy overrides for this object. |
typename... |