Mads
Multi-Agent Distributed System
Loading...
Searching...
No Matches
Mads::Doctor Namespace Reference

Classes

struct  CheckResult
 
struct  PluginLoadFacts
 

Typedefs

using CurveKeyCheck = Mads::ProbeCurveKeys
 

Enumerations

enum class  Status { Pass , Warn , Fail }
 

Functions

CheckResult check_settings_file (const std::filesystem::path &path)
 Checks that path is a local settings file that exists and parses as valid TOML. A tcp://... URI is treated as "remote broker, not a local file" and reported Pass with an explanatory note (broker reachability is check 2's job, not this one's).
 
CheckResult evaluate_broker_reachable (const std::string &uri, bool reachable, bool crypto=false)
 
CheckResult check_broker_reachable (const std::string &uri, std::chrono::milliseconds timeout, const std::optional< CurveKeyCheck > &curve=std::nullopt)
 
CheckResult evaluate_plugin_load (const PluginLoadFacts &facts)
 
std::optional< int > parse_pinned_plugin_protocol (const std::string &manifest_json_text)
 Reads the plugin_protocol field out of share/plugin_deps.json's text content (already read by the caller – doctor.cpp reuses Mads::PluginMigrate::read_file() for that, the same helper src/main/plugin_migrate.hpp's own migration engine uses to load the same file). Kept as a pure string->int function so it needs no filesystem access to unit test.
 
CheckResult evaluate_plugin_protocol (int loaded_version, std::optional< int > pinned_version, int min_supported=kMinSupportedPluginProtocol)
 
bool is_well_formed_curve_key (const std::string &key_line)
 
CheckResult check_curve_keys (const CurveKeyCheck &cfg)
 Checks that a client's CURVE key files exist and are well-formed: <client>.key (secret), <client>.pub (public), and <server>.pub (the broker's public key the client needs to encrypt toward it) – exactly the three files Mads::CurveAuth::setup_curve_client(socket, client, server) (src/curve.hpp) reads.
 
CheckResult evaluate_port_available (const std::string &host, int port, bool in_use)
 
CheckResult check_port_available (const std::string &host, int port, std::chrono::milliseconds timeout)
 
CheckResult evaluate_curve_handshake (const std::string &uri, CurveProbeResult result)
 
CheckResult check_curve_handshake (const std::string &uri, const CurveKeyCheck &cfg, std::chrono::milliseconds timeout)
 
CheckResult evaluate_fd_limit (bool supported, uint64_t soft, uint64_t hard, std::optional< int64_t > configured)
 
CheckResult check_fd_limit (std::optional< int64_t > configured)
 

Variables

constexpr int kMinSupportedPluginProtocol = 7
 

Typedef Documentation

◆ CurveKeyCheck

Mirrors AgentAppT::CryptoOptions (src/agent_app.hpp): the same key_dir/client/server naming convention every mads-* executable's –crypto/–keys_dir/–key_client/–key_broker flags configure. Declared up here rather than beside check 5, because checks 2 and 5 and 7 all need it: probing a CURVE-secured broker in the clear cannot tell it apart from a broker that is down (see Mads::ProbeCurveKeys).

Definition at line 66 of file doctor_checks.hpp.

Enumeration Type Documentation

◆ Status

enum class Mads::Doctor::Status
strong

Outcome of a single check, mirroring the three-state model of ros2 doctor/brew doctor: Pass (nothing to do), Warn (works but worth a look), Fail (needs fixing before things will work).

Enumerator
Pass 
Warn 
Fail 

Definition at line 46 of file doctor_checks.hpp.

Function Documentation

◆ check_broker_reachable()

CheckResult Mads::Doctor::check_broker_reachable ( const std::string &  uri,
std::chrono::milliseconds  timeout,
const std::optional< CurveKeyCheck > &  curve = std::nullopt 
)

◆ check_curve_handshake()

CheckResult Mads::Doctor::check_curve_handshake ( const std::string &  uri,
const CurveKeyCheck cfg,
std::chrono::milliseconds  timeout 
)

◆ check_curve_keys()

CheckResult Mads::Doctor::check_curve_keys ( const CurveKeyCheck cfg)

Checks that a client's CURVE key files exist and are well-formed: <client>.key (secret), <client>.pub (public), and <server>.pub (the broker's public key the client needs to encrypt toward it) – exactly the three files Mads::CurveAuth::setup_curve_client(socket, client, server) (src/curve.hpp) reads.

◆ check_fd_limit()

CheckResult Mads::Doctor::check_fd_limit ( std::optional< int64_t >  configured)

◆ check_port_available()

CheckResult Mads::Doctor::check_port_available ( const std::string &  host,
int  port,
std::chrono::milliseconds  timeout 
)

◆ check_settings_file()

CheckResult Mads::Doctor::check_settings_file ( const std::filesystem::path &  path)

Checks that path is a local settings file that exists and parses as valid TOML. A tcp://... URI is treated as "remote broker, not a local file" and reported Pass with an explanatory note (broker reachability is check 2's job, not this one's).

◆ evaluate_broker_reachable()

CheckResult Mads::Doctor::evaluate_broker_reachable ( const std::string &  uri,
bool  reachable,
bool  crypto = false 
)

◆ evaluate_curve_handshake()

CheckResult Mads::Doctor::evaluate_curve_handshake ( const std::string &  uri,
CurveProbeResult  result 
)

◆ evaluate_fd_limit()

CheckResult Mads::Doctor::evaluate_fd_limit ( bool  supported,
uint64_t  soft,
uint64_t  hard,
std::optional< int64_t >  configured 
)

◆ evaluate_plugin_load()

CheckResult Mads::Doctor::evaluate_plugin_load ( const PluginLoadFacts facts)

◆ evaluate_plugin_protocol()

CheckResult Mads::Doctor::evaluate_plugin_protocol ( int  loaded_version,
std::optional< int >  pinned_version,
int  min_supported = kMinSupportedPluginProtocol 
)

◆ evaluate_port_available()

CheckResult Mads::Doctor::evaluate_port_available ( const std::string &  host,
int  port,
bool  in_use 
)

◆ is_well_formed_curve_key()

bool Mads::Doctor::is_well_formed_curve_key ( const std::string &  key_line)

True if key_line (one file line, already trimmed of trailing CR/LF/whitespace) is a well-formed Z85-encoded CURVE key: exactly 40 characters that libzmq's zmq_z85_decode() accepts.

◆ parse_pinned_plugin_protocol()

std::optional< int > Mads::Doctor::parse_pinned_plugin_protocol ( const std::string &  manifest_json_text)

Reads the plugin_protocol field out of share/plugin_deps.json's text content (already read by the caller – doctor.cpp reuses Mads::PluginMigrate::read_file() for that, the same helper src/main/plugin_migrate.hpp's own migration engine uses to load the same file). Kept as a pure string->int function so it needs no filesystem access to unit test.

Variable Documentation

◆ kMinSupportedPluginProtocol

constexpr int Mads::Doctor::kMinSupportedPluginProtocol = 7
constexpr

Mirrors MADS_PLUGIN_MIN_PROTOCOL in src/main/plugin_loader.cpp: the oldest plugin protocol the loaders are meant to accept. In practice a successful dry-run load (check 3) already implies at least this, since pugg::Kernel::add_server<T>() gates driver registration on the current pinned protocol (see doctor.cpp); kept here for a defensive, explicit floor rather than relying on that gate alone.

Definition at line 119 of file doctor_checks.hpp.