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(pubsub): configure TopicAdminConnection with Options #7336

Merged
merged 4 commits into from
Sep 21, 2021

Conversation

dbolduc
Copy link
Member

@dbolduc dbolduc commented Sep 20, 2021

Part of the work for #6306

This PR adds a method to configure TopicAdminConnection using g::c::Options. Users who might have relied on calling MakeTopicAdminConnection({}) will not be broken because of the introduction of a non-constructible backwards compatibility type. (Credit to @devbww for the idea and implementation).

This PR also adds Options alternatives for CreateDefaultPublisherStub() and CreateChannel(). The old methods are still used by the rest of the Make*Connection methods. Leaving them allows for incremental changes. I put in some TODO's to remind myself to remove the old methods when I am done, though.

FYI: The same work for TopicAdminConnection will also be done for:

  • PublisherConnection
  • SubscriberConnection
  • SubscriptionAdminConnection
  • SchemaAdminConnection

(I started with TopicAdminConnection, because it didn't seem that involved)


This change is Reviewable

@product-auto-label product-auto-label bot added the api: pubsub Issues related to the Pub/Sub API. label Sep 20, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Sep 20, 2021
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 12e9ae1f4b05d65f6c460edb66655529258b0552

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

@codecov
Copy link

codecov bot commented Sep 20, 2021

Codecov Report

Merging #7336 (605c2a9) into main (081289c) will increase coverage by 0.00%.
The diff coverage is 96.00%.

❗ Current head 605c2a9 differs from pull request most recent head d08faef. Consider uploading reports for the commit d08faef to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main    #7336   +/-   ##
=======================================
  Coverage   93.66%   93.67%           
=======================================
  Files        1352     1352           
  Lines      117092   117122   +30     
=======================================
+ Hits       109679   109711   +32     
+ Misses       7413     7411    -2     
Impacted Files Coverage Δ
google/cloud/pubsub/internal/publisher_stub.h 100.00% <ø> (ø)
google/cloud/pubsub/topic_admin_connection.cc 88.31% <87.50%> (-0.81%) ⬇️
google/cloud/pubsub/internal/create_channel.cc 100.00% <100.00%> (ø)
google/cloud/pubsub/internal/publisher_stub.cc 96.82% <100.00%> (+0.15%) ⬆️
google/cloud/pubsub/testing/test_retry_policies.cc 100.00% <100.00%> (ø)
google/cloud/pubsub/topic_admin_connection_test.cc 100.00% <100.00%> (ø)
google/cloud/pubsub/samples/samples.cc 91.97% <0.00%> (-0.08%) ⬇️
...ud/spanner/integration_tests/client_stress_test.cc 86.18% <0.00%> (+0.65%) ⬆️
google/cloud/pubsub/subscriber_connection_test.cc 97.91% <0.00%> (+0.69%) ⬆️
...le/cloud/storage/internal/curl_download_request.cc 89.25% <0.00%> (+1.11%) ⬆️

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 081289c...d08faef. Read the comment docs.

@dbolduc dbolduc marked this pull request as ready for review September 20, 2021 23:35
@dbolduc dbolduc requested a review from a team as a code owner September 20, 2021 23:35
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 7e40e18860e97185db06dc8d798e493de3a040d9

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

Copy link
Contributor

@devbww devbww left a comment

Choose a reason for hiding this comment

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

Reviewed 7 of 12 files at r1, 5 of 5 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dbolduc)


google/cloud/pubsub/topic_admin_connection.h, line 166 at r2 (raw file):

 *
 * @warning This method exists solely for backwards compatibility. It prevents
 *     existing code, which calls `MakeTopicAdminConnection({})` from breaking,

s/, which/that/


google/cloud/pubsub/internal/backwards_compatibility_type.h, line 23 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…

I agree that it could be useful in the future for other libraries.

My thinking was just that we could start with it in pubsub_internal, and only move it into g::c::internal if a use case in another library arises. I don't think that would constitute a breaking change, because nobody should be using the type.

I don't feel strongly either way, though.

OK ... leaving it until that other use case might arise sounds reasonable.


google/cloud/pubsub/internal/backwards_compatibility_type.h, line 32 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…

Do we like NonConstructibleTypePleaseIgnore?

I think I would just go with just NonConstructible (Unconstructible?), and limit the description to something about cases where we want to disallow the instantiation of an object. (Might it sometimes not be about backwards compatibility?) That is, I'd suggest leaving mention of "initializer list" for the particular case that uses the unconstructible type that way (and drop mention of MakeTopicAdminConnection()). I'd also drop the PleaseIgnore.

@coryan
Copy link
Contributor

coryan commented Sep 21, 2021


google/cloud/pubsub/internal/backwards_compatibility_type.h, line 32 at r1 (raw file):

Previously, devbww (Bradley White) wrote…

I think I would just go with just NonConstructible (Unconstructible?), and limit the description to something about cases where we want to disallow the instantiation of an object. (Might it sometimes not be about backwards compatibility?) That is, I'd suggest leaving mention of "initializer list" for the particular case that uses the unconstructible type that way (and drop mention of MakeTopicAdminConnection()). I'd also drop the PleaseIgnore.

👍 to what @devbww said.

@dbolduc
Copy link
Member Author

dbolduc commented Sep 21, 2021

/gcbrun

1 similar comment
@coryan
Copy link
Contributor

coryan commented Sep 21, 2021

/gcbrun

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 605c2a9f6e1c5c284b1c6c44c9afb2bcce14c358

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

Copy link
Contributor

@devbww devbww left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dbolduc)


google/cloud/pubsub/topic_admin_connection.h, line 165 at r3 (raw file):

 * Creates a new `TopicAdminConnection` object to work with `TopicAdminClient`.
 *
 * @note This method exists solely for backwards compatibility. It prevents

FYI, I believe we try to avoid the term "method" for C++.

@devbww
Copy link
Contributor

devbww commented Sep 21, 2021

/gcbrun

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: d08faef2fa7d94251632057c15b506c390c51fc1

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

@dbolduc dbolduc merged commit 796ad38 into googleapis:main Sep 21, 2021
@dbolduc dbolduc deleted the pubsub-to-options branch September 21, 2021 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub 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