Google Cloud Bigtable C++ Client 2.13.0
A C++ Client Library for Google Cloud Bigtable
Loading...
Searching...
No Matches
admin_client.h
1// Copyright 2017 Google Inc.
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_ADMIN_CLIENT_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_ADMIN_CLIENT_H
17
18#include "google/cloud/bigtable/admin/bigtable_table_admin_connection.h"
19#include "google/cloud/bigtable/client_options.h"
20#include "google/cloud/bigtable/internal/admin_client_params.h"
21#include "google/cloud/bigtable/version.h"
22#include "google/cloud/options.h"
23#include <memory>
24#include <string>
25
26namespace google {
27namespace cloud {
28namespace bigtable {
29GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
30
31/**
32 * Creates a `bigtable_admin::BigtableTableAdminConnection` and a
33 * `CompletionQueue` for `bigtable::TableAdmin` to use.
34 *
35 * This class is used to initiate a connection to the Cloud Bigtable Table
36 * Admin service. It is maintained only for backwards compatibility.
37 *
38 * @note Please prefer using `bigtable_admin::BigtableTableAdminConnection` to
39 * configure `bigtable_admin::BigtableTableAdminClient`, instead of using
40 * this class to configure `bigtable::TableAdmin`.
41 */
42class AdminClient final {
43 public:
44 /// The project id that this AdminClient works on.
45 std::string const& project() { return project_; };
46
47 private:
48 friend class TableAdmin;
49 friend std::shared_ptr<AdminClient> MakeAdminClient(std::string, Options);
50
51 AdminClient(std::string project, bigtable_internal::AdminClientParams params)
52 : project_(std::move(project)),
53 cq_(params.options.get<GrpcCompletionQueueOption>()),
54 background_threads_(std::move(params.background_threads)),
56 std::move(params.options))) {}
57
58 std::string project_;
60 std::shared_ptr<BackgroundThreads> background_threads_;
61 std::shared_ptr<bigtable_admin::BigtableTableAdminConnection> connection_;
62};
63
64/// Create a new table admin client configured via @p options.
65std::shared_ptr<AdminClient> MakeAdminClient(std::string project,
66 Options options = {});
67
68/**
69 * Create a new table admin client configured via @p options.
70 *
71 * @deprecated use the `MakeAdminClient` method which accepts
72 * `google::cloud::Options` instead.
73 */
74GOOGLE_CLOUD_CPP_DEPRECATED("use `MakeAdminClient` instead")
75std::shared_ptr<AdminClient> CreateDefaultAdminClient(std::string project,
76 ClientOptions options);
77
78GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
79} // namespace bigtable
80} // namespace cloud
81} // namespace google
82
83#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_ADMIN_CLIENT_H
ValueTypeT< T > const & get() const
std::string const & project()
The project id that this AdminClient works on.
Definition: admin_client.h:45
friend std::shared_ptr< AdminClient > MakeAdminClient(std::string, Options)
Create a new table admin client configured via options.
Configuration options for the Bigtable Client.
Definition: client_options.h:55
Implements the API to administer tables in a Cloud Bigtable instance.
Definition: table_admin.h:147
The BigtableTableAdminConnection object for BigtableTableAdminClient.
Definition: bigtable_table_admin_connection.h:64
Definition: bigtable_instance_admin_client.h:35
std::shared_ptr< BigtableTableAdminConnection > MakeBigtableTableAdminConnection(Options options={})
A factory function to construct an object of type BigtableTableAdminConnection.
Contains all the Cloud Bigtable C++ client APIs.
Definition: admin_client.h:28
std::shared_ptr< AdminClient > CreateDefaultAdminClient(std::string project, ClientOptions options)
Create a new table admin client configured via options.