UniSet 2.44.3
HealthChecker.h
1/*
2 * Copyright (c) 2026 Pavel Vainerman.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as
6 * published by the Free Software Foundation, version 2.1.
7 */
8// -------------------------------------------------------------------------
9#ifndef HealthChecker_H_
10#define HealthChecker_H_
11// -------------------------------------------------------------------------
12#include <memory>
13#include <string>
14#include <Poco/Process.h>
15#include "ProcessInfo.h"
16#include "Configuration.h"
17#include "UInterface.h"
18// -------------------------------------------------------------------------
19namespace uniset
20{
25 class HealthChecker
26 {
27 public:
28 explicit HealthChecker(std::shared_ptr<Configuration> conf = nullptr);
29
37 bool waitForReady(const ReadyCheck& check, size_t timeout_msec);
38
43 bool checkOnce(const ReadyCheck& check);
44
50 static bool isProcessAlive(Poco::Process::PID pid);
51
55 static ReadyCheck parseReadyCheck(const std::string& checkStr);
56
57 private:
58 bool checkTCP(const std::string& hostPort, size_t timeout_msec);
59 bool checkCORBA(const std::string& objectName, size_t timeout_msec, size_t pause_msec);
60 bool checkHTTP(const std::string& url, size_t timeout_msec);
61 bool checkFile(const std::string& path);
62
63 std::shared_ptr<Configuration> conf_;
64 std::shared_ptr<UInterface> ui_;
65 };
66
67} // end of namespace uniset
68// -------------------------------------------------------------------------
69#endif // HealthChecker_H_
70// -------------------------------------------------------------------------
static bool isProcessAlive(Poco::Process::PID pid)
Определения HealthChecker.cc:81
bool checkOnce(const ReadyCheck &check)
Определения HealthChecker.cc:56
static ReadyCheck parseReadyCheck(const std::string &checkStr)
Определения HealthChecker.cc:89
bool waitForReady(const ReadyCheck &check, size_t timeout_msec)
Определения HealthChecker.cc:32
Определения Calibration.h:27
Определения ProcessInfo.h:51