Skip to content

Commit bf23454

Browse files
authored
cleanup(pubsub): use generator for *Stub (#10075)
1 parent 0c2859c commit bf23454

48 files changed

Lines changed: 449 additions & 2820 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codecov.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ ignore:
1616
- "google/cloud/bigtable/internal/bigtable_stub.cc"
1717
- "google/cloud/bigtable/internal/bigtable_stub.h"
1818
- "google/cloud/bigtable/admin"
19+
- "google/cloud/pubsub/internal/*_auth_decorator.cc"
20+
- "google/cloud/pubsub/internal/*_auth_decorator.h"
21+
- "google/cloud/pubsub/internal/*_logging_decorator.cc"
22+
- "google/cloud/pubsub/internal/*_logging_decorator.h"
23+
- "google/cloud/pubsub/internal/*_metadata_decorator.cc"
24+
- "google/cloud/pubsub/internal/*_metadata_decorator.h"
25+
- "google/cloud/pubsub/internal/*_stub.cc"
26+
- "google/cloud/pubsub/internal/*_stub.h"
1927
- "google/cloud/pubsublite/admin_*"
2028
- "google/cloud/pubsublite/internal/*_auth_decorator.cc"
2129
- "google/cloud/pubsublite/internal/*_auth_decorator.h"

ci/cloudbuild/builds/cmake-install.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ expected_dirs+=(
8181
./include/google/cloud/orgpolicy/v1
8282
# no RPC services in google/cloud/oslogin/common
8383
./include/google/cloud/oslogin/common
84-
./include/google/cloud/pubsub
85-
./include/google/cloud/pubsub/internal
8684
./include/google/cloud/pubsub/mocks
8785
# no gRPC services in google/cloud/recommender/logging
8886
./include/google/cloud/recommender/logging
@@ -103,8 +101,6 @@ expected_dirs+=(
103101
./include/google/identity/accesscontextmanager/type
104102
./include/google/logging/type
105103
./include/google/longrunning
106-
./include/google/pubsub
107-
./include/google/pubsub/v1
108104
./include/google/rpc
109105
./include/google/spanner/v1
110106
./include/google/type
@@ -114,7 +110,6 @@ expected_dirs+=(
114110
./lib64/cmake/google_cloud_cpp_googleapis
115111
./lib64/cmake/google_cloud_cpp_grafeas
116112
./lib64/cmake/google_cloud_cpp_grpc_utils
117-
./lib64/cmake/google_cloud_cpp_pubsub
118113
./lib64/cmake/google_cloud_cpp_rest_internal
119114
./lib64/cmake/google_cloud_cpp_spanner
120115
./lib64/pkgconfig

ci/etc/expected_install_directories

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@
281281
./include/google/cloud/profiler
282282
./include/google/cloud/profiler/internal
283283
./include/google/cloud/profiler/mocks
284+
./include/google/cloud/pubsub
285+
./include/google/cloud/pubsub/internal
284286
./include/google/cloud/pubsublite
285287
./include/google/cloud/pubsublite/internal
286288
./include/google/cloud/pubsublite/mocks
@@ -450,6 +452,8 @@
450452
./include/google/privacy
451453
./include/google/privacy/dlp
452454
./include/google/privacy/dlp/v2
455+
./include/google/pubsub
456+
./include/google/pubsub/v1
453457
./include/google/spanner
454458
./include/google/spanner/admin
455459
./include/google/spanner/admin/database
@@ -523,6 +527,7 @@
523527
./lib64/cmake/google_cloud_cpp_policytroubleshooter
524528
./lib64/cmake/google_cloud_cpp_privateca
525529
./lib64/cmake/google_cloud_cpp_profiler
530+
./lib64/cmake/google_cloud_cpp_pubsub
526531
./lib64/cmake/google_cloud_cpp_pubsublite
527532
./lib64/cmake/google_cloud_cpp_recommender
528533
./lib64/cmake/google_cloud_cpp_redis

ci/etc/full_feature_list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ oslogin
5959
policytroubleshooter
6060
privateca
6161
profiler
62+
pubsub
6263
pubsublite
6364
recommender
6465
redis

generator/generator_config.textproto

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,38 @@ service {
10971097
retryable_status_codes: ["kUnavailable"]
10981098
}
10991099

1100+
# Cloud Pub/Sub
1101+
service {
1102+
service_proto_path: "google/pubsub/v1/pubsub.proto"
1103+
product_path: "google/cloud/pubsub"
1104+
initial_copyright_year: "2022"
1105+
retryable_status_codes: []
1106+
omit_client: true
1107+
omit_connection: true
1108+
omit_stub_factory: true
1109+
omitted_rpcs: [
1110+
"Pull",
1111+
"Acknowledge",
1112+
"ModifyAckDeadline"
1113+
],
1114+
gen_async_rpcs: [
1115+
"StreamingPull",
1116+
"Acknowledge",
1117+
"ModifyAckDeadline",
1118+
"Publish"
1119+
]
1120+
}
1121+
1122+
service {
1123+
service_proto_path: "google/pubsub/v1/schema.proto"
1124+
product_path: "google/cloud/pubsub"
1125+
initial_copyright_year: "2022"
1126+
retryable_status_codes: []
1127+
omit_client: true
1128+
omit_connection: true
1129+
omit_stub_factory: true
1130+
}
1131+
11001132
# Pub/Sub Lite
11011133
service {
11021134
service_proto_path: "google/cloud/pubsublite/v1/admin.proto"

google/cloud/pubsub/CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,20 +268,11 @@ function (google_cloud_cpp_pubsub_client_define_tests)
268268
internal/extend_leases_with_retry_test.cc
269269
internal/flow_controlled_publisher_connection_test.cc
270270
internal/ordering_key_publisher_connection_test.cc
271-
internal/publisher_auth_test.cc
272-
internal/publisher_logging_test.cc
273-
internal/publisher_metadata_test.cc
274271
internal/publisher_round_robin_test.cc
275272
internal/rejects_with_ordering_key_test.cc
276-
internal/schema_auth_test.cc
277-
internal/schema_logging_test.cc
278-
internal/schema_metadata_test.cc
279273
internal/sequential_batch_sink_test.cc
280274
internal/session_shutdown_manager_test.cc
281275
internal/streaming_subscription_batch_source_test.cc
282-
internal/subscriber_auth_test.cc
283-
internal/subscriber_logging_test.cc
284-
internal/subscriber_metadata_test.cc
285276
internal/subscriber_round_robin_test.cc
286277
internal/subscription_concurrency_control_test.cc
287278
internal/subscription_lease_management_test.cc

google/cloud/pubsub/blocking_publisher_connection_test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ TEST(BlockingPublisherConnectionTest, Metadata) {
7474
.WillRepeatedly([&](grpc::ClientContext& context,
7575
google::pubsub::v1::PublishRequest const& request) {
7676
google::cloud::testing_util::ValidateMetadataFixture fixture;
77-
fixture.IsContextMDValid(context, "google.pubsub.v1.Publisher.Publish",
78-
request,
79-
google::cloud::internal::ApiClientHeader());
77+
fixture.IsContextMDValid(
78+
context, "google.pubsub.v1.Publisher.Publish", request,
79+
google::cloud::internal::ApiClientHeader("generator"));
8080
google::pubsub::v1::PublishResponse response;
8181
for (auto const& m : request.messages()) {
8282
response.add_message_ids("ack-" + m.message_id());

google/cloud/pubsub/internal/default_batch_sink_test.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "google/cloud/pubsub/testing/mock_publisher_stub.h"
1919
#include "google/cloud/pubsub/testing/test_retry_policies.h"
2020
#include "google/cloud/pubsub/topic.h"
21+
#include "google/cloud/internal/background_threads_impl.h"
2122
#include "google/cloud/testing_util/is_proto_equal.h"
2223
#include "google/cloud/testing_util/status_matchers.h"
2324
#include <gmock/gmock.h>

google/cloud/pubsub/internal/publisher_auth_decorator.cc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,35 @@
1-
// Copyright 2021 Google LLC
1+
// Copyright 2022 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
66
//
7-
// https://www.apache.org/licenses/LICENSE-2.0
7+
// https://www.apache.org/licenses/LICENSE-2.0
88
//
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// Generated by the Codegen C++ plugin.
16+
// If you make any local changes, they will be lost.
17+
// source: google/pubsub/v1/pubsub.proto
18+
1519
#include "google/cloud/pubsub/internal/publisher_auth_decorator.h"
16-
#include "google/cloud/internal/log_wrapper.h"
20+
#include <google/pubsub/v1/pubsub.grpc.pb.h>
21+
#include <memory>
1722

1823
namespace google {
1924
namespace cloud {
2025
namespace pubsub_internal {
2126
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
2227

28+
PublisherAuth::PublisherAuth(
29+
std::shared_ptr<google::cloud::internal::GrpcAuthenticationStrategy> auth,
30+
std::shared_ptr<PublisherStub> child)
31+
: auth_(std::move(auth)), child_(std::move(child)) {}
32+
2333
StatusOr<google::pubsub::v1::Topic> PublisherAuth::CreateTopic(
2434
grpc::ClientContext& context, google::pubsub::v1::Topic const& request) {
2535
auto status = auth_->ConfigureContext(context);

google/cloud/pubsub/internal/publisher_auth_decorator.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
1-
// Copyright 2021 Google LLC
1+
// Copyright 2022 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
66
//
7-
// https://www.apache.org/licenses/LICENSE-2.0
7+
// https://www.apache.org/licenses/LICENSE-2.0
88
//
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// Generated by the Codegen C++ plugin.
16+
// If you make any local changes, they will be lost.
17+
// source: google/pubsub/v1/pubsub.proto
18+
1519
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_INTERNAL_PUBLISHER_AUTH_DECORATOR_H
1620
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_INTERNAL_PUBLISHER_AUTH_DECORATOR_H
1721

1822
#include "google/cloud/pubsub/internal/publisher_stub.h"
19-
#include "google/cloud/pubsub/version.h"
2023
#include "google/cloud/internal/unified_grpc_credentials.h"
24+
#include "google/cloud/version.h"
2125
#include <memory>
26+
#include <set>
27+
#include <string>
2228

2329
namespace google {
2430
namespace cloud {
@@ -27,10 +33,10 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
2733

2834
class PublisherAuth : public PublisherStub {
2935
public:
36+
~PublisherAuth() override = default;
3037
PublisherAuth(
3138
std::shared_ptr<google::cloud::internal::GrpcAuthenticationStrategy> auth,
32-
std::shared_ptr<PublisherStub> child)
33-
: auth_(std::move(auth)), child_(std::move(child)) {}
39+
std::shared_ptr<PublisherStub> child);
3440

3541
StatusOr<google::pubsub::v1::Topic> CreateTopic(
3642
grpc::ClientContext& context,

0 commit comments

Comments
 (0)