Imported Upstream version 1.27.0
[platform/upstream/grpc.git] / include / grpcpp / server_impl.h
index bb9380a..9506c41 100644 (file)
@@ -23,6 +23,8 @@
 #include <memory>
 #include <vector>
 
+#include <grpc/impl/codegen/port_platform.h>
+
 #include <grpc/compression.h>
 #include <grpc/support/atm.h>
 #include <grpcpp/channel_impl.h>
@@ -161,9 +163,6 @@ class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen {
   ///
   /// Server constructors. To be used by \a ServerBuilder only.
   ///
-  /// \param max_message_size Maximum message length that the channel can
-  /// receive.
-  ///
   /// \param args The channel args
   ///
   /// \param sync_server_cqs The completion queues to use if the server is a
@@ -180,7 +179,7 @@ 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(int max_message_size, ChannelArguments* args,
+  Server(ChannelArguments* args,
          std::shared_ptr<std::vector<std::unique_ptr<ServerCompletionQueue>>>
              sync_server_cqs,
          int min_pollers, int max_pollers, int sync_cq_timeout_msec,
@@ -243,6 +242,13 @@ class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen {
   /// service. The service must exist for the lifetime of the Server instance.
   void RegisterAsyncGenericService(grpc::AsyncGenericService* service) override;
 
+#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+  /// Register a callback-based generic service. This call does not take
+  /// ownership of theservice. The service must exist for the lifetime of the
+  /// Server instance.
+  void RegisterCallbackGenericService(
+      grpc::CallbackGenericService* service) override;
+#else
   /// NOTE: class experimental_registration_type is not part of the public API
   /// of this class
   /// TODO(vjpai): Move these contents to the public API of Server when
@@ -270,6 +276,7 @@ class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen {
   experimental_registration_interface* experimental_registration() override {
     return &experimental_registration_;
   }
+#endif
 
   void PerformOpsOnCall(grpc::internal::CallOpSetInterface* ops,
                         grpc::internal::Call* call) override;
@@ -296,7 +303,7 @@ class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen {
       std::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface>>
       interceptor_creators_;
 
-  const int max_receive_message_size_;
+  int max_receive_message_size_;
 
   /// 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
@@ -318,9 +325,11 @@ class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen {
   // List of callback requests to start when server actually starts.
   std::list<CallbackRequestBase*> callback_reqs_to_start_;
 
+#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
   // For registering experimental callback generic service; remove when that
   // method longer experimental
   experimental_registration_type experimental_registration_{this};
+#endif
 
   // Server status
   grpc::internal::Mutex mu_;
@@ -357,8 +366,12 @@ class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen {
 
   // When appropriate, use a default callback generic service to handle
   // unimplemented methods
+#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+  std::unique_ptr<grpc::CallbackGenericService> unimplemented_service_;
+#else
   std::unique_ptr<grpc::experimental::CallbackGenericService>
       unimplemented_service_;
+#endif
 
   // A special handler for resource exhausted in sync case
   std::unique_ptr<grpc::internal::MethodHandler> resource_exhausted_handler_;