include/entropic/mcp/health_monitor.h¶
include/entropic/mcp/health_monitor.h
entropic::HealthEvent
Status change event posted by the monitor thread.
std::string entropic::HealthEvent::server_name
Which server changed.
std::string entropic::HealthEvent::old_status
Previous status.
std::string entropic::HealthEvent::new_status
New status.
std::vector<std::string> entropic::HealthEvent::added_tools
Tools added on refresh.
std::vector<std::string> entropic::HealthEvent::removed_tools
Tools removed on refresh.
entropic::HealthMonitor
Monitors external server connections and handles reconnection.
using entropic::HealthMonitor::StatusCallback = std::function<void(const HealthEvent&)>
Callback invoked on engine thread when processing events.
entropic::HealthMonitor::HealthMonitor(ReconnectPolicy policy, uint32_t health_check_interval_ms=0)
Construct with reconnection policy.
- Parameters
policy— Backoff policy for reconnection attempts.health_check_interval_ms— Ping interval (0 = disabled).policy— Backoff policy.
entropic::HealthMonitor::~HealthMonitor()
Destructor — stops monitor if running.
void entropic::HealthMonitor::watch(const std::string &name, ExternalMCPClient *client)
Start monitoring a server.
- Parameters
name— Server name.client— Non-owning pointer to ExternalMCPClient.client— Non-owning pointer.
void entropic::HealthMonitor::unwatch(const std::string &name)
Stop monitoring a server.
- Parameters
name— Server name.
void entropic::HealthMonitor::set_status_callback(StatusCallback cb)
Set callback for status change events.
- Parameters
cb— Callback invoked by process_events().cb— Callback.
void entropic::HealthMonitor::start()
Start the monitoring thread.
void entropic::HealthMonitor::stop()
Stop monitoring and all reconnection attempts.
void entropic::HealthMonitor::process_events()
Drain event queue, invoke callbacks (call on engine thread).
Drain event queue, invoke callbacks on engine thread. The monitor thread only ever ENQUEUES; callbacks fire here, on the engine thread, so engine state is never mutated cross-thread. The queue is swapped out under the lock so a callback cannot deadlock against a concurrent post_event.
entropic::HealthMonitor::WatchEntry
ExternalMCPClient* entropic::HealthMonitor::WatchEntry::client
Non-owning.
std::string entropic::HealthMonitor::WatchEntry::status
Current status.
uint32_t entropic::HealthMonitor::WatchEntry::reconnect_attempt
Attempt counter.
std::chrono::steady_clock::time_point entropic::HealthMonitor::WatchEntry::next_action
Next check/reconnect time.