pub struct StatusMonitor { /* private fields */ }Expand description
High-level bridge between SelfDiagnosisEngine and the FleetManager backend.
Implementations§
Source§impl StatusMonitor
impl StatusMonitor
Sourcepub fn new(
config_path: Option<&str>,
diagnosis: Option<Arc<SelfDiagnosisEngine>>,
software_name: &str,
version: Option<&str>,
shutdown: Option<ShutdownHandler>,
status_engine: Option<Arc<StatusEngine>>,
group: Option<String>,
group_priority: Option<i64>,
sort_priority: Option<i64>,
) -> Self
pub fn new( config_path: Option<&str>, diagnosis: Option<Arc<SelfDiagnosisEngine>>, software_name: &str, version: Option<&str>, shutdown: Option<ShutdownHandler>, status_engine: Option<Arc<StatusEngine>>, group: Option<String>, group_priority: Option<i64>, sort_priority: Option<i64>, ) -> Self
Create a new StatusMonitor.
Sourcepub fn register_command(&self, spec: CommandSpec)
pub fn register_command(&self, spec: CommandSpec)
Register a command the FleetManager can invoke. Replaces an earlier one with the same id; the catalog is re-sent with the next snapshot.
Sourcepub fn command_catalog(&self) -> Vec<Value>
pub fn command_catalog(&self) -> Vec<Value>
Catalog of registered commands as advertised in the status snapshot.
Sourcepub fn set_licence(&self, report: Option<Value>)
pub fn set_licence(&self, report: Option<Value>)
Licence report sent in every heartbeat (field licence); None omits it.
Sourcepub fn set_hardware(&self, report: Option<Value>)
pub fn set_hardware(&self, report: Option<Value>)
Hardware report sent in every heartbeat (field hardware); None omits it.
Sourcepub fn set_build_channel(&self, channel: Option<String>) -> Result<(), String>
pub fn set_build_channel(&self, channel: Option<String>) -> Result<(), String>
Release channel this build was delivered with (see the client).
Sourcepub fn channel(&self) -> Option<(String, ChannelSource)>
pub fn channel(&self) -> Option<(String, ChannelSource)>
Release channel with its source, see the client.
Sourcepub fn start(&self)
pub fn start(&self)
Mark the client as started. Prefer run_fleet_loops which also drives
the heartbeat and controller loops; this only flips the lifecycle flag.
Sourcepub fn set_branding(&self, branding: Option<String>)
pub fn set_branding(&self, branding: Option<String>)
Brand this software runs under (e.g. “uttec”), sent in every heartbeat.
Sourcepub fn set_controller_timing_for_testing(
&self,
initial_delay: Duration,
period: Duration,
)
pub fn set_controller_timing_for_testing( &self, initial_delay: Duration, period: Duration, )
Override the controller-loop timings. For tests only — lets a conformance test observe diagnostics/status without waiting 10s + 60s.
Sourcepub fn map_diagnosis(&self) -> Vec<(u16, String, u8)>
pub fn map_diagnosis(&self) -> Vec<(u16, String, u8)>
Map diagnosis messages to fleet-compatible tuples.
Sourcepub async fn run(self: Arc<Self>, shutdown: ShutdownHandler)
pub async fn run(self: Arc<Self>, shutdown: ShutdownHandler)
Run the heartbeat + controller loops until shutdown fires.
Drives everything the Python reference does in its background threads:
initial running status, periodic heartbeats, periodic diagnostics +
status/snapshot, connection-state diagnosis (7002), config retry, and a
final stopped status on exit.
Sourcepub async fn run_supervised(
self: Arc<Self>,
shutdown: ShutdownHandler,
watchdog: Option<(Arc<HeartbeatEngine>, String)>,
)
pub async fn run_supervised( self: Arc<Self>, shutdown: ShutdownHandler, watchdog: Option<(Arc<HeartbeatEngine>, String)>, )
Like run, but reports to a HeartbeatEngine on every
heartbeat cycle.
Consumers whose architecture requires every long-running thread to be
watchdog-supervised need this: a wedged fleet thread is otherwise silent,
and silence is exactly what it is supposed to prevent. Registers with a
timeout of 4 × the heartbeat interval — a missed beat then means
“wedged”, not “the fleet server is slow” (send failures are reported via
diagnosis code 7002, not by withholding the beat).