-
Notifications
You must be signed in to change notification settings - Fork 440
impl(v3): remove deprecated Bigtable admin classes #15920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: prepare-for-v3.0.0
Are you sure you want to change the base?
Changes from all commits
f2f14c1
533b6b1
1e92685
abd3379
e947948
3b637d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -487,6 +487,122 @@ internal legacy files. | |||||||||||||||||
|
|
||||||||||||||||||
| </details> | ||||||||||||||||||
|
|
||||||||||||||||||
| <details> | ||||||||||||||||||
| <summary>Removed <code>bigtable::AdminClient</code> and <code>bigtable::TableAdmin</code></summary> | ||||||||||||||||||
|
|
||||||||||||||||||
| The `bigtable::AdminClient` class and `bigtable::TableAdmin` class have been | ||||||||||||||||||
| replaced with `bigtable_admin::BigtableTableAdminClient`. | ||||||||||||||||||
|
|
||||||||||||||||||
| **Before:** | ||||||||||||||||||
|
|
||||||||||||||||||
| ```cpp | ||||||||||||||||||
|
|
||||||||||||||||||
| std::shared_ptr<bigtable::AdminClient> admin_client = | ||||||||||||||||||
| bigtable::MakeAdminClient("project-id"); | ||||||||||||||||||
| auto table_admin = std::make_unique<bigtable::TableAdmin>( | ||||||||||||||||||
| admin_client, "instance-id"); | ||||||||||||||||||
|
|
||||||||||||||||||
| // Drop a selection of rows by key prefix. | ||||||||||||||||||
| auto result = table_admin.DropRowByPrefix("table-id", "row-key-prefix"); | ||||||||||||||||||
|
|
||||||||||||||||||
| // Drop all rows. | ||||||||||||||||||
| result = table_admin.DropAllRows("table-id"); | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| **After:** | ||||||||||||||||||
|
|
||||||||||||||||||
| ```cpp | ||||||||||||||||||
| #include "google/cloud/bigtable/admin/bigtable_table_admin_client.h" | ||||||||||||||||||
|
|
||||||||||||||||||
| auto table_admin = bigtable_admin::BigtableTableAdminClient( | ||||||||||||||||||
| bigtable_admin::MakeBigtableAdminConnection()); | ||||||||||||||||||
| auto table_name = bigtable::TableName("project-id", "instance-id", "table-id"); | ||||||||||||||||||
|
|
||||||||||||||||||
| // Drop a selection of rows by key prefix. | ||||||||||||||||||
| google::bigtable::admin::v2::DropRowRangeRequest drop_rows_by_prefix; | ||||||||||||||||||
| drop_rows_by_prefix.set_name(table_name); | ||||||||||||||||||
| drop_rows_by_prefix.set_row_key_prefix("row-key-prefix"); | ||||||||||||||||||
| auto result = table_admin.DropRowRange(drop_rows_by_prefix); | ||||||||||||||||||
|
|
||||||||||||||||||
| // Drop all rows. | ||||||||||||||||||
| google::bigtable::admin::v2::DropRowRangeRequest drop_all_rows; | ||||||||||||||||||
| drop_all_rows.set_name(table_name); | ||||||||||||||||||
| drop_all_rows.set_delete_all_data_from_table(true); | ||||||||||||||||||
| result = table_admin.DropRowRange(drop_all_rows); | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| </details> | ||||||||||||||||||
|
|
||||||||||||||||||
| <details><summary><code>WaitForConsistency</code> is now a free function</summary> | ||||||||||||||||||
|
|
||||||||||||||||||
| With the removal of the `bigtable::TableAdmin` class, `WaitForConsistency` has | ||||||||||||||||||
| been moved to `bigtable_admin::BigtableTableAdminClient::WaitForConsistency`. | ||||||||||||||||||
|
|
||||||||||||||||||
| **Before:** | ||||||||||||||||||
|
|
||||||||||||||||||
| ```cpp | ||||||||||||||||||
|
|
||||||||||||||||||
| std::shared_ptr<bigtable::AdminClient> admin_client = | ||||||||||||||||||
| bigtable::MakeAdminClient("project-id"); | ||||||||||||||||||
| auto table_admin = std::make_unique<bigtable::TableAdmin>( | ||||||||||||||||||
| admin_client, "instance-id"); | ||||||||||||||||||
|
|
||||||||||||||||||
| auto token = table_admin.GenerateConsistencyToken("table-id"); | ||||||||||||||||||
| if (!token) throw std::runtime_error(token.status().message()); | ||||||||||||||||||
| auto result = table_admin.WaitForConsistency("table-id", *token); | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| **After:** | ||||||||||||||||||
|
|
||||||||||||||||||
| ```cpp | ||||||||||||||||||
| #include "google/cloud/bigtable/admin/bigtable_table_admin_client.h" | ||||||||||||||||||
|
|
||||||||||||||||||
| auto connection = bigtable_admin::MakeBigtableAdminConnection(); | ||||||||||||||||||
| auto table_admin = bigtable_admin::BigtableTableAdminClient(connection); | ||||||||||||||||||
| auto table_name = bigtable::TableName("project-id", "instance-id", "table-id"); | ||||||||||||||||||
|
|
||||||||||||||||||
| auto token = table_admin.GenerateConsistencyToken(table_name); | ||||||||||||||||||
| if (!token) throw std::runtime_error(token.status().message()); | ||||||||||||||||||
|
|
||||||||||||||||||
| google::bigtable::admin::v2::CheckConsistencyRequest wait_request; | ||||||||||||||||||
| wait_request.set_name(table_name); | ||||||||||||||||||
| wait_request.set_consistency_token(token->consistency_token()); | ||||||||||||||||||
| auto wait_response = table_admin.WaitForConsistency(wait_request).get(); | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| </details> | ||||||||||||||||||
|
|
||||||||||||||||||
| <details> | ||||||||||||||||||
| <summary>Removed <code>bigtable::InstanceAdminClient</code> and <code>bigtable::InstanceAdmin</code></summary> | ||||||||||||||||||
|
|
||||||||||||||||||
| The `bigtable::InstanceAdminClient` class and `bigtable::InstanceAdmin` class | ||||||||||||||||||
| have been replaced with `bigtable_admin::BigtableInstanceAdminClient`. | ||||||||||||||||||
|
|
||||||||||||||||||
| **Before:** | ||||||||||||||||||
|
|
||||||||||||||||||
| ```cpp | ||||||||||||||||||
| auto instance_admin_client = bigtable::MakeInstanceAdminClient("project-id"); | ||||||||||||||||||
| auto instance_admin = | ||||||||||||||||||
| std::make_unique<bigtable::InstanceAdmin>(instance_admin_client); | ||||||||||||||||||
|
|
||||||||||||||||||
| auto clusters = instance_admin->ListClusters(); | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| **After:** | ||||||||||||||||||
|
|
||||||||||||||||||
| ```cpp | ||||||||||||||||||
| #include "google/cloud/bigtable/admin/bigtable_instance_admin_client.h" | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The example uses
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| auto instance_admin = | ||||||||||||||||||
| std::make_unique<bigtable_admin::BigtableInstanceAdminClient>( | ||||||||||||||||||
| bigtable_admin::MakeBigtableInstanceAdminConnection()); | ||||||||||||||||||
|
|
||||||||||||||||||
| auto clusters = instance_admin->ListClusters( | ||||||||||||||||||
| InstanceName("project-id", "instance-id")); | ||||||||||||||||||
|
Comment on lines
+600
to
+601
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The example for
Suggested change
|
||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| </details> | ||||||||||||||||||
|
|
||||||||||||||||||
| ### Pubsub | ||||||||||||||||||
|
|
||||||||||||||||||
| <details> | ||||||||||||||||||
|
|
||||||||||||||||||
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example for
WaitForConsistencyis a bit too brief. It retrieves theStatusOrfrom the future but doesn't demonstrate how to handle potential errors or use the result. Providing a more complete example would be beneficial for users migrating their code.