Move ::grpc::HealthCheckServiceInterface to ::grpc_impl namespace

pull/18371/head
Karthik Ravi Shankar 6 years ago
parent 6fb62c4bae
commit e27ddbc87e
  1. 1
      BUILD
  2. 3
      CMakeLists.txt
  3. 3
      Makefile
  4. 1
      build.yaml
  5. 1
      gRPC-C++.podspec
  6. 31
      include/grpcpp/health_check_service_interface.h
  7. 55
      include/grpcpp/health_check_service_interface_impl.h
  8. 9
      include/grpcpp/server.h
  9. 2
      src/cpp/server/server_cc.cc

@ -225,6 +225,7 @@ GRPCXX_PUBLIC_HDRS = [
"include/grpcpp/generic/generic_stub.h",
"include/grpcpp/grpcpp.h",
"include/grpcpp/health_check_service_interface.h",
"include/grpcpp/health_check_service_interface_impl.h",
"include/grpcpp/impl/call.h",
"include/grpcpp/impl/channel_argument_option.h",
"include/grpcpp/impl/client_unary_call.h",

@ -3005,6 +3005,7 @@ foreach(_hdr
include/grpcpp/generic/generic_stub.h
include/grpcpp/grpcpp.h
include/grpcpp/health_check_service_interface.h
include/grpcpp/health_check_service_interface_impl.h
include/grpcpp/impl/call.h
include/grpcpp/impl/channel_argument_option.h
include/grpcpp/impl/client_unary_call.h
@ -3596,6 +3597,7 @@ foreach(_hdr
include/grpcpp/generic/generic_stub.h
include/grpcpp/grpcpp.h
include/grpcpp/health_check_service_interface.h
include/grpcpp/health_check_service_interface_impl.h
include/grpcpp/impl/call.h
include/grpcpp/impl/channel_argument_option.h
include/grpcpp/impl/client_unary_call.h
@ -4559,6 +4561,7 @@ foreach(_hdr
include/grpcpp/generic/generic_stub.h
include/grpcpp/grpcpp.h
include/grpcpp/health_check_service_interface.h
include/grpcpp/health_check_service_interface_impl.h
include/grpcpp/impl/call.h
include/grpcpp/impl/channel_argument_option.h
include/grpcpp/impl/client_unary_call.h

@ -5332,6 +5332,7 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/generic/generic_stub.h \
include/grpcpp/grpcpp.h \
include/grpcpp/health_check_service_interface.h \
include/grpcpp/health_check_service_interface_impl.h \
include/grpcpp/impl/call.h \
include/grpcpp/impl/channel_argument_option.h \
include/grpcpp/impl/client_unary_call.h \
@ -5931,6 +5932,7 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/generic/generic_stub.h \
include/grpcpp/grpcpp.h \
include/grpcpp/health_check_service_interface.h \
include/grpcpp/health_check_service_interface_impl.h \
include/grpcpp/impl/call.h \
include/grpcpp/impl/channel_argument_option.h \
include/grpcpp/impl/client_unary_call.h \
@ -6843,6 +6845,7 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/generic/generic_stub.h \
include/grpcpp/grpcpp.h \
include/grpcpp/health_check_service_interface.h \
include/grpcpp/health_check_service_interface_impl.h \
include/grpcpp/impl/call.h \
include/grpcpp/impl/channel_argument_option.h \
include/grpcpp/impl/client_unary_call.h \

@ -1350,6 +1350,7 @@ filegroups:
- include/grpcpp/generic/generic_stub.h
- include/grpcpp/grpcpp.h
- include/grpcpp/health_check_service_interface.h
- include/grpcpp/health_check_service_interface_impl.h
- include/grpcpp/impl/call.h
- include/grpcpp/impl/channel_argument_option.h
- include/grpcpp/impl/client_unary_call.h

@ -91,6 +91,7 @@ Pod::Spec.new do |s|
'include/grpcpp/generic/generic_stub.h',
'include/grpcpp/grpcpp.h',
'include/grpcpp/health_check_service_interface.h',
'include/grpcpp/health_check_service_interface_impl.h',
'include/grpcpp/impl/call.h',
'include/grpcpp/impl/channel_argument_option.h',
'include/grpcpp/impl/client_unary_call.h',

@ -1,6 +1,6 @@
/*
*
* Copyright 2016 gRPC authors.
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,39 +19,14 @@
#ifndef GRPCPP_HEALTH_CHECK_SERVICE_INTERFACE_H
#define GRPCPP_HEALTH_CHECK_SERVICE_INTERFACE_H
#include <grpcpp/support/config.h>
#include <grpcpp/health_check_service_interface_impl.h>
namespace grpc {
const char kHealthCheckServiceInterfaceArg[] =
"grpc.health_check_service_interface";
/// The gRPC server uses this interface to expose the health checking service
/// without depending on protobuf.
class HealthCheckServiceInterface {
public:
virtual ~HealthCheckServiceInterface() {}
/// Set or change the serving status of the given \a service_name.
virtual void SetServingStatus(const grpc::string& service_name,
bool serving) = 0;
/// Apply to all registered service names.
virtual void SetServingStatus(bool serving) = 0;
/// Set all registered service names to not serving and prevent future
/// state changes.
virtual void Shutdown() {}
};
/// Enable/disable the default health checking service. This applies to all C++
/// servers created afterwards. For each server, user can override the default
/// with a HealthCheckServiceServerBuilderOption.
/// NOT thread safe.
void EnableDefaultHealthCheckService(bool enable);
/// Returns whether the default health checking service is enabled.
/// NOT thread safe.
bool DefaultHealthCheckServiceEnabled();
typedef ::grpc_impl::HealthCheckServiceInterface HealthCheckServiceInterface;
} // namespace grpc

@ -0,0 +1,55 @@
/*
*
* Copyright 2016 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPCPP_HEALTH_CHECK_SERVICE_INTERFACE_IMPL_H
#define GRPCPP_HEALTH_CHECK_SERVICE_INTERFACE_IMPL_H
#include <grpcpp/support/config.h>
namespace grpc_impl {
/// The gRPC server uses this interface to expose the health checking service
/// without depending on protobuf.
class HealthCheckServiceInterface {
public:
virtual ~HealthCheckServiceInterface() {}
/// Set or change the serving status of the given \a service_name.
virtual void SetServingStatus(const grpc::string& service_name,
bool serving) = 0;
/// Apply to all registered service names.
virtual void SetServingStatus(bool serving) = 0;
/// Set all registered service names to not serving and prevent future
/// state changes.
virtual void Shutdown() {}
};
/// Enable/disable the default health checking service. This applies to all C++
/// servers created afterwards. For each server, user can override the default
/// with a HealthCheckServiceServerBuilderOption.
/// NOT thread safe.
void EnableDefaultHealthCheckService(bool enable);
/// Returns whether the default health checking service is enabled.
/// NOT thread safe.
bool DefaultHealthCheckServiceEnabled();
} // namespace grpc_impl
#endif // GRPCPP_HEALTH_CHECK_SERVICE_INTERFACE_IMPL_H

@ -40,10 +40,13 @@
struct grpc_server;
namespace grpc_impl {
class HealthCheckServiceInterface;
}
namespace grpc {
class AsyncGenericService;
class HealthCheckServiceInterface;
class ServerContext;
class ServerInitializer;
@ -94,7 +97,7 @@ class Server : public ServerInterface, private GrpcLibraryCodegen {
grpc_server* c_server();
/// Returns the health check service.
HealthCheckServiceInterface* GetHealthCheckService() const {
grpc_impl::HealthCheckServiceInterface* GetHealthCheckService() const {
return health_check_service_.get();
}
@ -323,7 +326,7 @@ class Server : public ServerInterface, private GrpcLibraryCodegen {
std::unique_ptr<ServerInitializer> server_initializer_;
std::unique_ptr<HealthCheckServiceInterface> health_check_service_;
std::unique_ptr<grpc_impl::HealthCheckServiceInterface> health_check_service_;
bool health_check_service_disabled_;
// When appropriate, use a default callback generic service to handle

@ -987,7 +987,7 @@ void Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) {
DefaultHealthCheckService::HealthCheckServiceImpl*
default_health_check_service_impl = nullptr;
if (health_check_service_ == nullptr && !health_check_service_disabled_ &&
DefaultHealthCheckServiceEnabled()) {
grpc_impl::DefaultHealthCheckServiceEnabled()) {
auto* default_hc_service = new DefaultHealthCheckService;
health_check_service_.reset(default_hc_service);
// We create a non-polling CQ to avoid impacting application

Loading…
Cancel
Save