| #pragma once | |
| #include <string> | |
| #include "boottime.grpc.pb.h" | |
| #include "absl/status/status.h" | |
| #include "boottime_api/boottime_api.h" | |
| #include "boottime_api/node_config.h" | |
| #include "grpcpp/server_context.h" | |
| #include "grpcpp/support/server_callback.h" | |
| #include "grpcpp/support/status.h" | |
| namespace blobs { | |
| class BootTimeServiceImpl final | |
| : public phosphor::boottime::grpc_gen::BootTimeService::CallbackService { | |
| public: | |
| explicit BootTimeServiceImpl(int instance); | |
| explicit BootTimeServiceImpl(int instance, const std::string& basePath); | |
| grpc::ServerUnaryReactor* SetCheckpoint( | |
| [[maybe_unused]] grpc::CallbackServerContext* context, | |
| const phosphor::boottime::SetCheckpointRequest* request, | |
| [[maybe_unused]] phosphor::boottime::SetCheckpointResponse* response) | |
| override; | |
| grpc::ServerUnaryReactor* RebootComplete( | |
| [[maybe_unused]] grpc::CallbackServerContext* context, | |
| [[maybe_unused]] const phosphor::boottime::RebootCompleteRequest* request, | |
| [[maybe_unused]] phosphor::boottime::RebootCompleteResponse* response) | |
| override; | |
| grpc::ServerUnaryReactor* SetDuration( | |
| [[maybe_unused]] grpc::CallbackServerContext* context, | |
| const phosphor::boottime::SetDurationRequest* request, | |
| [[maybe_unused]] phosphor::boottime::SetDurationResponse* response) | |
| override; | |
| grpc::ServerUnaryReactor* GetBootTime( | |
| [[maybe_unused]] grpc::CallbackServerContext* context, | |
| [[maybe_unused]] const phosphor::boottime::GetBootTimeRequest* request, | |
| phosphor::boottime::GetBootTimeResponse* response) override; | |
| private: | |
| // Register the node to BoottimeApi. | |
| absl::Status RegisterSelfToApi(); | |
| // Converts absl::Status to grpc::Status. | |
| // This is needed because BMC do not support implicit conversions. | |
| static grpc::Status ToGrpcStatus(absl::Status s); | |
| // 0-indexed to match D-bus convention | |
| int instance_number_; | |
| std::string base_path_; | |
| boot_time_monitor::NodeConfig node_config_; | |
| boot_time_monitor::api::BoottimeApi boottime_api_; | |
| }; | |
| } // namespace blobs |