83 std::chrono::seconds heartbeat_interval = std::chrono::seconds(30),
84 size_t max_missed_heartbeats = 3);
98 auto start_monitoring(std::shared_ptr<core::messaging_client> client) -> void;
147 auto update_health(
bool success, std::chrono::milliseconds response_time) -> void;
150 std::shared_ptr<core::messaging_client>
client_;
153 std::unique_ptr<asio::executor_work_guard<asio::io_context::executor_type>>
Monitors connection health with heartbeat mechanism.
auto set_health_callback(std::function< void(const connection_health &)> callback) -> void
Sets callback for health status changes.
std::unique_ptr< asio::steady_timer > heartbeat_timer_
std::atomic< bool > is_monitoring_
auto schedule_next_heartbeat() -> void
Schedules the next heartbeat.
auto do_heartbeat() -> void
Performs a single heartbeat check.
std::shared_ptr< core::messaging_client > client_
auto start_monitoring(std::shared_ptr< core::messaging_client > client) -> void
Starts monitoring the given client.
auto update_health(bool success, std::chrono::milliseconds response_time) -> void
Updates health metrics.
std::function< void(const connection_health &)> health_callback_
~health_monitor() noexcept
Destructor - stops monitoring if active.
connection_health health_
std::atomic< size_t > total_heartbeats_
std::atomic< size_t > failed_heartbeats_
std::future< void > io_future_
auto get_health() const -> connection_health
Gets current health status.
auto stop_monitoring() -> void
Stops monitoring.
size_t max_missed_heartbeats_
auto is_monitoring() const noexcept -> bool
Checks if monitoring is active.
std::unique_ptr< asio::executor_work_guard< asio::io_context::executor_type > > work_guard_
std::chrono::seconds heartbeat_interval_
std::unique_ptr< asio::io_context > io_context_
health_monitor(std::chrono::seconds heartbeat_interval=std::chrono::seconds(30), size_t max_missed_heartbeats=3)
Constructs a health monitor.
TCP client implementation.
Utility components for network_system.
Contains connection health metrics.
std::chrono::steady_clock::time_point last_heartbeat
std::chrono::milliseconds last_response_time