From eeb02ba77a2076b40f37163f3b78facbd25722e7 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 13 Jan 2016 20:43:33 -0800 Subject: [PATCH 1/2] Update copyrights again --- include/grpc++/generic/async_generic_service.h | 4 ++-- include/grpc++/support/byte_buffer.h | 4 ++-- include/grpc++/support/slice.h | 4 ++-- src/cpp/util/byte_buffer.cc | 4 ++-- test/cpp/qps/client.h | 4 ++-- test/cpp/qps/client_async.cc | 4 ++-- test/cpp/qps/client_sync.cc | 4 ++-- test/cpp/qps/generic_async_streaming_ping_pong_test.cc | 4 ++-- test/cpp/qps/qps_driver.cc | 6 +++--- test/cpp/qps/qps_worker.cc | 4 ++-- test/cpp/qps/server.h | 4 ++-- test/cpp/qps/server_async.cc | 4 ++-- 12 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/grpc++/generic/async_generic_service.h b/include/grpc++/generic/async_generic_service.h index f209c077e6c..33045b8d859 100644 --- a/include/grpc++/generic/async_generic_service.h +++ b/include/grpc++/generic/async_generic_service.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -76,4 +76,4 @@ class AsyncGenericService GRPC_FINAL { } // namespace grpc -#endif // GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H +#endif // GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H \ No newline at end of file diff --git a/include/grpc++/support/byte_buffer.h b/include/grpc++/support/byte_buffer.h index d3f9b7b1d1f..be1957ac84a 100644 --- a/include/grpc++/support/byte_buffer.h +++ b/include/grpc++/support/byte_buffer.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -107,4 +107,4 @@ class SerializationTraits { } // namespace grpc -#endif // GRPCXX_SUPPORT_BYTE_BUFFER_H +#endif // GRPCXX_SUPPORT_BYTE_BUFFER_H \ No newline at end of file diff --git a/include/grpc++/support/slice.h b/include/grpc++/support/slice.h index 8dce7e68af9..30325ef90bf 100644 --- a/include/grpc++/support/slice.h +++ b/include/grpc++/support/slice.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -85,4 +85,4 @@ class Slice GRPC_FINAL { } // namespace grpc -#endif // GRPCXX_SUPPORT_SLICE_H +#endif // GRPCXX_SUPPORT_SLICE_H \ No newline at end of file diff --git a/src/cpp/util/byte_buffer.cc b/src/cpp/util/byte_buffer.cc index 5245739c89b..1c1d55271da 100644 --- a/src/cpp/util/byte_buffer.cc +++ b/src/cpp/util/byte_buffer.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -89,4 +89,4 @@ ByteBuffer& ByteBuffer::operator=(const ByteBuffer& buf) { return *this; } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 03bbf03b6c3..0159f4f1e67 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -377,4 +377,4 @@ std::unique_ptr CreateGenericAsyncStreamingClient( } // namespace testing } // namespace grpc -#endif +#endif \ No newline at end of file diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index af55187b2bc..d822d78aac0 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -605,4 +605,4 @@ std::unique_ptr CreateGenericAsyncStreamingClient( } } // namespace testing -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 54cdf390d70..1045915b832 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -172,4 +172,4 @@ std::unique_ptr CreateSynchronousStreamingClient( } } // namespace testing -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/test/cpp/qps/generic_async_streaming_ping_pong_test.cc b/test/cpp/qps/generic_async_streaming_ping_pong_test.cc index fe79b2d8037..7a1275054a6 100644 --- a/test/cpp/qps/generic_async_streaming_ping_pong_test.cc +++ b/test/cpp/qps/generic_async_streaming_ping_pong_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -79,4 +79,4 @@ int main(int argc, char** argv) { grpc::testing::RunGenericAsyncStreamingPingPong(); return 0; -} +} \ No newline at end of file diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc index a8d404590c4..76d1595c4ba 100644 --- a/test/cpp/qps/qps_driver.cc +++ b/test/cpp/qps/qps_driver.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -117,7 +117,7 @@ static void QpsDriver() { params->set_resp_size(FLAGS_bbuf_resp_size); if (FLAGS_bbuf_req_size >= 0) { params->set_req_size(FLAGS_bbuf_req_size); - } + } } else { // set a reasonable default: proto but no payload client_config.mutable_payload_config()->mutable_simple_params(); @@ -184,4 +184,4 @@ int main(int argc, char** argv) { grpc::testing::QpsDriver(); return 0; -} +} \ No newline at end of file diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc index ef2b633f68a..e7714c0bb30 100644 --- a/test/cpp/qps/qps_worker.cc +++ b/test/cpp/qps/qps_worker.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -239,4 +239,4 @@ QpsWorker::QpsWorker(int driver_port) { QpsWorker::~QpsWorker() {} } // namespace testing -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h index 920fc563566..daee7c36634 100644 --- a/test/cpp/qps/server.h +++ b/test/cpp/qps/server.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -112,4 +112,4 @@ std::unique_ptr CreateAsyncServer(const ServerConfig& config); } // namespace testing } // namespace grpc -#endif +#endif \ No newline at end of file diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index b39d8c4d3e6..da7646eaf2c 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -403,4 +403,4 @@ std::unique_ptr CreateAsyncGenericServer(const ServerConfig &config) { } } // namespace testing -} // namespace grpc +} // namespace grpc \ No newline at end of file From 754bd26e28496f0be294a3b58060ad2fea91f76c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 14 Jan 2016 06:10:15 -0800 Subject: [PATCH 2/2] clang-format code --- include/grpc++/support/byte_buffer.h | 2 +- src/cpp/util/byte_buffer.cc | 9 ++++---- test/cpp/qps/client_async.cc | 34 ++++++++++++---------------- test/cpp/qps/qps_driver.cc | 2 +- test/cpp/qps/server_async.cc | 32 +++++++++++--------------- 5 files changed, 33 insertions(+), 46 deletions(-) diff --git a/include/grpc++/support/byte_buffer.h b/include/grpc++/support/byte_buffer.h index be1957ac84a..84042cbef80 100644 --- a/include/grpc++/support/byte_buffer.h +++ b/include/grpc++/support/byte_buffer.h @@ -57,7 +57,7 @@ class ByteBuffer GRPC_FINAL { /// Constuct a byte buffer by referencing elements of existing buffer /// \a buf. Wrapper of core function grpc_byte_buffer_copy - ByteBuffer(const ByteBuffer&buf); + ByteBuffer(const ByteBuffer& buf); ~ByteBuffer(); diff --git a/src/cpp/util/byte_buffer.cc b/src/cpp/util/byte_buffer.cc index 1c1d55271da..df873eb1ceb 100644 --- a/src/cpp/util/byte_buffer.cc +++ b/src/cpp/util/byte_buffer.cc @@ -79,13 +79,12 @@ size_t ByteBuffer::Length() const { } } -ByteBuffer::ByteBuffer(const ByteBuffer& buf): - buffer_(grpc_byte_buffer_copy(buf.buffer_)) { -} +ByteBuffer::ByteBuffer(const ByteBuffer& buf) + : buffer_(grpc_byte_buffer_copy(buf.buffer_)) {} ByteBuffer& ByteBuffer::operator=(const ByteBuffer& buf) { - Clear(); // first remove existing data - buffer_ = grpc_byte_buffer_copy(buf.buffer_); // then copy + Clear(); // first remove existing data + buffer_ = grpc_byte_buffer_copy(buf.buffer_); // then copy return *this; } diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index d822d78aac0..3e2317c6d46 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -93,8 +93,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { std::function< std::unique_ptr>( BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, - CompletionQueue*)> - start_req, + CompletionQueue*)> start_req, std::function on_done) : ClientRpcContext(channel_id), context_(), @@ -140,8 +139,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { std::function callback_; std::function>( BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, - CompletionQueue*)> - start_req_; + CompletionQueue*)> start_req_; grpc::Status status_; double start_; std::unique_ptr> @@ -160,12 +158,11 @@ class AsyncClient : public ClientImpl { using Client::closed_loop_; using ClientImpl::channels_; using ClientImpl::request_; - AsyncClient( - const ClientConfig& config, - std::function - setup_ctx, - std::function(std::shared_ptr)> - create_stub) + AsyncClient(const ClientConfig& config, + std::function setup_ctx, + std::function(std::shared_ptr)> + create_stub) : ClientImpl(config, create_stub), channel_lock_(new std::mutex[config.client_channels()]), contexts_(config.client_channels()), @@ -394,8 +391,7 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { std::function>( BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, - void*)> - start_req, + void*)> start_req, std::function on_done) : ClientRpcContext(channel_id), context_(), @@ -447,10 +443,10 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { ResponseType response_; bool (ClientRpcContextStreamingImpl::*next_state_)(bool, Histogram*); std::function callback_; - std::function>( - BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, void*)> - start_req_; + std::function< + std::unique_ptr>( + BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, + void*)> start_req_; grpc::Status status_; double start_; std::unique_ptr> @@ -494,8 +490,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { int channel_id, grpc::GenericStub* stub, const ByteBuffer& req, std::function( grpc::GenericStub*, grpc::ClientContext*, - const grpc::string& method_name, CompletionQueue*, void*)> - start_req, + const grpc::string& method_name, CompletionQueue*, void*)> start_req, std::function on_done) : ClientRpcContext(channel_id), context_(), @@ -552,8 +547,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { std::function callback_; std::function( grpc::GenericStub*, grpc::ClientContext*, const grpc::string&, - CompletionQueue*, void*)> - start_req_; + CompletionQueue*, void*)> start_req_; grpc::Status status_; double start_; std::unique_ptr stream_; diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc index 76d1595c4ba..c70db188d9c 100644 --- a/test/cpp/qps/qps_driver.cc +++ b/test/cpp/qps/qps_driver.cc @@ -113,7 +113,7 @@ static void QpsDriver() { } } else if (FLAGS_bbuf_resp_size >= 0) { auto params = - client_config.mutable_payload_config()->mutable_bytebuf_params(); + client_config.mutable_payload_config()->mutable_bytebuf_params(); params->set_resp_size(FLAGS_bbuf_resp_size); if (FLAGS_bbuf_req_size >= 0) { params->set_req_size(FLAGS_bbuf_req_size); diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index da7646eaf2c..1ae88d7323e 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -72,8 +72,7 @@ class AsyncQpsServerTest : public Server { CompletionQueue *, ServerCompletionQueue *, void *)> request_streaming_function, std::function - process_rpc) + ResponseType *)> process_rpc) : Server(config) { char *server_address = NULL; @@ -94,8 +93,8 @@ class AsyncQpsServerTest : public Server { using namespace std::placeholders; - auto process_rpc_bound = std::bind(process_rpc, config.payload_config(), - _1, _2); + auto process_rpc_bound = + std::bind(process_rpc, config.payload_config(), _1, _2); for (int i = 0; i < 10000 / config.async_server_threads(); i++) { for (int j = 0; j < config.async_server_threads(); j++) { @@ -185,8 +184,7 @@ class AsyncQpsServerTest : public Server { ServerRpcContextUnaryImpl( std::function *, - void *)> - request_method, + void *)> request_method, std::function invoke_method) : srv_ctx_(new ServerContextType), @@ -359,8 +357,7 @@ static void RegisterGenericService(ServerBuilder *builder, builder->RegisterAsyncGenericService(service); } - -static Status ProcessSimpleRPC(const PayloadConfig&, +static Status ProcessSimpleRPC(const PayloadConfig &, const SimpleRequest *request, SimpleResponse *response) { if (request->response_size() > 0) { @@ -372,7 +369,7 @@ static Status ProcessSimpleRPC(const PayloadConfig&, return Status::OK; } -static Status ProcessGenericRPC(const PayloadConfig& payload_config, +static Status ProcessGenericRPC(const PayloadConfig &payload_config, const ByteBuffer *request, ByteBuffer *response) { int resp_size = payload_config.bytebuf_params().resp_size(); @@ -384,22 +381,19 @@ static Status ProcessGenericRPC(const PayloadConfig& payload_config, } std::unique_ptr CreateAsyncServer(const ServerConfig &config) { - return std::unique_ptr( - new AsyncQpsServerTest( - config, RegisterBenchmarkService, - &BenchmarkService::AsyncService::RequestUnaryCall, - &BenchmarkService::AsyncService::RequestStreamingCall, - ProcessSimpleRPC)); + return std::unique_ptr(new AsyncQpsServerTest< + SimpleRequest, SimpleResponse, BenchmarkService::AsyncService, + grpc::ServerContext>( + config, RegisterBenchmarkService, + &BenchmarkService::AsyncService::RequestUnaryCall, + &BenchmarkService::AsyncService::RequestStreamingCall, ProcessSimpleRPC)); } std::unique_ptr CreateAsyncGenericServer(const ServerConfig &config) { return std::unique_ptr( new AsyncQpsServerTest( config, RegisterGenericService, nullptr, - &grpc::AsyncGenericService::RequestCall, - ProcessGenericRPC)); + &grpc::AsyncGenericService::RequestCall, ProcessGenericRPC)); } } // namespace testing