Skip to content

Commit c2c0f96

Browse files
Trisfaldaspurio
authored andcommitted
adapted most languages to the new protobuf file
1 parent f838ae9 commit c2c0f96

File tree

23 files changed

+21
-22
lines changed

23 files changed

+21
-22
lines changed

cpp_asio_grpc_bench/main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void spawn_accept_loop(
4949
return;
5050
}
5151
helloworld::HelloReply response;
52-
response.set_message(context->request.name());
52+
*response.mutable_response() = context->request.request();
5353
auto &writer = context->writer;
5454
agrpc::finish(writer, response, grpc::Status::OK,
5555
boost::asio::bind_executor(
@@ -92,4 +92,4 @@ int main() {
9292
}
9393

9494
server->Shutdown();
95-
}
95+
}

cpp_grpc_mt_bench/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class ServerImpl final {
109109
new CallData(service_, cq_);
110110

111111
// The actual processing.
112-
reply_.set_message(request_.name());
112+
*reply_.mutable_response() = request_.request();
113113

114114
// And we are done! Let the gRPC runtime know we've finished, using the
115115
// memory address of this instance as the uniquely identifying tag for

cpp_grpc_st_bench/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class ServerImpl final {
101101
new CallData(service_, cq_);
102102

103103
// The actual processing.
104-
reply_.set_message(request_.name());
104+
*reply_.mutable_response() = request_.request();
105105

106106
// And we are done! Let the gRPC runtime know we've finished, using the
107107
// memory address of this instance as the uniquely identifying tag for

crystal_grpc_bench/src/server.cr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require "./protobufs/helloworld.pb"
66

77
class HelloWorldHandler < Helloworld::Greeter
88
def say_hello(request : Helloworld::HelloRequest) : Helloworld::HelloReply
9-
Helloworld::HelloReply.new(message: request.name)
9+
Helloworld::HelloReply.new(response: request.request)
1010
end
1111
end
1212

csharp_grpc_bench/GreeterServer/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class GreeterImpl : Greeter.GreeterBase
2424
// Server side handler of the SayHello RPC
2525
public override Task<HelloReply> SayHello(HelloRequest request, ServerCallContext context)
2626
{
27-
return Task.FromResult(new HelloReply { Message = request.Name });
27+
return Task.FromResult(new HelloReply { Response = request.Request });
2828
}
2929
}
3030

dotnet_grpc_bench/GreeterServer/Services/GreeterService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class GreeterService : Greeter.GreeterBase
2323
// Server side handler of the SayHello RPC
2424
public override Task<HelloReply> SayHello(HelloRequest request, ServerCallContext context)
2525
{
26-
return Task.FromResult(new HelloReply { Message = request.Name });
26+
return Task.FromResult(new HelloReply { Response = request.Request });
2727
}
2828
}
2929
}

elixir_grpc_bench/lib/server.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ defmodule Helloworld.Greeter.Server do
44
@spec say_hello(Helloworld.HelloRequest.t(), GRPC.Server.Stream.t()) ::
55
Helloworld.HelloReply.t()
66
def say_hello(request, _stream) do
7-
Helloworld.HelloReply.new(message: "#{request.name}")
7+
Helloworld.HelloReply.new(response: request.request)
88
end
99
end

erlang_grpcbox_bench/src/egb_handler.erl

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
-spec say_hello(ctx:ctx(), helloworld_pb:hello_request()) ->
1010
{ok, helloworld_pb:hello_reply(), ctx:ctx()} | grpcbox_stream:grpc_error_response().
1111

12-
say_hello(Ctx, #{name := Name}) ->
13-
Rep = #{message => Name},
12+
say_hello(Ctx, #{request := Request}) ->
13+
Rep = #{response => Request},
1414
{ok, Rep, Ctx}.

go_grpc_bench/example/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type server struct {
3939

4040
// SayHello implements helloworld.GreeterServer
4141
func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
42-
return &pb.HelloReply{Message: in.GetName()}, nil
42+
return &pb.HelloReply{Response: in.GetRequest()}, nil
4343
}
4444

4545
func main() {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

node_grpcjs_st_bench/greeter_server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var hello_proto = grpc.loadPackageDefinition(packageDefinition).helloworld;
3434
* Implements the SayHello RPC method.
3535
*/
3636
function sayHello(call, callback) {
37-
callback(null, {message: call.request.name});
37+
callback(null, {response: call.request.request});
3838
}
3939

4040
/**

php_grpc_bench/src/HelloworldService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ class HelloworldService implements GreeterInterface
1313
public function SayHello(ContextInterface $ctx, HelloRequest $in): HelloReply
1414
{
1515
$out = new HelloReply();
16-
return $out->setMessage($in->getName());
16+
return $out->setResponse($in->getRequest());
1717
}
1818
}

php_swoole_grpc_bench/Dockerfile renamed to php_swoole_grpc_onhold/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM phpswoole/swoole:php8.1-alpine
1+
FROM phpswoole/swoole:php8.0-alpine
22

33
WORKDIR /app
44

php_swoole_grpc_bench/server.php renamed to php_swoole_grpc_onhold/server.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
$http = new Swoole\Http\Server('0.0.0.0', 50051, SWOOLE_BASE);
1010
$http->set([
11-
'worker_num' => swoole_cpu_num(),
11+
'trace_flags' => 0,
1212
'log_file' => '/dev/null',
1313
'log_level' => 5,
1414
'open_http2_protocol' => true
@@ -18,10 +18,9 @@
1818

1919
try {
2020
$request_message = new HelloRequest;
21-
$request_message->mergeFromString(Parser::unpack($request->rawContent()));
2221

2322
$response_message = new HelloReply();
24-
$response_message->setMessage($request_message->getName());
23+
$response_message->setResponse($request_message->getRequest());
2524

2625
$response->header('content-type', 'application/grpc');
2726
$response->header('trailer', 'grpc-status, grpc-message');
@@ -36,4 +35,4 @@
3635
}
3736
});
3837

39-
$http->start();
38+
$http->start();

python_async_grpc_bench/server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Greeter(helloworld_pb2_grpc.GreeterServicer):
2525
async def SayHello(
2626
self, request: helloworld_pb2.HelloRequest,
2727
context: grpc.aio.ServicerContext) -> helloworld_pb2.HelloReply:
28-
return helloworld_pb2.HelloReply(message=request.name)
28+
return helloworld_pb2.HelloReply(response=request.request)
2929

3030

3131
async def serve() -> None:

python_grpc_bench/server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
class Greeter(helloworld_pb2_grpc.GreeterServicer):
2525

2626
def SayHello(self, request, context):
27-
return helloworld_pb2.HelloReply(message=request.name)
27+
return helloworld_pb2.HelloReply(response=request.request)
2828

2929

3030
def serve():

ruby_grpc_bench/server.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
class GreeterServer < Helloworld::Greeter::Service
3030
# say_hello implements the SayHello rpc method.
3131
def say_hello(hello_req, _unused_call)
32-
Helloworld::HelloReply.new(message: hello_req.name)
32+
Helloworld::HelloReply.new(response: hello_req.request)
3333
end
3434
end
3535

@@ -40,7 +40,7 @@ def main
4040
s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)
4141
puts 'Listening on 50051'
4242
s.handle(GreeterServer)
43-
# Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to
43+
# Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to
4444
# gracefully shutdown.
4545
# User could also choose to run server via call to run_till_terminated
4646
s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT'])

0 commit comments

Comments
 (0)