Skip to content

Commit c1ce073

Browse files
authored
feat(generator): all bidir streams are experimental (#8471)
Change the bidirectional streaming RPCs to take a `ExperimentalTag` parameter. We are not certain if these APIs are ergonomic enough, and may want to change them for something easier to use. Until we make these decisions, it seems sad to keep all the other RPCs from reaching "GA" status. In the case of BigQuery, the overall library is GA, we don't want to revert the GA status based on a single RPC. This is not a breaking change, as none of the libraries affected by the change are GA. It does reset the clock for these libraries until T+28d.
1 parent c6f614d commit c1ce073

32 files changed

+88
-39
lines changed

generator/integration_tests/golden/golden_kitchen_sink_client.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ GoldenKitchenSinkClient::DoNothing(google::protobuf::Empty const& request, Optio
136136
std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
137137
google::test::admin::database::v1::AppendRowsRequest,
138138
google::test::admin::database::v1::AppendRowsResponse>>
139-
GoldenKitchenSinkClient::AsyncAppendRows(Options opts) {
139+
GoldenKitchenSinkClient::AsyncAppendRows(ExperimentalTag tag, Options opts) {
140140
internal::OptionsSpan span(
141141
internal::MergeOptions(std::move(opts), options_));
142-
return connection_->AsyncAppendRows();
142+
return connection_->AsyncAppendRows(std::move(tag));
143143
}
144144

145145
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END

generator/integration_tests/golden/golden_kitchen_sink_client.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_GOLDEN_KITCHEN_SINK_CLIENT_H
2121

2222
#include "generator/integration_tests/golden/golden_kitchen_sink_connection.h"
23+
#include "google/cloud/experimental_tag.h"
2324
#include "google/cloud/future.h"
2425
#include "google/cloud/options.h"
2526
#include "google/cloud/polling_policy.h"
@@ -363,7 +364,7 @@ class GoldenKitchenSinkClient {
363364
std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
364365
google::test::admin::database::v1::AppendRowsRequest,
365366
google::test::admin::database::v1::AppendRowsResponse>>
366-
AsyncAppendRows(Options opts = {});
367+
AsyncAppendRows(ExperimentalTag, Options opts = {});
367368

368369
private:
369370
std::shared_ptr<GoldenKitchenSinkConnection> connection_;

generator/integration_tests/golden/golden_kitchen_sink_connection.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ GoldenKitchenSinkConnection::DoNothing(
8383
std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
8484
google::test::admin::database::v1::AppendRowsRequest,
8585
google::test::admin::database::v1::AppendRowsResponse>>
86-
GoldenKitchenSinkConnection::AsyncAppendRows() {
86+
GoldenKitchenSinkConnection::AsyncAppendRows(ExperimentalTag) {
8787
return absl::make_unique<
8888
::google::cloud::internal::AsyncStreamingReadWriteRpcError<
8989
google::test::admin::database::v1::AppendRowsRequest,

generator/integration_tests/golden/golden_kitchen_sink_connection.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "generator/integration_tests/golden/internal/golden_kitchen_sink_retry_traits.h"
2424
#include "generator/integration_tests/golden/internal/golden_kitchen_sink_stub.h"
2525
#include "google/cloud/backoff_policy.h"
26+
#include "google/cloud/experimental_tag.h"
2627
#include "google/cloud/internal/async_read_write_stream_impl.h"
2728
#include "google/cloud/options.h"
2829
#include "google/cloud/status_or.h"
@@ -75,7 +76,7 @@ class GoldenKitchenSinkConnection {
7576
virtual std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
7677
google::test::admin::database::v1::AppendRowsRequest,
7778
google::test::admin::database::v1::AppendRowsResponse>>
78-
AsyncAppendRows();
79+
AsyncAppendRows(ExperimentalTag);
7980
};
8081

8182
std::shared_ptr<GoldenKitchenSinkConnection> MakeGoldenKitchenSinkConnection(

generator/integration_tests/golden/internal/golden_kitchen_sink_connection_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class GoldenKitchenSinkConnectionImpl
7878
std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
7979
google::test::admin::database::v1::AppendRowsRequest,
8080
google::test::admin::database::v1::AppendRowsResponse>>
81-
AsyncAppendRows() override;
81+
AsyncAppendRows(ExperimentalTag) override;
8282

8383
private:
8484
std::unique_ptr<golden::GoldenKitchenSinkRetryPolicy> retry_policy() {

generator/integration_tests/golden/internal/streaming.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
2424
std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
2525
google::test::admin::database::v1::AppendRowsRequest,
2626
google::test::admin::database::v1::AppendRowsResponse>>
27-
GoldenKitchenSinkConnectionImpl::AsyncAppendRows() {
27+
GoldenKitchenSinkConnectionImpl::AsyncAppendRows(ExperimentalTag) {
2828
return stub_->AsyncAppendRows(
2929
background_->cq(), absl::make_unique<grpc::ClientContext>());
3030
}

generator/integration_tests/golden/mocks/mock_golden_kitchen_sink_connection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class MockGoldenKitchenSinkConnection : public golden::GoldenKitchenSinkConnecti
6262
MOCK_METHOD((std::unique_ptr<
6363
::google::cloud::AsyncStreamingReadWriteRpc<
6464
google::test::admin::database::v1::AppendRowsRequest, google::test::admin::database::v1::AppendRowsResponse>>),
65-
AsyncAppendRows, (), (override));
65+
AsyncAppendRows, (ExperimentalTag), (override));
6666
};
6767

6868
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END

generator/integration_tests/golden/tests/golden_kitchen_sink_client_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ TEST(GoldenKitchenSinkClientTest, AsyncAppendRows) {
318318
.set<UserAgentProductsOption>({"override-me"});
319319
});
320320

321-
EXPECT_CALL(*mock, AsyncAppendRows).WillOnce([] {
321+
EXPECT_CALL(*mock, AsyncAppendRows).WillOnce([](ExperimentalTag) {
322322
auto const& current = internal::CurrentOptions();
323323
EXPECT_TRUE(current.has<EndpointOption>());
324324
EXPECT_TRUE(current.has<GrpcTracingOptionsOption>());
@@ -358,6 +358,7 @@ TEST(GoldenKitchenSinkClientTest, AsyncAppendRows) {
358358
.set<EndpointOption>("test-endpoint")
359359
.set<UserAgentProductsOption>({"override-me-too"}));
360360
auto stream = client.AsyncAppendRows(
361+
ExperimentalTag{},
361362
Options{}.set<UserAgentProductsOption>({"test-only/1.0"}));
362363
ASSERT_TRUE(stream->Start().get());
363364
AppendRowsRequest request;

generator/integration_tests/golden/tests/golden_kitchen_sink_connection_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ TEST(GoldenKitchenSinkConnectionTest, AppendRowsError) {
309309
Status{StatusCode::kUnavailable, "try-again"});
310310
});
311311
auto conn = CreateTestingConnection(std::move(mock));
312-
auto stream = conn->AsyncAppendRows();
312+
auto stream = conn->AsyncAppendRows(ExperimentalTag{});
313313
ASSERT_FALSE(stream->Start().get());
314314
auto status = stream->Finish().get();
315315
EXPECT_THAT(status, StatusIs(StatusCode::kUnavailable, "try-again"));

generator/internal/client_generator.cc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,12 @@ Status ClientGenerator::GenerateHeader() {
7171

7272
// includes
7373
HeaderPrint("\n");
74-
HeaderLocalIncludes({vars("connection_header_path"), "google/cloud/future.h",
75-
"google/cloud/options.h",
76-
"google/cloud/polling_policy.h",
77-
"google/cloud/status_or.h", "google/cloud/version.h"});
74+
HeaderLocalIncludes(
75+
{vars("connection_header_path"),
76+
HasBidirStreamingMethod() ? "google/cloud/experimental_tag.h" : "",
77+
"google/cloud/future.h", "google/cloud/options.h",
78+
"google/cloud/polling_policy.h", "google/cloud/status_or.h",
79+
"google/cloud/version.h"});
7880
if (get_iam_policy_extension_ && set_iam_policy_extension_) {
7981
HeaderLocalIncludes({"google/cloud/iam_updater.h"});
8082
}
@@ -121,7 +123,7 @@ Status ClientGenerator::GenerateHeader() {
121123
std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
122124
$request_type$,
123125
$response_type$>>
124-
Async$method_name$(Options opts = {});
126+
Async$method_name$(ExperimentalTag, Options opts = {});
125127
)""");
126128
continue;
127129
}
@@ -358,10 +360,10 @@ Status ClientGenerator::GenerateCc() {
358360
std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
359361
$request_type$,
360362
$response_type$>>
361-
$client_class_name$::Async$method_name$(Options opts) {
363+
$client_class_name$::Async$method_name$(ExperimentalTag tag, Options opts) {
362364
internal::OptionsSpan span(
363365
internal::MergeOptions(std::move(opts), options_));
364-
return connection_->Async$method_name$();
366+
return connection_->Async$method_name$(std::move(tag));
365367
}
366368
)""");
367369
continue;

0 commit comments

Comments
 (0)