Skip to content
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

feat(bigtable): add Make(Data,Admin,InstanceAdmin)Client methods that take Options #7226

Merged
merged 3 commits into from
Aug 27, 2021

Conversation

dbolduc
Copy link
Member

@dbolduc dbolduc commented Aug 26, 2021

Part of the work for #6307 (nearly there!)

This change

  1. introduces a conversion method to go from ClientOptions -> Options for backwards compatibility:
Options&& ClientOptions::ToOptions() &&
  1. introduces Make*Client(... , Options) methods to replace CreateDefault*Client(... , ClientOptions) methods.
  2. refactors internal::CommonClient implementation to use Options instead of ClientOptions

Still TODO on #6307, which I will address in subsequent PR's:

  • add an Options constructor to testing::Mock*Client
  • remove ClientOptions from testing::InProcess*Client
  • update calls to CreateDefault*Client in our examples/tests to use Make*Client instead

This change is Reviewable

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 26, 2021
@product-auto-label product-auto-label bot added the api: bigtable Issues related to the Bigtable API. label Aug 26, 2021
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: d26b0fddba8c06bf169d008358cffc9011e04d4c

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link

codecov bot commented Aug 26, 2021

Codecov Report

Merging #7226 (7ac9450) into main (d3a808e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##             main    #7226    +/-   ##
========================================
  Coverage   93.80%   93.81%            
========================================
  Files        1338     1338            
  Lines      114948   115118   +170     
========================================
+ Hits       107830   107994   +164     
- Misses       7118     7124     +6     
Impacted Files Coverage Δ
google/cloud/bigtable/admin_client.h 100.00% <ø> (ø)
google/cloud/bigtable/client_options.h 100.00% <ø> (ø)
google/cloud/bigtable/data_client.h 100.00% <ø> (ø)
google/cloud/bigtable/instance_admin_client.h 100.00% <ø> (ø)
google/cloud/bigtable/admin_client.cc 38.40% <100.00%> (+4.21%) ⬆️
google/cloud/bigtable/admin_client_test.cc 100.00% <100.00%> (ø)
google/cloud/bigtable/client_options.cc 100.00% <100.00%> (ø)
google/cloud/bigtable/client_options_test.cc 99.74% <100.00%> (+0.06%) ⬆️
google/cloud/bigtable/data_client.cc 85.00% <100.00%> (+1.98%) ⬆️
google/cloud/bigtable/data_client_test.cc 100.00% <100.00%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d3a808e...7ac9450. Read the comment docs.

@dbolduc dbolduc marked this pull request as ready for review August 26, 2021 18:23
@dbolduc dbolduc requested a review from a team as a code owner August 26, 2021 18:23
Copy link
Contributor

@coryan coryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some thoughts below, let me know what you think.

std::move(connection_pool_name_);
}
return std::move(opts_);
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: semi-colon ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -462,6 +462,16 @@ class ClientOptions {
using BackgroundThreadsFactory = ::google::cloud::BackgroundThreadsFactory;
BackgroundThreadsFactory background_threads_factory() const;

/// Consume this object and convert it to `Options`.
Options&& ToOptions() && {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something you want in the public API (and therefore maintain forever?) Consider adding a friend function in the internal namespace so it is not a public function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there was no reason to introduce a public function here.

/**
* Create a new data client configured via @p options.
*
* @deprecated use the `MakeDataClient` method which accepts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a issue to remind us that this should be labeled with a GOOGLE_CLOUD_CPP_DEPRECATED macro?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opened #7230

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 4fcd10c9d2929ce3ba90e7447433ab75a260deac

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 7ac94507eba40adeb26aca6dc7da940640b2cedd

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@dbolduc dbolduc merged commit b711471 into googleapis:main Aug 27, 2021
@dbolduc dbolduc deleted the bigtable-make-clients-with-options branch August 27, 2021 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the Bigtable API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants