clang-format

pull/4918/head
Vijay Pai 9 years ago
parent 7a5e89570c
commit 16e45702ac
  1. 34
      test/cpp/qps/client_async.cc
  2. 20
      test/cpp/qps/server_async.cc

@ -94,8 +94,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext {
std::function< std::function<
std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>( std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>(
BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&,
CompletionQueue*)> CompletionQueue*)> start_req,
start_req,
std::function<void(grpc::Status, ResponseType*)> on_done) std::function<void(grpc::Status, ResponseType*)> on_done)
: ClientRpcContext(channel_id), : ClientRpcContext(channel_id),
context_(), context_(),
@ -141,8 +140,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext {
std::function<void(grpc::Status, ResponseType*)> callback_; std::function<void(grpc::Status, ResponseType*)> callback_;
std::function<std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>( std::function<std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>(
BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&,
CompletionQueue*)> CompletionQueue*)> start_req_;
start_req_;
grpc::Status status_; grpc::Status status_;
double start_; double start_;
std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>> std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>
@ -161,12 +159,11 @@ class AsyncClient : public ClientImpl<StubType, RequestType> {
using Client::closed_loop_; using Client::closed_loop_;
using ClientImpl<StubType, RequestType>::channels_; using ClientImpl<StubType, RequestType>::channels_;
using ClientImpl<StubType, RequestType>::request_; using ClientImpl<StubType, RequestType>::request_;
AsyncClient( AsyncClient(const ClientConfig& config,
const ClientConfig& config, std::function<ClientRpcContext*(int, StubType*,
std::function<ClientRpcContext*(int, StubType*, const RequestType&)> const RequestType&)> setup_ctx,
setup_ctx, std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)>
std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)> create_stub)
create_stub)
: ClientImpl<StubType, RequestType>(config, create_stub), : ClientImpl<StubType, RequestType>(config, create_stub),
num_async_threads_(NumThreads(config)), num_async_threads_(NumThreads(config)),
channel_lock_(new std::mutex[config.client_channels()]), channel_lock_(new std::mutex[config.client_channels()]),
@ -408,8 +405,7 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext {
std::function<std::unique_ptr< std::function<std::unique_ptr<
grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>(
BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*,
void*)> void*)> start_req,
start_req,
std::function<void(grpc::Status, ResponseType*)> on_done) std::function<void(grpc::Status, ResponseType*)> on_done)
: ClientRpcContext(channel_id), : ClientRpcContext(channel_id),
context_(), context_(),
@ -461,10 +457,10 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext {
ResponseType response_; ResponseType response_;
bool (ClientRpcContextStreamingImpl::*next_state_)(bool, Histogram*); bool (ClientRpcContextStreamingImpl::*next_state_)(bool, Histogram*);
std::function<void(grpc::Status, ResponseType*)> callback_; std::function<void(grpc::Status, ResponseType*)> callback_;
std::function<std::unique_ptr< std::function<
grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>(
BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, void*)> BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*,
start_req_; void*)> start_req_;
grpc::Status status_; grpc::Status status_;
double start_; double start_;
std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>> std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>
@ -508,8 +504,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext {
int channel_id, grpc::GenericStub* stub, const ByteBuffer& req, int channel_id, grpc::GenericStub* stub, const ByteBuffer& req,
std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>( std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>(
grpc::GenericStub*, grpc::ClientContext*, grpc::GenericStub*, grpc::ClientContext*,
const grpc::string& method_name, CompletionQueue*, void*)> const grpc::string& method_name, CompletionQueue*, void*)> start_req,
start_req,
std::function<void(grpc::Status, ByteBuffer*)> on_done) std::function<void(grpc::Status, ByteBuffer*)> on_done)
: ClientRpcContext(channel_id), : ClientRpcContext(channel_id),
context_(), context_(),
@ -566,8 +561,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext {
std::function<void(grpc::Status, ByteBuffer*)> callback_; std::function<void(grpc::Status, ByteBuffer*)> callback_;
std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>( std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>(
grpc::GenericStub*, grpc::ClientContext*, const grpc::string&, grpc::GenericStub*, grpc::ClientContext*, const grpc::string&,
CompletionQueue*, void*)> CompletionQueue*, void*)> start_req_;
start_req_;
grpc::Status status_; grpc::Status status_;
double start_; double start_;
std::unique_ptr<grpc::GenericClientAsyncReaderWriter> stream_; std::unique_ptr<grpc::GenericClientAsyncReaderWriter> stream_;

@ -72,8 +72,7 @@ class AsyncQpsServerTest : public Server {
CompletionQueue *, ServerCompletionQueue *, void *)> CompletionQueue *, ServerCompletionQueue *, void *)>
request_streaming_function, request_streaming_function,
std::function<grpc::Status(const PayloadConfig &, const RequestType *, std::function<grpc::Status(const PayloadConfig &, const RequestType *,
ResponseType *)> ResponseType *)> process_rpc)
process_rpc)
: Server(config) { : Server(config) {
char *server_address = NULL; char *server_address = NULL;
@ -191,8 +190,7 @@ class AsyncQpsServerTest : public Server {
ServerRpcContextUnaryImpl( ServerRpcContextUnaryImpl(
std::function<void(ServerContextType *, RequestType *, std::function<void(ServerContextType *, RequestType *,
grpc::ServerAsyncResponseWriter<ResponseType> *, grpc::ServerAsyncResponseWriter<ResponseType> *,
void *)> void *)> request_method,
request_method,
std::function<grpc::Status(const RequestType *, ResponseType *)> std::function<grpc::Status(const RequestType *, ResponseType *)>
invoke_method) invoke_method)
: srv_ctx_(new ServerContextType), : srv_ctx_(new ServerContextType),
@ -389,14 +387,12 @@ static Status ProcessGenericRPC(const PayloadConfig &payload_config,
} }
std::unique_ptr<Server> CreateAsyncServer(const ServerConfig &config) { std::unique_ptr<Server> CreateAsyncServer(const ServerConfig &config) {
return std::unique_ptr<Server>( return std::unique_ptr<Server>(new AsyncQpsServerTest<
new AsyncQpsServerTest<SimpleRequest, SimpleResponse, SimpleRequest, SimpleResponse, BenchmarkService::AsyncService,
BenchmarkService::AsyncService, grpc::ServerContext>(
grpc::ServerContext>( config, RegisterBenchmarkService,
config, RegisterBenchmarkService, &BenchmarkService::AsyncService::RequestUnaryCall,
&BenchmarkService::AsyncService::RequestUnaryCall, &BenchmarkService::AsyncService::RequestStreamingCall, ProcessSimpleRPC));
&BenchmarkService::AsyncService::RequestStreamingCall,
ProcessSimpleRPC));
} }
std::unique_ptr<Server> CreateAsyncGenericServer(const ServerConfig &config) { std::unique_ptr<Server> CreateAsyncGenericServer(const ServerConfig &config) {
return std::unique_ptr<Server>( return std::unique_ptr<Server>(

Loading…
Cancel
Save