Skip to content

Commit 7214e38

Browse files
committed
fixup: use helloworld API
1 parent 9b3f183 commit 7214e38

File tree

4 files changed

+21
-23
lines changed

4 files changed

+21
-23
lines changed

examples/cpp/flow_control/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ cc_binary(
2121
deps = [
2222
"//:grpc++",
2323
"//:grpc++_reflection",
24-
"//examples/protos:hellostreamingworld",
24+
"//examples/protos:helloworld_cc_grpc",
2525
"@com_google_absl//absl/flags:flag",
2626
"@com_google_absl//absl/flags:parse",
2727
],
@@ -34,7 +34,7 @@ cc_binary(
3434
deps = [
3535
"//:grpc++",
3636
"//:grpc++_reflection",
37-
"//examples/protos:hellostreamingworld",
37+
"//examples/protos:helloworld_cc_grpc",
3838
"@com_google_absl//absl/flags:flag",
3939
"@com_google_absl//absl/flags:parse",
4040
],

examples/cpp/flow_control/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/cpp/flow_control/server_flow_control_client.cc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
#include <grpcpp/grpcpp.h>
2828

2929
#ifdef BAZEL_BUILD
30-
#include "examples/protos/hellostreamingworld.grpc.pb.h"
30+
#include "examples/protos/helloworld.grpc.pb.h"
3131
#else
32-
#include "hellostreamingworld.grpc.pb.h"
32+
#include "helloworld.grpc.pb.h"
3333
#endif
3434

3535
ABSL_FLAG(std::string, target, "localhost:50051", "Server address");
@@ -39,8 +39,7 @@ ABSL_FLAG(bool, bdp_probe, false,
3939

4040
namespace {
4141

42-
class Reader final
43-
: public grpc::ClientReadReactor<hellostreamingworld::HelloReply> {
42+
class Reader final : public grpc::ClientReadReactor<helloworld::HelloReply> {
4443
public:
4544
void Start() {
4645
StartRead(&res_);
@@ -74,7 +73,7 @@ class Reader final
7473
private:
7574
absl::Mutex mu_;
7675
absl::optional<grpc::Status> result_;
77-
hellostreamingworld::HelloReply res_;
76+
helloworld::HelloReply res_;
7877
};
7978

8079
} // namespace
@@ -91,12 +90,12 @@ int main(int argc, char* argv[]) {
9190
auto channel = grpc::CreateCustomChannel(absl::GetFlag(FLAGS_target),
9291
grpc::InsecureChannelCredentials(),
9392
channel_arguments);
94-
auto greeter = hellostreamingworld::MultiGreeter::NewStub(channel);
93+
auto greeter = helloworld::Greeter::NewStub(channel);
9594
grpc::ClientContext ctx;
96-
hellostreamingworld::HelloRequest req;
95+
helloworld::HelloRequest req;
9796
req.set_name("World");
9897
Reader reader;
99-
greeter->async()->sayHello(&ctx, &req, &reader);
98+
greeter->async()->SayHelloStreamReply(&ctx, &req, &reader);
10099
reader.Start();
101100
auto status = reader.WaitForDone();
102101
if (status.ok()) {

examples/cpp/flow_control/server_flow_control_server.cc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
#include <grpcpp/support/status.h>
3131

3232
#ifdef BAZEL_BUILD
33-
#include "examples/protos/hellostreamingworld.grpc.pb.h"
33+
#include "examples/protos/helloworld.grpc.pb.h"
3434
#else
35-
#include "hellostreamingworld.grpc.pb.h"
35+
#include "helloworld.grpc.pb.h"
3636
#endif
3737

3838
ABSL_FLAG(uint16_t, port, 50051, "Server port for the service");
@@ -53,7 +53,7 @@ namespace {
5353
* previous one is done.
5454
*/
5555
class HelloReactor final
56-
: public grpc::ServerWriteReactor<hellostreamingworld::HelloReply> {
56+
: public grpc::ServerWriteReactor<helloworld::HelloReply> {
5757
public:
5858
HelloReactor(size_t message_size, size_t to_send)
5959
: messages_to_send_(to_send) {
@@ -88,21 +88,20 @@ class HelloReactor final
8888
void OnDone() override { delete this; }
8989

9090
private:
91-
hellostreamingworld::HelloReply res_;
91+
helloworld::HelloReply res_;
9292
size_t messages_to_send_;
9393
absl::optional<absl::Time> write_start_time_;
9494
absl::Mutex mu_;
9595
};
9696

97-
class GreeterService final
98-
: public hellostreamingworld::MultiGreeter::CallbackService {
97+
class GreeterService final : public helloworld::Greeter::CallbackService {
9998
public:
10099
GreeterService(size_t message_size, size_t to_send)
101100
: message_size_(message_size), to_send_(to_send) {}
102101

103-
grpc::ServerWriteReactor<hellostreamingworld::HelloReply>* sayHello(
102+
grpc::ServerWriteReactor<helloworld::HelloReply>* SayHelloStreamReply(
104103
grpc::CallbackServerContext* /*context*/,
105-
const hellostreamingworld::HelloRequest* request) override {
104+
const helloworld::HelloRequest* request) override {
106105
return new HelloReactor(message_size_, to_send_);
107106
}
108107

0 commit comments

Comments
 (0)