Imported Upstream version 1.36.0
[platform/upstream/grpc.git] / include / grpcpp / server.h
index 5dc73a1..d90f28d 100644 (file)
@@ -203,6 +203,8 @@ class Server : public ServerInterface, private GrpcLibraryCodegen {
     health_check_service_ = std::move(service);
   }
 
+  ContextAllocator* context_allocator() { return context_allocator_.get(); }
+
   /// NOTE: This method is not part of the public API for this class.
   bool health_check_service_disabled() const {
     return health_check_service_disabled_;
@@ -240,6 +242,12 @@ class Server : public ServerInterface, private GrpcLibraryCodegen {
   /// ownership of theservice. The service must exist for the lifetime of the
   /// Server instance.
   void RegisterCallbackGenericService(CallbackGenericService* service) override;
+
+  void RegisterContextAllocator(
+      std::unique_ptr<ContextAllocator> context_allocator) {
+    context_allocator_ = std::move(context_allocator);
+  }
+
 #else
   /// NOTE: class experimental_registration_type is not part of the public API
   /// of this class
@@ -254,6 +262,11 @@ class Server : public ServerInterface, private GrpcLibraryCodegen {
       server_->RegisterCallbackGenericService(service);
     }
 
+    void RegisterContextAllocator(
+        std::unique_ptr<ContextAllocator> context_allocator) override {
+      server_->context_allocator_ = std::move(context_allocator);
+    }
+
    private:
     Server* server_;
   };
@@ -342,6 +355,8 @@ class Server : public ServerInterface, private GrpcLibraryCodegen {
 
   std::unique_ptr<ServerInitializer> server_initializer_;
 
+  std::unique_ptr<ContextAllocator> context_allocator_;
+
   std::unique_ptr<HealthCheckServiceInterface> health_check_service_;
   bool health_check_service_disabled_;