|
Entropic 2.11.1
Local-first agentic inference engine
|
Monitors external server connections and handles reconnection. More...
#include <entropic/mcp/health_monitor.h>
Public Types | |
| using | StatusCallback = std::function< void(const HealthEvent &)> |
| Callback invoked on engine thread when processing events. | |
Public Member Functions | |
| HealthMonitor (ReconnectPolicy policy, uint32_t health_check_interval_ms=0) | |
| Construct with reconnection policy. | |
| ~HealthMonitor () | |
| Destructor — stops monitor if running. | |
| void | watch (const std::string &name, ExternalMCPClient *client) |
| Start monitoring a server. | |
| void | unwatch (const std::string &name) |
| Stop monitoring a server. | |
| void | set_status_callback (StatusCallback cb) |
| Set callback for status change events. | |
| void | start () |
| Start the monitoring thread. | |
| void | stop () |
| Stop monitoring and all reconnection attempts. | |
| void | process_events () |
| Drain event queue, invoke callbacks (call on engine thread). | |
Monitors external server connections and handles reconnection.
The monitor thread checks connection state periodically and attempts reconnection using ReconnectPolicy. Events are queued for the engine thread to process (no direct cross-thread mutation).
Definition at line 55 of file health_monitor.h.
| using entropic::HealthMonitor::StatusCallback = std::function<void(const HealthEvent&)> |
Callback invoked on engine thread when processing events.
Definition at line 61 of file health_monitor.h.
| entropic::HealthMonitor::HealthMonitor | ( | ReconnectPolicy | policy, |
| uint32_t | health_check_interval_ms = 0 |
||
| ) |
Construct with reconnection policy.
| policy | Backoff policy for reconnection attempts. |
| health_check_interval_ms | Ping interval (0 = disabled). |
| policy | Backoff policy. |
| health_check_interval_ms | Ping interval (0 = disabled). @dg_internal |
Definition at line 22 of file health_monitor.cpp.
| entropic::HealthMonitor::~HealthMonitor | ( | ) |
Destructor — stops monitor if running.
@dg_internal
Definition at line 33 of file health_monitor.cpp.
| 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.
@req REQ-MCP-025
Definition at line 124 of file health_monitor.cpp.
| void entropic::HealthMonitor::set_status_callback | ( | StatusCallback | cb | ) |
Set callback for status change events.
| cb | Callback invoked by process_events(). |
| cb | Callback. @dg_internal |
Definition at line 78 of file health_monitor.cpp.
| void entropic::HealthMonitor::start | ( | ) |
Start the monitoring thread.
@dg_internal
Definition at line 87 of file health_monitor.cpp.
| void entropic::HealthMonitor::stop | ( | ) |
Stop monitoring and all reconnection attempts.
@dg_internal
Definition at line 102 of file health_monitor.cpp.
| void entropic::HealthMonitor::unwatch | ( | const std::string & | name | ) |
Stop monitoring a server.
| name | Server name. |
| name | Server name. @dg_internal |
Definition at line 66 of file health_monitor.cpp.
| void entropic::HealthMonitor::watch | ( | const std::string & | name, |
| ExternalMCPClient * | client | ||
| ) |
Start monitoring a server.
| name | Server name. |
| client | Non-owning pointer to ExternalMCPClient. |
| name | Server name. |
| client | Non-owning pointer. @dg_internal |
Definition at line 44 of file health_monitor.cpp.