test_health_check_service_impl.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2018 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 #ifndef GRPC_TEST_CPP_END2END_TEST_HEALTH_CHECK_SERVICE_IMPL_H
19 #define GRPC_TEST_CPP_END2END_TEST_HEALTH_CHECK_SERVICE_IMPL_H
20 
21 #include <map>
22 #include <mutex>
23 
24 #include <grpcpp/server_context.h>
25 #include <grpcpp/support/status.h>
26 
27 #include "src/proto/grpc/health/v1/health.grpc.pb.h"
28 
29 namespace grpc {
30 namespace testing {
31 
32 // A sample sync implementation of the health checking service. This does the
33 // same thing as the default one.
34 class HealthCheckServiceImpl : public health::v1::Health::Service {
35  public:
37  const health::v1::HealthCheckRequest* request,
38  health::v1::HealthCheckResponse* response) override;
40  const health::v1::HealthCheckRequest* request,
42  void SetStatus(const std::string& service_name,
43  health::v1::HealthCheckResponse::ServingStatus status);
44  void SetAll(health::v1::HealthCheckResponse::ServingStatus status);
45 
46  void Shutdown();
47 
48  private:
50  bool shutdown_ = false;
51  std::map<const std::string, health::v1::HealthCheckResponse::ServingStatus>
53 };
54 
55 } // namespace testing
56 } // namespace grpc
57 
58 #endif // GRPC_TEST_CPP_END2END_TEST_HEALTH_CHECK_SERVICE_IMPL_H
testing
Definition: aws_request_signer_test.cc:25
grpc::status
auto status
Definition: cpp/client/credentials_test.cc:200
grpc::ServerWriter
Definition: include/grpcpp/impl/codegen/completion_queue.h:60
grpc::ServerContext
Definition: grpcpp/impl/codegen/server_context.h:566
grpc
Definition: grpcpp/alarm.h:33
mutex
static uv_mutex_t mutex
Definition: threadpool.c:34
benchmark.request
request
Definition: benchmark.py:77
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc::testing::HealthCheckServiceImpl::status_map_
std::map< const std::string, health::v1::HealthCheckResponse::ServingStatus > status_map_
Definition: test_health_check_service_impl.h:52
grpc::testing::HealthCheckServiceImpl::shutdown_
bool shutdown_
Definition: test_health_check_service_impl.h:50
grpc::testing::HealthCheckServiceImpl::SetAll
void SetAll(health::v1::HealthCheckResponse::ServingStatus status)
Definition: test_health_check_service_impl.cc:76
grpc::testing::HealthCheckServiceImpl::Shutdown
void Shutdown()
Definition: test_health_check_service_impl.cc:86
writer
void writer(void *n)
Definition: libuv/docs/code/locks/main.c:22
grpc::testing::HealthCheckServiceImpl::Watch
Status Watch(ServerContext *context, const health::v1::HealthCheckRequest *request, ServerWriter< health::v1::HealthCheckResponse > *writer) override
Definition: test_health_check_service_impl.cc:41
server_context.h
asyncio_get_stats.response
response
Definition: asyncio_get_stats.py:28
grpc::testing::HealthCheckServiceImpl::SetStatus
void SetStatus(const std::string &service_name, health::v1::HealthCheckResponse::ServingStatus status)
Definition: test_health_check_service_impl.cc:66
grpc::Status
Definition: include/grpcpp/impl/codegen/status.h:35
context
grpc::ClientContext context
Definition: istio_echo_server_lib.cc:61
grpc::testing::HealthCheckServiceImpl
Definition: test_health_check_service_impl.h:34
grpc::testing::HealthCheckServiceImpl::Check
Status Check(ServerContext *context, const health::v1::HealthCheckRequest *request, health::v1::HealthCheckResponse *response) override
Definition: test_health_check_service_impl.cc:29
grpc::testing::HealthCheckServiceImpl::mu_
std::mutex mu_
Definition: test_health_check_service_impl.h:49
status.h


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:28