From ab775de1a24719f9e721b62131cbf13139a41164 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Tue, 4 Aug 2020 13:05:48 -0700 Subject: [PATCH] Build and formatting fixes --- gRPC-C++.podspec | 2 +- include/grpcpp/channel.h | 15 +++---- include/grpcpp/completion_queue.h | 8 ++-- include/grpcpp/generic/generic_stub.h | 9 ++-- .../impl/codegen/async_generic_service.h | 5 +-- .../grpcpp/impl/codegen/async_stream_impl.h | 6 +-- .../impl/codegen/async_unary_call_impl.h | 2 +- include/grpcpp/impl/codegen/call_op_set.h | 2 +- .../impl/codegen/client_callback_impl.h | 2 +- .../grpcpp/impl/codegen/client_unary_call.h | 2 +- .../grpcpp/impl/codegen/completion_queue.h | 9 ++-- .../grpcpp/impl/codegen/delegating_channel.h | 8 ++-- .../grpcpp/impl/codegen/server_interface.h | 38 +++++++--------- include/grpcpp/impl/codegen/service_type.h | 8 ++-- .../grpcpp/impl/codegen/sync_stream_impl.h | 8 ++-- include/grpcpp/server_builder.h | 4 +- include/grpcpp/server_builder_impl.h | 4 +- include/grpcpp/server_impl.h | 45 ++++++++++--------- src/cpp/server/async_generic_service.cc | 4 +- src/cpp/server/server_builder.cc | 19 ++++---- src/cpp/server/server_context.cc | 4 +- 21 files changed, 99 insertions(+), 105 deletions(-) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 3f6628a00a4..6b548465b6e 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -79,7 +79,6 @@ Pod::Spec.new do |s| ss.source_files = 'include/grpcpp/alarm.h', 'include/grpcpp/alarm_impl.h', 'include/grpcpp/channel.h', - 'include/grpcpp/channel_impl.h', 'include/grpcpp/client_context.h', 'include/grpcpp/completion_queue.h', 'include/grpcpp/create_channel.h', @@ -111,6 +110,7 @@ Pod::Spec.new do |s| 'include/grpcpp/impl/codegen/client_interceptor.h', 'include/grpcpp/impl/codegen/client_unary_call.h', 'include/grpcpp/impl/codegen/completion_queue.h', + 'include/grpcpp/impl/codegen/completion_queue_tag.h', 'include/grpcpp/impl/codegen/config.h', 'include/grpcpp/impl/codegen/core_codegen.h', 'include/grpcpp/impl/codegen/core_codegen_interface.h', diff --git a/include/grpcpp/channel.h b/include/grpcpp/channel.h index eef5fcca50b..c6ad707b57b 100644 --- a/include/grpcpp/channel.h +++ b/include/grpcpp/channel.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -37,7 +37,7 @@ namespace testing { class ChannelTestPeer; } // namespace testing -std::shared_ptr<::grpc_impl::Channel> CreateChannelInternal( +std::shared_ptr CreateChannelInternal( const std::string& host, grpc_channel* c_channel, std::vector< std::unique_ptr> @@ -87,23 +87,22 @@ class Channel final : public ::grpc::ChannelInterface, ::grpc::internal::Call CreateCall(const ::grpc::internal::RpcMethod& method, ::grpc_impl::ClientContext* context, - ::grpc_impl::CompletionQueue* cq) override; + ::grpc::CompletionQueue* cq) override; void PerformOpsOnCall(::grpc::internal::CallOpSetInterface* ops, ::grpc::internal::Call* call) override; void* RegisterMethod(const char* method) override; void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, gpr_timespec deadline, - ::grpc_impl::CompletionQueue* cq, - void* tag) override; + ::grpc::CompletionQueue* cq, void* tag) override; bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, gpr_timespec deadline) override; - ::grpc_impl::CompletionQueue* CallbackCQ() override; + ::grpc::CompletionQueue* CallbackCQ() override; ::grpc::internal::Call CreateCallInternal( const ::grpc::internal::RpcMethod& method, - ::grpc_impl::ClientContext* context, ::grpc_impl::CompletionQueue* cq, + ::grpc_impl::ClientContext* context, ::grpc::CompletionQueue* cq, size_t interceptor_pos) override; const std::string host_; @@ -116,7 +115,7 @@ class Channel final : public ::grpc::ChannelInterface, // with this channel (if any). It is set on the first call to CallbackCQ(). // It is _not owned_ by the channel; ownership belongs with its internal // shutdown callback tag (invoked when the CQ is fully shutdown). - ::grpc_impl::CompletionQueue* callback_cq_ = nullptr; + ::grpc::CompletionQueue* callback_cq_ = nullptr; std::vector< std::unique_ptr<::grpc::experimental::ClientInterceptorFactoryInterface>> diff --git a/include/grpcpp/completion_queue.h b/include/grpcpp/completion_queue.h index b6fb2b4f990..36dfddbf3d7 100644 --- a/include/grpcpp/completion_queue.h +++ b/include/grpcpp/completion_queue.h @@ -16,9 +16,9 @@ * */ -#ifndef GRPCPP_COMPLETION_QUEUE_IMPL_H -#define GRPCPP_COMPLETION_QUEUE_IMPL_H +#ifndef GRPCPP_COMPLETION_QUEUE_H +#define GRPCPP_COMPLETION_QUEUE_H -#include +#include -#endif // GRPCPP_COMPLETION_QUEUE_IMPL_H +#endif // GRPCPP_COMPLETION_QUEUE_H diff --git a/include/grpcpp/generic/generic_stub.h b/include/grpcpp/generic/generic_stub.h index 52d11d6d977..70c5f5d763d 100644 --- a/include/grpcpp/generic/generic_stub.h +++ b/include/grpcpp/generic/generic_stub.h @@ -54,7 +54,7 @@ class TemplatedGenericStub final { std::unique_ptr< ::grpc_impl::ClientAsyncReaderWriter> PrepareCall(ClientContext* context, const std::string& method, - ::grpc_impl::CompletionQueue* cq) { + ::grpc::CompletionQueue* cq) { return CallInternal(channel_.get(), context, method, cq, false, nullptr); } @@ -64,8 +64,7 @@ class TemplatedGenericStub final { /// succeeded (i.e. the call won't proceed if the return value is nullptr). std::unique_ptr<::grpc_impl::ClientAsyncResponseReader> PrepareUnaryCall(ClientContext* context, const std::string& method, - const RequestType& request, - ::grpc_impl::CompletionQueue* cq) { + const RequestType& request, ::grpc::CompletionQueue* cq) { return std::unique_ptr< ::grpc_impl::ClientAsyncResponseReader>( grpc_impl::internal::ClientAsyncResponseReaderFactory< @@ -85,7 +84,7 @@ class TemplatedGenericStub final { std::unique_ptr< ::grpc_impl::ClientAsyncReaderWriter> Call(ClientContext* context, const std::string& method, - ::grpc_impl::CompletionQueue* cq, void* tag) { + ::grpc::CompletionQueue* cq, void* tag) { return CallInternal(channel_.get(), context, method, cq, true, tag); } @@ -204,7 +203,7 @@ class TemplatedGenericStub final { std::unique_ptr< ::grpc_impl::ClientAsyncReaderWriter> CallInternal(grpc::ChannelInterface* channel, ClientContext* context, - const std::string& method, ::grpc_impl::CompletionQueue* cq, + const std::string& method, ::grpc::CompletionQueue* cq, bool start, void* tag) { return std::unique_ptr< ::grpc_impl::ClientAsyncReaderWriter>( diff --git a/include/grpcpp/impl/codegen/async_generic_service.h b/include/grpcpp/impl/codegen/async_generic_service.h index 81d5e8ed314..3cb20fbfc33 100644 --- a/include/grpcpp/impl/codegen/async_generic_service.h +++ b/include/grpcpp/impl/codegen/async_generic_service.h @@ -80,9 +80,8 @@ class AsyncGenericService final { void RequestCall(GenericServerContext* ctx, GenericServerAsyncReaderWriter* reader_writer, - ::grpc_impl::CompletionQueue* call_cq, - ::grpc_impl::ServerCompletionQueue* notification_cq, - void* tag); + ::grpc::CompletionQueue* call_cq, + ::grpc::ServerCompletionQueue* notification_cq, void* tag); private: friend class grpc_impl::Server; diff --git a/include/grpcpp/impl/codegen/async_stream_impl.h b/include/grpcpp/impl/codegen/async_stream_impl.h index f832f5e457a..5e945b154ff 100644 --- a/include/grpcpp/impl/codegen/async_stream_impl.h +++ b/include/grpcpp/impl/codegen/async_stream_impl.h @@ -178,7 +178,7 @@ class ClientAsyncReaderFactory { /// used to send to the server when starting the call. template static ClientAsyncReader* Create(::grpc::ChannelInterface* channel, - ::grpc_impl::CompletionQueue* cq, + ::grpc::CompletionQueue* cq, const ::grpc::internal::RpcMethod& method, ::grpc_impl::ClientContext* context, const W& request, bool start, void* tag) { @@ -327,7 +327,7 @@ class ClientAsyncWriterFactory { /// method of this instance. template static ClientAsyncWriter* Create(::grpc::ChannelInterface* channel, - ::grpc_impl::CompletionQueue* cq, + ::grpc::CompletionQueue* cq, const ::grpc::internal::RpcMethod& method, ::grpc_impl::ClientContext* context, R* response, bool start, void* tag) { @@ -493,7 +493,7 @@ class ClientAsyncReaderWriterFactory { /// Note that \a context will be used to fill in custom initial metadata /// used to send to the server when starting the call. static ClientAsyncReaderWriter* Create( - ::grpc::ChannelInterface* channel, ::grpc_impl::CompletionQueue* cq, + ::grpc::ChannelInterface* channel, ::grpc::CompletionQueue* cq, const ::grpc::internal::RpcMethod& method, ::grpc_impl::ClientContext* context, bool start, void* tag) { ::grpc::internal::Call call = channel->CreateCall(method, context, cq); diff --git a/include/grpcpp/impl/codegen/async_unary_call_impl.h b/include/grpcpp/impl/codegen/async_unary_call_impl.h index e7a2101226d..6febbd404d1 100644 --- a/include/grpcpp/impl/codegen/async_unary_call_impl.h +++ b/include/grpcpp/impl/codegen/async_unary_call_impl.h @@ -77,7 +77,7 @@ class ClientAsyncResponseReaderFactory { /// used to send to the server when starting the call. template static ClientAsyncResponseReader* Create( - ::grpc::ChannelInterface* channel, ::grpc_impl::CompletionQueue* cq, + ::grpc::ChannelInterface* channel, ::grpc::CompletionQueue* cq, const ::grpc::internal::RpcMethod& method, ::grpc_impl::ClientContext* context, const W& request, bool start) { ::grpc::internal::Call call = channel->CreateCall(method, context, cq); diff --git a/include/grpcpp/impl/codegen/call_op_set.h b/include/grpcpp/impl/codegen/call_op_set.h index 66d249ae03d..14353514056 100644 --- a/include/grpcpp/impl/codegen/call_op_set.h +++ b/include/grpcpp/impl/codegen/call_op_set.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/grpcpp/impl/codegen/client_callback_impl.h b/include/grpcpp/impl/codegen/client_callback_impl.h index 31e4d3b2aee..1c2349aea9f 100644 --- a/include/grpcpp/impl/codegen/client_callback_impl.h +++ b/include/grpcpp/impl/codegen/client_callback_impl.h @@ -60,7 +60,7 @@ class CallbackUnaryCallImpl { ::grpc_impl::ClientContext* context, const InputMessage* request, OutputMessage* result, std::function on_completion) { - ::grpc_::CompletionQueue* cq = channel->CallbackCQ(); + ::grpc::CompletionQueue* cq = channel->CallbackCQ(); GPR_CODEGEN_ASSERT(cq != nullptr); grpc::internal::Call call(channel->CreateCall(method, context, cq)); diff --git a/include/grpcpp/impl/codegen/client_unary_call.h b/include/grpcpp/impl/codegen/client_unary_call.h index 7f80e571c07..11b884f1ce2 100644 --- a/include/grpcpp/impl/codegen/client_unary_call.h +++ b/include/grpcpp/impl/codegen/client_unary_call.h @@ -49,7 +49,7 @@ class BlockingUnaryCallImpl { BlockingUnaryCallImpl(ChannelInterface* channel, const RpcMethod& method, grpc_impl::ClientContext* context, const InputMessage& request, OutputMessage* result) { - ::grpc_impl::CompletionQueue cq(grpc_completion_queue_attributes{ + ::grpc::CompletionQueue cq(grpc_completion_queue_attributes{ GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, nullptr}); // Pluckable completion queue ::grpc::internal::Call call(channel->CreateCall(method, context, &cq)); diff --git a/include/grpcpp/impl/codegen/completion_queue.h b/include/grpcpp/impl/codegen/completion_queue.h index 61a78b4c2f5..f2012460371 100644 --- a/include/grpcpp/impl/codegen/completion_queue.h +++ b/include/grpcpp/impl/codegen/completion_queue.h @@ -284,7 +284,7 @@ class CompletionQueue : private ::grpc::GrpcLibraryCodegen { friend class ::grpc::internal::BlockingUnaryCallImpl; // Friends that need access to constructor for callback CQ - friend class ::grpc_impl::Channel; + friend class ::grpc::Channel; // For access to Register/CompleteAvalanching template @@ -382,14 +382,14 @@ class CompletionQueue : private ::grpc::GrpcLibraryCodegen { } } - void RegisterServer(const Server* server) { + void RegisterServer(const ::grpc_impl::Server* server) { (void)server; #ifndef NDEBUG grpc::internal::MutexLock l(&server_list_mutex_); server_list_.push_back(server); #endif } - void UnregisterServer(const Server* server) { + void UnregisterServer(const ::grpc_impl::Server* server) { (void)server; #ifndef NDEBUG grpc::internal::MutexLock l(&server_list_mutex_); @@ -412,7 +412,8 @@ class CompletionQueue : private ::grpc::GrpcLibraryCodegen { // NDEBUG, instantiate it in all cases since otherwise the size will be // inconsistent. mutable grpc::internal::Mutex server_list_mutex_; - std::list server_list_ /* GUARDED_BY(server_list_mutex_) */; + std::list + server_list_ /* GUARDED_BY(server_list_mutex_) */; }; /// A specific type of completion queue used by the processing of notifications diff --git a/include/grpcpp/impl/codegen/delegating_channel.h b/include/grpcpp/impl/codegen/delegating_channel.h index a18622235f9..1a3bbd3349a 100644 --- a/include/grpcpp/impl/codegen/delegating_channel.h +++ b/include/grpcpp/impl/codegen/delegating_channel.h @@ -40,7 +40,7 @@ class DelegatingChannel : public ::grpc::ChannelInterface { private: internal::Call CreateCall(const internal::RpcMethod& method, ClientContext* context, - ::grpc_impl::CompletionQueue* cq) final { + ::grpc::CompletionQueue* cq) final { return delegate_channel()->CreateCall(method, context, cq); } @@ -55,7 +55,7 @@ class DelegatingChannel : public ::grpc::ChannelInterface { void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, gpr_timespec deadline, - ::grpc_impl::CompletionQueue* cq, + ::grpc::CompletionQueue* cq, void* tag) override { delegate_channel()->NotifyOnStateChangeImpl(last_observed, deadline, cq, tag); @@ -68,13 +68,13 @@ class DelegatingChannel : public ::grpc::ChannelInterface { internal::Call CreateCallInternal(const internal::RpcMethod& method, ClientContext* context, - ::grpc_impl::CompletionQueue* cq, + ::grpc::CompletionQueue* cq, size_t interceptor_pos) final { return delegate_channel()->CreateCallInternal(method, context, cq, interceptor_pos); } - ::grpc_impl::CompletionQueue* CallbackCQ() final { + ::grpc::CompletionQueue* CallbackCQ() final { return delegate_channel()->CallbackCQ(); } diff --git a/include/grpcpp/impl/codegen/server_interface.h b/include/grpcpp/impl/codegen/server_interface.h index d15e1d4891f..ef5252b454f 100644 --- a/include/grpcpp/impl/codegen/server_interface.h +++ b/include/grpcpp/impl/codegen/server_interface.h @@ -31,16 +31,13 @@ #include #include -namespace grpc_impl { - -class ServerCompletionQueue; -} // namespace grpc_impl namespace grpc { class AsyncGenericService; class Channel; class CompletionQueue; class GenericServerContext; +class ServerCompletionQueue; class ServerCredentials; class Service; @@ -181,8 +178,7 @@ class ServerInterface : public internal::CallHook { /// caller is required to keep all completion queues live until the server is /// destroyed. /// \param num_cqs How many completion queues does \a cqs hold. - virtual void Start(::grpc_impl::ServerCompletionQueue** cqs, - size_t num_cqs) = 0; + virtual void Start(::grpc::ServerCompletionQueue** cqs, size_t num_cqs) = 0; virtual void ShutdownInternal(gpr_timespec deadline) = 0; @@ -199,8 +195,8 @@ class ServerInterface : public internal::CallHook { ::grpc_impl::ServerContext* context, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, - ::grpc_impl::ServerCompletionQueue* notification_cq, - void* tag, bool delete_on_finalize); + ::grpc::ServerCompletionQueue* notification_cq, void* tag, + bool delete_on_finalize); virtual ~BaseAsyncRequest(); bool FinalizeResult(void** tag, bool* status) override; @@ -213,7 +209,7 @@ class ServerInterface : public internal::CallHook { ::grpc_impl::ServerContext* const context_; internal::ServerAsyncStreamingInterface* const stream_; ::grpc::CompletionQueue* const call_cq_; - ::grpc_impl::ServerCompletionQueue* const notification_cq_; + ::grpc::ServerCompletionQueue* const notification_cq_; void* const tag_; const bool delete_on_finalize_; grpc_call* call_; @@ -229,7 +225,7 @@ class ServerInterface : public internal::CallHook { ::grpc_impl::ServerContext* context, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, - ::grpc_impl::ServerCompletionQueue* notification_cq, + ::grpc::ServerCompletionQueue* notification_cq, void* tag, const char* name, internal::RpcMethod::RpcType type); @@ -247,7 +243,7 @@ class ServerInterface : public internal::CallHook { protected: void IssueRequest(void* registered_method, grpc_byte_buffer** payload, - ::grpc_impl::ServerCompletionQueue* notification_cq); + ::grpc::ServerCompletionQueue* notification_cq); const char* name_; const internal::RpcMethod::RpcType type_; }; @@ -259,7 +255,7 @@ class ServerInterface : public internal::CallHook { ::grpc_impl::ServerContext* context, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, - ::grpc_impl::ServerCompletionQueue* notification_cq, + ::grpc::ServerCompletionQueue* notification_cq, void* tag) : RegisteredAsyncRequest( server, context, stream, call_cq, notification_cq, tag, @@ -278,7 +274,7 @@ class ServerInterface : public internal::CallHook { ::grpc_impl::ServerContext* context, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, - ::grpc_impl::ServerCompletionQueue* notification_cq, + ::grpc::ServerCompletionQueue* notification_cq, void* tag, Message* request) : RegisteredAsyncRequest( server, context, stream, call_cq, notification_cq, tag, @@ -334,7 +330,7 @@ class ServerInterface : public internal::CallHook { GenericAsyncRequest(ServerInterface* server, GenericServerContext* context, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, - ::grpc_impl::ServerCompletionQueue* notification_cq, + ::grpc::ServerCompletionQueue* notification_cq, void* tag, bool delete_on_finalize); bool FinalizeResult(void** tag, bool* status) override; @@ -348,7 +344,7 @@ class ServerInterface : public internal::CallHook { ::grpc_impl::ServerContext* context, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, - ::grpc_impl::ServerCompletionQueue* notification_cq, + ::grpc::ServerCompletionQueue* notification_cq, void* tag, Message* message) { GPR_CODEGEN_ASSERT(method); new PayloadAsyncRequest(method, this, context, stream, call_cq, @@ -359,18 +355,18 @@ class ServerInterface : public internal::CallHook { ::grpc_impl::ServerContext* context, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, - ::grpc_impl::ServerCompletionQueue* notification_cq, + ::grpc::ServerCompletionQueue* notification_cq, void* tag) { GPR_CODEGEN_ASSERT(method); new NoPayloadAsyncRequest(method, this, context, stream, call_cq, notification_cq, tag); } - void RequestAsyncGenericCall( - GenericServerContext* context, - internal::ServerAsyncStreamingInterface* stream, - ::grpc::CompletionQueue* call_cq, - ::grpc_impl::ServerCompletionQueue* notification_cq, void* tag) { + void RequestAsyncGenericCall(GenericServerContext* context, + internal::ServerAsyncStreamingInterface* stream, + ::grpc::CompletionQueue* call_cq, + ::grpc::ServerCompletionQueue* notification_cq, + void* tag) { new GenericAsyncRequest(this, context, stream, call_cq, notification_cq, tag, true); } diff --git a/include/grpcpp/impl/codegen/service_type.h b/include/grpcpp/impl/codegen/service_type.h index 54fb3f0b6d8..84a9893a7e8 100644 --- a/include/grpcpp/impl/codegen/service_type.h +++ b/include/grpcpp/impl/codegen/service_type.h @@ -131,7 +131,7 @@ class Service { Message* request, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, - ::grpc_impl::ServerCompletionQueue* notification_cq, + ::grpc::ServerCompletionQueue* notification_cq, void* tag) { // Typecast the index to size_t for indexing into a vector // while preserving the API that existed before a compiler @@ -144,7 +144,7 @@ class Service { int index, ::grpc_impl::ServerContext* context, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, - ::grpc_impl::ServerCompletionQueue* notification_cq, void* tag) { + ::grpc::ServerCompletionQueue* notification_cq, void* tag) { size_t idx = static_cast(index); server_->RequestAsyncCall(methods_[idx].get(), context, stream, call_cq, notification_cq, tag); @@ -154,7 +154,7 @@ class Service { int index, ::grpc_impl::ServerContext* context, Message* request, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, - ::grpc_impl::ServerCompletionQueue* notification_cq, void* tag) { + ::grpc::ServerCompletionQueue* notification_cq, void* tag) { size_t idx = static_cast(index); server_->RequestAsyncCall(methods_[idx].get(), context, stream, call_cq, notification_cq, tag, request); @@ -163,7 +163,7 @@ class Service { int index, ::grpc_impl::ServerContext* context, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, - ::grpc_impl::ServerCompletionQueue* notification_cq, void* tag) { + ::grpc::ServerCompletionQueue* notification_cq, void* tag) { size_t idx = static_cast(index); server_->RequestAsyncCall(methods_[idx].get(), context, stream, call_cq, notification_cq, tag); diff --git a/include/grpcpp/impl/codegen/sync_stream_impl.h b/include/grpcpp/impl/codegen/sync_stream_impl.h index 1a67467ebbc..2ea2b0fe9d4 100644 --- a/include/grpcpp/impl/codegen/sync_stream_impl.h +++ b/include/grpcpp/impl/codegen/sync_stream_impl.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -232,7 +232,7 @@ class ClientReader final : public ClientReaderInterface { private: friend class internal::ClientReaderFactory; ::grpc_impl::ClientContext* context_; - ::grpc_impl::CompletionQueue cq_; + ::grpc::CompletionQueue cq_; ::grpc::internal::Call call_; /// Block to create a stream and write the initial metadata and \a request @@ -400,7 +400,7 @@ class ClientWriter : public ClientWriterInterface { ::grpc::internal::CallOpGenericRecvMessage, ::grpc::internal::CallOpClientRecvStatus> finish_ops_; - ::grpc_impl::CompletionQueue cq_; + ::grpc::CompletionQueue cq_; ::grpc::internal::Call call_; }; @@ -544,7 +544,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface { friend class internal::ClientReaderWriterFactory; ::grpc_impl::ClientContext* context_; - ::grpc_impl::CompletionQueue cq_; + ::grpc::CompletionQueue cq_; ::grpc::internal::Call call_; /// Block to create a stream and write the initial metadata and \a request diff --git a/include/grpcpp/server_builder.h b/include/grpcpp/server_builder.h index 8a15abad3fb..cd3debdae78 100644 --- a/include/grpcpp/server_builder.h +++ b/include/grpcpp/server_builder.h @@ -163,7 +163,7 @@ class ServerBuilder { /// not polling the completion queue frequently) will have a significantly /// negative performance impact and hence should not be used in production /// use cases. - std::unique_ptr AddCompletionQueue( + std::unique_ptr AddCompletionQueue( bool is_frequently_polled = true); ////////////////////////////////////////////////////////////////////////////// @@ -378,7 +378,7 @@ class ServerBuilder { SyncServerSettings sync_server_settings_; /// List of completion queues added via \a AddCompletionQueue method. - std::vector cqs_; + std::vector cqs_; std::shared_ptr creds_; std::vector> plugins_; diff --git a/include/grpcpp/server_builder_impl.h b/include/grpcpp/server_builder_impl.h index 63e889b7b9a..35d08ca0a28 100644 --- a/include/grpcpp/server_builder_impl.h +++ b/include/grpcpp/server_builder_impl.h @@ -167,7 +167,7 @@ class ServerBuilder { /// not polling the completion queue frequently) will have a significantly /// negative performance impact and hence should not be used in production /// use cases. - std::unique_ptr AddCompletionQueue( + std::unique_ptr AddCompletionQueue( bool is_frequently_polled = true); ////////////////////////////////////////////////////////////////////////////// @@ -383,7 +383,7 @@ class ServerBuilder { SyncServerSettings sync_server_settings_; /// List of completion queues added via \a AddCompletionQueue method. - std::vector cqs_; + std::vector cqs_; std::shared_ptr creds_; std::vector> plugins_; diff --git a/include/grpcpp/server_impl.h b/include/grpcpp/server_impl.h index 7561696ae2d..4bb7cc6f1c8 100644 --- a/include/grpcpp/server_impl.h +++ b/include/grpcpp/server_impl.h @@ -27,12 +27,12 @@ #include #include -#include -#include +#include +#include #include #include #include -#include +#include #include #include #include @@ -109,7 +109,7 @@ class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen { } /// Establish a channel for in-process communication - std::shared_ptr InProcessChannel(const ChannelArguments& args); + std::shared_ptr InProcessChannel(const ChannelArguments& args); /// NOTE: class experimental_type is not part of the public API of this class. /// TODO(yashykt): Integrate into public API when this is no longer @@ -120,7 +120,7 @@ class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen { /// Establish a channel for in-process communication with client /// interceptors - std::shared_ptr InProcessChannelWithInterceptors( + std::shared_ptr InProcessChannelWithInterceptors( const ChannelArguments& args, std::vector> @@ -179,18 +179,19 @@ class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen { /// /// \param sync_cq_timeout_msec The timeout to use when calling AsyncNext() on /// server completion queues passed via sync_server_cqs param. - Server(ChannelArguments* args, - std::shared_ptr>> - sync_server_cqs, - int min_pollers, int max_pollers, int sync_cq_timeout_msec, - std::vector< - std::shared_ptr> - acceptors, - grpc_resource_quota* server_rq = nullptr, - std::vector> - interceptor_creators = std::vector>()); + Server( + ChannelArguments* args, + std::shared_ptr>> + sync_server_cqs, + int min_pollers, int max_pollers, int sync_cq_timeout_msec, + std::vector< + std::shared_ptr> + acceptors, + grpc_resource_quota* server_rq = nullptr, + std::vector> + interceptor_creators = std::vector>()); /// Start the server. /// @@ -198,7 +199,7 @@ class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen { /// caller is required to keep all completion queues live until the server is /// destroyed. /// \param num_cqs How many completion queues does \a cqs hold. - void Start(ServerCompletionQueue** cqs, size_t num_cqs) override; + void Start(grpc::ServerCompletionQueue** cqs, size_t num_cqs) override; grpc_server* server() override { return server_; } @@ -287,7 +288,7 @@ class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen { return max_receive_message_size_; } - CompletionQueue* CallbackCQ() override; + grpc::CompletionQueue* CallbackCQ() override; grpc_impl::ServerInitializer* initializer(); @@ -315,7 +316,7 @@ class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen { /// The following completion queues are ONLY used in case of Sync API /// i.e. if the server has any services with sync methods. The server uses /// these completion queues to poll for new RPCs - std::shared_ptr>> + std::shared_ptr>> sync_server_cqs_; /// List of \a ThreadManager instances (one for each cq in @@ -373,12 +374,12 @@ class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen { // with this server (if any). It is set on the first call to CallbackCQ(). // It is _not owned_ by the server; ownership belongs with its internal // shutdown callback tag (invoked when the CQ is fully shutdown). - CompletionQueue* callback_cq_ /* GUARDED_BY(mu_) */ = nullptr; + grpc::CompletionQueue* callback_cq_ /* GUARDED_BY(mu_) */ = nullptr; // List of CQs passed in by user that must be Shutdown only after Server is // Shutdown. Even though this is only used with NDEBUG, instantiate it in all // cases since otherwise the size will be inconsistent. - std::vector cq_list_; + std::vector cq_list_; }; } // namespace grpc_impl diff --git a/src/cpp/server/async_generic_service.cc b/src/cpp/server/async_generic_service.cc index 556447a7f40..07697a52d1f 100644 --- a/src/cpp/server/async_generic_service.cc +++ b/src/cpp/server/async_generic_service.cc @@ -24,8 +24,8 @@ namespace grpc { void AsyncGenericService::RequestCall( GenericServerContext* ctx, GenericServerAsyncReaderWriter* reader_writer, - ::grpc_impl::CompletionQueue* call_cq, - ::grpc_impl::ServerCompletionQueue* notification_cq, void* tag) { + ::grpc::CompletionQueue* call_cq, + ::grpc::ServerCompletionQueue* notification_cq, void* tag) { server_->RequestAsyncGenericCall(ctx, reader_writer, call_cq, notification_cq, tag); } diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 7fa33a803e9..e6ab95eaf22 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -68,14 +68,14 @@ ServerBuilder::~ServerBuilder() { } } -std::unique_ptr -ServerBuilder::AddCompletionQueue(bool is_frequently_polled) { - grpc_impl::ServerCompletionQueue* cq = new grpc_impl::ServerCompletionQueue( +std::unique_ptr ServerBuilder::AddCompletionQueue( + bool is_frequently_polled) { + grpc::ServerCompletionQueue* cq = new grpc::ServerCompletionQueue( GRPC_CQ_NEXT, is_frequently_polled ? GRPC_CQ_DEFAULT_POLLING : GRPC_CQ_NON_LISTENING, nullptr); cqs_.push_back(cq); - return std::unique_ptr(cq); + return std::unique_ptr(cq); } ServerBuilder& ServerBuilder::RegisterService(Service* service) { @@ -275,11 +275,10 @@ std::unique_ptr ServerBuilder::BuildAndStart() { // This is different from the completion queues added to the server via // ServerBuilder's AddCompletionQueue() method (those completion queues // are in 'cqs_' member variable of ServerBuilder object) - std::shared_ptr< - std::vector>> + std::shared_ptr>> sync_server_cqs( - std::make_shared>>()); + std::make_shared< + std::vector>>()); bool has_frequently_polled_cqs = false; for (const auto& cq : cqs_) { @@ -307,8 +306,8 @@ std::unique_ptr ServerBuilder::BuildAndStart() { // Create completion queues to listen to incoming rpc requests for (int i = 0; i < sync_server_settings_.num_cqs; i++) { - sync_server_cqs->emplace_back(new grpc_impl::ServerCompletionQueue( - GRPC_CQ_NEXT, polling_type, nullptr)); + sync_server_cqs->emplace_back( + new grpc::ServerCompletionQueue(GRPC_CQ_NEXT, polling_type, nullptr)); } } diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index c7cad23741c..f1042e74ce9 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include @@ -89,7 +89,7 @@ class ServerContextBase::CompletionOp final bool FinalizeResult(void** tag, bool* status) override; - bool CheckCancelled(CompletionQueue* cq) { + bool CheckCancelled(grpc::CompletionQueue* cq) { cq->TryPluck(this); return CheckCancelledNoPluck(); }