Skip to content

Commit

Permalink
address review comments; add deprecated tags
Browse files Browse the repository at this point in the history
  • Loading branch information
dbolduc committed Sep 21, 2021
1 parent 7e40e18 commit 605c2a9
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion google/cloud/pubsub/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ add_library(
backoff_policy.h
connection_options.cc
connection_options.h
internal/backwards_compatibility_type.h
internal/batch_sink.h
internal/batching_publisher_connection.cc
internal/batching_publisher_connection.h
Expand All @@ -60,6 +59,7 @@ add_library(
internal/emulator_overrides.h
internal/flow_controlled_publisher_connection.cc
internal/flow_controlled_publisher_connection.h
internal/non_constructible.h
internal/ordering_key_publisher_connection.cc
internal/ordering_key_publisher_connection.h
internal/publisher_logging.cc
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/pubsub/google_cloud_cpp_pubsub.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ google_cloud_cpp_pubsub_hdrs = [
"application_callback.h",
"backoff_policy.h",
"connection_options.h",
"internal/backwards_compatibility_type.h",
"internal/batch_sink.h",
"internal/batching_publisher_connection.h",
"internal/create_channel.h",
Expand All @@ -30,6 +29,7 @@ google_cloud_cpp_pubsub_hdrs = [
"internal/defaults.h",
"internal/emulator_overrides.h",
"internal/flow_controlled_publisher_connection.h",
"internal/non_constructible.h",
"internal/ordering_key_publisher_connection.h",
"internal/publisher_logging.h",
"internal/publisher_metadata.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_INTERNAL_BACKWARDS_COMPATIBILITY_TYPE_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_INTERNAL_BACKWARDS_COMPATIBILITY_TYPE_H
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_INTERNAL_NON_CONSTRUCTIBLE_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_INTERNAL_NON_CONSTRUCTIBLE_H

#include "google/cloud/pubsub/version.h"
#include "google/cloud/options.h"
Expand All @@ -24,22 +24,21 @@ namespace pubsub_internal {
inline namespace GOOGLE_CLOUD_CPP_PUBSUB_NS {

/**
* This is a non-constructible type. It is used to disambiguate overloaded
* methods that are passed an empty initializer list.
* A type that is not constructible.
*
* See `MakeTopicAdminConnection()` for an example use case.
* This type can be used to disallow the instantiation of an object. We might
* use it, for example, to disambiguate overloaded methods that are passed an
* empty initializer list.
*/
struct BackwardsCompatibilityTypePleaseIgnore {
BackwardsCompatibilityTypePleaseIgnore() = delete;
BackwardsCompatibilityTypePleaseIgnore(
const BackwardsCompatibilityTypePleaseIgnore&) = delete;
BackwardsCompatibilityTypePleaseIgnore(
BackwardsCompatibilityTypePleaseIgnore&&) = delete;
struct NonConstructible {
NonConstructible() = delete;
NonConstructible(const NonConstructible&) = delete;
NonConstructible(NonConstructible&&) = delete;
};

} // namespace GOOGLE_CLOUD_CPP_PUBSUB_NS
} // namespace pubsub_internal
} // namespace cloud
} // namespace google

#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_INTERNAL_BACKWARDS_COMPATIBILITY_TYPE_H
#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_INTERNAL_NON_CONSTRUCTIBLE_H
3 changes: 1 addition & 2 deletions google/cloud/pubsub/topic_admin_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,7 @@ ListTopicSnapshotsRange TopicAdminConnection::ListTopicSnapshots(
}

std::shared_ptr<TopicAdminConnection> MakeTopicAdminConnection(
std::initializer_list<
pubsub_internal::BackwardsCompatibilityTypePleaseIgnore>) {
std::initializer_list<pubsub_internal::NonConstructible>) {
return MakeTopicAdminConnection();
}

Expand Down
16 changes: 10 additions & 6 deletions google/cloud/pubsub/topic_admin_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include "google/cloud/pubsub/backoff_policy.h"
#include "google/cloud/pubsub/connection_options.h"
#include "google/cloud/pubsub/internal/backwards_compatibility_type.h"
#include "google/cloud/pubsub/internal/non_constructible.h"
#include "google/cloud/pubsub/internal/publisher_stub.h"
#include "google/cloud/pubsub/retry_policy.h"
#include "google/cloud/pubsub/subscription.h"
Expand Down Expand Up @@ -162,13 +162,14 @@ class TopicAdminConnection {
/**
* Creates a new `TopicAdminConnection` object to work with `TopicAdminClient`.
*
* @warning This method exists solely for backwards compatibility. It prevents
* existing code, which calls `MakeTopicAdminConnection({})` from breaking,
* due to ambiguity. Please use `MakeTopicAdminConnection()` instead.
* @note This method exists solely for backwards compatibility. It prevents
* existing code that calls `MakeTopicAdminConnection({})` from breaking,
* due to ambiguity.
*
* @deprecated Please use `MakeTopicAdminConnection()` instead.
*/
std::shared_ptr<TopicAdminConnection> MakeTopicAdminConnection(
std::initializer_list<
pubsub_internal::BackwardsCompatibilityTypePleaseIgnore>);
std::initializer_list<pubsub_internal::NonConstructible>);

/**
* Creates a new `TopicAdminConnection` object to work with `TopicAdminClient`.
Expand Down Expand Up @@ -221,6 +222,9 @@ std::shared_ptr<TopicAdminConnection> MakeTopicAdminConnection(
* RPCs attempted.
* @param backoff_policy controls the backoff behavior between retry attempts,
* typically some form of exponential backoff with jitter.
*
* @deprecated Please use the `MakeTopicAdminConnection` method that accepts
* `google::cloud::Options` instead.
*/
std::shared_ptr<TopicAdminConnection> MakeTopicAdminConnection(
ConnectionOptions const& options,
Expand Down

0 comments on commit 605c2a9

Please sign in to comment.