From 9b7757dd356dae2549433d5b2686ce9a902c7bcc Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 13 Aug 2015 11:15:53 -0700 Subject: Use a sync service to handle requests to unknown services --- include/grpc++/completion_queue.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/grpc++/completion_queue.h') diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 0523ab6a0e..2f30211145 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -63,6 +63,7 @@ template class ServerStreamingHandler; template class BidiStreamingHandler; +class UnknownMethodHandler; class ChannelInterface; class ClientContext; @@ -138,6 +139,7 @@ class CompletionQueue : public GrpcLibrary { friend class ServerStreamingHandler; template friend class BidiStreamingHandler; + friend class UnknownMethodHandler; friend class ::grpc::Server; friend class ::grpc::ServerContext; template -- cgit v1.2.3 From 8c2be9f22807870585111d88f5168dd11da99ce1 Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 19 Aug 2015 16:28:09 -0700 Subject: Remove ChannelInterface and replace it with Channel --- BUILD | 6 +- Makefile | 4 +- build.json | 3 +- examples/pubsub/main.cc | 4 +- examples/pubsub/publisher.cc | 2 +- examples/pubsub/publisher.h | 4 +- examples/pubsub/publisher_test.cc | 6 +- examples/pubsub/subscriber.cc | 2 +- examples/pubsub/subscriber.h | 4 +- examples/pubsub/subscriber_test.cc | 4 +- include/grpc++/async_unary_call.h | 4 +- include/grpc++/channel.h | 137 +++++++++++++++++++++ include/grpc++/channel_interface.h | 92 -------------- include/grpc++/client_context.h | 10 +- include/grpc++/completion_queue.h | 5 +- include/grpc++/create_channel.h | 3 +- include/grpc++/credentials.h | 6 +- include/grpc++/generic_stub.h | 5 +- include/grpc++/impl/client_unary_call.h | 4 +- include/grpc++/impl/internal_stub.h | 9 +- include/grpc++/stream.h | 14 +-- src/compiler/cpp_generator.cc | 28 ++--- src/cpp/client/channel.cc | 2 +- src/cpp/client/channel.h | 80 ------------ src/cpp/client/client_context.cc | 2 +- src/cpp/client/create_channel.cc | 7 +- src/cpp/client/insecure_credentials.cc | 6 +- src/cpp/client/secure_credentials.cc | 6 +- src/cpp/client/secure_credentials.h | 2 +- src/cpp/common/call.cc | 2 +- test/cpp/end2end/async_end2end_test.cc | 6 +- test/cpp/end2end/client_crash_test.cc | 2 +- test/cpp/end2end/end2end_test.cc | 8 +- test/cpp/end2end/generic_end2end_test.cc | 4 +- test/cpp/end2end/mock_test.cc | 4 +- test/cpp/end2end/server_crash_test.cc | 2 +- test/cpp/end2end/server_crash_test_client.cc | 2 +- test/cpp/end2end/thread_stress_test.cc | 4 +- test/cpp/end2end/zookeeper_test.cc | 4 +- test/cpp/interop/client.cc | 2 +- test/cpp/interop/client_helper.cc | 4 +- test/cpp/interop/client_helper.h | 4 +- test/cpp/interop/interop_client.cc | 4 +- test/cpp/interop/interop_client.h | 8 +- test/cpp/interop/reconnect_interop_client.cc | 6 +- test/cpp/qps/client.h | 4 +- test/cpp/qps/perf_db_client.h | 4 +- test/cpp/util/cli_call.cc | 4 +- test/cpp/util/cli_call.h | 4 +- test/cpp/util/cli_call_test.cc | 4 +- test/cpp/util/create_test_channel.cc | 8 +- test/cpp/util/create_test_channel.h | 10 +- test/cpp/util/grpc_cli.cc | 4 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 3 +- tools/run_tests/sources_and_headers.json | 12 +- vsprojects/grpc++/grpc++.vcxproj | 3 +- vsprojects/grpc++/grpc++.vcxproj.filters | 7 +- vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj | 3 +- .../grpc++_unsecure.vcxproj.filters | 7 +- 60 files changed, 273 insertions(+), 333 deletions(-) create mode 100644 include/grpc++/channel.h delete mode 100644 include/grpc++/channel_interface.h delete mode 100644 src/cpp/client/channel.h (limited to 'include/grpc++/completion_queue.h') diff --git a/BUILD b/BUILD index 7eb59797d4..adcc4cb413 100644 --- a/BUILD +++ b/BUILD @@ -675,7 +675,6 @@ cc_library( "src/cpp/client/secure_credentials.h", "src/cpp/common/secure_auth_context.h", "src/cpp/server/secure_server_credentials.h", - "src/cpp/client/channel.h", "src/cpp/common/create_auth_context.h", "src/cpp/client/secure_channel_arguments.cc", "src/cpp/client/secure_credentials.cc", @@ -714,8 +713,8 @@ cc_library( "include/grpc++/async_unary_call.h", "include/grpc++/auth_context.h", "include/grpc++/byte_buffer.h", + "include/grpc++/channel.h", "include/grpc++/channel_arguments.h", - "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/config.h", @@ -767,7 +766,6 @@ cc_library( cc_library( name = "grpc++_unsecure", srcs = [ - "src/cpp/client/channel.h", "src/cpp/common/create_auth_context.h", "src/cpp/common/insecure_create_auth_context.cc", "src/cpp/client/channel.cc", @@ -801,8 +799,8 @@ cc_library( "include/grpc++/async_unary_call.h", "include/grpc++/auth_context.h", "include/grpc++/byte_buffer.h", + "include/grpc++/channel.h", "include/grpc++/channel_arguments.h", - "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/config.h", diff --git a/Makefile b/Makefile index f3944eccbb..dba1a0457e 100644 --- a/Makefile +++ b/Makefile @@ -4630,8 +4630,8 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/async_unary_call.h \ include/grpc++/auth_context.h \ include/grpc++/byte_buffer.h \ + include/grpc++/channel.h \ include/grpc++/channel_arguments.h \ - include/grpc++/channel_interface.h \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/config.h \ @@ -4873,8 +4873,8 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/async_unary_call.h \ include/grpc++/auth_context.h \ include/grpc++/byte_buffer.h \ + include/grpc++/channel.h \ include/grpc++/channel_arguments.h \ - include/grpc++/channel_interface.h \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/config.h \ diff --git a/build.json b/build.json index 85457dde86..553e98db4b 100644 --- a/build.json +++ b/build.json @@ -34,8 +34,8 @@ "include/grpc++/async_unary_call.h", "include/grpc++/auth_context.h", "include/grpc++/byte_buffer.h", + "include/grpc++/channel.h", "include/grpc++/channel_arguments.h", - "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/config.h", @@ -73,7 +73,6 @@ "include/grpc++/time.h" ], "headers": [ - "src/cpp/client/channel.h", "src/cpp/common/create_auth_context.h" ], "src": [ diff --git a/examples/pubsub/main.cc b/examples/pubsub/main.cc index b1898f18d9..fcee3b316b 100644 --- a/examples/pubsub/main.cc +++ b/examples/pubsub/main.cc @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include @@ -72,7 +72,7 @@ int main(int argc, char** argv) { ss << FLAGS_server_host << ":" << FLAGS_server_port; std::shared_ptr creds = grpc::GoogleDefaultCredentials(); - std::shared_ptr channel = + std::shared_ptr channel = grpc::CreateChannel(ss.str(), creds, grpc::ChannelArguments()); grpc::examples::pubsub::Publisher publisher(channel); diff --git a/examples/pubsub/publisher.cc b/examples/pubsub/publisher.cc index 458050af73..fd38ca92ed 100644 --- a/examples/pubsub/publisher.cc +++ b/examples/pubsub/publisher.cc @@ -50,7 +50,7 @@ namespace grpc { namespace examples { namespace pubsub { -Publisher::Publisher(std::shared_ptr channel) +Publisher::Publisher(std::shared_ptr channel) : stub_(PublisherService::NewStub(channel)) {} void Publisher::Shutdown() { stub_.reset(); } diff --git a/examples/pubsub/publisher.h b/examples/pubsub/publisher.h index 33bcf98df4..b98e6973dc 100644 --- a/examples/pubsub/publisher.h +++ b/examples/pubsub/publisher.h @@ -34,7 +34,7 @@ #ifndef GRPC_EXAMPLES_PUBSUB_PUBLISHER_H #define GRPC_EXAMPLES_PUBSUB_PUBLISHER_H -#include +#include #include #include "examples/pubsub/pubsub.grpc.pb.h" @@ -45,7 +45,7 @@ namespace pubsub { class Publisher { public: - Publisher(std::shared_ptr channel); + Publisher(std::shared_ptr channel); void Shutdown(); Status CreateTopic(const grpc::string& topic); diff --git a/examples/pubsub/publisher_test.cc b/examples/pubsub/publisher_test.cc index 6b9dcacc49..972b426e64 100644 --- a/examples/pubsub/publisher_test.cc +++ b/examples/pubsub/publisher_test.cc @@ -32,7 +32,7 @@ */ #include -#include +#include #include #include #include @@ -46,7 +46,7 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -using grpc::ChannelInterface; +using grpc::Channel; namespace grpc { namespace testing { @@ -124,7 +124,7 @@ class PublisherTest : public ::testing::Test { std::unique_ptr server_; PublisherServiceImpl service_; - std::shared_ptr channel_; + std::shared_ptr channel_; std::unique_ptr publisher_; }; diff --git a/examples/pubsub/subscriber.cc b/examples/pubsub/subscriber.cc index d9e0292ba0..0818f501db 100644 --- a/examples/pubsub/subscriber.cc +++ b/examples/pubsub/subscriber.cc @@ -48,7 +48,7 @@ namespace grpc { namespace examples { namespace pubsub { -Subscriber::Subscriber(std::shared_ptr channel) +Subscriber::Subscriber(std::shared_ptr channel) : stub_(SubscriberService::NewStub(channel)) {} void Subscriber::Shutdown() { stub_.reset(); } diff --git a/examples/pubsub/subscriber.h b/examples/pubsub/subscriber.h index 40ab45471d..87c833102c 100644 --- a/examples/pubsub/subscriber.h +++ b/examples/pubsub/subscriber.h @@ -34,7 +34,7 @@ #ifndef GRPC_EXAMPLES_PUBSUB_SUBSCRIBER_H #define GRPC_EXAMPLES_PUBSUB_SUBSCRIBER_H -#include +#include #include #include "examples/pubsub/pubsub.grpc.pb.h" @@ -45,7 +45,7 @@ namespace pubsub { class Subscriber { public: - Subscriber(std::shared_ptr channel); + Subscriber(std::shared_ptr channel); void Shutdown(); Status CreateSubscription(const grpc::string& topic, diff --git a/examples/pubsub/subscriber_test.cc b/examples/pubsub/subscriber_test.cc index b0e7fc034b..7974ca88c2 100644 --- a/examples/pubsub/subscriber_test.cc +++ b/examples/pubsub/subscriber_test.cc @@ -32,7 +32,7 @@ */ #include -#include +#include #include #include #include @@ -122,7 +122,7 @@ class SubscriberTest : public ::testing::Test { std::unique_ptr server_; SubscriberServiceImpl service_; - std::shared_ptr channel_; + std::shared_ptr channel_; std::unique_ptr subscriber_; }; diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h index 3d22df4b33..4e1dd15f32 100644 --- a/include/grpc++/async_unary_call.h +++ b/include/grpc++/async_unary_call.h @@ -34,7 +34,7 @@ #ifndef GRPCXX_ASYNC_UNARY_CALL_H #define GRPCXX_ASYNC_UNARY_CALL_H -#include +#include #include #include #include @@ -58,7 +58,7 @@ class ClientAsyncResponseReader GRPC_FINAL : public ClientAsyncResponseReaderInterface { public: template - ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq, + ClientAsyncResponseReader(Channel* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, const W& request) : context_(context), call_(channel->CreateCall(method, context, cq)) { diff --git a/include/grpc++/channel.h b/include/grpc++/channel.h new file mode 100644 index 0000000000..a4cef1b4d9 --- /dev/null +++ b/include/grpc++/channel.h @@ -0,0 +1,137 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_CHANNEL_H +#define GRPCXX_CHANNEL_H + +#include + +#include +#include +#include +#include + +struct grpc_channel; + +namespace grpc { +class CallOpSetInterface; +class ChannelArguments; +class CompletionQueue; +class Credentials; +class SecureCredentials; + +template +class ClientReader; +template +class ClientWriter; +template +class ClientReaderWriter; +template +class ClientAsyncReader; +template +class ClientAsyncWriter; +template +class ClientAsyncReaderWriter; +template +class ClientAsyncResponseReader; + +class Channel GRPC_FINAL : public GrpcLibrary, + public CallHook, + public std::enable_shared_from_this { + public: + explicit Channel(grpc_channel* c_channel); + Channel(const grpc::string& host, grpc_channel* c_channel); + ~Channel(); + + // Get the current channel state. If the channel is in IDLE and try_to_connect + // is set to true, try to connect. + grpc_connectivity_state GetState(bool try_to_connect); + + // Return the tag on cq when the channel state is changed or deadline expires. + // GetState needs to called to get the current state. + template + void NotifyOnStateChange(grpc_connectivity_state last_observed, T deadline, + CompletionQueue* cq, void* tag) { + TimePoint deadline_tp(deadline); + NotifyOnStateChangeImpl(last_observed, deadline_tp.raw_time(), cq, tag); + } + + // Blocking wait for channel state change or deadline expiration. + // GetState needs to called to get the current state. + template + bool WaitForStateChange(grpc_connectivity_state last_observed, T deadline) { + TimePoint deadline_tp(deadline); + return WaitForStateChangeImpl(last_observed, deadline_tp.raw_time()); + } + + // Used by Stub only in generated code. + void* RegisterMethod(const char* method); + + private: + template + friend class ::grpc::ClientReader; + template + friend class ::grpc::ClientWriter; + template + friend class ::grpc::ClientReaderWriter; + template + friend class ::grpc::ClientAsyncReader; + template + friend class ::grpc::ClientAsyncWriter; + template + friend class ::grpc::ClientAsyncReaderWriter; + template + friend class ::grpc::ClientAsyncResponseReader; + template + friend Status BlockingUnaryCall(Channel* channel, const RpcMethod& method, + ClientContext* context, + const InputMessage& request, + OutputMessage* result); + + Call CreateCall(const RpcMethod& method, ClientContext* context, + CompletionQueue* cq); + void PerformOpsOnCall(CallOpSetInterface* ops, Call* call); + + void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, + gpr_timespec deadline, CompletionQueue* cq, + void* tag); + bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, + gpr_timespec deadline); + + const grpc::string host_; + grpc_channel* const c_channel_; // owned +}; + +} // namespace grpc + +#endif // GRPCXX_CHANNEL_H diff --git a/include/grpc++/channel_interface.h b/include/grpc++/channel_interface.h deleted file mode 100644 index 4176cded7b..0000000000 --- a/include/grpc++/channel_interface.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_CHANNEL_INTERFACE_H -#define GRPCXX_CHANNEL_INTERFACE_H - -#include - -#include -#include -#include - -struct grpc_call; - -namespace grpc { -class Call; -class CallOpBuffer; -class ClientContext; -class CompletionQueue; -class RpcMethod; - -class ChannelInterface : public CallHook, - public std::enable_shared_from_this { - public: - virtual ~ChannelInterface() {} - - virtual void* RegisterMethod(const char* method_name) = 0; - virtual Call CreateCall(const RpcMethod& method, ClientContext* context, - CompletionQueue* cq) = 0; - - // Get the current channel state. If the channel is in IDLE and try_to_connect - // is set to true, try to connect. - virtual grpc_connectivity_state GetState(bool try_to_connect) = 0; - - // Return the tag on cq when the channel state is changed or deadline expires. - // GetState needs to called to get the current state. - template - void NotifyOnStateChange(grpc_connectivity_state last_observed, T deadline, - CompletionQueue* cq, void* tag) { - TimePoint deadline_tp(deadline); - NotifyOnStateChangeImpl(last_observed, deadline_tp.raw_time(), cq, tag); - } - - // Blocking wait for channel state change or deadline expiration. - // GetState needs to called to get the current state. - template - bool WaitForStateChange(grpc_connectivity_state last_observed, T deadline) { - TimePoint deadline_tp(deadline); - return WaitForStateChangeImpl(last_observed, deadline_tp.raw_time()); - } - - private: - virtual void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, - gpr_timespec deadline, - CompletionQueue* cq, void* tag) = 0; - virtual bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, - gpr_timespec deadline) = 0; -}; - -} // namespace grpc - -#endif // GRPCXX_CHANNEL_INTERFACE_H diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 8de2ba4877..55ed17506a 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -51,7 +51,7 @@ struct census_context; namespace grpc { -class ChannelInterface; +class Channel; class CompletionQueue; class Credentials; class RpcMethod; @@ -215,20 +215,18 @@ class ClientContext { template friend class ::grpc::ClientAsyncResponseReader; template - friend Status BlockingUnaryCall(ChannelInterface* channel, - const RpcMethod& method, + friend Status BlockingUnaryCall(Channel* channel, const RpcMethod& method, ClientContext* context, const InputMessage& request, OutputMessage* result); grpc_call* call() { return call_; } - void set_call(grpc_call* call, - const std::shared_ptr& channel); + void set_call(grpc_call* call, const std::shared_ptr& channel); grpc::string authority() { return authority_; } bool initial_metadata_received_; - std::shared_ptr channel_; + std::shared_ptr channel_; grpc_call* call_; gpr_timespec deadline_; grpc::string authority_; diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 2f30211145..061f4874fa 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -65,7 +65,7 @@ template class BidiStreamingHandler; class UnknownMethodHandler; -class ChannelInterface; +class Channel; class ClientContext; class CompletionQueue; class RpcMethod; @@ -143,8 +143,7 @@ class CompletionQueue : public GrpcLibrary { friend class ::grpc::Server; friend class ::grpc::ServerContext; template - friend Status BlockingUnaryCall(ChannelInterface* channel, - const RpcMethod& method, + friend Status BlockingUnaryCall(Channel* channel, const RpcMethod& method, ClientContext* context, const InputMessage& request, OutputMessage* result); diff --git a/include/grpc++/create_channel.h b/include/grpc++/create_channel.h index 424a93a64c..fe34452128 100644 --- a/include/grpc++/create_channel.h +++ b/include/grpc++/create_channel.h @@ -41,10 +41,9 @@ namespace grpc { class ChannelArguments; -class ChannelInterface; // If creds does not hold an object or is invalid, a lame channel is returned. -std::shared_ptr CreateChannel( +std::shared_ptr CreateChannel( const grpc::string& target, const std::shared_ptr& creds, const ChannelArguments& args); diff --git a/include/grpc++/credentials.h b/include/grpc++/credentials.h index a4f1e73118..306dc961c0 100644 --- a/include/grpc++/credentials.h +++ b/include/grpc++/credentials.h @@ -41,7 +41,7 @@ namespace grpc { class ChannelArguments; -class ChannelInterface; +class Channel; class SecureCredentials; class Credentials : public GrpcLibrary { @@ -57,11 +57,11 @@ class Credentials : public GrpcLibrary { virtual SecureCredentials* AsSecureCredentials() = 0; private: - friend std::shared_ptr CreateChannel( + friend std::shared_ptr CreateChannel( const grpc::string& target, const std::shared_ptr& creds, const ChannelArguments& args); - virtual std::shared_ptr CreateChannel( + virtual std::shared_ptr CreateChannel( const grpc::string& target, const ChannelArguments& args) = 0; }; diff --git a/include/grpc++/generic_stub.h b/include/grpc++/generic_stub.h index 172f10e45a..734440881e 100644 --- a/include/grpc++/generic_stub.h +++ b/include/grpc++/generic_stub.h @@ -47,8 +47,7 @@ typedef ClientAsyncReaderWriter // by name. class GenericStub GRPC_FINAL { public: - explicit GenericStub(std::shared_ptr channel) - : channel_(channel) {} + explicit GenericStub(std::shared_ptr channel) : channel_(channel) {} // begin a call to a named method std::unique_ptr Call( @@ -56,7 +55,7 @@ class GenericStub GRPC_FINAL { void* tag); private: - std::shared_ptr channel_; + std::shared_ptr channel_; }; } // namespace grpc diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h index b77ce7d02c..4aae816cd7 100644 --- a/include/grpc++/impl/client_unary_call.h +++ b/include/grpc++/impl/client_unary_call.h @@ -41,14 +41,14 @@ namespace grpc { -class ChannelInterface; +class Channel; class ClientContext; class CompletionQueue; class RpcMethod; // Wrapper that performs a blocking unary call template -Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, +Status BlockingUnaryCall(Channel* channel, const RpcMethod& method, ClientContext* context, const InputMessage& request, OutputMessage* result) { CompletionQueue cq; diff --git a/include/grpc++/impl/internal_stub.h b/include/grpc++/impl/internal_stub.h index 370a3b8ac5..60eb3fdd06 100644 --- a/include/grpc++/impl/internal_stub.h +++ b/include/grpc++/impl/internal_stub.h @@ -36,20 +36,19 @@ #include -#include +#include namespace grpc { class InternalStub { public: - InternalStub(const std::shared_ptr& channel) - : channel_(channel) {} + InternalStub(const std::shared_ptr& channel) : channel_(channel) {} virtual ~InternalStub() {} - ChannelInterface* channel() { return channel_.get(); } + Channel* channel() { return channel_.get(); } private: - const std::shared_ptr channel_; + const std::shared_ptr channel_; }; } // namespace grpc diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 45dafcd282..577eb4e925 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -34,7 +34,7 @@ #ifndef GRPCXX_STREAM_H #define GRPCXX_STREAM_H -#include +#include #include #include #include @@ -100,7 +100,7 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface { public: // Blocking create a stream and write the first request out. template - ClientReader(ChannelInterface* channel, const RpcMethod& method, + ClientReader(Channel* channel, const RpcMethod& method, ClientContext* context, const W& request) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { CallOpSet { public: // Blocking create a stream. template - ClientWriter(ChannelInterface* channel, const RpcMethod& method, + ClientWriter(Channel* channel, const RpcMethod& method, ClientContext* context, R* response) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { finish_ops_.RecvMessage(response); @@ -221,7 +221,7 @@ template class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface { public: // Blocking create a stream. - ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method, + ClientReaderWriter(Channel* channel, const RpcMethod& method, ClientContext* context) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { CallOpSet ops; @@ -425,7 +425,7 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface { public: // Create a stream and write the first request out. template - ClientAsyncReader(ChannelInterface* channel, CompletionQueue* cq, + ClientAsyncReader(Channel* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, const W& request, void* tag) : context_(context), call_(channel->CreateCall(method, context, cq)) { @@ -484,7 +484,7 @@ template class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface { public: template - ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq, + ClientAsyncWriter(Channel* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, R* response, void* tag) : context_(context), call_(channel->CreateCall(method, context, cq)) { @@ -549,7 +549,7 @@ template class ClientAsyncReaderWriter GRPC_FINAL : public ClientAsyncReaderWriterInterface { public: - ClientAsyncReaderWriter(ChannelInterface* channel, CompletionQueue* cq, + ClientAsyncReaderWriter(Channel* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, void* tag) : context_(context), call_(channel->CreateCall(method, context, cq)) { diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index ea487bcd89..731ba58fb1 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -123,7 +123,7 @@ grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file, "\n" "namespace grpc {\n" "class CompletionQueue;\n" - "class ChannelInterface;\n" + "class Channel;\n" "class RpcService;\n" "class ServerCompletionQueue;\n" "class ServerContext;\n" @@ -557,8 +557,7 @@ void PrintHeaderService(grpc::protobuf::io::Printer *printer, "class Stub GRPC_FINAL : public StubInterface," " public ::grpc::InternalStub {\n public:\n"); printer->Indent(); - printer->Print( - "Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);\n"); + printer->Print("Stub(const std::shared_ptr< ::grpc::Channel>& channel);\n"); for (int i = 0; i < service->method_count(); ++i) { PrintHeaderClientMethod(printer, service->method(i), vars, true); } @@ -575,7 +574,7 @@ void PrintHeaderService(grpc::protobuf::io::Printer *printer, printer->Print("};\n"); printer->Print( "static std::unique_ptr NewStub(const std::shared_ptr< " - "::grpc::ChannelInterface>& channel, " + "::grpc::Channel>& channel, " "const ::grpc::StubOptions& options = ::grpc::StubOptions());\n"); printer->Print("\n"); @@ -703,7 +702,7 @@ grpc::string GetSourceIncludes(const grpc::protobuf::FileDescriptor *file, std::map vars; printer.Print(vars, "#include \n"); - printer.Print(vars, "#include \n"); + printer.Print(vars, "#include \n"); printer.Print(vars, "#include \n"); printer.Print(vars, "#include \n"); printer.Print(vars, "#include \n"); @@ -964,18 +963,17 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, } printer->Print(*vars, "};\n\n"); - printer->Print( - *vars, - "std::unique_ptr< $ns$$Service$::Stub> $ns$$Service$::NewStub(" - "const std::shared_ptr< ::grpc::ChannelInterface>& channel, " - "const ::grpc::StubOptions& options) {\n" - " std::unique_ptr< $ns$$Service$::Stub> stub(new " - "$ns$$Service$::Stub(channel));\n" - " return stub;\n" - "}\n\n"); + printer->Print(*vars, + "std::unique_ptr< $ns$$Service$::Stub> $ns$$Service$::NewStub(" + "const std::shared_ptr< ::grpc::Channel>& channel, " + "const ::grpc::StubOptions& options) {\n" + " std::unique_ptr< $ns$$Service$::Stub> stub(new " + "$ns$$Service$::Stub(channel));\n" + " return stub;\n" + "}\n\n"); printer->Print(*vars, "$ns$$Service$::Stub::Stub(const std::shared_ptr< " - "::grpc::ChannelInterface>& channel)\n"); + "::grpc::Channel>& channel)\n"); printer->Indent(); printer->Print(": ::grpc::InternalStub(channel)"); for (int i = 0; i < service->method_count(); ++i) { diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index 9695a0f14b..d9ffdc30cd 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -31,7 +31,7 @@ * */ -#include "src/cpp/client/channel.h" +#include #include diff --git a/src/cpp/client/channel.h b/src/cpp/client/channel.h deleted file mode 100644 index 7e406ad788..0000000000 --- a/src/cpp/client/channel.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPC_INTERNAL_CPP_CLIENT_CHANNEL_H -#define GRPC_INTERNAL_CPP_CLIENT_CHANNEL_H - -#include - -#include -#include -#include - -struct grpc_channel; - -namespace grpc { -class Call; -class CallOpSetInterface; -class ChannelArguments; -class CompletionQueue; -class Credentials; -class StreamContextInterface; - -class Channel GRPC_FINAL : public GrpcLibrary, public ChannelInterface { - public: - explicit Channel(grpc_channel* c_channel); - Channel(const grpc::string& host, grpc_channel* c_channel); - ~Channel() GRPC_OVERRIDE; - - void* RegisterMethod(const char* method) GRPC_OVERRIDE; - Call CreateCall(const RpcMethod& method, ClientContext* context, - CompletionQueue* cq) GRPC_OVERRIDE; - void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) GRPC_OVERRIDE; - - grpc_connectivity_state GetState(bool try_to_connect) GRPC_OVERRIDE; - - private: - void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, - gpr_timespec deadline, CompletionQueue* cq, - void* tag) GRPC_OVERRIDE; - - bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, - gpr_timespec deadline) GRPC_OVERRIDE; - - const grpc::string host_; - grpc_channel* const c_channel_; // owned -}; - -} // namespace grpc - -#endif // GRPC_INTERNAL_CPP_CLIENT_CHANNEL_H diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index b8caa1eae4..a3906fc781 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -71,7 +71,7 @@ void ClientContext::AddMetadata(const grpc::string& meta_key, } void ClientContext::set_call(grpc_call* call, - const std::shared_ptr& channel) { + const std::shared_ptr& channel) { GPR_ASSERT(call_ == nullptr); call_ = call; channel_ = channel; diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc index 5ae772f096..704470693e 100644 --- a/src/cpp/client/create_channel.cc +++ b/src/cpp/client/create_channel.cc @@ -34,15 +34,14 @@ #include #include -#include "src/cpp/client/channel.h" -#include +#include #include #include namespace grpc { class ChannelArguments; -std::shared_ptr CreateChannel( +std::shared_ptr CreateChannel( const grpc::string& target, const std::shared_ptr& creds, const ChannelArguments& args) { ChannelArguments cp_args = args; @@ -51,7 +50,7 @@ std::shared_ptr CreateChannel( cp_args.SetString(GRPC_ARG_PRIMARY_USER_AGENT_STRING, user_agent_prefix.str()); return creds ? creds->CreateChannel(target, cp_args) - : std::shared_ptr( + : std::shared_ptr( new Channel(grpc_lame_client_channel_create( NULL, GRPC_STATUS_INVALID_ARGUMENT, "Invalid credentials."))); diff --git a/src/cpp/client/insecure_credentials.cc b/src/cpp/client/insecure_credentials.cc index 2f9357b568..70ce17dc6d 100644 --- a/src/cpp/client/insecure_credentials.cc +++ b/src/cpp/client/insecure_credentials.cc @@ -34,21 +34,21 @@ #include #include +#include #include #include #include -#include "src/cpp/client/channel.h" namespace grpc { namespace { class InsecureCredentialsImpl GRPC_FINAL : public Credentials { public: - std::shared_ptr CreateChannel( + std::shared_ptr CreateChannel( const string& target, const grpc::ChannelArguments& args) GRPC_OVERRIDE { grpc_channel_args channel_args; args.SetChannelArgs(&channel_args); - return std::shared_ptr(new Channel( + return std::shared_ptr(new Channel( grpc_insecure_channel_create(target.c_str(), &channel_args, nullptr))); } diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index 6cd6b77fcf..b32f783fa3 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -33,18 +33,18 @@ #include +#include #include #include -#include "src/cpp/client/channel.h" #include "src/cpp/client/secure_credentials.h" namespace grpc { -std::shared_ptr SecureCredentials::CreateChannel( +std::shared_ptr SecureCredentials::CreateChannel( const string& target, const grpc::ChannelArguments& args) { grpc_channel_args channel_args; args.SetChannelArgs(&channel_args); - return std::shared_ptr(new Channel( + return std::shared_ptr(new Channel( args.GetSslTargetNameOverride(), grpc_secure_channel_create(c_creds_, target.c_str(), &channel_args))); } diff --git a/src/cpp/client/secure_credentials.h b/src/cpp/client/secure_credentials.h index c2b8d43a15..974d83514d 100644 --- a/src/cpp/client/secure_credentials.h +++ b/src/cpp/client/secure_credentials.h @@ -48,7 +48,7 @@ class SecureCredentials GRPC_FINAL : public Credentials { grpc_credentials* GetRawCreds() { return c_creds_; } bool ApplyToCall(grpc_call* call) GRPC_OVERRIDE; - std::shared_ptr CreateChannel( + std::shared_ptr CreateChannel( const string& target, const grpc::ChannelArguments& args) GRPC_OVERRIDE; SecureCredentials* AsSecureCredentials() GRPC_OVERRIDE { return this; } diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 0a5c976e01..479f14d42b 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include "src/core/profiling/timers.h" diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index a30c841216..7006ebb83a 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -39,7 +39,7 @@ #include "test/cpp/util/echo.grpc.pb.h" #include #include -#include +#include #include #include #include @@ -136,7 +136,7 @@ class AsyncEnd2endTest : public ::testing::Test { } void ResetStub() { - std::shared_ptr channel = CreateChannel( + std::shared_ptr channel = CreateChannel( server_address_.str(), InsecureCredentials(), ChannelArguments()); stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel)); } @@ -672,7 +672,7 @@ TEST_F(AsyncEnd2endTest, ServerCheckDone) { } TEST_F(AsyncEnd2endTest, UnimplementedRpc) { - std::shared_ptr channel = CreateChannel( + std::shared_ptr channel = CreateChannel( server_address_.str(), InsecureCredentials(), ChannelArguments()); std::unique_ptr stub; stub = diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc index 1c2a5c3a36..89708a2ef6 100644 --- a/test/cpp/end2end/client_crash_test.cc +++ b/test/cpp/end2end/client_crash_test.cc @@ -36,7 +36,7 @@ #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" #include -#include +#include #include #include #include diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 350b10726f..fc4e88c2a7 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -41,7 +41,7 @@ #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" #include -#include +#include #include #include #include @@ -106,7 +106,7 @@ bool CheckIsLocalhost(const grpc::string& addr) { class Proxy : public ::grpc::cpp::test::util::TestService::Service { public: - Proxy(std::shared_ptr channel) + Proxy(std::shared_ptr channel) : stub_(grpc::cpp::test::util::TestService::NewStub(channel)) {} Status Echo(ServerContext* server_context, const EchoRequest* request, @@ -319,7 +319,7 @@ class End2endTest : public ::testing::TestWithParam { stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_)); } - std::shared_ptr channel_; + std::shared_ptr channel_; std::unique_ptr stub_; std::unique_ptr server_; std::unique_ptr proxy_server_; @@ -571,7 +571,7 @@ TEST_F(End2endTest, DiffPackageServices) { TEST_F(End2endTest, BadCredentials) { std::shared_ptr bad_creds = ServiceAccountCredentials("", "", 1); EXPECT_EQ(static_cast(nullptr), bad_creds.get()); - std::shared_ptr channel = + std::shared_ptr channel = CreateChannel(server_address_.str(), bad_creds, ChannelArguments()); std::unique_ptr stub( grpc::cpp::test::util::TestService::NewStub(channel)); diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 3120cec938..b817198fa7 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include @@ -127,7 +127,7 @@ class GenericEnd2endTest : public ::testing::Test { } void ResetStub() { - std::shared_ptr channel = CreateChannel( + std::shared_ptr channel = CreateChannel( server_address_.str(), InsecureCredentials(), ChannelArguments()); generic_stub_.reset(new GenericStub(channel)); } diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index 32130e24e9..96b6ecbd6e 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -38,7 +38,7 @@ #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" #include -#include +#include #include #include #include @@ -251,7 +251,7 @@ class MockTest : public ::testing::Test { void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } void ResetStub() { - std::shared_ptr channel = CreateChannel( + std::shared_ptr channel = CreateChannel( server_address_.str(), InsecureCredentials(), ChannelArguments()); stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel)); } diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc index 5c7bb4e653..2688f2c4ea 100644 --- a/test/cpp/end2end/server_crash_test.cc +++ b/test/cpp/end2end/server_crash_test.cc @@ -36,7 +36,7 @@ #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" #include -#include +#include #include #include #include diff --git a/test/cpp/end2end/server_crash_test_client.cc b/test/cpp/end2end/server_crash_test_client.cc index 1da4f05c8d..52dce8f28e 100644 --- a/test/cpp/end2end/server_crash_test_client.cc +++ b/test/cpp/end2end/server_crash_test_client.cc @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index ff9c945c7c..e59a77dc9e 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -39,7 +39,7 @@ #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" #include -#include +#include #include #include #include @@ -197,7 +197,7 @@ class End2endTest : public ::testing::Test { void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } void ResetStub() { - std::shared_ptr channel = CreateChannel( + std::shared_ptr channel = CreateChannel( server_address_.str(), InsecureCredentials(), ChannelArguments()); stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel)); } diff --git a/test/cpp/end2end/zookeeper_test.cc b/test/cpp/end2end/zookeeper_test.cc index f5eba66cb2..d7fac3d07e 100644 --- a/test/cpp/end2end/zookeeper_test.cc +++ b/test/cpp/end2end/zookeeper_test.cc @@ -36,7 +36,7 @@ #include "test/cpp/util/echo.grpc.pb.h" #include "src/core/support/env.h" #include -#include +#include #include #include #include @@ -170,7 +170,7 @@ class ZookeeperTest : public ::testing::Test { return strs.str(); } - std::shared_ptr channel_; + std::shared_ptr channel_; std::unique_ptr stub_; std::unique_ptr server1_; std::unique_ptr server2_; diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 48143b2e53..d9e4f1ba6a 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc index b8a222c54a..91c8dbc0c3 100644 --- a/test/cpp/interop/client_helper.cc +++ b/test/cpp/interop/client_helper.cc @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include #include @@ -103,7 +103,7 @@ grpc::string GetOauth2AccessToken() { return access_token; } -std::shared_ptr CreateChannelForTestCase( +std::shared_ptr CreateChannelForTestCase( const grpc::string& test_case) { GPR_ASSERT(FLAGS_server_port); const int host_port_buf_size = 1024; diff --git a/test/cpp/interop/client_helper.h b/test/cpp/interop/client_helper.h index 000374ae8e..3b46d87016 100644 --- a/test/cpp/interop/client_helper.h +++ b/test/cpp/interop/client_helper.h @@ -37,7 +37,7 @@ #include #include -#include +#include namespace grpc { namespace testing { @@ -46,7 +46,7 @@ grpc::string GetServiceAccountJsonKey(); grpc::string GetOauth2AccessToken(); -std::shared_ptr CreateChannelForTestCase( +std::shared_ptr CreateChannelForTestCase( const grpc::string& test_case); class InteropClientContextInspector { diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index 5ed14d556a..c73505c670 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include @@ -84,7 +84,7 @@ CompressionType GetInteropCompressionTypeFromCompressionAlgorithm( } } // namespace -InteropClient::InteropClient(std::shared_ptr channel) +InteropClient::InteropClient(std::shared_ptr channel) : channel_(channel) {} void InteropClient::AssertOkOrPrintErrorStatus(const Status& s) { diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h index d6fb9bff39..354c2c6195 100644 --- a/test/cpp/interop/interop_client.h +++ b/test/cpp/interop/interop_client.h @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include "test/proto/messages.grpc.pb.h" @@ -45,10 +45,10 @@ namespace testing { class InteropClient { public: - explicit InteropClient(std::shared_ptr channel); + explicit InteropClient(std::shared_ptr channel); ~InteropClient() {} - void Reset(std::shared_ptr channel) { channel_ = channel; } + void Reset(std::shared_ptr channel) { channel_ = channel; } void DoEmpty(); void DoLargeUnary(); @@ -82,7 +82,7 @@ class InteropClient { void PerformLargeUnary(SimpleRequest* request, SimpleResponse* response); void AssertOkOrPrintErrorStatus(const Status& s); - std::shared_ptr channel_; + std::shared_ptr channel_; }; } // namespace testing diff --git a/test/cpp/interop/reconnect_interop_client.cc b/test/cpp/interop/reconnect_interop_client.cc index 65f098050e..675c6ff073 100644 --- a/test/cpp/interop/reconnect_interop_client.cc +++ b/test/cpp/interop/reconnect_interop_client.cc @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include "test/cpp/util/create_test_channel.h" @@ -50,7 +50,7 @@ DEFINE_int32(server_control_port, 0, "Server port for control rpcs."); DEFINE_int32(server_retry_port, 0, "Server port for testing reconnection."); DEFINE_string(server_host, "127.0.0.1", "Server host to connect to"); -using grpc::ChannelInterface; +using grpc::Channel; using grpc::ClientContext; using grpc::CreateTestChannel; using grpc::Status; @@ -78,7 +78,7 @@ int main(int argc, char** argv) { gpr_log(GPR_INFO, "Starting connections with retries."); server_address.str(""); server_address << FLAGS_server_host << ':' << FLAGS_server_retry_port; - std::shared_ptr retry_channel = + std::shared_ptr retry_channel = CreateTestChannel(server_address.str(), true); // About 13 retries. const int kDeadlineSeconds = 540; diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 1c4f46328f..5395d02e32 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -125,11 +125,11 @@ class Client { channel_ = CreateTestChannel(target, config.enable_ssl()); stub_ = TestService::NewStub(channel_); } - ChannelInterface* get_channel() { return channel_.get(); } + Channel* get_channel() { return channel_.get(); } TestService::Stub* get_stub() { return stub_.get(); } private: - std::shared_ptr channel_; + std::shared_ptr channel_; std::unique_ptr stub_; }; std::vector channels_; diff --git a/test/cpp/qps/perf_db_client.h b/test/cpp/qps/perf_db_client.h index 7a9d86d3a6..3433cd88d1 100644 --- a/test/cpp/qps/perf_db_client.h +++ b/test/cpp/qps/perf_db_client.h @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include @@ -65,7 +65,7 @@ class PerfDbClient { client_user_time_ = DBL_MIN; } - void init(std::shared_ptr channel) { + void init(std::shared_ptr channel) { stub_ = PerfDbTransfer::NewStub(channel); } diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc index ac88910a01..d0a300f511 100644 --- a/test/cpp/util/cli_call.cc +++ b/test/cpp/util/cli_call.cc @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include #include @@ -52,7 +52,7 @@ namespace { void* tag(int i) { return (void*)(gpr_intptr)i; } } // namespace -Status CliCall::Call(std::shared_ptr channel, +Status CliCall::Call(std::shared_ptr channel, const grpc::string& method, const grpc::string& request, grpc::string* response, const MetadataContainer& metadata, MetadataContainer* server_initial_metadata, diff --git a/test/cpp/util/cli_call.h b/test/cpp/util/cli_call.h index 8d114c9cb5..46b5dd3e4f 100644 --- a/test/cpp/util/cli_call.h +++ b/test/cpp/util/cli_call.h @@ -36,7 +36,7 @@ #include -#include +#include #include #include @@ -46,7 +46,7 @@ namespace testing { class CliCall GRPC_FINAL { public: typedef std::multimap MetadataContainer; - static Status Call(std::shared_ptr channel, + static Status Call(std::shared_ptr channel, const grpc::string& method, const grpc::string& request, grpc::string* response, const MetadataContainer& metadata, MetadataContainer* server_initial_metadata, diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc index 848a3aee57..146e96720f 100644 --- a/test/cpp/util/cli_call_test.cc +++ b/test/cpp/util/cli_call_test.cc @@ -35,7 +35,7 @@ #include "test/cpp/util/cli_call.h" #include "test/cpp/util/echo.grpc.pb.h" #include -#include +#include #include #include #include @@ -97,7 +97,7 @@ class CliCallTest : public ::testing::Test { stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_)); } - std::shared_ptr channel_; + std::shared_ptr channel_; std::unique_ptr stub_; std::unique_ptr server_; std::ostringstream server_address_; diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc index dc48fa2d87..43e719ef6b 100644 --- a/test/cpp/util/create_test_channel.cc +++ b/test/cpp/util/create_test_channel.cc @@ -55,7 +55,7 @@ namespace grpc { // CreateTestChannel("test.google.com:443", "", true, true, creds); // same as above // CreateTestChannel("", "test.google.com:443", true, true, creds); -std::shared_ptr CreateTestChannel( +std::shared_ptr CreateTestChannel( const grpc::string& server, const grpc::string& override_hostname, bool enable_ssl, bool use_prod_roots, const std::shared_ptr& creds) { @@ -80,7 +80,7 @@ std::shared_ptr CreateTestChannel( } } -std::shared_ptr CreateTestChannel( +std::shared_ptr CreateTestChannel( const grpc::string& server, const grpc::string& override_hostname, bool enable_ssl, bool use_prod_roots) { return CreateTestChannel(server, override_hostname, enable_ssl, @@ -88,8 +88,8 @@ std::shared_ptr CreateTestChannel( } // Shortcut for end2end and interop tests. -std::shared_ptr CreateTestChannel(const grpc::string& server, - bool enable_ssl) { +std::shared_ptr CreateTestChannel(const grpc::string& server, + bool enable_ssl) { return CreateTestChannel(server, "foo.test.google.fr", enable_ssl, false); } diff --git a/test/cpp/util/create_test_channel.h b/test/cpp/util/create_test_channel.h index 5f2609ddd8..129cc746f9 100644 --- a/test/cpp/util/create_test_channel.h +++ b/test/cpp/util/create_test_channel.h @@ -40,16 +40,16 @@ #include namespace grpc { -class ChannelInterface; +class Channel; -std::shared_ptr CreateTestChannel(const grpc::string& server, - bool enable_ssl); +std::shared_ptr CreateTestChannel(const grpc::string& server, + bool enable_ssl); -std::shared_ptr CreateTestChannel( +std::shared_ptr CreateTestChannel( const grpc::string& server, const grpc::string& override_hostname, bool enable_ssl, bool use_prod_roots); -std::shared_ptr CreateTestChannel( +std::shared_ptr CreateTestChannel( const grpc::string& server, const grpc::string& override_hostname, bool enable_ssl, bool use_prod_roots, const std::shared_ptr& creds); diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc index 3c3baeb769..15c56a352c 100644 --- a/test/cpp/util/grpc_cli.cc +++ b/test/cpp/util/grpc_cli.cc @@ -67,7 +67,7 @@ #include "test/cpp/util/cli_call.h" #include "test/cpp/util/test_config.h" #include -#include +#include #include #include @@ -154,7 +154,7 @@ int main(int argc, char** argv) { creds = grpc::SslCredentials(grpc::SslCredentialsOptions()); } } - std::shared_ptr channel = + std::shared_ptr channel = grpc::CreateChannel(server_address, creds, grpc::ChannelArguments()); grpc::string response; diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 790e637b72..366fc9962c 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -764,8 +764,8 @@ INPUT = include/grpc++/async_generic_service.h \ include/grpc++/async_unary_call.h \ include/grpc++/auth_context.h \ include/grpc++/byte_buffer.h \ +include/grpc++/channel.h \ include/grpc++/channel_arguments.h \ -include/grpc++/channel_interface.h \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/config.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index cd1279e2a6..7137018910 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -764,8 +764,8 @@ INPUT = include/grpc++/async_generic_service.h \ include/grpc++/async_unary_call.h \ include/grpc++/auth_context.h \ include/grpc++/byte_buffer.h \ +include/grpc++/channel.h \ include/grpc++/channel_arguments.h \ -include/grpc++/channel_interface.h \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/config.h \ @@ -804,7 +804,6 @@ include/grpc++/time.h \ src/cpp/client/secure_credentials.h \ src/cpp/common/secure_auth_context.h \ src/cpp/server/secure_server_credentials.h \ -src/cpp/client/channel.h \ src/cpp/common/create_auth_context.h \ src/cpp/client/secure_channel_arguments.cc \ src/cpp/client/secure_credentials.cc \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 72e6c41508..20eeabd288 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -13105,8 +13105,8 @@ "include/grpc++/async_unary_call.h", "include/grpc++/auth_context.h", "include/grpc++/byte_buffer.h", + "include/grpc++/channel.h", "include/grpc++/channel_arguments.h", - "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/config.h", @@ -13142,7 +13142,6 @@ "include/grpc++/stub_options.h", "include/grpc++/thread_pool_interface.h", "include/grpc++/time.h", - "src/cpp/client/channel.h", "src/cpp/client/secure_credentials.h", "src/cpp/common/create_auth_context.h", "src/cpp/common/secure_auth_context.h", @@ -13155,8 +13154,8 @@ "include/grpc++/async_unary_call.h", "include/grpc++/auth_context.h", "include/grpc++/byte_buffer.h", + "include/grpc++/channel.h", "include/grpc++/channel_arguments.h", - "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/config.h", @@ -13193,7 +13192,6 @@ "include/grpc++/thread_pool_interface.h", "include/grpc++/time.h", "src/cpp/client/channel.cc", - "src/cpp/client/channel.h", "src/cpp/client/channel_arguments.cc", "src/cpp/client/client_context.cc", "src/cpp/client/create_channel.cc", @@ -13279,8 +13277,8 @@ "include/grpc++/async_unary_call.h", "include/grpc++/auth_context.h", "include/grpc++/byte_buffer.h", + "include/grpc++/channel.h", "include/grpc++/channel_arguments.h", - "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/config.h", @@ -13316,7 +13314,6 @@ "include/grpc++/stub_options.h", "include/grpc++/thread_pool_interface.h", "include/grpc++/time.h", - "src/cpp/client/channel.h", "src/cpp/common/create_auth_context.h" ], "language": "c++", @@ -13326,8 +13323,8 @@ "include/grpc++/async_unary_call.h", "include/grpc++/auth_context.h", "include/grpc++/byte_buffer.h", + "include/grpc++/channel.h", "include/grpc++/channel_arguments.h", - "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/config.h", @@ -13364,7 +13361,6 @@ "include/grpc++/thread_pool_interface.h", "include/grpc++/time.h", "src/cpp/client/channel.cc", - "src/cpp/client/channel.h", "src/cpp/client/channel_arguments.cc", "src/cpp/client/client_context.cc", "src/cpp/client/create_channel.cc", diff --git a/vsprojects/grpc++/grpc++.vcxproj b/vsprojects/grpc++/grpc++.vcxproj index 929bc1500e..8ce96cc0e2 100644 --- a/vsprojects/grpc++/grpc++.vcxproj +++ b/vsprojects/grpc++/grpc++.vcxproj @@ -217,8 +217,8 @@ + - @@ -259,7 +259,6 @@ - diff --git a/vsprojects/grpc++/grpc++.vcxproj.filters b/vsprojects/grpc++/grpc++.vcxproj.filters index 0408fb46a5..924cbc4c73 100644 --- a/vsprojects/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/grpc++/grpc++.vcxproj.filters @@ -108,10 +108,10 @@ include\grpc++ - + include\grpc++ - + include\grpc++ @@ -230,9 +230,6 @@ src\cpp\server - - src\cpp\client - src\cpp\common diff --git a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj index 2ff252e04e..00667d38d7 100644 --- a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -217,8 +217,8 @@ + - @@ -256,7 +256,6 @@ - diff --git a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index b4fae7741c..12d42f5e61 100644 --- a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -93,10 +93,10 @@ include\grpc++ - + include\grpc++ - + include\grpc++ @@ -206,9 +206,6 @@ - - src\cpp\client - src\cpp\common -- cgit v1.2.3 From 9e2f90cd068b4c2a8fdec69ca93ca614d35cba28 Mon Sep 17 00:00:00 2001 From: yang-g Date: Fri, 21 Aug 2015 15:35:03 -0700 Subject: headers reorg --- BUILD | 68 +- Makefile | 68 +- build.json | 34 +- examples/pubsub/main.cc | 6 +- examples/pubsub/publisher.h | 1 - examples/pubsub/publisher_test.cc | 2 - examples/pubsub/subscriber.h | 1 - examples/pubsub/subscriber_test.cc | 2 - include/grpc++/async_generic_service.h | 78 --- include/grpc++/async_unary_call.h | 155 ---- include/grpc++/auth_context.h | 95 --- include/grpc++/byte_buffer.h | 104 --- include/grpc++/channel.h | 2 +- include/grpc++/channel_arguments.h | 93 --- include/grpc++/client_context.h | 8 +- include/grpc++/completion_queue.h | 4 +- include/grpc++/config.h | 116 --- include/grpc++/config_protobuf.h | 72 -- include/grpc++/create_channel.h | 4 +- include/grpc++/credentials.h | 2 +- include/grpc++/dynamic_thread_pool.h | 83 --- include/grpc++/fixed_size_thread_pool.h | 67 -- include/grpc++/generic/async_generic_service.h | 78 +++ include/grpc++/generic/generic_stub.h | 63 ++ include/grpc++/generic_stub.h | 63 -- include/grpc++/impl/call.h | 15 +- include/grpc++/impl/client_unary_call.h | 5 +- include/grpc++/impl/proto_utils.h | 4 +- include/grpc++/impl/rpc_service_method.h | 6 +- include/grpc++/impl/service_type.h | 4 +- include/grpc++/impl/sync.h | 2 +- include/grpc++/impl/thd.h | 2 +- include/grpc++/server.h | 4 +- include/grpc++/server_builder.h | 2 +- include/grpc++/server_context.h | 6 +- include/grpc++/server_credentials.h | 2 +- include/grpc++/slice.h | 74 -- include/grpc++/status.h | 64 -- include/grpc++/status_code_enum.h | 159 ----- include/grpc++/stream.h | 776 --------------------- include/grpc++/stub_options.h | 43 -- include/grpc++/support/async_unary_call.h | 155 ++++ include/grpc++/support/auth_context.h | 95 +++ include/grpc++/support/byte_buffer.h | 104 +++ include/grpc++/support/channel_arguments.h | 93 +++ include/grpc++/support/config.h | 116 +++ include/grpc++/support/config_protobuf.h | 72 ++ include/grpc++/support/dynamic_thread_pool.h | 82 +++ include/grpc++/support/fixed_size_thread_pool.h | 66 ++ include/grpc++/support/slice.h | 74 ++ include/grpc++/support/status.h | 64 ++ include/grpc++/support/status_code_enum.h | 159 +++++ include/grpc++/support/stream.h | 776 +++++++++++++++++++++ include/grpc++/support/stub_options.h | 43 ++ include/grpc++/support/thread_pool_interface.h | 54 ++ include/grpc++/support/time.h | 110 +++ include/grpc++/thread_pool_interface.h | 54 -- include/grpc++/time.h | 110 --- src/compiler/config.h | 4 +- src/compiler/cpp_generator.cc | 12 +- src/compiler/python_generator.cc | 2 +- src/cpp/client/channel.cc | 11 +- src/cpp/client/channel_arguments.cc | 3 +- src/cpp/client/client_context.cc | 2 +- src/cpp/client/create_channel.cc | 2 +- src/cpp/client/create_channel_internal.h | 2 +- src/cpp/client/generic_stub.cc | 2 +- src/cpp/client/insecure_credentials.cc | 8 +- src/cpp/client/secure_channel_arguments.cc | 4 +- src/cpp/client/secure_credentials.cc | 2 +- src/cpp/client/secure_credentials.h | 2 +- src/cpp/common/auth_property_iterator.cc | 2 +- src/cpp/common/call.cc | 5 +- src/cpp/common/completion_queue.cc | 2 +- src/cpp/common/create_auth_context.h | 2 +- src/cpp/common/insecure_create_auth_context.cc | 2 +- src/cpp/common/secure_auth_context.h | 2 +- src/cpp/common/secure_create_auth_context.cc | 2 +- src/cpp/proto/proto_utils.cc | 2 +- src/cpp/server/async_generic_service.cc | 2 +- src/cpp/server/create_default_thread_pool.cc | 2 +- src/cpp/server/dynamic_thread_pool.cc | 2 +- src/cpp/server/fixed_size_thread_pool.cc | 2 +- src/cpp/server/secure_server_credentials.h | 4 +- src/cpp/server/server.cc | 7 +- src/cpp/server/server_builder.cc | 4 +- src/cpp/server/server_context.cc | 2 +- src/cpp/util/byte_buffer.cc | 2 +- src/cpp/util/slice.cc | 2 +- src/cpp/util/status.cc | 2 +- src/cpp/util/time.cc | 4 +- test/cpp/client/channel_arguments_test.cc | 2 +- test/cpp/common/auth_property_iterator_test.cc | 2 +- test/cpp/common/secure_auth_context_test.cc | 2 +- test/cpp/end2end/async_end2end_test.cc | 19 +- test/cpp/end2end/client_crash_test.cc | 19 +- test/cpp/end2end/client_crash_test_server.cc | 1 - test/cpp/end2end/end2end_test.cc | 24 +- test/cpp/end2end/generic_end2end_test.cc | 24 +- test/cpp/end2end/mock_test.cc | 20 +- test/cpp/end2end/server_crash_test.cc | 19 +- test/cpp/end2end/server_crash_test_client.cc | 2 - test/cpp/end2end/shutdown_test.cc | 16 +- test/cpp/end2end/thread_stress_test.cc | 20 +- test/cpp/end2end/zookeeper_test.cc | 11 +- test/cpp/interop/client.cc | 3 +- test/cpp/interop/client_helper.cc | 9 +- test/cpp/interop/client_helper.h | 1 - test/cpp/interop/interop_client.cc | 8 +- test/cpp/interop/interop_client.h | 2 +- test/cpp/interop/interop_test.cc | 11 +- test/cpp/interop/reconnect_interop_client.cc | 1 - test/cpp/interop/reconnect_interop_server.cc | 9 +- test/cpp/interop/server.cc | 14 +- test/cpp/interop/server_helper.cc | 1 - test/cpp/qps/client.h | 8 +- test/cpp/qps/client_async.cc | 6 +- test/cpp/qps/client_sync.cc | 9 +- test/cpp/qps/driver.cc | 22 +- test/cpp/qps/interarrival.h | 2 +- test/cpp/qps/perf_db_client.h | 3 +- test/cpp/qps/qps_interarrival_test.cc | 4 +- test/cpp/qps/qps_openloop_test.cc | 4 +- test/cpp/qps/qps_test.cc | 4 +- test/cpp/qps/qps_test_with_poll.cc | 4 +- test/cpp/qps/qps_worker.cc | 5 +- test/cpp/qps/report.h | 3 +- test/cpp/qps/server_async.cc | 10 +- test/cpp/qps/server_sync.cc | 15 +- test/cpp/qps/stats.h | 3 +- test/cpp/qps/sync_streaming_ping_pong_test.cc | 4 +- test/cpp/qps/sync_unary_ping_pong_test.cc | 4 +- test/cpp/qps/timer.cc | 1 - test/cpp/qps/worker.cc | 2 +- test/cpp/server/dynamic_thread_pool_test.cc | 3 +- test/cpp/server/fixed_size_thread_pool_test.cc | 3 +- test/cpp/util/byte_buffer_test.cc | 4 +- test/cpp/util/cli_call.cc | 11 +- test/cpp/util/cli_call.h | 3 +- test/cpp/util/cli_call_test.cc | 13 +- test/cpp/util/create_test_channel.cc | 4 +- test/cpp/util/create_test_channel.h | 1 - test/cpp/util/grpc_cli.cc | 7 +- test/cpp/util/slice_test.cc | 2 +- test/cpp/util/status_test.cc | 3 +- test/cpp/util/time_test.cc | 2 +- tools/doxygen/Doxyfile.c++ | 36 +- tools/doxygen/Doxyfile.c++.internal | 36 +- tools/run_tests/sources_and_headers.json | 136 ++-- vsprojects/grpc++/grpc++.vcxproj | 34 +- vsprojects/grpc++/grpc++.vcxproj.filters | 90 +-- vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj | 34 +- .../grpc++_unsecure.vcxproj.filters | 90 +-- 153 files changed, 2786 insertions(+), 2853 deletions(-) delete mode 100644 include/grpc++/async_generic_service.h delete mode 100644 include/grpc++/async_unary_call.h delete mode 100644 include/grpc++/auth_context.h delete mode 100644 include/grpc++/byte_buffer.h delete mode 100644 include/grpc++/channel_arguments.h delete mode 100644 include/grpc++/config.h delete mode 100644 include/grpc++/config_protobuf.h delete mode 100644 include/grpc++/dynamic_thread_pool.h delete mode 100644 include/grpc++/fixed_size_thread_pool.h create mode 100644 include/grpc++/generic/async_generic_service.h create mode 100644 include/grpc++/generic/generic_stub.h delete mode 100644 include/grpc++/generic_stub.h delete mode 100644 include/grpc++/slice.h delete mode 100644 include/grpc++/status.h delete mode 100644 include/grpc++/status_code_enum.h delete mode 100644 include/grpc++/stream.h delete mode 100644 include/grpc++/stub_options.h create mode 100644 include/grpc++/support/async_unary_call.h create mode 100644 include/grpc++/support/auth_context.h create mode 100644 include/grpc++/support/byte_buffer.h create mode 100644 include/grpc++/support/channel_arguments.h create mode 100644 include/grpc++/support/config.h create mode 100644 include/grpc++/support/config_protobuf.h create mode 100644 include/grpc++/support/dynamic_thread_pool.h create mode 100644 include/grpc++/support/fixed_size_thread_pool.h create mode 100644 include/grpc++/support/slice.h create mode 100644 include/grpc++/support/status.h create mode 100644 include/grpc++/support/status_code_enum.h create mode 100644 include/grpc++/support/stream.h create mode 100644 include/grpc++/support/stub_options.h create mode 100644 include/grpc++/support/thread_pool_interface.h create mode 100644 include/grpc++/support/time.h delete mode 100644 include/grpc++/thread_pool_interface.h delete mode 100644 include/grpc++/time.h (limited to 'include/grpc++/completion_queue.h') diff --git a/BUILD b/BUILD index d712053a3d..620a954a5a 100644 --- a/BUILD +++ b/BUILD @@ -710,21 +710,13 @@ cc_library( "src/cpp/util/time.cc", ], hdrs = [ - "include/grpc++/async_generic_service.h", - "include/grpc++/async_unary_call.h", - "include/grpc++/auth_context.h", - "include/grpc++/byte_buffer.h", "include/grpc++/channel.h", - "include/grpc++/channel_arguments.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", - "include/grpc++/config.h", - "include/grpc++/config_protobuf.h", "include/grpc++/create_channel.h", "include/grpc++/credentials.h", - "include/grpc++/dynamic_thread_pool.h", - "include/grpc++/fixed_size_thread_pool.h", - "include/grpc++/generic_stub.h", + "include/grpc++/generic/async_generic_service.h", + "include/grpc++/generic/generic_stub.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/grpc_library.h", @@ -743,13 +735,21 @@ cc_library( "include/grpc++/server_builder.h", "include/grpc++/server_context.h", "include/grpc++/server_credentials.h", - "include/grpc++/slice.h", - "include/grpc++/status.h", - "include/grpc++/status_code_enum.h", - "include/grpc++/stream.h", - "include/grpc++/stub_options.h", - "include/grpc++/thread_pool_interface.h", - "include/grpc++/time.h", + "include/grpc++/support/async_unary_call.h", + "include/grpc++/support/auth_context.h", + "include/grpc++/support/byte_buffer.h", + "include/grpc++/support/channel_arguments.h", + "include/grpc++/support/config.h", + "include/grpc++/support/config_protobuf.h", + "include/grpc++/support/dynamic_thread_pool.h", + "include/grpc++/support/fixed_size_thread_pool.h", + "include/grpc++/support/slice.h", + "include/grpc++/support/status.h", + "include/grpc++/support/status_code_enum.h", + "include/grpc++/support/stream.h", + "include/grpc++/support/stub_options.h", + "include/grpc++/support/thread_pool_interface.h", + "include/grpc++/support/time.h", ], includes = [ "include", @@ -796,21 +796,13 @@ cc_library( "src/cpp/util/time.cc", ], hdrs = [ - "include/grpc++/async_generic_service.h", - "include/grpc++/async_unary_call.h", - "include/grpc++/auth_context.h", - "include/grpc++/byte_buffer.h", "include/grpc++/channel.h", - "include/grpc++/channel_arguments.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", - "include/grpc++/config.h", - "include/grpc++/config_protobuf.h", "include/grpc++/create_channel.h", "include/grpc++/credentials.h", - "include/grpc++/dynamic_thread_pool.h", - "include/grpc++/fixed_size_thread_pool.h", - "include/grpc++/generic_stub.h", + "include/grpc++/generic/async_generic_service.h", + "include/grpc++/generic/generic_stub.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/grpc_library.h", @@ -829,13 +821,21 @@ cc_library( "include/grpc++/server_builder.h", "include/grpc++/server_context.h", "include/grpc++/server_credentials.h", - "include/grpc++/slice.h", - "include/grpc++/status.h", - "include/grpc++/status_code_enum.h", - "include/grpc++/stream.h", - "include/grpc++/stub_options.h", - "include/grpc++/thread_pool_interface.h", - "include/grpc++/time.h", + "include/grpc++/support/async_unary_call.h", + "include/grpc++/support/auth_context.h", + "include/grpc++/support/byte_buffer.h", + "include/grpc++/support/channel_arguments.h", + "include/grpc++/support/config.h", + "include/grpc++/support/config_protobuf.h", + "include/grpc++/support/dynamic_thread_pool.h", + "include/grpc++/support/fixed_size_thread_pool.h", + "include/grpc++/support/slice.h", + "include/grpc++/support/status.h", + "include/grpc++/support/status_code_enum.h", + "include/grpc++/support/stream.h", + "include/grpc++/support/stub_options.h", + "include/grpc++/support/thread_pool_interface.h", + "include/grpc++/support/time.h", ], includes = [ "include", diff --git a/Makefile b/Makefile index 5cce835c02..9dffab01c0 100644 --- a/Makefile +++ b/Makefile @@ -4629,21 +4629,13 @@ LIBGRPC++_SRC = \ src/cpp/util/time.cc \ PUBLIC_HEADERS_CXX += \ - include/grpc++/async_generic_service.h \ - include/grpc++/async_unary_call.h \ - include/grpc++/auth_context.h \ - include/grpc++/byte_buffer.h \ include/grpc++/channel.h \ - include/grpc++/channel_arguments.h \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ - include/grpc++/config.h \ - include/grpc++/config_protobuf.h \ include/grpc++/create_channel.h \ include/grpc++/credentials.h \ - include/grpc++/dynamic_thread_pool.h \ - include/grpc++/fixed_size_thread_pool.h \ - include/grpc++/generic_stub.h \ + include/grpc++/generic/async_generic_service.h \ + include/grpc++/generic/generic_stub.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/grpc_library.h \ @@ -4662,13 +4654,21 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/server_builder.h \ include/grpc++/server_context.h \ include/grpc++/server_credentials.h \ - include/grpc++/slice.h \ - include/grpc++/status.h \ - include/grpc++/status_code_enum.h \ - include/grpc++/stream.h \ - include/grpc++/stub_options.h \ - include/grpc++/thread_pool_interface.h \ - include/grpc++/time.h \ + include/grpc++/support/async_unary_call.h \ + include/grpc++/support/auth_context.h \ + include/grpc++/support/byte_buffer.h \ + include/grpc++/support/channel_arguments.h \ + include/grpc++/support/config.h \ + include/grpc++/support/config_protobuf.h \ + include/grpc++/support/dynamic_thread_pool.h \ + include/grpc++/support/fixed_size_thread_pool.h \ + include/grpc++/support/slice.h \ + include/grpc++/support/status.h \ + include/grpc++/support/status_code_enum.h \ + include/grpc++/support/stream.h \ + include/grpc++/support/stub_options.h \ + include/grpc++/support/thread_pool_interface.h \ + include/grpc++/support/time.h \ LIBGRPC++_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_SRC)))) @@ -4871,21 +4871,13 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/util/time.cc \ PUBLIC_HEADERS_CXX += \ - include/grpc++/async_generic_service.h \ - include/grpc++/async_unary_call.h \ - include/grpc++/auth_context.h \ - include/grpc++/byte_buffer.h \ include/grpc++/channel.h \ - include/grpc++/channel_arguments.h \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ - include/grpc++/config.h \ - include/grpc++/config_protobuf.h \ include/grpc++/create_channel.h \ include/grpc++/credentials.h \ - include/grpc++/dynamic_thread_pool.h \ - include/grpc++/fixed_size_thread_pool.h \ - include/grpc++/generic_stub.h \ + include/grpc++/generic/async_generic_service.h \ + include/grpc++/generic/generic_stub.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/grpc_library.h \ @@ -4904,13 +4896,21 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/server_builder.h \ include/grpc++/server_context.h \ include/grpc++/server_credentials.h \ - include/grpc++/slice.h \ - include/grpc++/status.h \ - include/grpc++/status_code_enum.h \ - include/grpc++/stream.h \ - include/grpc++/stub_options.h \ - include/grpc++/thread_pool_interface.h \ - include/grpc++/time.h \ + include/grpc++/support/async_unary_call.h \ + include/grpc++/support/auth_context.h \ + include/grpc++/support/byte_buffer.h \ + include/grpc++/support/channel_arguments.h \ + include/grpc++/support/config.h \ + include/grpc++/support/config_protobuf.h \ + include/grpc++/support/dynamic_thread_pool.h \ + include/grpc++/support/fixed_size_thread_pool.h \ + include/grpc++/support/slice.h \ + include/grpc++/support/status.h \ + include/grpc++/support/status_code_enum.h \ + include/grpc++/support/stream.h \ + include/grpc++/support/stub_options.h \ + include/grpc++/support/thread_pool_interface.h \ + include/grpc++/support/time.h \ LIBGRPC++_UNSECURE_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_UNSECURE_SRC)))) diff --git a/build.json b/build.json index 484502bf34..8eb4f37703 100644 --- a/build.json +++ b/build.json @@ -30,21 +30,13 @@ { "name": "grpc++_base", "public_headers": [ - "include/grpc++/async_generic_service.h", - "include/grpc++/async_unary_call.h", - "include/grpc++/auth_context.h", - "include/grpc++/byte_buffer.h", "include/grpc++/channel.h", - "include/grpc++/channel_arguments.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", - "include/grpc++/config.h", - "include/grpc++/config_protobuf.h", "include/grpc++/create_channel.h", "include/grpc++/credentials.h", - "include/grpc++/dynamic_thread_pool.h", - "include/grpc++/fixed_size_thread_pool.h", - "include/grpc++/generic_stub.h", + "include/grpc++/generic/async_generic_service.h", + "include/grpc++/generic/generic_stub.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/grpc_library.h", @@ -63,13 +55,21 @@ "include/grpc++/server_builder.h", "include/grpc++/server_context.h", "include/grpc++/server_credentials.h", - "include/grpc++/slice.h", - "include/grpc++/status.h", - "include/grpc++/status_code_enum.h", - "include/grpc++/stream.h", - "include/grpc++/stub_options.h", - "include/grpc++/thread_pool_interface.h", - "include/grpc++/time.h" + "include/grpc++/support/async_unary_call.h", + "include/grpc++/support/auth_context.h", + "include/grpc++/support/byte_buffer.h", + "include/grpc++/support/channel_arguments.h", + "include/grpc++/support/config.h", + "include/grpc++/support/config_protobuf.h", + "include/grpc++/support/dynamic_thread_pool.h", + "include/grpc++/support/fixed_size_thread_pool.h", + "include/grpc++/support/slice.h", + "include/grpc++/support/status.h", + "include/grpc++/support/status_code_enum.h", + "include/grpc++/support/stream.h", + "include/grpc++/support/stub_options.h", + "include/grpc++/support/thread_pool_interface.h", + "include/grpc++/support/time.h" ], "headers": [ "src/cpp/client/create_channel_internal.h", diff --git a/examples/pubsub/main.cc b/examples/pubsub/main.cc index fcee3b316b..32102dcb5c 100644 --- a/examples/pubsub/main.cc +++ b/examples/pubsub/main.cc @@ -37,18 +37,16 @@ #include #include +#include #include #include -#include -#include #include #include #include -#include -#include "test/cpp/util/test_config.h" #include "examples/pubsub/publisher.h" #include "examples/pubsub/subscriber.h" +#include "test/cpp/util/test_config.h" DEFINE_int32(server_port, 443, "Server port."); DEFINE_string(server_host, "pubsub-staging.googleapis.com", diff --git a/examples/pubsub/publisher.h b/examples/pubsub/publisher.h index b98e6973dc..02e6194b0b 100644 --- a/examples/pubsub/publisher.h +++ b/examples/pubsub/publisher.h @@ -35,7 +35,6 @@ #define GRPC_EXAMPLES_PUBSUB_PUBLISHER_H #include -#include #include "examples/pubsub/pubsub.grpc.pb.h" diff --git a/examples/pubsub/publisher_test.cc b/examples/pubsub/publisher_test.cc index 972b426e64..c2eb295ef2 100644 --- a/examples/pubsub/publisher_test.cc +++ b/examples/pubsub/publisher_test.cc @@ -31,7 +31,6 @@ * */ -#include #include #include #include @@ -39,7 +38,6 @@ #include #include #include -#include #include #include "examples/pubsub/publisher.h" diff --git a/examples/pubsub/subscriber.h b/examples/pubsub/subscriber.h index 87c833102c..c5b1df0d3e 100644 --- a/examples/pubsub/subscriber.h +++ b/examples/pubsub/subscriber.h @@ -35,7 +35,6 @@ #define GRPC_EXAMPLES_PUBSUB_SUBSCRIBER_H #include -#include #include "examples/pubsub/pubsub.grpc.pb.h" diff --git a/examples/pubsub/subscriber_test.cc b/examples/pubsub/subscriber_test.cc index 7974ca88c2..c5a077f407 100644 --- a/examples/pubsub/subscriber_test.cc +++ b/examples/pubsub/subscriber_test.cc @@ -31,7 +31,6 @@ * */ -#include #include #include #include @@ -39,7 +38,6 @@ #include #include #include -#include #include #include "examples/pubsub/subscriber.h" diff --git a/include/grpc++/async_generic_service.h b/include/grpc++/async_generic_service.h deleted file mode 100644 index b435c6e73d..0000000000 --- a/include/grpc++/async_generic_service.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_ASYNC_GENERIC_SERVICE_H -#define GRPCXX_ASYNC_GENERIC_SERVICE_H - -#include -#include - -struct grpc_server; - -namespace grpc { - -typedef ServerAsyncReaderWriter - GenericServerAsyncReaderWriter; - -class GenericServerContext GRPC_FINAL : public ServerContext { - public: - const grpc::string& method() const { return method_; } - const grpc::string& host() const { return host_; } - - private: - friend class Server; - - grpc::string method_; - grpc::string host_; -}; - -class AsyncGenericService GRPC_FINAL { - public: - // TODO(yangg) Once we can add multiple completion queues to the server - // in c core, add a CompletionQueue* argument to the ctor here. - // TODO(yangg) support methods list. - AsyncGenericService(const grpc::string& methods) : server_(nullptr) {} - - void RequestCall(GenericServerContext* ctx, - GenericServerAsyncReaderWriter* reader_writer, - CompletionQueue* call_cq, - ServerCompletionQueue* notification_cq, void* tag); - - private: - friend class Server; - Server* server_; -}; - -} // namespace grpc - -#endif // GRPCXX_ASYNC_GENERIC_SERVICE_H diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h deleted file mode 100644 index 4e1dd15f32..0000000000 --- a/include/grpc++/async_unary_call.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_ASYNC_UNARY_CALL_H -#define GRPCXX_ASYNC_UNARY_CALL_H - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace grpc { - -template -class ClientAsyncResponseReaderInterface { - public: - virtual ~ClientAsyncResponseReaderInterface() {} - virtual void ReadInitialMetadata(void* tag) = 0; - virtual void Finish(R* msg, Status* status, void* tag) = 0; -}; - -template -class ClientAsyncResponseReader GRPC_FINAL - : public ClientAsyncResponseReaderInterface { - public: - template - ClientAsyncResponseReader(Channel* channel, CompletionQueue* cq, - const RpcMethod& method, ClientContext* context, - const W& request) - : context_(context), call_(channel->CreateCall(method, context, cq)) { - init_buf_.SendInitialMetadata(context->send_initial_metadata_); - // TODO(ctiller): don't assert - GPR_ASSERT(init_buf_.SendMessage(request).ok()); - init_buf_.ClientSendClose(); - call_.PerformOps(&init_buf_); - } - - void ReadInitialMetadata(void* tag) { - GPR_ASSERT(!context_->initial_metadata_received_); - - meta_buf_.set_output_tag(tag); - meta_buf_.RecvInitialMetadata(context_); - call_.PerformOps(&meta_buf_); - } - - void Finish(R* msg, Status* status, void* tag) { - finish_buf_.set_output_tag(tag); - if (!context_->initial_metadata_received_) { - finish_buf_.RecvInitialMetadata(context_); - } - finish_buf_.RecvMessage(msg); - finish_buf_.ClientRecvStatus(context_, status); - call_.PerformOps(&finish_buf_); - } - - private: - ClientContext* context_; - Call call_; - SneakyCallOpSet init_buf_; - CallOpSet meta_buf_; - CallOpSet, - CallOpClientRecvStatus> finish_buf_; -}; - -template -class ServerAsyncResponseWriter GRPC_FINAL - : public ServerAsyncStreamingInterface { - public: - explicit ServerAsyncResponseWriter(ServerContext* ctx) - : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} - - void SendInitialMetadata(void* tag) GRPC_OVERRIDE { - GPR_ASSERT(!ctx_->sent_initial_metadata_); - - meta_buf_.set_output_tag(tag); - meta_buf_.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - call_.PerformOps(&meta_buf_); - } - - void Finish(const W& msg, const Status& status, void* tag) { - finish_buf_.set_output_tag(tag); - if (!ctx_->sent_initial_metadata_) { - finish_buf_.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - } - // The response is dropped if the status is not OK. - if (status.ok()) { - finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, - finish_buf_.SendMessage(msg)); - } else { - finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status); - } - call_.PerformOps(&finish_buf_); - } - - void FinishWithError(const Status& status, void* tag) { - GPR_ASSERT(!status.ok()); - finish_buf_.set_output_tag(tag); - if (!ctx_->sent_initial_metadata_) { - finish_buf_.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - } - finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status); - call_.PerformOps(&finish_buf_); - } - - private: - void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } - - Call call_; - ServerContext* ctx_; - CallOpSet meta_buf_; - CallOpSet finish_buf_; -}; - -} // namespace grpc - -#endif // GRPCXX_ASYNC_UNARY_CALL_H diff --git a/include/grpc++/auth_context.h b/include/grpc++/auth_context.h deleted file mode 100644 index 7dced90ce5..0000000000 --- a/include/grpc++/auth_context.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_AUTH_CONTEXT_H -#define GRPCXX_AUTH_CONTEXT_H - -#include -#include - -#include - -struct grpc_auth_context; -struct grpc_auth_property; -struct grpc_auth_property_iterator; - -namespace grpc { -class SecureAuthContext; - -typedef std::pair AuthProperty; - -class AuthPropertyIterator - : public std::iterator { - public: - ~AuthPropertyIterator(); - AuthPropertyIterator& operator++(); - AuthPropertyIterator operator++(int); - bool operator==(const AuthPropertyIterator& rhs) const; - bool operator!=(const AuthPropertyIterator& rhs) const; - const AuthProperty operator*(); - - protected: - AuthPropertyIterator(); - AuthPropertyIterator(const grpc_auth_property* property, - const grpc_auth_property_iterator* iter); - - private: - friend class SecureAuthContext; - const grpc_auth_property* property_; - // The following items form a grpc_auth_property_iterator. - const grpc_auth_context* ctx_; - size_t index_; - const char* name_; -}; - -class AuthContext { - public: - virtual ~AuthContext() {} - - // A peer identity, in general is one or more properties (in which case they - // have the same name). - virtual std::vector GetPeerIdentity() const = 0; - virtual grpc::string GetPeerIdentityPropertyName() const = 0; - - // Returns all the property values with the given name. - virtual std::vector FindPropertyValues( - const grpc::string& name) const = 0; - - // Iteration over all the properties. - virtual AuthPropertyIterator begin() const = 0; - virtual AuthPropertyIterator end() const = 0; -}; - -} // namespace grpc - -#endif // GRPCXX_AUTH_CONTEXT_H diff --git a/include/grpc++/byte_buffer.h b/include/grpc++/byte_buffer.h deleted file mode 100644 index 6467776398..0000000000 --- a/include/grpc++/byte_buffer.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_BYTE_BUFFER_H -#define GRPCXX_BYTE_BUFFER_H - -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace grpc { - -class ByteBuffer GRPC_FINAL { - public: - ByteBuffer() : buffer_(nullptr) {} - - ByteBuffer(const Slice* slices, size_t nslices); - - ~ByteBuffer() { - if (buffer_) { - grpc_byte_buffer_destroy(buffer_); - } - } - - void Dump(std::vector* slices) const; - - void Clear(); - size_t Length() const; - - private: - friend class SerializationTraits; - - ByteBuffer(const ByteBuffer&); - ByteBuffer& operator=(const ByteBuffer&); - - // takes ownership - void set_buffer(grpc_byte_buffer* buf) { - if (buffer_) { - gpr_log(GPR_ERROR, "Overriding existing buffer"); - Clear(); - } - buffer_ = buf; - } - - grpc_byte_buffer* buffer() const { return buffer_; } - - grpc_byte_buffer* buffer_; -}; - -template <> -class SerializationTraits { - public: - static Status Deserialize(grpc_byte_buffer* byte_buffer, ByteBuffer* dest, - int max_message_size) { - dest->set_buffer(byte_buffer); - return Status::OK; - } - static Status Serialize(const ByteBuffer& source, grpc_byte_buffer** buffer, - bool* own_buffer) { - *buffer = source.buffer(); - *own_buffer = false; - return Status::OK; - } -}; - -} // namespace grpc - -#endif // GRPCXX_BYTE_BUFFER_H diff --git a/include/grpc++/channel.h b/include/grpc++/channel.h index 7d6216e9c4..a8af74175b 100644 --- a/include/grpc++/channel.h +++ b/include/grpc++/channel.h @@ -37,9 +37,9 @@ #include #include -#include #include #include +#include struct grpc_channel; diff --git a/include/grpc++/channel_arguments.h b/include/grpc++/channel_arguments.h deleted file mode 100644 index 4d926377ec..0000000000 --- a/include/grpc++/channel_arguments.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_CHANNEL_ARGUMENTS_H -#define GRPCXX_CHANNEL_ARGUMENTS_H - -#include -#include - -#include -#include -#include - -namespace grpc { -namespace testing { -class ChannelArgumentsTest; -} // namespace testing - -// Options for channel creation. The user can use generic setters to pass -// key value pairs down to c channel creation code. For grpc related options, -// concrete setters are provided. -class ChannelArguments { - public: - ChannelArguments() {} - ~ChannelArguments() {} - - ChannelArguments(const ChannelArguments& other); - ChannelArguments& operator=(ChannelArguments other) { - Swap(other); - return *this; - } - - void Swap(ChannelArguments& other); - - // grpc specific channel argument setters - // Set target name override for SSL host name checking. - void SetSslTargetNameOverride(const grpc::string& name); - // TODO(yangg) add flow control options - - // Set the compression algorithm for the channel. - void SetCompressionAlgorithm(grpc_compression_algorithm algorithm); - - // Generic channel argument setters. Only for advanced use cases. - void SetInt(const grpc::string& key, int value); - void SetString(const grpc::string& key, const grpc::string& value); - - // Populates given channel_args with args_, does not take ownership. - void SetChannelArgs(grpc_channel_args* channel_args) const; - - private: - friend class SecureCredentials; - friend class testing::ChannelArgumentsTest; - - // Returns empty string when it is not set. - grpc::string GetSslTargetNameOverride() const; - - std::vector args_; - std::list strings_; -}; - -} // namespace grpc - -#endif // GRPCXX_CHANNEL_ARGUMENTS_H diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 55ed17506a..ee28f360cb 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -42,10 +42,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include struct census_context; diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 061f4874fa..d81d2e735d 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -36,8 +36,8 @@ #include #include -#include -#include +#include +#include struct grpc_completion_queue; diff --git a/include/grpc++/config.h b/include/grpc++/config.h deleted file mode 100644 index 889dc39eb7..0000000000 --- a/include/grpc++/config.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_CONFIG_H -#define GRPCXX_CONFIG_H - -#if !defined(GRPC_NO_AUTODETECT_PLATFORM) - -#ifdef _MSC_VER -// Visual Studio 2010 is 1600. -#if _MSC_VER < 1600 -#error "gRPC is only supported with Visual Studio starting at 2010" -// Visual Studio 2013 is 1800. -#elif _MSC_VER < 1800 -#define GRPC_CXX0X_NO_FINAL 1 -#define GRPC_CXX0X_NO_OVERRIDE 1 -#define GRPC_CXX0X_NO_CHRONO 1 -#define GRPC_CXX0X_NO_THREAD 1 -#endif -#endif // Visual Studio - -#ifndef __clang__ -#ifdef __GNUC__ -// nullptr was added in gcc 4.6 -#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) -#define GRPC_CXX0X_NO_NULLPTR 1 -#endif -// final and override were added in gcc 4.7 -#if (__GNUC__ * 100 + __GNUC_MINOR__ < 407) -#define GRPC_CXX0X_NO_FINAL 1 -#define GRPC_CXX0X_NO_OVERRIDE 1 -#endif -#endif -#endif - -#endif - -#ifdef GRPC_CXX0X_NO_FINAL -#define GRPC_FINAL -#else -#define GRPC_FINAL final -#endif - -#ifdef GRPC_CXX0X_NO_OVERRIDE -#define GRPC_OVERRIDE -#else -#define GRPC_OVERRIDE override -#endif - -#ifdef GRPC_CXX0X_NO_NULLPTR -#include -namespace grpc { -const class { - public: - template - operator T *() const { - return static_cast(0); - } - template - operator std::unique_ptr() const { - return std::unique_ptr(static_cast(0)); - } - template - operator std::shared_ptr() const { - return std::shared_ptr(static_cast(0)); - } - operator bool() const { return false; } - - private: - void operator&() const = delete; -} nullptr = {}; -} -#endif - -#ifndef GRPC_CUSTOM_STRING -#include -#define GRPC_CUSTOM_STRING std::string -#endif - -namespace grpc { - -typedef GRPC_CUSTOM_STRING string; - -} // namespace grpc - -#endif // GRPCXX_CONFIG_H diff --git a/include/grpc++/config_protobuf.h b/include/grpc++/config_protobuf.h deleted file mode 100644 index 3afc7a58e2..0000000000 --- a/include/grpc++/config_protobuf.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_CONFIG_PROTOBUF_H -#define GRPCXX_CONFIG_PROTOBUF_H - -#ifndef GRPC_CUSTOM_PROTOBUF_INT64 -#include -#define GRPC_CUSTOM_PROTOBUF_INT64 ::google::protobuf::int64 -#endif - -#ifndef GRPC_CUSTOM_MESSAGE -#include -#define GRPC_CUSTOM_MESSAGE ::google::protobuf::Message -#endif - -#ifndef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM -#include -#include -#define GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM \ - ::google::protobuf::io::ZeroCopyOutputStream -#define GRPC_CUSTOM_ZEROCOPYINPUTSTREAM \ - ::google::protobuf::io::ZeroCopyInputStream -#define GRPC_CUSTOM_CODEDINPUTSTREAM ::google::protobuf::io::CodedInputStream -#endif - -namespace grpc { -namespace protobuf { - -typedef GRPC_CUSTOM_MESSAGE Message; -typedef GRPC_CUSTOM_PROTOBUF_INT64 int64; - -namespace io { -typedef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream; -typedef GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ZeroCopyInputStream; -typedef GRPC_CUSTOM_CODEDINPUTSTREAM CodedInputStream; -} // namespace io - -} // namespace protobuf -} // namespace grpc - -#endif // GRPCXX_CONFIG_PROTOBUF_H diff --git a/include/grpc++/create_channel.h b/include/grpc++/create_channel.h index fe34452128..0e559ac53e 100644 --- a/include/grpc++/create_channel.h +++ b/include/grpc++/create_channel.h @@ -36,11 +36,11 @@ #include -#include #include +#include +#include namespace grpc { -class ChannelArguments; // If creds does not hold an object or is invalid, a lame channel is returned. std::shared_ptr CreateChannel( diff --git a/include/grpc++/credentials.h b/include/grpc++/credentials.h index 306dc961c0..71e1f00f15 100644 --- a/include/grpc++/credentials.h +++ b/include/grpc++/credentials.h @@ -36,8 +36,8 @@ #include -#include #include +#include namespace grpc { class ChannelArguments; diff --git a/include/grpc++/dynamic_thread_pool.h b/include/grpc++/dynamic_thread_pool.h deleted file mode 100644 index a4d4885b51..0000000000 --- a/include/grpc++/dynamic_thread_pool.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_DYNAMIC_THREAD_POOL_H -#define GRPCXX_DYNAMIC_THREAD_POOL_H - -#include - -#include -#include -#include - -#include -#include -#include - -namespace grpc { - -class DynamicThreadPool GRPC_FINAL : public ThreadPoolInterface { - public: - explicit DynamicThreadPool(int reserve_threads); - ~DynamicThreadPool(); - - void Add(const std::function& callback) GRPC_OVERRIDE; - - private: - class DynamicThread { - public: - DynamicThread(DynamicThreadPool* pool); - ~DynamicThread(); - - private: - DynamicThreadPool* pool_; - std::unique_ptr thd_; - void ThreadFunc(); - }; - grpc::mutex mu_; - grpc::condition_variable cv_; - grpc::condition_variable shutdown_cv_; - bool shutdown_; - std::queue> callbacks_; - int reserve_threads_; - int nthreads_; - int threads_waiting_; - std::list dead_threads_; - - void ThreadFunc(); - static void ReapThreads(std::list* tlist); -}; - -} // namespace grpc - -#endif // GRPCXX_DYNAMIC_THREAD_POOL_H diff --git a/include/grpc++/fixed_size_thread_pool.h b/include/grpc++/fixed_size_thread_pool.h deleted file mode 100644 index 307e166142..0000000000 --- a/include/grpc++/fixed_size_thread_pool.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_FIXED_SIZE_THREAD_POOL_H -#define GRPCXX_FIXED_SIZE_THREAD_POOL_H - -#include - -#include -#include -#include - -#include -#include - -namespace grpc { - -class FixedSizeThreadPool GRPC_FINAL : public ThreadPoolInterface { - public: - explicit FixedSizeThreadPool(int num_threads); - ~FixedSizeThreadPool(); - - void Add(const std::function& callback) GRPC_OVERRIDE; - - private: - grpc::mutex mu_; - grpc::condition_variable cv_; - bool shutdown_; - std::queue> callbacks_; - std::vector threads_; - - void ThreadFunc(); -}; - -} // namespace grpc - -#endif // GRPCXX_FIXED_SIZE_THREAD_POOL_H diff --git a/include/grpc++/generic/async_generic_service.h b/include/grpc++/generic/async_generic_service.h new file mode 100644 index 0000000000..35bc945824 --- /dev/null +++ b/include/grpc++/generic/async_generic_service.h @@ -0,0 +1,78 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H +#define GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H + +#include +#include + +struct grpc_server; + +namespace grpc { + +typedef ServerAsyncReaderWriter + GenericServerAsyncReaderWriter; + +class GenericServerContext GRPC_FINAL : public ServerContext { + public: + const grpc::string& method() const { return method_; } + const grpc::string& host() const { return host_; } + + private: + friend class Server; + + grpc::string method_; + grpc::string host_; +}; + +class AsyncGenericService GRPC_FINAL { + public: + // TODO(yangg) Once we can add multiple completion queues to the server + // in c core, add a CompletionQueue* argument to the ctor here. + // TODO(yangg) support methods list. + AsyncGenericService(const grpc::string& methods) : server_(nullptr) {} + + void RequestCall(GenericServerContext* ctx, + GenericServerAsyncReaderWriter* reader_writer, + CompletionQueue* call_cq, + ServerCompletionQueue* notification_cq, void* tag); + + private: + friend class Server; + Server* server_; +}; + +} // namespace grpc + +#endif // GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H diff --git a/include/grpc++/generic/generic_stub.h b/include/grpc++/generic/generic_stub.h new file mode 100644 index 0000000000..08ed77aefb --- /dev/null +++ b/include/grpc++/generic/generic_stub.h @@ -0,0 +1,63 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_GENERIC_GENERIC_STUB_H +#define GRPCXX_GENERIC_GENERIC_STUB_H + +#include +#include + +namespace grpc { + +class CompletionQueue; +typedef ClientAsyncReaderWriter + GenericClientAsyncReaderWriter; + +// Generic stubs provide a type-unsafe interface to call gRPC methods +// by name. +class GenericStub GRPC_FINAL { + public: + explicit GenericStub(std::shared_ptr channel) : channel_(channel) {} + + // begin a call to a named method + std::unique_ptr Call( + ClientContext* context, const grpc::string& method, CompletionQueue* cq, + void* tag); + + private: + std::shared_ptr channel_; +}; + +} // namespace grpc + +#endif // GRPCXX_GENERIC_GENERIC_STUB_H diff --git a/include/grpc++/generic_stub.h b/include/grpc++/generic_stub.h deleted file mode 100644 index 734440881e..0000000000 --- a/include/grpc++/generic_stub.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_GENERIC_STUB_H -#define GRPCXX_GENERIC_STUB_H - -#include -#include - -namespace grpc { - -class CompletionQueue; -typedef ClientAsyncReaderWriter - GenericClientAsyncReaderWriter; - -// Generic stubs provide a type-unsafe interface to call gRPC methods -// by name. -class GenericStub GRPC_FINAL { - public: - explicit GenericStub(std::shared_ptr channel) : channel_(channel) {} - - // begin a call to a named method - std::unique_ptr Call( - ClientContext* context, const grpc::string& method, CompletionQueue* cq, - void* tag); - - private: - std::shared_ptr channel_; -}; - -} // namespace grpc - -#endif // GRPCXX_GENERIC_STUB_H diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index bc1db4c12c..ed3110fdb7 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -34,18 +34,17 @@ #ifndef GRPCXX_IMPL_CALL_H #define GRPCXX_IMPL_CALL_H -#include -#include -#include -#include -#include -#include - #include #include #include +#include -#include +#include +#include +#include +#include +#include +#include struct grpc_call; struct grpc_op; diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h index 4aae816cd7..4cdc800267 100644 --- a/include/grpc++/impl/client_unary_call.h +++ b/include/grpc++/impl/client_unary_call.h @@ -34,10 +34,9 @@ #ifndef GRPCXX_IMPL_CLIENT_UNARY_CALL_H #define GRPCXX_IMPL_CLIENT_UNARY_CALL_H -#include -#include - #include +#include +#include namespace grpc { diff --git a/include/grpc++/impl/proto_utils.h b/include/grpc++/impl/proto_utils.h index ebefa3e1be..283e33486d 100644 --- a/include/grpc++/impl/proto_utils.h +++ b/include/grpc++/impl/proto_utils.h @@ -38,8 +38,8 @@ #include #include -#include -#include +#include +#include namespace grpc { diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h index 078c8c491a..0138eb2ac0 100644 --- a/include/grpc++/impl/rpc_service_method.h +++ b/include/grpc++/impl/rpc_service_method.h @@ -39,10 +39,10 @@ #include #include -#include #include -#include -#include +#include +#include +#include namespace grpc { class ServerContext; diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h index c33a278f5b..3b6ac1de77 100644 --- a/include/grpc++/impl/service_type.h +++ b/include/grpc++/impl/service_type.h @@ -34,10 +34,10 @@ #ifndef GRPCXX_IMPL_SERVICE_TYPE_H #define GRPCXX_IMPL_SERVICE_TYPE_H -#include #include #include -#include +#include +#include namespace grpc { diff --git a/include/grpc++/impl/sync.h b/include/grpc++/impl/sync.h index 2f41d2bdeb..999c4303cb 100644 --- a/include/grpc++/impl/sync.h +++ b/include/grpc++/impl/sync.h @@ -34,7 +34,7 @@ #ifndef GRPCXX_IMPL_SYNC_H #define GRPCXX_IMPL_SYNC_H -#include +#include #ifdef GRPC_CXX0X_NO_THREAD #include diff --git a/include/grpc++/impl/thd.h b/include/grpc++/impl/thd.h index 4c4578a92d..f8d4258ac6 100644 --- a/include/grpc++/impl/thd.h +++ b/include/grpc++/impl/thd.h @@ -34,7 +34,7 @@ #ifndef GRPCXX_IMPL_THD_H #define GRPCXX_IMPL_THD_H -#include +#include #ifdef GRPC_CXX0X_NO_THREAD #include diff --git a/include/grpc++/server.h b/include/grpc++/server.h index a2bc097c7f..183cbc4692 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -38,11 +38,11 @@ #include #include -#include #include #include #include -#include +#include +#include struct grpc_server; diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index 906daf1370..95325915a1 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -37,7 +37,7 @@ #include #include -#include +#include namespace grpc { diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index b87a1f0379..ce3cb47a23 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -39,9 +39,9 @@ #include #include -#include -#include -#include +#include +#include +#include struct gpr_timespec; struct grpc_metadata; diff --git a/include/grpc++/server_credentials.h b/include/grpc++/server_credentials.h index 11acd67e8a..16b78c08af 100644 --- a/include/grpc++/server_credentials.h +++ b/include/grpc++/server_credentials.h @@ -37,7 +37,7 @@ #include #include -#include +#include struct grpc_server; diff --git a/include/grpc++/slice.h b/include/grpc++/slice.h deleted file mode 100644 index 3e01bcf0ad..0000000000 --- a/include/grpc++/slice.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_SLICE_H -#define GRPCXX_SLICE_H - -#include -#include - -namespace grpc { - -class Slice GRPC_FINAL { - public: - // construct empty slice - Slice(); - // destructor - drops one ref - ~Slice(); - // construct slice from grpc slice, adding a ref - enum AddRef { ADD_REF }; - Slice(gpr_slice slice, AddRef); - // construct slice from grpc slice, stealing a ref - enum StealRef { STEAL_REF }; - Slice(gpr_slice slice, StealRef); - // copy constructor - adds a ref - Slice(const Slice& other); - // assignment - ref count is unchanged - Slice& operator=(Slice other) { - std::swap(slice_, other.slice_); - return *this; - } - - size_t size() const { return GPR_SLICE_LENGTH(slice_); } - const gpr_uint8* begin() const { return GPR_SLICE_START_PTR(slice_); } - const gpr_uint8* end() const { return GPR_SLICE_END_PTR(slice_); } - - private: - friend class ByteBuffer; - - gpr_slice slice_; -}; - -} // namespace grpc - -#endif // GRPCXX_SLICE_H diff --git a/include/grpc++/status.h b/include/grpc++/status.h deleted file mode 100644 index fb8526ddce..0000000000 --- a/include/grpc++/status.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_STATUS_H -#define GRPCXX_STATUS_H - -#include -#include - -namespace grpc { - -class Status { - public: - Status() : code_(StatusCode::OK) {} - Status(StatusCode code, const grpc::string& details) - : code_(code), details_(details) {} - - // Pre-defined special status objects. - static const Status& OK; - static const Status& CANCELLED; - - StatusCode error_code() const { return code_; } - grpc::string error_message() const { return details_; } - - bool ok() const { return code_ == StatusCode::OK; } - - private: - StatusCode code_; - grpc::string details_; -}; - -} // namespace grpc - -#endif // GRPCXX_STATUS_H diff --git a/include/grpc++/status_code_enum.h b/include/grpc++/status_code_enum.h deleted file mode 100644 index 2211c964cd..0000000000 --- a/include/grpc++/status_code_enum.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_STATUS_CODE_ENUM_H -#define GRPCXX_STATUS_CODE_ENUM_H - -namespace grpc { - -enum StatusCode { - /* Not an error; returned on success */ - OK = 0, - - /* The operation was cancelled (typically by the caller). */ - CANCELLED = 1, - - /* Unknown error. An example of where this error may be returned is - if a Status value received from another address space belongs to - an error-space that is not known in this address space. Also - errors raised by APIs that do not return enough error information - may be converted to this error. */ - UNKNOWN = 2, - - /* Client specified an invalid argument. Note that this differs - from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments - that are problematic regardless of the state of the system - (e.g., a malformed file name). */ - INVALID_ARGUMENT = 3, - - /* Deadline expired before operation could complete. For operations - that change the state of the system, this error may be returned - even if the operation has completed successfully. For example, a - successful response from a server could have been delayed long - enough for the deadline to expire. */ - DEADLINE_EXCEEDED = 4, - - /* Some requested entity (e.g., file or directory) was not found. */ - NOT_FOUND = 5, - - /* Some entity that we attempted to create (e.g., file or directory) - already exists. */ - ALREADY_EXISTS = 6, - - /* The caller does not have permission to execute the specified - operation. PERMISSION_DENIED must not be used for rejections - caused by exhausting some resource (use RESOURCE_EXHAUSTED - instead for those errors). PERMISSION_DENIED must not be - used if the caller can not be identified (use UNAUTHENTICATED - instead for those errors). */ - PERMISSION_DENIED = 7, - - /* The request does not have valid authentication credentials for the - operation. */ - UNAUTHENTICATED = 16, - - /* Some resource has been exhausted, perhaps a per-user quota, or - perhaps the entire file system is out of space. */ - RESOURCE_EXHAUSTED = 8, - - /* Operation was rejected because the system is not in a state - required for the operation's execution. For example, directory - to be deleted may be non-empty, an rmdir operation is applied to - a non-directory, etc. - - A litmus test that may help a service implementor in deciding - between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: - (a) Use UNAVAILABLE if the client can retry just the failing call. - (b) Use ABORTED if the client should retry at a higher-level - (e.g., restarting a read-modify-write sequence). - (c) Use FAILED_PRECONDITION if the client should not retry until - the system state has been explicitly fixed. E.g., if an "rmdir" - fails because the directory is non-empty, FAILED_PRECONDITION - should be returned since the client should not retry unless - they have first fixed up the directory by deleting files from it. - (d) Use FAILED_PRECONDITION if the client performs conditional - REST Get/Update/Delete on a resource and the resource on the - server does not match the condition. E.g., conflicting - read-modify-write on the same resource. */ - FAILED_PRECONDITION = 9, - - /* The operation was aborted, typically due to a concurrency issue - like sequencer check failures, transaction aborts, etc. - - See litmus test above for deciding between FAILED_PRECONDITION, - ABORTED, and UNAVAILABLE. */ - ABORTED = 10, - - /* Operation was attempted past the valid range. E.g., seeking or - reading past end of file. - - Unlike INVALID_ARGUMENT, this error indicates a problem that may - be fixed if the system state changes. For example, a 32-bit file - system will generate INVALID_ARGUMENT if asked to read at an - offset that is not in the range [0,2^32-1], but it will generate - OUT_OF_RANGE if asked to read from an offset past the current - file size. - - There is a fair bit of overlap between FAILED_PRECONDITION and - OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific - error) when it applies so that callers who are iterating through - a space can easily look for an OUT_OF_RANGE error to detect when - they are done. */ - OUT_OF_RANGE = 11, - - /* Operation is not implemented or not supported/enabled in this service. */ - UNIMPLEMENTED = 12, - - /* Internal errors. Means some invariants expected by underlying - system has been broken. If you see one of these errors, - something is very broken. */ - INTERNAL = 13, - - /* The service is currently unavailable. This is a most likely a - transient condition and may be corrected by retrying with - a backoff. - - See litmus test above for deciding between FAILED_PRECONDITION, - ABORTED, and UNAVAILABLE. */ - UNAVAILABLE = 14, - - /* Unrecoverable data loss or corruption. */ - DATA_LOSS = 15, - - /* Force users to include a default branch: */ - DO_NOT_USE = -1 -}; - -} // namespace grpc - -#endif // GRPCXX_STATUS_CODE_ENUM_H diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h deleted file mode 100644 index 577eb4e925..0000000000 --- a/include/grpc++/stream.h +++ /dev/null @@ -1,776 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_STREAM_H -#define GRPCXX_STREAM_H - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace grpc { - -// Common interface for all client side streaming. -class ClientStreamingInterface { - public: - virtual ~ClientStreamingInterface() {} - - // Wait until the stream finishes, and return the final status. When the - // client side declares it has no more message to send, either implicitly or - // by calling WritesDone, it needs to make sure there is no more message to - // be received from the server, either implicitly or by getting a false from - // a Read(). - // This function will return either: - // - when all incoming messages have been read and the server has returned - // status - // - OR when the server has returned a non-OK status - virtual Status Finish() = 0; -}; - -// An interface that yields a sequence of R messages. -template -class ReaderInterface { - public: - virtual ~ReaderInterface() {} - - // Blocking read a message and parse to msg. Returns true on success. - // The method returns false when there will be no more incoming messages, - // either because the other side has called WritesDone or the stream has - // failed (or been cancelled). - virtual bool Read(R* msg) = 0; -}; - -// An interface that can be fed a sequence of W messages. -template -class WriterInterface { - public: - virtual ~WriterInterface() {} - - // Blocking write msg to the stream. Returns true on success. - // Returns false when the stream has been closed. - virtual bool Write(const W& msg, const WriteOptions& options) = 0; - - inline bool Write(const W& msg) { return Write(msg, WriteOptions()); } -}; - -template -class ClientReaderInterface : public ClientStreamingInterface, - public ReaderInterface { - public: - virtual void WaitForInitialMetadata() = 0; -}; - -template -class ClientReader GRPC_FINAL : public ClientReaderInterface { - public: - // Blocking create a stream and write the first request out. - template - ClientReader(Channel* channel, const RpcMethod& method, - ClientContext* context, const W& request) - : context_(context), call_(channel->CreateCall(method, context, &cq_)) { - CallOpSet ops; - ops.SendInitialMetadata(context->send_initial_metadata_); - // TODO(ctiller): don't assert - GPR_ASSERT(ops.SendMessage(request).ok()); - ops.ClientSendClose(); - call_.PerformOps(&ops); - cq_.Pluck(&ops); - } - - // Blocking wait for initial metadata from server. The received metadata - // can only be accessed after this call returns. Should only be called before - // the first read. Calling this method is optional, and if it is not called - // the metadata will be available in ClientContext after the first read. - void WaitForInitialMetadata() { - GPR_ASSERT(!context_->initial_metadata_received_); - - CallOpSet ops; - ops.RecvInitialMetadata(context_); - call_.PerformOps(&ops); - cq_.Pluck(&ops); // status ignored - } - - bool Read(R* msg) GRPC_OVERRIDE { - CallOpSet> ops; - if (!context_->initial_metadata_received_) { - ops.RecvInitialMetadata(context_); - } - ops.RecvMessage(msg); - call_.PerformOps(&ops); - return cq_.Pluck(&ops) && ops.got_message; - } - - Status Finish() GRPC_OVERRIDE { - CallOpSet ops; - Status status; - ops.ClientRecvStatus(context_, &status); - call_.PerformOps(&ops); - GPR_ASSERT(cq_.Pluck(&ops)); - return status; - } - - private: - ClientContext* context_; - CompletionQueue cq_; - Call call_; -}; - -template -class ClientWriterInterface : public ClientStreamingInterface, - public WriterInterface { - public: - virtual bool WritesDone() = 0; -}; - -template -class ClientWriter : public ClientWriterInterface { - public: - // Blocking create a stream. - template - ClientWriter(Channel* channel, const RpcMethod& method, - ClientContext* context, R* response) - : context_(context), call_(channel->CreateCall(method, context, &cq_)) { - finish_ops_.RecvMessage(response); - - CallOpSet ops; - ops.SendInitialMetadata(context->send_initial_metadata_); - call_.PerformOps(&ops); - cq_.Pluck(&ops); - } - - using WriterInterface::Write; - bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { - CallOpSet ops; - if (!ops.SendMessage(msg, options).ok()) { - return false; - } - call_.PerformOps(&ops); - return cq_.Pluck(&ops); - } - - bool WritesDone() GRPC_OVERRIDE { - CallOpSet ops; - ops.ClientSendClose(); - call_.PerformOps(&ops); - return cq_.Pluck(&ops); - } - - // Read the final response and wait for the final status. - Status Finish() GRPC_OVERRIDE { - Status status; - finish_ops_.ClientRecvStatus(context_, &status); - call_.PerformOps(&finish_ops_); - GPR_ASSERT(cq_.Pluck(&finish_ops_)); - return status; - } - - private: - ClientContext* context_; - CallOpSet finish_ops_; - CompletionQueue cq_; - Call call_; -}; - -// Client-side interface for bi-directional streaming. -template -class ClientReaderWriterInterface : public ClientStreamingInterface, - public WriterInterface, - public ReaderInterface { - public: - virtual void WaitForInitialMetadata() = 0; - virtual bool WritesDone() = 0; -}; - -template -class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface { - public: - // Blocking create a stream. - ClientReaderWriter(Channel* channel, const RpcMethod& method, - ClientContext* context) - : context_(context), call_(channel->CreateCall(method, context, &cq_)) { - CallOpSet ops; - ops.SendInitialMetadata(context->send_initial_metadata_); - call_.PerformOps(&ops); - cq_.Pluck(&ops); - } - - // Blocking wait for initial metadata from server. The received metadata - // can only be accessed after this call returns. Should only be called before - // the first read. Calling this method is optional, and if it is not called - // the metadata will be available in ClientContext after the first read. - void WaitForInitialMetadata() { - GPR_ASSERT(!context_->initial_metadata_received_); - - CallOpSet ops; - ops.RecvInitialMetadata(context_); - call_.PerformOps(&ops); - cq_.Pluck(&ops); // status ignored - } - - bool Read(R* msg) GRPC_OVERRIDE { - CallOpSet> ops; - if (!context_->initial_metadata_received_) { - ops.RecvInitialMetadata(context_); - } - ops.RecvMessage(msg); - call_.PerformOps(&ops); - return cq_.Pluck(&ops) && ops.got_message; - } - - using WriterInterface::Write; - bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { - CallOpSet ops; - if (!ops.SendMessage(msg, options).ok()) return false; - call_.PerformOps(&ops); - return cq_.Pluck(&ops); - } - - bool WritesDone() GRPC_OVERRIDE { - CallOpSet ops; - ops.ClientSendClose(); - call_.PerformOps(&ops); - return cq_.Pluck(&ops); - } - - Status Finish() GRPC_OVERRIDE { - CallOpSet ops; - Status status; - ops.ClientRecvStatus(context_, &status); - call_.PerformOps(&ops); - GPR_ASSERT(cq_.Pluck(&ops)); - return status; - } - - private: - ClientContext* context_; - CompletionQueue cq_; - Call call_; -}; - -template -class ServerReader GRPC_FINAL : public ReaderInterface { - public: - ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} - - void SendInitialMetadata() { - GPR_ASSERT(!ctx_->sent_initial_metadata_); - - CallOpSet ops; - ops.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - call_->PerformOps(&ops); - call_->cq()->Pluck(&ops); - } - - bool Read(R* msg) GRPC_OVERRIDE { - CallOpSet> ops; - ops.RecvMessage(msg); - call_->PerformOps(&ops); - return call_->cq()->Pluck(&ops) && ops.got_message; - } - - private: - Call* const call_; - ServerContext* const ctx_; -}; - -template -class ServerWriter GRPC_FINAL : public WriterInterface { - public: - ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} - - void SendInitialMetadata() { - GPR_ASSERT(!ctx_->sent_initial_metadata_); - - CallOpSet ops; - ops.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - call_->PerformOps(&ops); - call_->cq()->Pluck(&ops); - } - - using WriterInterface::Write; - bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { - CallOpSet ops; - if (!ops.SendMessage(msg, options).ok()) { - return false; - } - if (!ctx_->sent_initial_metadata_) { - ops.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - } - call_->PerformOps(&ops); - return call_->cq()->Pluck(&ops); - } - - private: - Call* const call_; - ServerContext* const ctx_; -}; - -// Server-side interface for bi-directional streaming. -template -class ServerReaderWriter GRPC_FINAL : public WriterInterface, - public ReaderInterface { - public: - ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} - - void SendInitialMetadata() { - GPR_ASSERT(!ctx_->sent_initial_metadata_); - - CallOpSet ops; - ops.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - call_->PerformOps(&ops); - call_->cq()->Pluck(&ops); - } - - bool Read(R* msg) GRPC_OVERRIDE { - CallOpSet> ops; - ops.RecvMessage(msg); - call_->PerformOps(&ops); - return call_->cq()->Pluck(&ops) && ops.got_message; - } - - using WriterInterface::Write; - bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { - CallOpSet ops; - if (!ops.SendMessage(msg, options).ok()) { - return false; - } - if (!ctx_->sent_initial_metadata_) { - ops.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - } - call_->PerformOps(&ops); - return call_->cq()->Pluck(&ops); - } - - private: - Call* const call_; - ServerContext* const ctx_; -}; - -// Async interfaces -// Common interface for all client side streaming. -class ClientAsyncStreamingInterface { - public: - virtual ~ClientAsyncStreamingInterface() {} - - virtual void ReadInitialMetadata(void* tag) = 0; - - virtual void Finish(Status* status, void* tag) = 0; -}; - -// An interface that yields a sequence of R messages. -template -class AsyncReaderInterface { - public: - virtual ~AsyncReaderInterface() {} - - virtual void Read(R* msg, void* tag) = 0; -}; - -// An interface that can be fed a sequence of W messages. -template -class AsyncWriterInterface { - public: - virtual ~AsyncWriterInterface() {} - - virtual void Write(const W& msg, void* tag) = 0; -}; - -template -class ClientAsyncReaderInterface : public ClientAsyncStreamingInterface, - public AsyncReaderInterface {}; - -template -class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface { - public: - // Create a stream and write the first request out. - template - ClientAsyncReader(Channel* channel, CompletionQueue* cq, - const RpcMethod& method, ClientContext* context, - const W& request, void* tag) - : context_(context), call_(channel->CreateCall(method, context, cq)) { - init_ops_.set_output_tag(tag); - init_ops_.SendInitialMetadata(context->send_initial_metadata_); - // TODO(ctiller): don't assert - GPR_ASSERT(init_ops_.SendMessage(request).ok()); - init_ops_.ClientSendClose(); - call_.PerformOps(&init_ops_); - } - - void ReadInitialMetadata(void* tag) GRPC_OVERRIDE { - GPR_ASSERT(!context_->initial_metadata_received_); - - meta_ops_.set_output_tag(tag); - meta_ops_.RecvInitialMetadata(context_); - call_.PerformOps(&meta_ops_); - } - - void Read(R* msg, void* tag) GRPC_OVERRIDE { - read_ops_.set_output_tag(tag); - if (!context_->initial_metadata_received_) { - read_ops_.RecvInitialMetadata(context_); - } - read_ops_.RecvMessage(msg); - call_.PerformOps(&read_ops_); - } - - void Finish(Status* status, void* tag) GRPC_OVERRIDE { - finish_ops_.set_output_tag(tag); - if (!context_->initial_metadata_received_) { - finish_ops_.RecvInitialMetadata(context_); - } - finish_ops_.ClientRecvStatus(context_, status); - call_.PerformOps(&finish_ops_); - } - - private: - ClientContext* context_; - Call call_; - CallOpSet - init_ops_; - CallOpSet meta_ops_; - CallOpSet> read_ops_; - CallOpSet finish_ops_; -}; - -template -class ClientAsyncWriterInterface : public ClientAsyncStreamingInterface, - public AsyncWriterInterface { - public: - virtual void WritesDone(void* tag) = 0; -}; - -template -class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface { - public: - template - ClientAsyncWriter(Channel* channel, CompletionQueue* cq, - const RpcMethod& method, ClientContext* context, - R* response, void* tag) - : context_(context), call_(channel->CreateCall(method, context, cq)) { - finish_ops_.RecvMessage(response); - - init_ops_.set_output_tag(tag); - init_ops_.SendInitialMetadata(context->send_initial_metadata_); - call_.PerformOps(&init_ops_); - } - - void ReadInitialMetadata(void* tag) GRPC_OVERRIDE { - GPR_ASSERT(!context_->initial_metadata_received_); - - meta_ops_.set_output_tag(tag); - meta_ops_.RecvInitialMetadata(context_); - call_.PerformOps(&meta_ops_); - } - - void Write(const W& msg, void* tag) GRPC_OVERRIDE { - write_ops_.set_output_tag(tag); - // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg).ok()); - call_.PerformOps(&write_ops_); - } - - void WritesDone(void* tag) GRPC_OVERRIDE { - writes_done_ops_.set_output_tag(tag); - writes_done_ops_.ClientSendClose(); - call_.PerformOps(&writes_done_ops_); - } - - void Finish(Status* status, void* tag) GRPC_OVERRIDE { - finish_ops_.set_output_tag(tag); - if (!context_->initial_metadata_received_) { - finish_ops_.RecvInitialMetadata(context_); - } - finish_ops_.ClientRecvStatus(context_, status); - call_.PerformOps(&finish_ops_); - } - - private: - ClientContext* context_; - Call call_; - CallOpSet init_ops_; - CallOpSet meta_ops_; - CallOpSet write_ops_; - CallOpSet writes_done_ops_; - CallOpSet finish_ops_; -}; - -// Client-side interface for bi-directional streaming. -template -class ClientAsyncReaderWriterInterface : public ClientAsyncStreamingInterface, - public AsyncWriterInterface, - public AsyncReaderInterface { - public: - virtual void WritesDone(void* tag) = 0; -}; - -template -class ClientAsyncReaderWriter GRPC_FINAL - : public ClientAsyncReaderWriterInterface { - public: - ClientAsyncReaderWriter(Channel* channel, CompletionQueue* cq, - const RpcMethod& method, ClientContext* context, - void* tag) - : context_(context), call_(channel->CreateCall(method, context, cq)) { - init_ops_.set_output_tag(tag); - init_ops_.SendInitialMetadata(context->send_initial_metadata_); - call_.PerformOps(&init_ops_); - } - - void ReadInitialMetadata(void* tag) GRPC_OVERRIDE { - GPR_ASSERT(!context_->initial_metadata_received_); - - meta_ops_.set_output_tag(tag); - meta_ops_.RecvInitialMetadata(context_); - call_.PerformOps(&meta_ops_); - } - - void Read(R* msg, void* tag) GRPC_OVERRIDE { - read_ops_.set_output_tag(tag); - if (!context_->initial_metadata_received_) { - read_ops_.RecvInitialMetadata(context_); - } - read_ops_.RecvMessage(msg); - call_.PerformOps(&read_ops_); - } - - void Write(const W& msg, void* tag) GRPC_OVERRIDE { - write_ops_.set_output_tag(tag); - // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg).ok()); - call_.PerformOps(&write_ops_); - } - - void WritesDone(void* tag) GRPC_OVERRIDE { - writes_done_ops_.set_output_tag(tag); - writes_done_ops_.ClientSendClose(); - call_.PerformOps(&writes_done_ops_); - } - - void Finish(Status* status, void* tag) GRPC_OVERRIDE { - finish_ops_.set_output_tag(tag); - if (!context_->initial_metadata_received_) { - finish_ops_.RecvInitialMetadata(context_); - } - finish_ops_.ClientRecvStatus(context_, status); - call_.PerformOps(&finish_ops_); - } - - private: - ClientContext* context_; - Call call_; - CallOpSet init_ops_; - CallOpSet meta_ops_; - CallOpSet> read_ops_; - CallOpSet write_ops_; - CallOpSet writes_done_ops_; - CallOpSet finish_ops_; -}; - -template -class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncReaderInterface { - public: - explicit ServerAsyncReader(ServerContext* ctx) - : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} - - void SendInitialMetadata(void* tag) GRPC_OVERRIDE { - GPR_ASSERT(!ctx_->sent_initial_metadata_); - - meta_ops_.set_output_tag(tag); - meta_ops_.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - call_.PerformOps(&meta_ops_); - } - - void Read(R* msg, void* tag) GRPC_OVERRIDE { - read_ops_.set_output_tag(tag); - read_ops_.RecvMessage(msg); - call_.PerformOps(&read_ops_); - } - - void Finish(const W& msg, const Status& status, void* tag) { - finish_ops_.set_output_tag(tag); - if (!ctx_->sent_initial_metadata_) { - finish_ops_.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - } - // The response is dropped if the status is not OK. - if (status.ok()) { - finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, - finish_ops_.SendMessage(msg)); - } else { - finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status); - } - call_.PerformOps(&finish_ops_); - } - - void FinishWithError(const Status& status, void* tag) { - GPR_ASSERT(!status.ok()); - finish_ops_.set_output_tag(tag); - if (!ctx_->sent_initial_metadata_) { - finish_ops_.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - } - finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status); - call_.PerformOps(&finish_ops_); - } - - private: - void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } - - Call call_; - ServerContext* ctx_; - CallOpSet meta_ops_; - CallOpSet> read_ops_; - CallOpSet finish_ops_; -}; - -template -class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncWriterInterface { - public: - explicit ServerAsyncWriter(ServerContext* ctx) - : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} - - void SendInitialMetadata(void* tag) GRPC_OVERRIDE { - GPR_ASSERT(!ctx_->sent_initial_metadata_); - - meta_ops_.set_output_tag(tag); - meta_ops_.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - call_.PerformOps(&meta_ops_); - } - - void Write(const W& msg, void* tag) GRPC_OVERRIDE { - write_ops_.set_output_tag(tag); - if (!ctx_->sent_initial_metadata_) { - write_ops_.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - } - // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg).ok()); - call_.PerformOps(&write_ops_); - } - - void Finish(const Status& status, void* tag) { - finish_ops_.set_output_tag(tag); - if (!ctx_->sent_initial_metadata_) { - finish_ops_.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - } - finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status); - call_.PerformOps(&finish_ops_); - } - - private: - void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } - - Call call_; - ServerContext* ctx_; - CallOpSet meta_ops_; - CallOpSet write_ops_; - CallOpSet finish_ops_; -}; - -// Server-side interface for bi-directional streaming. -template -class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncWriterInterface, - public AsyncReaderInterface { - public: - explicit ServerAsyncReaderWriter(ServerContext* ctx) - : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} - - void SendInitialMetadata(void* tag) GRPC_OVERRIDE { - GPR_ASSERT(!ctx_->sent_initial_metadata_); - - meta_ops_.set_output_tag(tag); - meta_ops_.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - call_.PerformOps(&meta_ops_); - } - - void Read(R* msg, void* tag) GRPC_OVERRIDE { - read_ops_.set_output_tag(tag); - read_ops_.RecvMessage(msg); - call_.PerformOps(&read_ops_); - } - - void Write(const W& msg, void* tag) GRPC_OVERRIDE { - write_ops_.set_output_tag(tag); - if (!ctx_->sent_initial_metadata_) { - write_ops_.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - } - // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg).ok()); - call_.PerformOps(&write_ops_); - } - - void Finish(const Status& status, void* tag) { - finish_ops_.set_output_tag(tag); - if (!ctx_->sent_initial_metadata_) { - finish_ops_.SendInitialMetadata(ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - } - finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status); - call_.PerformOps(&finish_ops_); - } - - private: - void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } - - Call call_; - ServerContext* ctx_; - CallOpSet meta_ops_; - CallOpSet> read_ops_; - CallOpSet write_ops_; - CallOpSet finish_ops_; -}; - -} // namespace grpc - -#endif // GRPCXX_STREAM_H diff --git a/include/grpc++/stub_options.h b/include/grpc++/stub_options.h deleted file mode 100644 index c7c16dcd55..0000000000 --- a/include/grpc++/stub_options.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_STUB_OPTIONS_H -#define GRPCXX_STUB_OPTIONS_H - -namespace grpc { - -class StubOptions {}; - -} // namespace grpc - -#endif // GRPCXX_STUB_OPTIONS_H diff --git a/include/grpc++/support/async_unary_call.h b/include/grpc++/support/async_unary_call.h new file mode 100644 index 0000000000..0f4ad2656f --- /dev/null +++ b/include/grpc++/support/async_unary_call.h @@ -0,0 +1,155 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_ASYNC_UNARY_CALL_H +#define GRPCXX_SUPPORT_ASYNC_UNARY_CALL_H + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace grpc { + +template +class ClientAsyncResponseReaderInterface { + public: + virtual ~ClientAsyncResponseReaderInterface() {} + virtual void ReadInitialMetadata(void* tag) = 0; + virtual void Finish(R* msg, Status* status, void* tag) = 0; +}; + +template +class ClientAsyncResponseReader GRPC_FINAL + : public ClientAsyncResponseReaderInterface { + public: + template + ClientAsyncResponseReader(Channel* channel, CompletionQueue* cq, + const RpcMethod& method, ClientContext* context, + const W& request) + : context_(context), call_(channel->CreateCall(method, context, cq)) { + init_buf_.SendInitialMetadata(context->send_initial_metadata_); + // TODO(ctiller): don't assert + GPR_ASSERT(init_buf_.SendMessage(request).ok()); + init_buf_.ClientSendClose(); + call_.PerformOps(&init_buf_); + } + + void ReadInitialMetadata(void* tag) { + GPR_ASSERT(!context_->initial_metadata_received_); + + meta_buf_.set_output_tag(tag); + meta_buf_.RecvInitialMetadata(context_); + call_.PerformOps(&meta_buf_); + } + + void Finish(R* msg, Status* status, void* tag) { + finish_buf_.set_output_tag(tag); + if (!context_->initial_metadata_received_) { + finish_buf_.RecvInitialMetadata(context_); + } + finish_buf_.RecvMessage(msg); + finish_buf_.ClientRecvStatus(context_, status); + call_.PerformOps(&finish_buf_); + } + + private: + ClientContext* context_; + Call call_; + SneakyCallOpSet init_buf_; + CallOpSet meta_buf_; + CallOpSet, + CallOpClientRecvStatus> finish_buf_; +}; + +template +class ServerAsyncResponseWriter GRPC_FINAL + : public ServerAsyncStreamingInterface { + public: + explicit ServerAsyncResponseWriter(ServerContext* ctx) + : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} + + void SendInitialMetadata(void* tag) GRPC_OVERRIDE { + GPR_ASSERT(!ctx_->sent_initial_metadata_); + + meta_buf_.set_output_tag(tag); + meta_buf_.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_.PerformOps(&meta_buf_); + } + + void Finish(const W& msg, const Status& status, void* tag) { + finish_buf_.set_output_tag(tag); + if (!ctx_->sent_initial_metadata_) { + finish_buf_.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + // The response is dropped if the status is not OK. + if (status.ok()) { + finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, + finish_buf_.SendMessage(msg)); + } else { + finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status); + } + call_.PerformOps(&finish_buf_); + } + + void FinishWithError(const Status& status, void* tag) { + GPR_ASSERT(!status.ok()); + finish_buf_.set_output_tag(tag); + if (!ctx_->sent_initial_metadata_) { + finish_buf_.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status); + call_.PerformOps(&finish_buf_); + } + + private: + void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } + + Call call_; + ServerContext* ctx_; + CallOpSet meta_buf_; + CallOpSet finish_buf_; +}; + +} // namespace grpc + +#endif // GRPCXX_SUPPORT_ASYNC_UNARY_CALL_H diff --git a/include/grpc++/support/auth_context.h b/include/grpc++/support/auth_context.h new file mode 100644 index 0000000000..f4f2dcf5bb --- /dev/null +++ b/include/grpc++/support/auth_context.h @@ -0,0 +1,95 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_AUTH_CONTEXT_H +#define GRPCXX_SUPPORT_AUTH_CONTEXT_H + +#include +#include + +#include + +struct grpc_auth_context; +struct grpc_auth_property; +struct grpc_auth_property_iterator; + +namespace grpc { +class SecureAuthContext; + +typedef std::pair AuthProperty; + +class AuthPropertyIterator + : public std::iterator { + public: + ~AuthPropertyIterator(); + AuthPropertyIterator& operator++(); + AuthPropertyIterator operator++(int); + bool operator==(const AuthPropertyIterator& rhs) const; + bool operator!=(const AuthPropertyIterator& rhs) const; + const AuthProperty operator*(); + + protected: + AuthPropertyIterator(); + AuthPropertyIterator(const grpc_auth_property* property, + const grpc_auth_property_iterator* iter); + + private: + friend class SecureAuthContext; + const grpc_auth_property* property_; + // The following items form a grpc_auth_property_iterator. + const grpc_auth_context* ctx_; + size_t index_; + const char* name_; +}; + +class AuthContext { + public: + virtual ~AuthContext() {} + + // A peer identity, in general is one or more properties (in which case they + // have the same name). + virtual std::vector GetPeerIdentity() const = 0; + virtual grpc::string GetPeerIdentityPropertyName() const = 0; + + // Returns all the property values with the given name. + virtual std::vector FindPropertyValues( + const grpc::string& name) const = 0; + + // Iteration over all the properties. + virtual AuthPropertyIterator begin() const = 0; + virtual AuthPropertyIterator end() const = 0; +}; + +} // namespace grpc + +#endif // GRPCXX_SUPPORT_AUTH_CONTEXT_H diff --git a/include/grpc++/support/byte_buffer.h b/include/grpc++/support/byte_buffer.h new file mode 100644 index 0000000000..3f8cc25f47 --- /dev/null +++ b/include/grpc++/support/byte_buffer.h @@ -0,0 +1,104 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_BYTE_BUFFER_H +#define GRPCXX_SUPPORT_BYTE_BUFFER_H + +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace grpc { + +class ByteBuffer GRPC_FINAL { + public: + ByteBuffer() : buffer_(nullptr) {} + + ByteBuffer(const Slice* slices, size_t nslices); + + ~ByteBuffer() { + if (buffer_) { + grpc_byte_buffer_destroy(buffer_); + } + } + + void Dump(std::vector* slices) const; + + void Clear(); + size_t Length() const; + + private: + friend class SerializationTraits; + + ByteBuffer(const ByteBuffer&); + ByteBuffer& operator=(const ByteBuffer&); + + // takes ownership + void set_buffer(grpc_byte_buffer* buf) { + if (buffer_) { + gpr_log(GPR_ERROR, "Overriding existing buffer"); + Clear(); + } + buffer_ = buf; + } + + grpc_byte_buffer* buffer() const { return buffer_; } + + grpc_byte_buffer* buffer_; +}; + +template <> +class SerializationTraits { + public: + static Status Deserialize(grpc_byte_buffer* byte_buffer, ByteBuffer* dest, + int max_message_size) { + dest->set_buffer(byte_buffer); + return Status::OK; + } + static Status Serialize(const ByteBuffer& source, grpc_byte_buffer** buffer, + bool* own_buffer) { + *buffer = source.buffer(); + *own_buffer = false; + return Status::OK; + } +}; + +} // namespace grpc + +#endif // GRPCXX_SUPPORT_BYTE_BUFFER_H diff --git a/include/grpc++/support/channel_arguments.h b/include/grpc++/support/channel_arguments.h new file mode 100644 index 0000000000..cee68467c7 --- /dev/null +++ b/include/grpc++/support/channel_arguments.h @@ -0,0 +1,93 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_CHANNEL_ARGUMENTS_H +#define GRPCXX_SUPPORT_CHANNEL_ARGUMENTS_H + +#include +#include + +#include +#include +#include + +namespace grpc { +namespace testing { +class ChannelArgumentsTest; +} // namespace testing + +// Options for channel creation. The user can use generic setters to pass +// key value pairs down to c channel creation code. For grpc related options, +// concrete setters are provided. +class ChannelArguments { + public: + ChannelArguments() {} + ~ChannelArguments() {} + + ChannelArguments(const ChannelArguments& other); + ChannelArguments& operator=(ChannelArguments other) { + Swap(other); + return *this; + } + + void Swap(ChannelArguments& other); + + // grpc specific channel argument setters + // Set target name override for SSL host name checking. + void SetSslTargetNameOverride(const grpc::string& name); + // TODO(yangg) add flow control options + + // Set the compression algorithm for the channel. + void SetCompressionAlgorithm(grpc_compression_algorithm algorithm); + + // Generic channel argument setters. Only for advanced use cases. + void SetInt(const grpc::string& key, int value); + void SetString(const grpc::string& key, const grpc::string& value); + + // Populates given channel_args with args_, does not take ownership. + void SetChannelArgs(grpc_channel_args* channel_args) const; + + private: + friend class SecureCredentials; + friend class testing::ChannelArgumentsTest; + + // Returns empty string when it is not set. + grpc::string GetSslTargetNameOverride() const; + + std::vector args_; + std::list strings_; +}; + +} // namespace grpc + +#endif // GRPCXX_SUPPORT_CHANNEL_ARGUMENTS_H diff --git a/include/grpc++/support/config.h b/include/grpc++/support/config.h new file mode 100644 index 0000000000..836bd47283 --- /dev/null +++ b/include/grpc++/support/config.h @@ -0,0 +1,116 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_CONFIG_H +#define GRPCXX_SUPPORT_CONFIG_H + +#if !defined(GRPC_NO_AUTODETECT_PLATFORM) + +#ifdef _MSC_VER +// Visual Studio 2010 is 1600. +#if _MSC_VER < 1600 +#error "gRPC is only supported with Visual Studio starting at 2010" +// Visual Studio 2013 is 1800. +#elif _MSC_VER < 1800 +#define GRPC_CXX0X_NO_FINAL 1 +#define GRPC_CXX0X_NO_OVERRIDE 1 +#define GRPC_CXX0X_NO_CHRONO 1 +#define GRPC_CXX0X_NO_THREAD 1 +#endif +#endif // Visual Studio + +#ifndef __clang__ +#ifdef __GNUC__ +// nullptr was added in gcc 4.6 +#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) +#define GRPC_CXX0X_NO_NULLPTR 1 +#endif +// final and override were added in gcc 4.7 +#if (__GNUC__ * 100 + __GNUC_MINOR__ < 407) +#define GRPC_CXX0X_NO_FINAL 1 +#define GRPC_CXX0X_NO_OVERRIDE 1 +#endif +#endif +#endif + +#endif + +#ifdef GRPC_CXX0X_NO_FINAL +#define GRPC_FINAL +#else +#define GRPC_FINAL final +#endif + +#ifdef GRPC_CXX0X_NO_OVERRIDE +#define GRPC_OVERRIDE +#else +#define GRPC_OVERRIDE override +#endif + +#ifdef GRPC_CXX0X_NO_NULLPTR +#include +namespace grpc { +const class { + public: + template + operator T *() const { + return static_cast(0); + } + template + operator std::unique_ptr() const { + return std::unique_ptr(static_cast(0)); + } + template + operator std::shared_ptr() const { + return std::shared_ptr(static_cast(0)); + } + operator bool() const { return false; } + + private: + void operator&() const = delete; +} nullptr = {}; +} +#endif + +#ifndef GRPC_CUSTOM_STRING +#include +#define GRPC_CUSTOM_STRING std::string +#endif + +namespace grpc { + +typedef GRPC_CUSTOM_STRING string; + +} // namespace grpc + +#endif // GRPCXX_SUPPORT_CONFIG_H diff --git a/include/grpc++/support/config_protobuf.h b/include/grpc++/support/config_protobuf.h new file mode 100644 index 0000000000..8235590d41 --- /dev/null +++ b/include/grpc++/support/config_protobuf.h @@ -0,0 +1,72 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_CONFIG_PROTOBUF_H +#define GRPCXX_SUPPORT_CONFIG_PROTOBUF_H + +#ifndef GRPC_CUSTOM_PROTOBUF_INT64 +#include +#define GRPC_CUSTOM_PROTOBUF_INT64 ::google::protobuf::int64 +#endif + +#ifndef GRPC_CUSTOM_MESSAGE +#include +#define GRPC_CUSTOM_MESSAGE ::google::protobuf::Message +#endif + +#ifndef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM +#include +#include +#define GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM \ + ::google::protobuf::io::ZeroCopyOutputStream +#define GRPC_CUSTOM_ZEROCOPYINPUTSTREAM \ + ::google::protobuf::io::ZeroCopyInputStream +#define GRPC_CUSTOM_CODEDINPUTSTREAM ::google::protobuf::io::CodedInputStream +#endif + +namespace grpc { +namespace protobuf { + +typedef GRPC_CUSTOM_MESSAGE Message; +typedef GRPC_CUSTOM_PROTOBUF_INT64 int64; + +namespace io { +typedef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream; +typedef GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ZeroCopyInputStream; +typedef GRPC_CUSTOM_CODEDINPUTSTREAM CodedInputStream; +} // namespace io + +} // namespace protobuf +} // namespace grpc + +#endif // GRPCXX_SUPPORT_CONFIG_PROTOBUF_H diff --git a/include/grpc++/support/dynamic_thread_pool.h b/include/grpc++/support/dynamic_thread_pool.h new file mode 100644 index 0000000000..6062705129 --- /dev/null +++ b/include/grpc++/support/dynamic_thread_pool.h @@ -0,0 +1,82 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_DYNAMIC_THREAD_POOL_H +#define GRPCXX_SUPPORT_DYNAMIC_THREAD_POOL_H + +#include +#include +#include + +#include +#include +#include +#include + +namespace grpc { + +class DynamicThreadPool GRPC_FINAL : public ThreadPoolInterface { + public: + explicit DynamicThreadPool(int reserve_threads); + ~DynamicThreadPool(); + + void Add(const std::function& callback) GRPC_OVERRIDE; + + private: + class DynamicThread { + public: + DynamicThread(DynamicThreadPool* pool); + ~DynamicThread(); + + private: + DynamicThreadPool* pool_; + std::unique_ptr thd_; + void ThreadFunc(); + }; + grpc::mutex mu_; + grpc::condition_variable cv_; + grpc::condition_variable shutdown_cv_; + bool shutdown_; + std::queue> callbacks_; + int reserve_threads_; + int nthreads_; + int threads_waiting_; + std::list dead_threads_; + + void ThreadFunc(); + static void ReapThreads(std::list* tlist); +}; + +} // namespace grpc + +#endif // GRPCXX_SUPPORT_DYNAMIC_THREAD_POOL_H diff --git a/include/grpc++/support/fixed_size_thread_pool.h b/include/grpc++/support/fixed_size_thread_pool.h new file mode 100644 index 0000000000..46ed745eff --- /dev/null +++ b/include/grpc++/support/fixed_size_thread_pool.h @@ -0,0 +1,66 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_FIXED_SIZE_THREAD_POOL_H +#define GRPCXX_SUPPORT_FIXED_SIZE_THREAD_POOL_H + +#include +#include + +#include +#include +#include +#include + +namespace grpc { + +class FixedSizeThreadPool GRPC_FINAL : public ThreadPoolInterface { + public: + explicit FixedSizeThreadPool(int num_threads); + ~FixedSizeThreadPool(); + + void Add(const std::function& callback) GRPC_OVERRIDE; + + private: + grpc::mutex mu_; + grpc::condition_variable cv_; + bool shutdown_; + std::queue> callbacks_; + std::vector threads_; + + void ThreadFunc(); +}; + +} // namespace grpc + +#endif // GRPCXX_SUPPORT_FIXED_SIZE_THREAD_POOL_H diff --git a/include/grpc++/support/slice.h b/include/grpc++/support/slice.h new file mode 100644 index 0000000000..b2343a7f3d --- /dev/null +++ b/include/grpc++/support/slice.h @@ -0,0 +1,74 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_SLICE_H +#define GRPCXX_SUPPORT_SLICE_H + +#include +#include + +namespace grpc { + +class Slice GRPC_FINAL { + public: + // construct empty slice + Slice(); + // destructor - drops one ref + ~Slice(); + // construct slice from grpc slice, adding a ref + enum AddRef { ADD_REF }; + Slice(gpr_slice slice, AddRef); + // construct slice from grpc slice, stealing a ref + enum StealRef { STEAL_REF }; + Slice(gpr_slice slice, StealRef); + // copy constructor - adds a ref + Slice(const Slice& other); + // assignment - ref count is unchanged + Slice& operator=(Slice other) { + std::swap(slice_, other.slice_); + return *this; + } + + size_t size() const { return GPR_SLICE_LENGTH(slice_); } + const gpr_uint8* begin() const { return GPR_SLICE_START_PTR(slice_); } + const gpr_uint8* end() const { return GPR_SLICE_END_PTR(slice_); } + + private: + friend class ByteBuffer; + + gpr_slice slice_; +}; + +} // namespace grpc + +#endif // GRPCXX_SUPPORT_SLICE_H diff --git a/include/grpc++/support/status.h b/include/grpc++/support/status.h new file mode 100644 index 0000000000..05750ff600 --- /dev/null +++ b/include/grpc++/support/status.h @@ -0,0 +1,64 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_STATUS_H +#define GRPCXX_SUPPORT_STATUS_H + +#include +#include + +namespace grpc { + +class Status { + public: + Status() : code_(StatusCode::OK) {} + Status(StatusCode code, const grpc::string& details) + : code_(code), details_(details) {} + + // Pre-defined special status objects. + static const Status& OK; + static const Status& CANCELLED; + + StatusCode error_code() const { return code_; } + grpc::string error_message() const { return details_; } + + bool ok() const { return code_ == StatusCode::OK; } + + private: + StatusCode code_; + grpc::string details_; +}; + +} // namespace grpc + +#endif // GRPCXX_SUPPORT_STATUS_H diff --git a/include/grpc++/support/status_code_enum.h b/include/grpc++/support/status_code_enum.h new file mode 100644 index 0000000000..7cb40452c8 --- /dev/null +++ b/include/grpc++/support/status_code_enum.h @@ -0,0 +1,159 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_STATUS_CODE_ENUM_H +#define GRPCXX_SUPPORT_STATUS_CODE_ENUM_H + +namespace grpc { + +enum StatusCode { + /* Not an error; returned on success */ + OK = 0, + + /* The operation was cancelled (typically by the caller). */ + CANCELLED = 1, + + /* Unknown error. An example of where this error may be returned is + if a Status value received from another address space belongs to + an error-space that is not known in this address space. Also + errors raised by APIs that do not return enough error information + may be converted to this error. */ + UNKNOWN = 2, + + /* Client specified an invalid argument. Note that this differs + from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments + that are problematic regardless of the state of the system + (e.g., a malformed file name). */ + INVALID_ARGUMENT = 3, + + /* Deadline expired before operation could complete. For operations + that change the state of the system, this error may be returned + even if the operation has completed successfully. For example, a + successful response from a server could have been delayed long + enough for the deadline to expire. */ + DEADLINE_EXCEEDED = 4, + + /* Some requested entity (e.g., file or directory) was not found. */ + NOT_FOUND = 5, + + /* Some entity that we attempted to create (e.g., file or directory) + already exists. */ + ALREADY_EXISTS = 6, + + /* The caller does not have permission to execute the specified + operation. PERMISSION_DENIED must not be used for rejections + caused by exhausting some resource (use RESOURCE_EXHAUSTED + instead for those errors). PERMISSION_DENIED must not be + used if the caller can not be identified (use UNAUTHENTICATED + instead for those errors). */ + PERMISSION_DENIED = 7, + + /* The request does not have valid authentication credentials for the + operation. */ + UNAUTHENTICATED = 16, + + /* Some resource has been exhausted, perhaps a per-user quota, or + perhaps the entire file system is out of space. */ + RESOURCE_EXHAUSTED = 8, + + /* Operation was rejected because the system is not in a state + required for the operation's execution. For example, directory + to be deleted may be non-empty, an rmdir operation is applied to + a non-directory, etc. + + A litmus test that may help a service implementor in deciding + between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: + (a) Use UNAVAILABLE if the client can retry just the failing call. + (b) Use ABORTED if the client should retry at a higher-level + (e.g., restarting a read-modify-write sequence). + (c) Use FAILED_PRECONDITION if the client should not retry until + the system state has been explicitly fixed. E.g., if an "rmdir" + fails because the directory is non-empty, FAILED_PRECONDITION + should be returned since the client should not retry unless + they have first fixed up the directory by deleting files from it. + (d) Use FAILED_PRECONDITION if the client performs conditional + REST Get/Update/Delete on a resource and the resource on the + server does not match the condition. E.g., conflicting + read-modify-write on the same resource. */ + FAILED_PRECONDITION = 9, + + /* The operation was aborted, typically due to a concurrency issue + like sequencer check failures, transaction aborts, etc. + + See litmus test above for deciding between FAILED_PRECONDITION, + ABORTED, and UNAVAILABLE. */ + ABORTED = 10, + + /* Operation was attempted past the valid range. E.g., seeking or + reading past end of file. + + Unlike INVALID_ARGUMENT, this error indicates a problem that may + be fixed if the system state changes. For example, a 32-bit file + system will generate INVALID_ARGUMENT if asked to read at an + offset that is not in the range [0,2^32-1], but it will generate + OUT_OF_RANGE if asked to read from an offset past the current + file size. + + There is a fair bit of overlap between FAILED_PRECONDITION and + OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific + error) when it applies so that callers who are iterating through + a space can easily look for an OUT_OF_RANGE error to detect when + they are done. */ + OUT_OF_RANGE = 11, + + /* Operation is not implemented or not supported/enabled in this service. */ + UNIMPLEMENTED = 12, + + /* Internal errors. Means some invariants expected by underlying + system has been broken. If you see one of these errors, + something is very broken. */ + INTERNAL = 13, + + /* The service is currently unavailable. This is a most likely a + transient condition and may be corrected by retrying with + a backoff. + + See litmus test above for deciding between FAILED_PRECONDITION, + ABORTED, and UNAVAILABLE. */ + UNAVAILABLE = 14, + + /* Unrecoverable data loss or corruption. */ + DATA_LOSS = 15, + + /* Force users to include a default branch: */ + DO_NOT_USE = -1 +}; + +} // namespace grpc + +#endif // GRPCXX_SUPPORT_STATUS_CODE_ENUM_H diff --git a/include/grpc++/support/stream.h b/include/grpc++/support/stream.h new file mode 100644 index 0000000000..89a6dd693d --- /dev/null +++ b/include/grpc++/support/stream.h @@ -0,0 +1,776 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_STREAM_H +#define GRPCXX_SUPPORT_STREAM_H + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace grpc { + +// Common interface for all client side streaming. +class ClientStreamingInterface { + public: + virtual ~ClientStreamingInterface() {} + + // Wait until the stream finishes, and return the final status. When the + // client side declares it has no more message to send, either implicitly or + // by calling WritesDone, it needs to make sure there is no more message to + // be received from the server, either implicitly or by getting a false from + // a Read(). + // This function will return either: + // - when all incoming messages have been read and the server has returned + // status + // - OR when the server has returned a non-OK status + virtual Status Finish() = 0; +}; + +// An interface that yields a sequence of R messages. +template +class ReaderInterface { + public: + virtual ~ReaderInterface() {} + + // Blocking read a message and parse to msg. Returns true on success. + // The method returns false when there will be no more incoming messages, + // either because the other side has called WritesDone or the stream has + // failed (or been cancelled). + virtual bool Read(R* msg) = 0; +}; + +// An interface that can be fed a sequence of W messages. +template +class WriterInterface { + public: + virtual ~WriterInterface() {} + + // Blocking write msg to the stream. Returns true on success. + // Returns false when the stream has been closed. + virtual bool Write(const W& msg, const WriteOptions& options) = 0; + + inline bool Write(const W& msg) { return Write(msg, WriteOptions()); } +}; + +template +class ClientReaderInterface : public ClientStreamingInterface, + public ReaderInterface { + public: + virtual void WaitForInitialMetadata() = 0; +}; + +template +class ClientReader GRPC_FINAL : public ClientReaderInterface { + public: + // Blocking create a stream and write the first request out. + template + ClientReader(Channel* channel, const RpcMethod& method, + ClientContext* context, const W& request) + : context_(context), call_(channel->CreateCall(method, context, &cq_)) { + CallOpSet ops; + ops.SendInitialMetadata(context->send_initial_metadata_); + // TODO(ctiller): don't assert + GPR_ASSERT(ops.SendMessage(request).ok()); + ops.ClientSendClose(); + call_.PerformOps(&ops); + cq_.Pluck(&ops); + } + + // Blocking wait for initial metadata from server. The received metadata + // can only be accessed after this call returns. Should only be called before + // the first read. Calling this method is optional, and if it is not called + // the metadata will be available in ClientContext after the first read. + void WaitForInitialMetadata() { + GPR_ASSERT(!context_->initial_metadata_received_); + + CallOpSet ops; + ops.RecvInitialMetadata(context_); + call_.PerformOps(&ops); + cq_.Pluck(&ops); // status ignored + } + + bool Read(R* msg) GRPC_OVERRIDE { + CallOpSet> ops; + if (!context_->initial_metadata_received_) { + ops.RecvInitialMetadata(context_); + } + ops.RecvMessage(msg); + call_.PerformOps(&ops); + return cq_.Pluck(&ops) && ops.got_message; + } + + Status Finish() GRPC_OVERRIDE { + CallOpSet ops; + Status status; + ops.ClientRecvStatus(context_, &status); + call_.PerformOps(&ops); + GPR_ASSERT(cq_.Pluck(&ops)); + return status; + } + + private: + ClientContext* context_; + CompletionQueue cq_; + Call call_; +}; + +template +class ClientWriterInterface : public ClientStreamingInterface, + public WriterInterface { + public: + virtual bool WritesDone() = 0; +}; + +template +class ClientWriter : public ClientWriterInterface { + public: + // Blocking create a stream. + template + ClientWriter(Channel* channel, const RpcMethod& method, + ClientContext* context, R* response) + : context_(context), call_(channel->CreateCall(method, context, &cq_)) { + finish_ops_.RecvMessage(response); + + CallOpSet ops; + ops.SendInitialMetadata(context->send_initial_metadata_); + call_.PerformOps(&ops); + cq_.Pluck(&ops); + } + + using WriterInterface::Write; + bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { + CallOpSet ops; + if (!ops.SendMessage(msg, options).ok()) { + return false; + } + call_.PerformOps(&ops); + return cq_.Pluck(&ops); + } + + bool WritesDone() GRPC_OVERRIDE { + CallOpSet ops; + ops.ClientSendClose(); + call_.PerformOps(&ops); + return cq_.Pluck(&ops); + } + + // Read the final response and wait for the final status. + Status Finish() GRPC_OVERRIDE { + Status status; + finish_ops_.ClientRecvStatus(context_, &status); + call_.PerformOps(&finish_ops_); + GPR_ASSERT(cq_.Pluck(&finish_ops_)); + return status; + } + + private: + ClientContext* context_; + CallOpSet finish_ops_; + CompletionQueue cq_; + Call call_; +}; + +// Client-side interface for bi-directional streaming. +template +class ClientReaderWriterInterface : public ClientStreamingInterface, + public WriterInterface, + public ReaderInterface { + public: + virtual void WaitForInitialMetadata() = 0; + virtual bool WritesDone() = 0; +}; + +template +class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface { + public: + // Blocking create a stream. + ClientReaderWriter(Channel* channel, const RpcMethod& method, + ClientContext* context) + : context_(context), call_(channel->CreateCall(method, context, &cq_)) { + CallOpSet ops; + ops.SendInitialMetadata(context->send_initial_metadata_); + call_.PerformOps(&ops); + cq_.Pluck(&ops); + } + + // Blocking wait for initial metadata from server. The received metadata + // can only be accessed after this call returns. Should only be called before + // the first read. Calling this method is optional, and if it is not called + // the metadata will be available in ClientContext after the first read. + void WaitForInitialMetadata() { + GPR_ASSERT(!context_->initial_metadata_received_); + + CallOpSet ops; + ops.RecvInitialMetadata(context_); + call_.PerformOps(&ops); + cq_.Pluck(&ops); // status ignored + } + + bool Read(R* msg) GRPC_OVERRIDE { + CallOpSet> ops; + if (!context_->initial_metadata_received_) { + ops.RecvInitialMetadata(context_); + } + ops.RecvMessage(msg); + call_.PerformOps(&ops); + return cq_.Pluck(&ops) && ops.got_message; + } + + using WriterInterface::Write; + bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { + CallOpSet ops; + if (!ops.SendMessage(msg, options).ok()) return false; + call_.PerformOps(&ops); + return cq_.Pluck(&ops); + } + + bool WritesDone() GRPC_OVERRIDE { + CallOpSet ops; + ops.ClientSendClose(); + call_.PerformOps(&ops); + return cq_.Pluck(&ops); + } + + Status Finish() GRPC_OVERRIDE { + CallOpSet ops; + Status status; + ops.ClientRecvStatus(context_, &status); + call_.PerformOps(&ops); + GPR_ASSERT(cq_.Pluck(&ops)); + return status; + } + + private: + ClientContext* context_; + CompletionQueue cq_; + Call call_; +}; + +template +class ServerReader GRPC_FINAL : public ReaderInterface { + public: + ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} + + void SendInitialMetadata() { + GPR_ASSERT(!ctx_->sent_initial_metadata_); + + CallOpSet ops; + ops.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_->PerformOps(&ops); + call_->cq()->Pluck(&ops); + } + + bool Read(R* msg) GRPC_OVERRIDE { + CallOpSet> ops; + ops.RecvMessage(msg); + call_->PerformOps(&ops); + return call_->cq()->Pluck(&ops) && ops.got_message; + } + + private: + Call* const call_; + ServerContext* const ctx_; +}; + +template +class ServerWriter GRPC_FINAL : public WriterInterface { + public: + ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} + + void SendInitialMetadata() { + GPR_ASSERT(!ctx_->sent_initial_metadata_); + + CallOpSet ops; + ops.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_->PerformOps(&ops); + call_->cq()->Pluck(&ops); + } + + using WriterInterface::Write; + bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { + CallOpSet ops; + if (!ops.SendMessage(msg, options).ok()) { + return false; + } + if (!ctx_->sent_initial_metadata_) { + ops.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + call_->PerformOps(&ops); + return call_->cq()->Pluck(&ops); + } + + private: + Call* const call_; + ServerContext* const ctx_; +}; + +// Server-side interface for bi-directional streaming. +template +class ServerReaderWriter GRPC_FINAL : public WriterInterface, + public ReaderInterface { + public: + ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} + + void SendInitialMetadata() { + GPR_ASSERT(!ctx_->sent_initial_metadata_); + + CallOpSet ops; + ops.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_->PerformOps(&ops); + call_->cq()->Pluck(&ops); + } + + bool Read(R* msg) GRPC_OVERRIDE { + CallOpSet> ops; + ops.RecvMessage(msg); + call_->PerformOps(&ops); + return call_->cq()->Pluck(&ops) && ops.got_message; + } + + using WriterInterface::Write; + bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { + CallOpSet ops; + if (!ops.SendMessage(msg, options).ok()) { + return false; + } + if (!ctx_->sent_initial_metadata_) { + ops.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + call_->PerformOps(&ops); + return call_->cq()->Pluck(&ops); + } + + private: + Call* const call_; + ServerContext* const ctx_; +}; + +// Async interfaces +// Common interface for all client side streaming. +class ClientAsyncStreamingInterface { + public: + virtual ~ClientAsyncStreamingInterface() {} + + virtual void ReadInitialMetadata(void* tag) = 0; + + virtual void Finish(Status* status, void* tag) = 0; +}; + +// An interface that yields a sequence of R messages. +template +class AsyncReaderInterface { + public: + virtual ~AsyncReaderInterface() {} + + virtual void Read(R* msg, void* tag) = 0; +}; + +// An interface that can be fed a sequence of W messages. +template +class AsyncWriterInterface { + public: + virtual ~AsyncWriterInterface() {} + + virtual void Write(const W& msg, void* tag) = 0; +}; + +template +class ClientAsyncReaderInterface : public ClientAsyncStreamingInterface, + public AsyncReaderInterface {}; + +template +class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface { + public: + // Create a stream and write the first request out. + template + ClientAsyncReader(Channel* channel, CompletionQueue* cq, + const RpcMethod& method, ClientContext* context, + const W& request, void* tag) + : context_(context), call_(channel->CreateCall(method, context, cq)) { + init_ops_.set_output_tag(tag); + init_ops_.SendInitialMetadata(context->send_initial_metadata_); + // TODO(ctiller): don't assert + GPR_ASSERT(init_ops_.SendMessage(request).ok()); + init_ops_.ClientSendClose(); + call_.PerformOps(&init_ops_); + } + + void ReadInitialMetadata(void* tag) GRPC_OVERRIDE { + GPR_ASSERT(!context_->initial_metadata_received_); + + meta_ops_.set_output_tag(tag); + meta_ops_.RecvInitialMetadata(context_); + call_.PerformOps(&meta_ops_); + } + + void Read(R* msg, void* tag) GRPC_OVERRIDE { + read_ops_.set_output_tag(tag); + if (!context_->initial_metadata_received_) { + read_ops_.RecvInitialMetadata(context_); + } + read_ops_.RecvMessage(msg); + call_.PerformOps(&read_ops_); + } + + void Finish(Status* status, void* tag) GRPC_OVERRIDE { + finish_ops_.set_output_tag(tag); + if (!context_->initial_metadata_received_) { + finish_ops_.RecvInitialMetadata(context_); + } + finish_ops_.ClientRecvStatus(context_, status); + call_.PerformOps(&finish_ops_); + } + + private: + ClientContext* context_; + Call call_; + CallOpSet + init_ops_; + CallOpSet meta_ops_; + CallOpSet> read_ops_; + CallOpSet finish_ops_; +}; + +template +class ClientAsyncWriterInterface : public ClientAsyncStreamingInterface, + public AsyncWriterInterface { + public: + virtual void WritesDone(void* tag) = 0; +}; + +template +class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface { + public: + template + ClientAsyncWriter(Channel* channel, CompletionQueue* cq, + const RpcMethod& method, ClientContext* context, + R* response, void* tag) + : context_(context), call_(channel->CreateCall(method, context, cq)) { + finish_ops_.RecvMessage(response); + + init_ops_.set_output_tag(tag); + init_ops_.SendInitialMetadata(context->send_initial_metadata_); + call_.PerformOps(&init_ops_); + } + + void ReadInitialMetadata(void* tag) GRPC_OVERRIDE { + GPR_ASSERT(!context_->initial_metadata_received_); + + meta_ops_.set_output_tag(tag); + meta_ops_.RecvInitialMetadata(context_); + call_.PerformOps(&meta_ops_); + } + + void Write(const W& msg, void* tag) GRPC_OVERRIDE { + write_ops_.set_output_tag(tag); + // TODO(ctiller): don't assert + GPR_ASSERT(write_ops_.SendMessage(msg).ok()); + call_.PerformOps(&write_ops_); + } + + void WritesDone(void* tag) GRPC_OVERRIDE { + writes_done_ops_.set_output_tag(tag); + writes_done_ops_.ClientSendClose(); + call_.PerformOps(&writes_done_ops_); + } + + void Finish(Status* status, void* tag) GRPC_OVERRIDE { + finish_ops_.set_output_tag(tag); + if (!context_->initial_metadata_received_) { + finish_ops_.RecvInitialMetadata(context_); + } + finish_ops_.ClientRecvStatus(context_, status); + call_.PerformOps(&finish_ops_); + } + + private: + ClientContext* context_; + Call call_; + CallOpSet init_ops_; + CallOpSet meta_ops_; + CallOpSet write_ops_; + CallOpSet writes_done_ops_; + CallOpSet finish_ops_; +}; + +// Client-side interface for bi-directional streaming. +template +class ClientAsyncReaderWriterInterface : public ClientAsyncStreamingInterface, + public AsyncWriterInterface, + public AsyncReaderInterface { + public: + virtual void WritesDone(void* tag) = 0; +}; + +template +class ClientAsyncReaderWriter GRPC_FINAL + : public ClientAsyncReaderWriterInterface { + public: + ClientAsyncReaderWriter(Channel* channel, CompletionQueue* cq, + const RpcMethod& method, ClientContext* context, + void* tag) + : context_(context), call_(channel->CreateCall(method, context, cq)) { + init_ops_.set_output_tag(tag); + init_ops_.SendInitialMetadata(context->send_initial_metadata_); + call_.PerformOps(&init_ops_); + } + + void ReadInitialMetadata(void* tag) GRPC_OVERRIDE { + GPR_ASSERT(!context_->initial_metadata_received_); + + meta_ops_.set_output_tag(tag); + meta_ops_.RecvInitialMetadata(context_); + call_.PerformOps(&meta_ops_); + } + + void Read(R* msg, void* tag) GRPC_OVERRIDE { + read_ops_.set_output_tag(tag); + if (!context_->initial_metadata_received_) { + read_ops_.RecvInitialMetadata(context_); + } + read_ops_.RecvMessage(msg); + call_.PerformOps(&read_ops_); + } + + void Write(const W& msg, void* tag) GRPC_OVERRIDE { + write_ops_.set_output_tag(tag); + // TODO(ctiller): don't assert + GPR_ASSERT(write_ops_.SendMessage(msg).ok()); + call_.PerformOps(&write_ops_); + } + + void WritesDone(void* tag) GRPC_OVERRIDE { + writes_done_ops_.set_output_tag(tag); + writes_done_ops_.ClientSendClose(); + call_.PerformOps(&writes_done_ops_); + } + + void Finish(Status* status, void* tag) GRPC_OVERRIDE { + finish_ops_.set_output_tag(tag); + if (!context_->initial_metadata_received_) { + finish_ops_.RecvInitialMetadata(context_); + } + finish_ops_.ClientRecvStatus(context_, status); + call_.PerformOps(&finish_ops_); + } + + private: + ClientContext* context_; + Call call_; + CallOpSet init_ops_; + CallOpSet meta_ops_; + CallOpSet> read_ops_; + CallOpSet write_ops_; + CallOpSet writes_done_ops_; + CallOpSet finish_ops_; +}; + +template +class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, + public AsyncReaderInterface { + public: + explicit ServerAsyncReader(ServerContext* ctx) + : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} + + void SendInitialMetadata(void* tag) GRPC_OVERRIDE { + GPR_ASSERT(!ctx_->sent_initial_metadata_); + + meta_ops_.set_output_tag(tag); + meta_ops_.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_.PerformOps(&meta_ops_); + } + + void Read(R* msg, void* tag) GRPC_OVERRIDE { + read_ops_.set_output_tag(tag); + read_ops_.RecvMessage(msg); + call_.PerformOps(&read_ops_); + } + + void Finish(const W& msg, const Status& status, void* tag) { + finish_ops_.set_output_tag(tag); + if (!ctx_->sent_initial_metadata_) { + finish_ops_.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + // The response is dropped if the status is not OK. + if (status.ok()) { + finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, + finish_ops_.SendMessage(msg)); + } else { + finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status); + } + call_.PerformOps(&finish_ops_); + } + + void FinishWithError(const Status& status, void* tag) { + GPR_ASSERT(!status.ok()); + finish_ops_.set_output_tag(tag); + if (!ctx_->sent_initial_metadata_) { + finish_ops_.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status); + call_.PerformOps(&finish_ops_); + } + + private: + void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } + + Call call_; + ServerContext* ctx_; + CallOpSet meta_ops_; + CallOpSet> read_ops_; + CallOpSet finish_ops_; +}; + +template +class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, + public AsyncWriterInterface { + public: + explicit ServerAsyncWriter(ServerContext* ctx) + : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} + + void SendInitialMetadata(void* tag) GRPC_OVERRIDE { + GPR_ASSERT(!ctx_->sent_initial_metadata_); + + meta_ops_.set_output_tag(tag); + meta_ops_.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_.PerformOps(&meta_ops_); + } + + void Write(const W& msg, void* tag) GRPC_OVERRIDE { + write_ops_.set_output_tag(tag); + if (!ctx_->sent_initial_metadata_) { + write_ops_.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + // TODO(ctiller): don't assert + GPR_ASSERT(write_ops_.SendMessage(msg).ok()); + call_.PerformOps(&write_ops_); + } + + void Finish(const Status& status, void* tag) { + finish_ops_.set_output_tag(tag); + if (!ctx_->sent_initial_metadata_) { + finish_ops_.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status); + call_.PerformOps(&finish_ops_); + } + + private: + void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } + + Call call_; + ServerContext* ctx_; + CallOpSet meta_ops_; + CallOpSet write_ops_; + CallOpSet finish_ops_; +}; + +// Server-side interface for bi-directional streaming. +template +class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface, + public AsyncWriterInterface, + public AsyncReaderInterface { + public: + explicit ServerAsyncReaderWriter(ServerContext* ctx) + : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} + + void SendInitialMetadata(void* tag) GRPC_OVERRIDE { + GPR_ASSERT(!ctx_->sent_initial_metadata_); + + meta_ops_.set_output_tag(tag); + meta_ops_.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_.PerformOps(&meta_ops_); + } + + void Read(R* msg, void* tag) GRPC_OVERRIDE { + read_ops_.set_output_tag(tag); + read_ops_.RecvMessage(msg); + call_.PerformOps(&read_ops_); + } + + void Write(const W& msg, void* tag) GRPC_OVERRIDE { + write_ops_.set_output_tag(tag); + if (!ctx_->sent_initial_metadata_) { + write_ops_.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + // TODO(ctiller): don't assert + GPR_ASSERT(write_ops_.SendMessage(msg).ok()); + call_.PerformOps(&write_ops_); + } + + void Finish(const Status& status, void* tag) { + finish_ops_.set_output_tag(tag); + if (!ctx_->sent_initial_metadata_) { + finish_ops_.SendInitialMetadata(ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status); + call_.PerformOps(&finish_ops_); + } + + private: + void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } + + Call call_; + ServerContext* ctx_; + CallOpSet meta_ops_; + CallOpSet> read_ops_; + CallOpSet write_ops_; + CallOpSet finish_ops_; +}; + +} // namespace grpc + +#endif // GRPCXX_SUPPORT_STREAM_H diff --git a/include/grpc++/support/stub_options.h b/include/grpc++/support/stub_options.h new file mode 100644 index 0000000000..973aa9bc83 --- /dev/null +++ b/include/grpc++/support/stub_options.h @@ -0,0 +1,43 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_STUB_OPTIONS_H +#define GRPCXX_SUPPORT_STUB_OPTIONS_H + +namespace grpc { + +class StubOptions {}; + +} // namespace grpc + +#endif // GRPCXX_SUPPORT_STUB_OPTIONS_H diff --git a/include/grpc++/support/thread_pool_interface.h b/include/grpc++/support/thread_pool_interface.h new file mode 100644 index 0000000000..6528e7276f --- /dev/null +++ b/include/grpc++/support/thread_pool_interface.h @@ -0,0 +1,54 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_THREAD_POOL_INTERFACE_H +#define GRPCXX_SUPPORT_THREAD_POOL_INTERFACE_H + +#include + +namespace grpc { + +// A thread pool interface for running callbacks. +class ThreadPoolInterface { + public: + virtual ~ThreadPoolInterface() {} + + // Schedule the given callback for execution. + virtual void Add(const std::function& callback) = 0; +}; + +ThreadPoolInterface* CreateDefaultThreadPool(); + +} // namespace grpc + +#endif // GRPCXX_SUPPORT_THREAD_POOL_INTERFACE_H diff --git a/include/grpc++/support/time.h b/include/grpc++/support/time.h new file mode 100644 index 0000000000..2d4196b93b --- /dev/null +++ b/include/grpc++/support/time.h @@ -0,0 +1,110 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_TIME_H +#define GRPCXX_SUPPORT_TIME_H + +#include + +namespace grpc { + +/* If you are trying to use CompletionQueue::AsyncNext with a time class that + isn't either gpr_timespec or std::chrono::system_clock::time_point, you + will most likely be looking at this comment as your compiler will have + fired an error below. In order to fix this issue, you have two potential + solutions: + + 1. Use gpr_timespec or std::chrono::system_clock::time_point instead + 2. Specialize the TimePoint class with whichever time class that you + want to use here. See below for two examples of how to do this. + */ + +template +class TimePoint { + public: + TimePoint(const T& time) { you_need_a_specialization_of_TimePoint(); } + gpr_timespec raw_time() { + gpr_timespec t; + return t; + } + + private: + void you_need_a_specialization_of_TimePoint(); +}; + +template <> +class TimePoint { + public: + TimePoint(const gpr_timespec& time) : time_(time) {} + gpr_timespec raw_time() { return time_; } + + private: + gpr_timespec time_; +}; + +} // namespace grpc + +#ifndef GRPC_CXX0X_NO_CHRONO + +#include + +#include + +namespace grpc { + +// from and to should be absolute time. +void Timepoint2Timespec(const std::chrono::system_clock::time_point& from, + gpr_timespec* to); +void TimepointHR2Timespec( + const std::chrono::high_resolution_clock::time_point& from, + gpr_timespec* to); + +std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t); + +template <> +class TimePoint { + public: + TimePoint(const std::chrono::system_clock::time_point& time) { + Timepoint2Timespec(time, &time_); + } + gpr_timespec raw_time() const { return time_; } + + private: + gpr_timespec time_; +}; + +} // namespace grpc + +#endif // !GRPC_CXX0X_NO_CHRONO + +#endif // GRPCXX_SUPPORT_TIME_H diff --git a/include/grpc++/thread_pool_interface.h b/include/grpc++/thread_pool_interface.h deleted file mode 100644 index d080b31dcc..0000000000 --- a/include/grpc++/thread_pool_interface.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_THREAD_POOL_INTERFACE_H -#define GRPCXX_THREAD_POOL_INTERFACE_H - -#include - -namespace grpc { - -// A thread pool interface for running callbacks. -class ThreadPoolInterface { - public: - virtual ~ThreadPoolInterface() {} - - // Schedule the given callback for execution. - virtual void Add(const std::function& callback) = 0; -}; - -ThreadPoolInterface* CreateDefaultThreadPool(); - -} // namespace grpc - -#endif // GRPCXX_THREAD_POOL_INTERFACE_H diff --git a/include/grpc++/time.h b/include/grpc++/time.h deleted file mode 100644 index 8fb2f8505c..0000000000 --- a/include/grpc++/time.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_TIME_H -#define GRPCXX_TIME_H - -#include - -namespace grpc { - -/* If you are trying to use CompletionQueue::AsyncNext with a time class that - isn't either gpr_timespec or std::chrono::system_clock::time_point, you - will most likely be looking at this comment as your compiler will have - fired an error below. In order to fix this issue, you have two potential - solutions: - - 1. Use gpr_timespec or std::chrono::system_clock::time_point instead - 2. Specialize the TimePoint class with whichever time class that you - want to use here. See below for two examples of how to do this. - */ - -template -class TimePoint { - public: - TimePoint(const T& time) { you_need_a_specialization_of_TimePoint(); } - gpr_timespec raw_time() { - gpr_timespec t; - return t; - } - - private: - void you_need_a_specialization_of_TimePoint(); -}; - -template <> -class TimePoint { - public: - TimePoint(const gpr_timespec& time) : time_(time) {} - gpr_timespec raw_time() { return time_; } - - private: - gpr_timespec time_; -}; - -} // namespace grpc - -#ifndef GRPC_CXX0X_NO_CHRONO - -#include - -#include - -namespace grpc { - -// from and to should be absolute time. -void Timepoint2Timespec(const std::chrono::system_clock::time_point& from, - gpr_timespec* to); -void TimepointHR2Timespec( - const std::chrono::high_resolution_clock::time_point& from, - gpr_timespec* to); - -std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t); - -template <> -class TimePoint { - public: - TimePoint(const std::chrono::system_clock::time_point& time) { - Timepoint2Timespec(time, &time_); - } - gpr_timespec raw_time() const { return time_; } - - private: - gpr_timespec time_; -}; - -} // namespace grpc - -#endif // !GRPC_CXX0X_NO_CHRONO - -#endif // GRPCXX_TIME_H diff --git a/src/compiler/config.h b/src/compiler/config.h index cd52aca57d..fea976c318 100644 --- a/src/compiler/config.h +++ b/src/compiler/config.h @@ -34,8 +34,8 @@ #ifndef SRC_COMPILER_CONFIG_H #define SRC_COMPILER_CONFIG_H -#include -#include +#include +#include #ifndef GRPC_CUSTOM_DESCRIPTOR #include diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index b04ac038ad..5d82b605fb 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -115,10 +115,10 @@ grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file, "#include \n" "#include \n" "#include \n" - "#include \n" - "#include \n" - "#include \n" - "#include \n" + "#include \n" + "#include \n" + "#include \n" + "#include \n" "\n" "namespace grpc {\n" "class CompletionQueue;\n" @@ -701,12 +701,12 @@ grpc::string GetSourceIncludes(const grpc::protobuf::FileDescriptor *file, grpc::protobuf::io::Printer printer(&output_stream, '$'); std::map vars; - printer.Print(vars, "#include \n"); printer.Print(vars, "#include \n"); printer.Print(vars, "#include \n"); printer.Print(vars, "#include \n"); printer.Print(vars, "#include \n"); - printer.Print(vars, "#include \n"); + printer.Print(vars, "#include \n"); + printer.Print(vars, "#include \n"); if (!file->package().empty()) { std::vector parts = diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index 2982a89fad..72c457ac6b 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -42,7 +42,7 @@ #include #include -#include +#include #include "src/compiler/config.h" #include "src/compiler/generator_helpers.h" #include "src/compiler/python_generator.h" diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index bb4be07beb..8bf2e4687e 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -38,17 +38,16 @@ #include #include #include - -#include "src/core/profiling/timers.h" -#include #include #include -#include #include #include #include -#include -#include +#include +#include +#include +#include +#include "src/core/profiling/timers.h" namespace grpc { diff --git a/src/cpp/client/channel_arguments.cc b/src/cpp/client/channel_arguments.cc index da6602e7af..50422d06c9 100644 --- a/src/cpp/client/channel_arguments.cc +++ b/src/cpp/client/channel_arguments.cc @@ -31,10 +31,9 @@ * */ -#include +#include #include - #include "src/core/channel/channel_args.h" namespace grpc { diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index a3906fc781..c4d7cf2e51 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include "src/core/channel/compress_filter.h" #include "src/cpp/common/create_auth_context.h" diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc index 70ea7e0e27..8c571cbbaa 100644 --- a/src/cpp/client/create_channel.cc +++ b/src/cpp/client/create_channel.cc @@ -35,8 +35,8 @@ #include #include -#include #include +#include #include "src/cpp/client/create_channel_internal.h" diff --git a/src/cpp/client/create_channel_internal.h b/src/cpp/client/create_channel_internal.h index 1692471990..4385ec701e 100644 --- a/src/cpp/client/create_channel_internal.h +++ b/src/cpp/client/create_channel_internal.h @@ -36,7 +36,7 @@ #include -#include +#include struct grpc_channel; diff --git a/src/cpp/client/generic_stub.cc b/src/cpp/client/generic_stub.cc index ee89c02965..7a2fdf941c 100644 --- a/src/cpp/client/generic_stub.cc +++ b/src/cpp/client/generic_stub.cc @@ -31,7 +31,7 @@ * */ -#include +#include #include diff --git a/src/cpp/client/insecure_credentials.cc b/src/cpp/client/insecure_credentials.cc index 97931406af..4a4d2cb97d 100644 --- a/src/cpp/client/insecure_credentials.cc +++ b/src/cpp/client/insecure_credentials.cc @@ -31,13 +31,13 @@ * */ +#include + #include #include - #include -#include -#include -#include +#include +#include #include "src/cpp/client/create_channel_internal.h" namespace grpc { diff --git a/src/cpp/client/secure_channel_arguments.cc b/src/cpp/client/secure_channel_arguments.cc index d89df999ad..e17d3b58b0 100644 --- a/src/cpp/client/secure_channel_arguments.cc +++ b/src/cpp/client/secure_channel_arguments.cc @@ -31,9 +31,9 @@ * */ -#include -#include +#include +#include #include "src/core/channel/channel_args.h" namespace grpc { diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index 1e912c6beb..f368f2590a 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -33,8 +33,8 @@ #include #include -#include #include +#include #include "src/cpp/client/create_channel_internal.h" #include "src/cpp/client/secure_credentials.h" diff --git a/src/cpp/client/secure_credentials.h b/src/cpp/client/secure_credentials.h index 974d83514d..62d3185477 100644 --- a/src/cpp/client/secure_credentials.h +++ b/src/cpp/client/secure_credentials.h @@ -36,7 +36,7 @@ #include -#include +#include #include namespace grpc { diff --git a/src/cpp/common/auth_property_iterator.cc b/src/cpp/common/auth_property_iterator.cc index d3bfd5cb6b..5ccf8cf72c 100644 --- a/src/cpp/common/auth_property_iterator.cc +++ b/src/cpp/common/auth_property_iterator.cc @@ -31,7 +31,7 @@ * */ -#include +#include #include diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 479f14d42b..16aa2c9fb9 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -34,10 +34,9 @@ #include #include -#include -#include #include - +#include +#include #include "src/core/profiling/timers.h" namespace grpc { diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index fca33f8f54..a175beb452 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -36,7 +36,7 @@ #include #include -#include +#include namespace grpc { diff --git a/src/cpp/common/create_auth_context.h b/src/cpp/common/create_auth_context.h index 9082a90c6d..b4962bae4e 100644 --- a/src/cpp/common/create_auth_context.h +++ b/src/cpp/common/create_auth_context.h @@ -33,7 +33,7 @@ #include #include -#include +#include namespace grpc { diff --git a/src/cpp/common/insecure_create_auth_context.cc b/src/cpp/common/insecure_create_auth_context.cc index 07fc0bd549..fe80c1a80c 100644 --- a/src/cpp/common/insecure_create_auth_context.cc +++ b/src/cpp/common/insecure_create_auth_context.cc @@ -33,7 +33,7 @@ #include #include -#include +#include namespace grpc { diff --git a/src/cpp/common/secure_auth_context.h b/src/cpp/common/secure_auth_context.h index 264ed620a3..01b7126189 100644 --- a/src/cpp/common/secure_auth_context.h +++ b/src/cpp/common/secure_auth_context.h @@ -34,7 +34,7 @@ #ifndef GRPC_INTERNAL_CPP_COMMON_SECURE_AUTH_CONTEXT_H #define GRPC_INTERNAL_CPP_COMMON_SECURE_AUTH_CONTEXT_H -#include +#include struct grpc_auth_context; diff --git a/src/cpp/common/secure_create_auth_context.cc b/src/cpp/common/secure_create_auth_context.cc index d81f4bbc4a..f13d25a1dd 100644 --- a/src/cpp/common/secure_create_auth_context.cc +++ b/src/cpp/common/secure_create_auth_context.cc @@ -34,7 +34,7 @@ #include #include -#include +#include #include "src/cpp/common/secure_auth_context.h" namespace grpc { diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc index 05470ec627..be84c222a0 100644 --- a/src/cpp/proto/proto_utils.cc +++ b/src/cpp/proto/proto_utils.cc @@ -32,7 +32,6 @@ */ #include -#include #include #include @@ -40,6 +39,7 @@ #include #include #include +#include const int kMaxBufferLength = 8192; diff --git a/src/cpp/server/async_generic_service.cc b/src/cpp/server/async_generic_service.cc index 2e99afcb5f..6b9ea532b6 100644 --- a/src/cpp/server/async_generic_service.cc +++ b/src/cpp/server/async_generic_service.cc @@ -31,7 +31,7 @@ * */ -#include +#include #include diff --git a/src/cpp/server/create_default_thread_pool.cc b/src/cpp/server/create_default_thread_pool.cc index 9f59d254f1..0eef7dfffe 100644 --- a/src/cpp/server/create_default_thread_pool.cc +++ b/src/cpp/server/create_default_thread_pool.cc @@ -32,7 +32,7 @@ */ #include -#include +#include #ifndef GRPC_CUSTOM_DEFAULT_THREAD_POOL diff --git a/src/cpp/server/dynamic_thread_pool.cc b/src/cpp/server/dynamic_thread_pool.cc index b475f43b1d..d33852364d 100644 --- a/src/cpp/server/dynamic_thread_pool.cc +++ b/src/cpp/server/dynamic_thread_pool.cc @@ -33,7 +33,7 @@ #include #include -#include +#include namespace grpc { DynamicThreadPool::DynamicThread::DynamicThread(DynamicThreadPool* pool) diff --git a/src/cpp/server/fixed_size_thread_pool.cc b/src/cpp/server/fixed_size_thread_pool.cc index bafbc5802a..427e904449 100644 --- a/src/cpp/server/fixed_size_thread_pool.cc +++ b/src/cpp/server/fixed_size_thread_pool.cc @@ -33,7 +33,7 @@ #include #include -#include +#include namespace grpc { diff --git a/src/cpp/server/secure_server_credentials.h b/src/cpp/server/secure_server_credentials.h index b9803f107e..d3d37b188d 100644 --- a/src/cpp/server/secure_server_credentials.h +++ b/src/cpp/server/secure_server_credentials.h @@ -34,10 +34,10 @@ #ifndef GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H #define GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H -#include - #include +#include + namespace grpc { class SecureServerCredentials GRPC_FINAL : public ServerCredentials { diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index e039c07374..568bb8ad5e 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -32,19 +32,20 @@ */ #include + #include #include #include #include #include -#include +#include #include #include #include #include -#include -#include +#include +#include #include "src/core/profiling/timers.h" diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 0b11d86173..4e8399405e 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -37,8 +37,8 @@ #include #include #include -#include -#include +#include +#include namespace grpc { diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 03461ddda5..acc163d6b5 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include "src/core/channel/compress_filter.h" #include "src/cpp/common/create_auth_context.h" diff --git a/src/cpp/util/byte_buffer.cc b/src/cpp/util/byte_buffer.cc index a66c92c3e1..e46e656beb 100644 --- a/src/cpp/util/byte_buffer.cc +++ b/src/cpp/util/byte_buffer.cc @@ -32,7 +32,7 @@ */ #include -#include +#include namespace grpc { diff --git a/src/cpp/util/slice.cc b/src/cpp/util/slice.cc index 57370dabc6..7e88423b6c 100644 --- a/src/cpp/util/slice.cc +++ b/src/cpp/util/slice.cc @@ -31,7 +31,7 @@ * */ -#include +#include namespace grpc { diff --git a/src/cpp/util/status.cc b/src/cpp/util/status.cc index 5bb9eda3d9..ad9850cf07 100644 --- a/src/cpp/util/status.cc +++ b/src/cpp/util/status.cc @@ -31,7 +31,7 @@ * */ -#include +#include namespace grpc { diff --git a/src/cpp/util/time.cc b/src/cpp/util/time.cc index 799c597e0b..b3401eb26b 100644 --- a/src/cpp/util/time.cc +++ b/src/cpp/util/time.cc @@ -31,12 +31,12 @@ * */ -#include +#include #ifndef GRPC_CXX0X_NO_CHRONO #include -#include +#include using std::chrono::duration_cast; using std::chrono::nanoseconds; diff --git a/test/cpp/client/channel_arguments_test.cc b/test/cpp/client/channel_arguments_test.cc index 01c56cb795..3d75e7b0e6 100644 --- a/test/cpp/client/channel_arguments_test.cc +++ b/test/cpp/client/channel_arguments_test.cc @@ -31,7 +31,7 @@ * */ -#include +#include #include #include diff --git a/test/cpp/common/auth_property_iterator_test.cc b/test/cpp/common/auth_property_iterator_test.cc index bf17842a84..630c38c7f6 100644 --- a/test/cpp/common/auth_property_iterator_test.cc +++ b/test/cpp/common/auth_property_iterator_test.cc @@ -32,7 +32,7 @@ */ #include -#include +#include #include #include "src/cpp/common/secure_auth_context.h" diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc index e0376c9cc7..c71ef58023 100644 --- a/test/cpp/common/secure_auth_context_test.cc +++ b/test/cpp/common/secure_auth_context_test.cc @@ -32,7 +32,7 @@ */ #include -#include +#include #include #include "src/cpp/common/secure_auth_context.h" diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 7006ebb83a..f81043d610 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -33,12 +33,9 @@ #include -#include "test/core/util/port.h" -#include "test/core/util/test_config.h" -#include "test/cpp/util/echo_duplicate.grpc.pb.h" -#include "test/cpp/util/echo.grpc.pb.h" -#include -#include +#include +#include +#include #include #include #include @@ -47,14 +44,12 @@ #include #include #include -#include -#include -#include #include -#include -#include -#include +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" +#include "test/cpp/util/echo_duplicate.grpc.pb.h" +#include "test/cpp/util/echo.grpc.pb.h" using grpc::cpp::test::util::EchoRequest; using grpc::cpp::test::util::EchoResponse; diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc index 89708a2ef6..3359080cec 100644 --- a/test/cpp/end2end/client_crash_test.cc +++ b/test/cpp/end2end/client_crash_test.cc @@ -31,11 +31,9 @@ * */ -#include "test/core/util/port.h" -#include "test/core/util/test_config.h" -#include "test/cpp/util/echo_duplicate.grpc.pb.h" -#include "test/cpp/util/echo.grpc.pb.h" -#include +#include +#include +#include #include #include #include @@ -44,15 +42,12 @@ #include #include #include -#include -#include -#include #include -#include -#include -#include - +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" +#include "test/cpp/util/echo_duplicate.grpc.pb.h" +#include "test/cpp/util/echo.grpc.pb.h" #include "test/cpp/util/subprocess.h" using grpc::cpp::test::util::EchoRequest; diff --git a/test/cpp/end2end/client_crash_test_server.cc b/test/cpp/end2end/client_crash_test_server.cc index 3fd8c2c2f9..79a7832874 100644 --- a/test/cpp/end2end/client_crash_test_server.cc +++ b/test/cpp/end2end/client_crash_test_server.cc @@ -40,7 +40,6 @@ #include #include #include -#include #include "test/cpp/util/echo.grpc.pb.h" DEFINE_string(address, "", "Address to bind to"); diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index fc4e88c2a7..1b83eb4b3c 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -34,30 +34,26 @@ #include #include -#include "src/core/security/credentials.h" -#include "test/core/end2end/data/ssl_test_data.h" -#include "test/core/util/port.h" -#include "test/core/util/test_config.h" -#include "test/cpp/util/echo_duplicate.grpc.pb.h" -#include "test/cpp/util/echo.grpc.pb.h" -#include +#include +#include +#include #include #include #include #include -#include #include #include #include #include -#include -#include -#include +#include #include -#include -#include -#include +#include "src/core/security/credentials.h" +#include "test/core/end2end/data/ssl_test_data.h" +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" +#include "test/cpp/util/echo_duplicate.grpc.pb.h" +#include "test/cpp/util/echo.grpc.pb.h" using grpc::cpp::test::util::EchoRequest; using grpc::cpp::test::util::EchoResponse; diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index b817198fa7..de7eab8dc2 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -33,32 +33,26 @@ #include -#include "test/core/util/port.h" -#include "test/core/util/test_config.h" -#include "test/cpp/util/echo.grpc.pb.h" +#include +#include +#include #include -#include -#include -#include -#include #include #include #include #include -#include +#include +#include #include #include #include #include -#include -#include -#include -#include +#include #include -#include -#include -#include +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" +#include "test/cpp/util/echo.grpc.pb.h" using grpc::cpp::test::util::EchoRequest; using grpc::cpp::test::util::EchoResponse; diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index 96b6ecbd6e..a547cfc67e 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -33,28 +33,24 @@ #include -#include "test/core/util/port.h" -#include "test/core/util/test_config.h" -#include "test/cpp/util/echo_duplicate.grpc.pb.h" -#include "test/cpp/util/echo.grpc.pb.h" -#include +#include +#include +#include #include #include #include #include -#include #include #include #include #include -#include -#include -#include +#include #include -#include -#include -#include +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" +#include "test/cpp/util/echo_duplicate.grpc.pb.h" +#include "test/cpp/util/echo.grpc.pb.h" using grpc::cpp::test::util::EchoRequest; using grpc::cpp::test::util::EchoResponse; diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc index 2688f2c4ea..1a0f04e22b 100644 --- a/test/cpp/end2end/server_crash_test.cc +++ b/test/cpp/end2end/server_crash_test.cc @@ -31,11 +31,9 @@ * */ -#include "test/core/util/port.h" -#include "test/core/util/test_config.h" -#include "test/cpp/util/echo_duplicate.grpc.pb.h" -#include "test/cpp/util/echo.grpc.pb.h" -#include +#include +#include +#include #include #include #include @@ -44,15 +42,12 @@ #include #include #include -#include -#include -#include #include -#include -#include -#include - +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" +#include "test/cpp/util/echo.grpc.pb.h" +#include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/subprocess.h" using grpc::cpp::test::util::EchoRequest; diff --git a/test/cpp/end2end/server_crash_test_client.cc b/test/cpp/end2end/server_crash_test_client.cc index 52dce8f28e..7ca43a0c5b 100644 --- a/test/cpp/end2end/server_crash_test_client.cc +++ b/test/cpp/end2end/server_crash_test_client.cc @@ -37,12 +37,10 @@ #include #include -#include #include #include #include #include -#include #include "test/cpp/util/echo.grpc.pb.h" DEFINE_string(address, "", "Address to connect to"); diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc index dc5fb5af9b..e83f86f7ec 100644 --- a/test/cpp/end2end/shutdown_test.cc +++ b/test/cpp/end2end/shutdown_test.cc @@ -31,14 +31,10 @@ * */ -#include "test/core/util/test_config.h" - #include -#include "test/core/util/port.h" -#include "test/cpp/util/echo.grpc.pb.h" -#include "src/core/support/env.h" -#include +#include +#include #include #include #include @@ -47,10 +43,12 @@ #include #include #include -#include #include -#include -#include + +#include "src/core/support/env.h" +#include "test/core/util/test_config.h" +#include "test/core/util/port.h" +#include "test/cpp/util/echo.grpc.pb.h" using grpc::cpp::test::util::EchoRequest; using grpc::cpp::test::util::EchoResponse; diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index e59a77dc9e..be436a2f6c 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -34,28 +34,24 @@ #include #include -#include "test/core/util/port.h" -#include "test/core/util/test_config.h" -#include "test/cpp/util/echo_duplicate.grpc.pb.h" -#include "test/cpp/util/echo.grpc.pb.h" -#include +#include +#include +#include #include #include #include #include -#include +#include #include #include #include #include -#include -#include -#include #include -#include -#include -#include +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" +#include "test/cpp/util/echo_duplicate.grpc.pb.h" +#include "test/cpp/util/echo.grpc.pb.h" using grpc::cpp::test::util::EchoRequest; using grpc::cpp::test::util::EchoResponse; diff --git a/test/cpp/end2end/zookeeper_test.cc b/test/cpp/end2end/zookeeper_test.cc index d7fac3d07e..e7d95b1c46 100644 --- a/test/cpp/end2end/zookeeper_test.cc +++ b/test/cpp/end2end/zookeeper_test.cc @@ -31,11 +31,6 @@ * */ -#include "test/core/util/test_config.h" -#include "test/core/util/port.h" -#include "test/cpp/util/echo.grpc.pb.h" -#include "src/core/support/env.h" -#include #include #include #include @@ -44,12 +39,16 @@ #include #include #include -#include #include #include #include #include +#include "test/core/util/test_config.h" +#include "test/core/util/port.h" +#include "test/cpp/util/echo.grpc.pb.h" +#include "src/core/support/env.h" + using grpc::cpp::test::util::EchoRequest; using grpc::cpp::test::util::EchoResponse; diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index d9e4f1ba6a..cb5232153b 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -40,8 +40,7 @@ #include #include #include -#include -#include + #include "test/cpp/interop/client_helper.h" #include "test/cpp/interop/interop_client.h" #include "test/cpp/util/test_config.h" diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc index be652a4add..abc14aeb98 100644 --- a/test/cpp/interop/client_helper.cc +++ b/test/cpp/interop/client_helper.cc @@ -33,27 +33,24 @@ #include "test/cpp/interop/client_helper.h" +#include + #include #include #include -#include - #include #include #include #include -#include #include #include #include -#include +#include "src/cpp/client/secure_credentials.h" #include "test/core/security/oauth2_utils.h" #include "test/cpp/util/create_test_channel.h" -#include "src/cpp/client/secure_credentials.h" - DECLARE_bool(enable_ssl); DECLARE_bool(use_prod_roots); DECLARE_int32(server_port); diff --git a/test/cpp/interop/client_helper.h b/test/cpp/interop/client_helper.h index d4c14433a9..92d5078f48 100644 --- a/test/cpp/interop/client_helper.h +++ b/test/cpp/interop/client_helper.h @@ -36,7 +36,6 @@ #include -#include #include #include "src/core/surface/call.h" diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index c73505c670..fa358585d4 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -33,11 +33,11 @@ #include "test/cpp/interop/interop_client.h" +#include + #include #include -#include - #include #include #include @@ -45,14 +45,12 @@ #include #include #include -#include -#include +#include "src/core/transport/stream_op.h" #include "test/cpp/interop/client_helper.h" #include "test/proto/test.grpc.pb.h" #include "test/proto/empty.grpc.pb.h" #include "test/proto/messages.grpc.pb.h" -#include "src/core/transport/stream_op.h" namespace grpc { namespace testing { diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h index 354c2c6195..5e26cc82e6 100644 --- a/test/cpp/interop/interop_client.h +++ b/test/cpp/interop/interop_client.h @@ -33,11 +33,11 @@ #ifndef GRPC_TEST_CPP_INTEROP_INTEROP_CLIENT_H #define GRPC_TEST_CPP_INTEROP_INTEROP_CLIENT_H + #include #include #include -#include #include "test/proto/messages.grpc.pb.h" namespace grpc { diff --git a/test/cpp/interop/interop_test.cc b/test/cpp/interop/interop_test.cc index aac6e56b89..f01b032e95 100644 --- a/test/cpp/interop/interop_test.cc +++ b/test/cpp/interop/interop_test.cc @@ -44,17 +44,18 @@ #include #include -extern "C" { -#include "src/core/iomgr/socket_utils_posix.h" -#include "src/core/support/string.h" -} - #include #include #include #include #include "test/core/util/port.h" +extern "C" { +#include "src/core/iomgr/socket_utils_posix.h" +#include "src/core/support/string.h" +} + + int test_client(const char* root, const char* host, int port) { int status; pid_t cli; diff --git a/test/cpp/interop/reconnect_interop_client.cc b/test/cpp/interop/reconnect_interop_client.cc index 675c6ff073..d332dcad84 100644 --- a/test/cpp/interop/reconnect_interop_client.cc +++ b/test/cpp/interop/reconnect_interop_client.cc @@ -39,7 +39,6 @@ #include #include #include -#include #include "test/cpp/util/create_test_channel.h" #include "test/cpp/util/test_config.h" #include "test/proto/test.grpc.pb.h" diff --git a/test/cpp/interop/reconnect_interop_server.cc b/test/cpp/interop/reconnect_interop_server.cc index 8bc51aa52e..d4f171b1d0 100644 --- a/test/cpp/interop/reconnect_interop_server.cc +++ b/test/cpp/interop/reconnect_interop_server.cc @@ -31,23 +31,22 @@ * */ +#include +#include + #include #include #include #include -#include -#include - #include #include #include -#include #include #include #include #include -#include + #include "test/core/util/reconnect_server.h" #include "test/cpp/util/test_config.h" #include "test/proto/test.grpc.pb.h" diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc index 760bb18f73..35ec890aa0 100644 --- a/test/cpp/interop/server.cc +++ b/test/cpp/interop/server.cc @@ -31,32 +31,28 @@ * */ +#include +#include + #include #include #include #include -#include -#include - #include #include #include #include - -#include #include #include #include #include -#include -#include +#include "test/cpp/interop/server_helper.h" +#include "test/cpp/util/test_config.h" #include "test/proto/test.grpc.pb.h" #include "test/proto/empty.grpc.pb.h" #include "test/proto/messages.grpc.pb.h" -#include "test/cpp/interop/server_helper.h" -#include "test/cpp/util/test_config.h" DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls."); DEFINE_int32(port, 0, "Server port."); diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc index 3721d79635..e897f4ebf0 100644 --- a/test/cpp/interop/server_helper.cc +++ b/test/cpp/interop/server_helper.cc @@ -36,7 +36,6 @@ #include #include -#include #include #include "src/core/surface/call.h" diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 5395d02e32..0f95cfea38 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -34,14 +34,14 @@ #ifndef TEST_QPS_CLIENT_H #define TEST_QPS_CLIENT_H +#include +#include + #include "test/cpp/qps/histogram.h" #include "test/cpp/qps/interarrival.h" #include "test/cpp/qps/timer.h" #include "test/cpp/qps/qpstest.grpc.pb.h" - -#include -#include -#include +#include "test/cpp/util/create_test_channel.h" namespace grpc { diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index a337610cbf..f779e4a577 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -46,14 +46,12 @@ #include #include #include -#include #include -#include -#include -#include "test/cpp/util/create_test_channel.h" + #include "test/cpp/qps/qpstest.grpc.pb.h" #include "test/cpp/qps/timer.h" #include "test/cpp/qps/client.h" +#include "test/cpp/util/create_test_channel.h" namespace grpc { namespace testing { diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index db5416a707..123dca6600 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -31,6 +31,8 @@ * */ +#include + #include #include #include @@ -40,21 +42,18 @@ #include #include -#include - +#include #include #include #include #include #include #include -#include #include #include #include -#include -#include #include + #include "test/cpp/util/create_test_channel.h" #include "test/cpp/qps/client.h" #include "test/cpp/qps/qpstest.grpc.pb.h" diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 78e3720938..3bd61ea4e8 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -31,24 +31,24 @@ * */ -#include "test/cpp/qps/driver.h" -#include "src/core/support/env.h" +#include +#include +#include +#include +#include + #include #include #include -#include #include #include -#include -#include -#include -#include -#include -#include -#include "test/cpp/qps/histogram.h" -#include "test/cpp/qps/qps_worker.h" + +#include "src/core/support/env.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" +#include "test/cpp/qps/driver.h" +#include "test/cpp/qps/histogram.h" +#include "test/cpp/qps/qps_worker.h" using std::list; using std::thread; diff --git a/test/cpp/qps/interarrival.h b/test/cpp/qps/interarrival.h index 04d14f689f..841619e3ff 100644 --- a/test/cpp/qps/interarrival.h +++ b/test/cpp/qps/interarrival.h @@ -39,7 +39,7 @@ #include #include -#include +#include namespace grpc { namespace testing { diff --git a/test/cpp/qps/perf_db_client.h b/test/cpp/qps/perf_db_client.h index 3433cd88d1..ae5d17074b 100644 --- a/test/cpp/qps/perf_db_client.h +++ b/test/cpp/qps/perf_db_client.h @@ -37,12 +37,11 @@ #include #include -#include +#include #include #include #include #include -#include #include "test/cpp/qps/perf_db.grpc.pb.h" namespace grpc { diff --git a/test/cpp/qps/qps_interarrival_test.cc b/test/cpp/qps/qps_interarrival_test.cc index 1eed956a1c..a7979e6187 100644 --- a/test/cpp/qps/qps_interarrival_test.cc +++ b/test/cpp/qps/qps_interarrival_test.cc @@ -31,13 +31,13 @@ * */ -#include "test/cpp/qps/interarrival.h" #include #include // Use the C histogram rather than C++ to avoid depending on proto #include -#include + +#include "test/cpp/qps/interarrival.h" using grpc::testing::RandomDist; using grpc::testing::InterarrivalTimer; diff --git a/test/cpp/qps/qps_openloop_test.cc b/test/cpp/qps/qps_openloop_test.cc index 9a7313f6e8..5a6a9249a9 100644 --- a/test/cpp/qps/qps_openloop_test.cc +++ b/test/cpp/qps/qps_openloop_test.cc @@ -31,12 +31,12 @@ * */ +#include + #include #include -#include - #include "test/cpp/qps/driver.h" #include "test/cpp/qps/report.h" #include "test/cpp/util/benchmark_config.h" diff --git a/test/cpp/qps/qps_test.cc b/test/cpp/qps/qps_test.cc index ba980a6664..d0c4a79cd9 100644 --- a/test/cpp/qps/qps_test.cc +++ b/test/cpp/qps/qps_test.cc @@ -31,12 +31,12 @@ * */ +#include + #include #include -#include - #include "test/cpp/qps/driver.h" #include "test/cpp/qps/report.h" #include "test/cpp/util/benchmark_config.h" diff --git a/test/cpp/qps/qps_test_with_poll.cc b/test/cpp/qps/qps_test_with_poll.cc index 90a8da8d11..31d2c1bf7b 100644 --- a/test/cpp/qps/qps_test_with_poll.cc +++ b/test/cpp/qps/qps_test_with_poll.cc @@ -31,12 +31,12 @@ * */ +#include + #include #include -#include - #include "test/cpp/qps/driver.h" #include "test/cpp/qps/report.h" #include "test/cpp/util/benchmark_config.h" diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc index f1cea5ee66..51e955a80a 100644 --- a/test/cpp/qps/qps_worker.cc +++ b/test/cpp/qps/qps_worker.cc @@ -47,16 +47,15 @@ #include #include #include -#include #include #include #include -#include + #include "test/core/util/grpc_profiler.h" -#include "test/cpp/util/create_test_channel.h" #include "test/cpp/qps/qpstest.pb.h" #include "test/cpp/qps/client.h" #include "test/cpp/qps/server.h" +#include "test/cpp/util/create_test_channel.h" namespace grpc { namespace testing { diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h index aec3cbe80a..620abade39 100644 --- a/test/cpp/qps/report.h +++ b/test/cpp/qps/report.h @@ -37,7 +37,8 @@ #include #include #include -#include + +#include #include "test/cpp/qps/driver.h" #include "test/cpp/qps/qpstest.grpc.pb.h" diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index b4fc49c31c..77415f42ce 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -41,22 +41,20 @@ #include #include +#include #include #include -#include -#include +#include +#include #include #include #include #include -#include -#include #include + #include "test/cpp/qps/qpstest.grpc.pb.h" #include "test/cpp/qps/server.h" -#include -#include namespace grpc { namespace testing { diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index 4c3c9cb497..c149fbc738 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -32,28 +32,25 @@ */ #include -#include - #include +#include #include +#include #include #include -#include -#include -#include +#include +#include +#include #include #include #include #include -#include -#include + #include "test/cpp/qps/qpstest.grpc.pb.h" #include "test/cpp/qps/server.h" #include "test/cpp/qps/timer.h" -#include -#include namespace grpc { namespace testing { diff --git a/test/cpp/qps/stats.h b/test/cpp/qps/stats.h index 82dc03e3da..93875017ca 100644 --- a/test/cpp/qps/stats.h +++ b/test/cpp/qps/stats.h @@ -34,9 +34,10 @@ #ifndef TEST_QPS_STATS_UTILS_H #define TEST_QPS_STATS_UTILS_H -#include "test/cpp/qps/histogram.h" #include +#include "test/cpp/qps/histogram.h" + namespace grpc { namespace testing { diff --git a/test/cpp/qps/sync_streaming_ping_pong_test.cc b/test/cpp/qps/sync_streaming_ping_pong_test.cc index d53905a779..52e43939a8 100644 --- a/test/cpp/qps/sync_streaming_ping_pong_test.cc +++ b/test/cpp/qps/sync_streaming_ping_pong_test.cc @@ -31,12 +31,12 @@ * */ +#include + #include #include -#include - #include "test/cpp/qps/driver.h" #include "test/cpp/qps/report.h" #include "test/cpp/util/benchmark_config.h" diff --git a/test/cpp/qps/sync_unary_ping_pong_test.cc b/test/cpp/qps/sync_unary_ping_pong_test.cc index d276d13a43..fbd21357aa 100644 --- a/test/cpp/qps/sync_unary_ping_pong_test.cc +++ b/test/cpp/qps/sync_unary_ping_pong_test.cc @@ -31,12 +31,12 @@ * */ +#include + #include #include -#include - #include "test/cpp/qps/driver.h" #include "test/cpp/qps/report.h" #include "test/cpp/util/benchmark_config.h" diff --git a/test/cpp/qps/timer.cc b/test/cpp/qps/timer.cc index c1ba23decd..8edb838da3 100644 --- a/test/cpp/qps/timer.cc +++ b/test/cpp/qps/timer.cc @@ -36,7 +36,6 @@ #include #include #include -#include Timer::Timer() : start_(Sample()) {} diff --git a/test/cpp/qps/worker.cc b/test/cpp/qps/worker.cc index 7cf4903148..935e4853a6 100644 --- a/test/cpp/qps/worker.cc +++ b/test/cpp/qps/worker.cc @@ -36,9 +36,9 @@ #include #include +#include #include #include -#include #include "test/cpp/qps/qps_worker.h" #include "test/cpp/util/test_config.h" diff --git a/test/cpp/server/dynamic_thread_pool_test.cc b/test/cpp/server/dynamic_thread_pool_test.cc index 63b603b8f7..e978fd03f3 100644 --- a/test/cpp/server/dynamic_thread_pool_test.cc +++ b/test/cpp/server/dynamic_thread_pool_test.cc @@ -31,11 +31,12 @@ * */ +#include + #include #include #include -#include #include namespace grpc { diff --git a/test/cpp/server/fixed_size_thread_pool_test.cc b/test/cpp/server/fixed_size_thread_pool_test.cc index 442e974fc1..97953af224 100644 --- a/test/cpp/server/fixed_size_thread_pool_test.cc +++ b/test/cpp/server/fixed_size_thread_pool_test.cc @@ -31,11 +31,12 @@ * */ +#include + #include #include #include -#include #include namespace grpc { diff --git a/test/cpp/util/byte_buffer_test.cc b/test/cpp/util/byte_buffer_test.cc index 5195575f99..f36c32cac5 100644 --- a/test/cpp/util/byte_buffer_test.cc +++ b/test/cpp/util/byte_buffer_test.cc @@ -31,13 +31,13 @@ * */ -#include +#include #include #include #include -#include +#include #include namespace grpc { diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc index d0a300f511..d60cee9c02 100644 --- a/test/cpp/util/cli_call.cc +++ b/test/cpp/util/cli_call.cc @@ -35,16 +35,13 @@ #include -#include -#include -#include -#include -#include -#include - #include #include #include +#include +#include +#include +#include namespace grpc { namespace testing { diff --git a/test/cpp/util/cli_call.h b/test/cpp/util/cli_call.h index 46b5dd3e4f..7a3dcf2e9f 100644 --- a/test/cpp/util/cli_call.h +++ b/test/cpp/util/cli_call.h @@ -37,8 +37,7 @@ #include #include -#include -#include +#include namespace grpc { namespace testing { diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc index 146e96720f..0d34009bd5 100644 --- a/test/cpp/util/cli_call_test.cc +++ b/test/cpp/util/cli_call_test.cc @@ -31,24 +31,23 @@ * */ -#include "test/core/util/test_config.h" #include "test/cpp/util/cli_call.h" -#include "test/cpp/util/echo.grpc.pb.h" -#include + +#include #include #include #include #include -#include +#include #include #include #include #include -#include -#include "test/core/util/port.h" #include -#include +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" +#include "test/cpp/util/echo.grpc.pb.h" using grpc::cpp::test::util::EchoRequest; using grpc::cpp::test::util::EchoResponse; diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc index 43e719ef6b..161b4bdc1d 100644 --- a/test/cpp/util/create_test_channel.cc +++ b/test/cpp/util/create_test_channel.cc @@ -33,11 +33,11 @@ #include "test/cpp/util/create_test_channel.h" -#include "test/core/end2end/data/ssl_test_data.h" -#include #include #include +#include "test/core/end2end/data/ssl_test_data.h" + namespace grpc { // When ssl is enabled, if server is empty, override_hostname is used to diff --git a/test/cpp/util/create_test_channel.h b/test/cpp/util/create_test_channel.h index 129cc746f9..1263d4ed68 100644 --- a/test/cpp/util/create_test_channel.h +++ b/test/cpp/util/create_test_channel.h @@ -36,7 +36,6 @@ #include -#include #include namespace grpc { diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc index 15c56a352c..746d67deeb 100644 --- a/test/cpp/util/grpc_cli.cc +++ b/test/cpp/util/grpc_cli.cc @@ -64,14 +64,13 @@ #include #include -#include "test/cpp/util/cli_call.h" -#include "test/cpp/util/test_config.h" -#include +#include #include #include #include -#include +#include "test/cpp/util/cli_call.h" +#include "test/cpp/util/test_config.h" DEFINE_bool(enable_ssl, true, "Whether to use ssl/tls."); DEFINE_bool(use_auth, false, "Whether to create default google credentials."); diff --git a/test/cpp/util/slice_test.cc b/test/cpp/util/slice_test.cc index eb328490e1..de7ff031ab 100644 --- a/test/cpp/util/slice_test.cc +++ b/test/cpp/util/slice_test.cc @@ -31,7 +31,7 @@ * */ -#include +#include #include #include diff --git a/test/cpp/util/status_test.cc b/test/cpp/util/status_test.cc index 17b92ab06a..837a6bab02 100644 --- a/test/cpp/util/status_test.cc +++ b/test/cpp/util/status_test.cc @@ -31,7 +31,8 @@ * */ -#include +#include + #include #include diff --git a/test/cpp/util/time_test.cc b/test/cpp/util/time_test.cc index 4cb6ec4b4e..1e501dfd28 100644 --- a/test/cpp/util/time_test.cc +++ b/test/cpp/util/time_test.cc @@ -32,7 +32,7 @@ */ #include -#include +#include #include using std::chrono::duration_cast; diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 8daeb134f7..ccea4f68de 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -760,21 +760,13 @@ WARN_LOGFILE = # spaces. # Note: If this tag is empty the current directory is searched. -INPUT = include/grpc++/async_generic_service.h \ -include/grpc++/async_unary_call.h \ -include/grpc++/auth_context.h \ -include/grpc++/byte_buffer.h \ -include/grpc++/channel.h \ -include/grpc++/channel_arguments.h \ +INPUT = include/grpc++/channel.h \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ -include/grpc++/config.h \ -include/grpc++/config_protobuf.h \ include/grpc++/create_channel.h \ include/grpc++/credentials.h \ -include/grpc++/dynamic_thread_pool.h \ -include/grpc++/fixed_size_thread_pool.h \ -include/grpc++/generic_stub.h \ +include/grpc++/generic/async_generic_service.h \ +include/grpc++/generic/generic_stub.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/grpc_library.h \ @@ -793,13 +785,21 @@ include/grpc++/server.h \ include/grpc++/server_builder.h \ include/grpc++/server_context.h \ include/grpc++/server_credentials.h \ -include/grpc++/slice.h \ -include/grpc++/status.h \ -include/grpc++/status_code_enum.h \ -include/grpc++/stream.h \ -include/grpc++/stub_options.h \ -include/grpc++/thread_pool_interface.h \ -include/grpc++/time.h +include/grpc++/support/async_unary_call.h \ +include/grpc++/support/auth_context.h \ +include/grpc++/support/byte_buffer.h \ +include/grpc++/support/channel_arguments.h \ +include/grpc++/support/config.h \ +include/grpc++/support/config_protobuf.h \ +include/grpc++/support/dynamic_thread_pool.h \ +include/grpc++/support/fixed_size_thread_pool.h \ +include/grpc++/support/slice.h \ +include/grpc++/support/status.h \ +include/grpc++/support/status_code_enum.h \ +include/grpc++/support/stream.h \ +include/grpc++/support/stub_options.h \ +include/grpc++/support/thread_pool_interface.h \ +include/grpc++/support/time.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 23ff05fb86..c4a7fb0757 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -760,21 +760,13 @@ WARN_LOGFILE = # spaces. # Note: If this tag is empty the current directory is searched. -INPUT = include/grpc++/async_generic_service.h \ -include/grpc++/async_unary_call.h \ -include/grpc++/auth_context.h \ -include/grpc++/byte_buffer.h \ -include/grpc++/channel.h \ -include/grpc++/channel_arguments.h \ +INPUT = include/grpc++/channel.h \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ -include/grpc++/config.h \ -include/grpc++/config_protobuf.h \ include/grpc++/create_channel.h \ include/grpc++/credentials.h \ -include/grpc++/dynamic_thread_pool.h \ -include/grpc++/fixed_size_thread_pool.h \ -include/grpc++/generic_stub.h \ +include/grpc++/generic/async_generic_service.h \ +include/grpc++/generic/generic_stub.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/grpc_library.h \ @@ -793,13 +785,21 @@ include/grpc++/server.h \ include/grpc++/server_builder.h \ include/grpc++/server_context.h \ include/grpc++/server_credentials.h \ -include/grpc++/slice.h \ -include/grpc++/status.h \ -include/grpc++/status_code_enum.h \ -include/grpc++/stream.h \ -include/grpc++/stub_options.h \ -include/grpc++/thread_pool_interface.h \ -include/grpc++/time.h \ +include/grpc++/support/async_unary_call.h \ +include/grpc++/support/auth_context.h \ +include/grpc++/support/byte_buffer.h \ +include/grpc++/support/channel_arguments.h \ +include/grpc++/support/config.h \ +include/grpc++/support/config_protobuf.h \ +include/grpc++/support/dynamic_thread_pool.h \ +include/grpc++/support/fixed_size_thread_pool.h \ +include/grpc++/support/slice.h \ +include/grpc++/support/status.h \ +include/grpc++/support/status_code_enum.h \ +include/grpc++/support/stream.h \ +include/grpc++/support/stub_options.h \ +include/grpc++/support/thread_pool_interface.h \ +include/grpc++/support/time.h \ src/cpp/client/secure_credentials.h \ src/cpp/common/secure_auth_context.h \ src/cpp/server/secure_server_credentials.h \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 9446368a8e..8e6afe87d2 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -13118,21 +13118,13 @@ "grpc" ], "headers": [ - "include/grpc++/async_generic_service.h", - "include/grpc++/async_unary_call.h", - "include/grpc++/auth_context.h", - "include/grpc++/byte_buffer.h", "include/grpc++/channel.h", - "include/grpc++/channel_arguments.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", - "include/grpc++/config.h", - "include/grpc++/config_protobuf.h", "include/grpc++/create_channel.h", "include/grpc++/credentials.h", - "include/grpc++/dynamic_thread_pool.h", - "include/grpc++/fixed_size_thread_pool.h", - "include/grpc++/generic_stub.h", + "include/grpc++/generic/async_generic_service.h", + "include/grpc++/generic/generic_stub.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/grpc_library.h", @@ -13151,13 +13143,21 @@ "include/grpc++/server_builder.h", "include/grpc++/server_context.h", "include/grpc++/server_credentials.h", - "include/grpc++/slice.h", - "include/grpc++/status.h", - "include/grpc++/status_code_enum.h", - "include/grpc++/stream.h", - "include/grpc++/stub_options.h", - "include/grpc++/thread_pool_interface.h", - "include/grpc++/time.h", + "include/grpc++/support/async_unary_call.h", + "include/grpc++/support/auth_context.h", + "include/grpc++/support/byte_buffer.h", + "include/grpc++/support/channel_arguments.h", + "include/grpc++/support/config.h", + "include/grpc++/support/config_protobuf.h", + "include/grpc++/support/dynamic_thread_pool.h", + "include/grpc++/support/fixed_size_thread_pool.h", + "include/grpc++/support/slice.h", + "include/grpc++/support/status.h", + "include/grpc++/support/status_code_enum.h", + "include/grpc++/support/stream.h", + "include/grpc++/support/stub_options.h", + "include/grpc++/support/thread_pool_interface.h", + "include/grpc++/support/time.h", "src/cpp/client/create_channel_internal.h", "src/cpp/client/secure_credentials.h", "src/cpp/common/create_auth_context.h", @@ -13167,21 +13167,13 @@ "language": "c++", "name": "grpc++", "src": [ - "include/grpc++/async_generic_service.h", - "include/grpc++/async_unary_call.h", - "include/grpc++/auth_context.h", - "include/grpc++/byte_buffer.h", "include/grpc++/channel.h", - "include/grpc++/channel_arguments.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", - "include/grpc++/config.h", - "include/grpc++/config_protobuf.h", "include/grpc++/create_channel.h", "include/grpc++/credentials.h", - "include/grpc++/dynamic_thread_pool.h", - "include/grpc++/fixed_size_thread_pool.h", - "include/grpc++/generic_stub.h", + "include/grpc++/generic/async_generic_service.h", + "include/grpc++/generic/generic_stub.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/grpc_library.h", @@ -13200,13 +13192,21 @@ "include/grpc++/server_builder.h", "include/grpc++/server_context.h", "include/grpc++/server_credentials.h", - "include/grpc++/slice.h", - "include/grpc++/status.h", - "include/grpc++/status_code_enum.h", - "include/grpc++/stream.h", - "include/grpc++/stub_options.h", - "include/grpc++/thread_pool_interface.h", - "include/grpc++/time.h", + "include/grpc++/support/async_unary_call.h", + "include/grpc++/support/auth_context.h", + "include/grpc++/support/byte_buffer.h", + "include/grpc++/support/channel_arguments.h", + "include/grpc++/support/config.h", + "include/grpc++/support/config_protobuf.h", + "include/grpc++/support/dynamic_thread_pool.h", + "include/grpc++/support/fixed_size_thread_pool.h", + "include/grpc++/support/slice.h", + "include/grpc++/support/status.h", + "include/grpc++/support/status_code_enum.h", + "include/grpc++/support/stream.h", + "include/grpc++/support/stub_options.h", + "include/grpc++/support/thread_pool_interface.h", + "include/grpc++/support/time.h", "src/cpp/client/channel.cc", "src/cpp/client/channel_arguments.cc", "src/cpp/client/client_context.cc", @@ -13290,21 +13290,13 @@ "grpc_unsecure" ], "headers": [ - "include/grpc++/async_generic_service.h", - "include/grpc++/async_unary_call.h", - "include/grpc++/auth_context.h", - "include/grpc++/byte_buffer.h", "include/grpc++/channel.h", - "include/grpc++/channel_arguments.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", - "include/grpc++/config.h", - "include/grpc++/config_protobuf.h", "include/grpc++/create_channel.h", "include/grpc++/credentials.h", - "include/grpc++/dynamic_thread_pool.h", - "include/grpc++/fixed_size_thread_pool.h", - "include/grpc++/generic_stub.h", + "include/grpc++/generic/async_generic_service.h", + "include/grpc++/generic/generic_stub.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/grpc_library.h", @@ -13323,34 +13315,34 @@ "include/grpc++/server_builder.h", "include/grpc++/server_context.h", "include/grpc++/server_credentials.h", - "include/grpc++/slice.h", - "include/grpc++/status.h", - "include/grpc++/status_code_enum.h", - "include/grpc++/stream.h", - "include/grpc++/stub_options.h", - "include/grpc++/thread_pool_interface.h", - "include/grpc++/time.h", + "include/grpc++/support/async_unary_call.h", + "include/grpc++/support/auth_context.h", + "include/grpc++/support/byte_buffer.h", + "include/grpc++/support/channel_arguments.h", + "include/grpc++/support/config.h", + "include/grpc++/support/config_protobuf.h", + "include/grpc++/support/dynamic_thread_pool.h", + "include/grpc++/support/fixed_size_thread_pool.h", + "include/grpc++/support/slice.h", + "include/grpc++/support/status.h", + "include/grpc++/support/status_code_enum.h", + "include/grpc++/support/stream.h", + "include/grpc++/support/stub_options.h", + "include/grpc++/support/thread_pool_interface.h", + "include/grpc++/support/time.h", "src/cpp/client/create_channel_internal.h", "src/cpp/common/create_auth_context.h" ], "language": "c++", "name": "grpc++_unsecure", "src": [ - "include/grpc++/async_generic_service.h", - "include/grpc++/async_unary_call.h", - "include/grpc++/auth_context.h", - "include/grpc++/byte_buffer.h", "include/grpc++/channel.h", - "include/grpc++/channel_arguments.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", - "include/grpc++/config.h", - "include/grpc++/config_protobuf.h", "include/grpc++/create_channel.h", "include/grpc++/credentials.h", - "include/grpc++/dynamic_thread_pool.h", - "include/grpc++/fixed_size_thread_pool.h", - "include/grpc++/generic_stub.h", + "include/grpc++/generic/async_generic_service.h", + "include/grpc++/generic/generic_stub.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/grpc_library.h", @@ -13369,13 +13361,21 @@ "include/grpc++/server_builder.h", "include/grpc++/server_context.h", "include/grpc++/server_credentials.h", - "include/grpc++/slice.h", - "include/grpc++/status.h", - "include/grpc++/status_code_enum.h", - "include/grpc++/stream.h", - "include/grpc++/stub_options.h", - "include/grpc++/thread_pool_interface.h", - "include/grpc++/time.h", + "include/grpc++/support/async_unary_call.h", + "include/grpc++/support/auth_context.h", + "include/grpc++/support/byte_buffer.h", + "include/grpc++/support/channel_arguments.h", + "include/grpc++/support/config.h", + "include/grpc++/support/config_protobuf.h", + "include/grpc++/support/dynamic_thread_pool.h", + "include/grpc++/support/fixed_size_thread_pool.h", + "include/grpc++/support/slice.h", + "include/grpc++/support/status.h", + "include/grpc++/support/status_code_enum.h", + "include/grpc++/support/stream.h", + "include/grpc++/support/stub_options.h", + "include/grpc++/support/thread_pool_interface.h", + "include/grpc++/support/time.h", "src/cpp/client/channel.cc", "src/cpp/client/channel_arguments.cc", "src/cpp/client/client_context.cc", diff --git a/vsprojects/grpc++/grpc++.vcxproj b/vsprojects/grpc++/grpc++.vcxproj index e2e17d4177..5181b3a200 100644 --- a/vsprojects/grpc++/grpc++.vcxproj +++ b/vsprojects/grpc++/grpc++.vcxproj @@ -213,21 +213,13 @@ - - - - - - - - - - + + @@ -246,13 +238,21 @@ - - - - - - - + + + + + + + + + + + + + + + diff --git a/vsprojects/grpc++/grpc++.vcxproj.filters b/vsprojects/grpc++/grpc++.vcxproj.filters index 6f308d1d02..cbffd3c765 100644 --- a/vsprojects/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/grpc++/grpc++.vcxproj.filters @@ -96,50 +96,26 @@ - - include\grpc++ - - - include\grpc++ - - - include\grpc++ - - - include\grpc++ - include\grpc++ - - include\grpc++ - include\grpc++ include\grpc++ - - include\grpc++ - - - include\grpc++ - include\grpc++ include\grpc++ - - include\grpc++ - - - include\grpc++ + + include\grpc++\generic - - include\grpc++ + + include\grpc++\generic include\grpc++\impl @@ -195,26 +171,50 @@ include\grpc++ - - include\grpc++ + + include\grpc++\support - - include\grpc++ + + include\grpc++\support - - include\grpc++ + + include\grpc++\support - - include\grpc++ + + include\grpc++\support - - include\grpc++ + + include\grpc++\support - - include\grpc++ + + include\grpc++\support - - include\grpc++ + + include\grpc++\support + + + include\grpc++\support + + + include\grpc++\support + + + include\grpc++\support + + + include\grpc++\support + + + include\grpc++\support + + + include\grpc++\support + + + include\grpc++\support + + + include\grpc++\support @@ -242,9 +242,15 @@ {784a0281-f547-aeb0-9f55-b26b7de9c769} + + {51dae921-3aa2-1976-2ee4-c5615de1af54} + {0da8cd95-314f-da1b-5ce7-7791a5be1f1a} + + {a5c10dae-f715-2a30-1066-d22f8bc94cb2} + {328ff211-2886-406e-56f9-18ba1686f363} diff --git a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj index 4be468cb62..77f83086c7 100644 --- a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -213,21 +213,13 @@ - - - - - - - - - - + + @@ -246,13 +238,21 @@ - - - - - - - + + + + + + + + + + + + + + + diff --git a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index bd51d1fa0b..d4288f8987 100644 --- a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -81,50 +81,26 @@ - - include\grpc++ - - - include\grpc++ - - - include\grpc++ - - - include\grpc++ - include\grpc++ - - include\grpc++ - include\grpc++ include\grpc++ - - include\grpc++ - - - include\grpc++ - include\grpc++ include\grpc++ - - include\grpc++ - - - include\grpc++ + + include\grpc++\generic - - include\grpc++ + + include\grpc++\generic include\grpc++\impl @@ -180,26 +156,50 @@ include\grpc++ - - include\grpc++ + + include\grpc++\support - - include\grpc++ + + include\grpc++\support - - include\grpc++ + + include\grpc++\support - - include\grpc++ + + include\grpc++\support - - include\grpc++ + + include\grpc++\support - - include\grpc++ + + include\grpc++\support - - include\grpc++ + + include\grpc++\support + + + include\grpc++\support + + + include\grpc++\support + + + include\grpc++\support + + + include\grpc++\support + + + include\grpc++\support + + + include\grpc++\support + + + include\grpc++\support + + + include\grpc++\support @@ -218,9 +218,15 @@ {eceb50c0-bb49-3812-b6bd-b0af6df81da7} + + {83717d3c-57d9-2bfa-ed9c-2b08f86da12b} + {dadc0002-f2ac-451b-a9b8-33b8de10b5fc} + + {0ebf8008-80b9-d6da-e1dc-854bf1ec2195} + {cce6a85d-1111-3834-6825-31e170d93cff} -- cgit v1.2.3