brinkhaustools

Struct StatusMonitor

Source
pub struct StatusMonitor { /* private fields */ }
Expand description

High-level bridge between SelfDiagnosisEngine and the FleetManager backend.

Implementations§

Source§

impl StatusMonitor

Source

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.

Source

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.

Source

pub fn command_catalog(&self) -> Vec<Value>

Catalog of registered commands as advertised in the status snapshot.

Source

pub fn set_licence(&self, report: Option<Value>)

Licence report sent in every heartbeat (field licence); None omits it.

Source

pub fn set_hardware(&self, report: Option<Value>)

Hardware report sent in every heartbeat (field hardware); None omits it.

Source

pub fn set_build_channel(&self, channel: Option<String>) -> Result<(), String>

Release channel this build was delivered with (see the client).

Source

pub fn channel(&self) -> Option<(String, ChannelSource)>

Release channel with its source, see the client.

Source

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.

Source

pub fn stop(&self)

Stop the client (signals the background loops to exit).

Source

pub fn set_branding(&self, branding: Option<String>)

Brand this software runs under (e.g. “uttec”), sent in every heartbeat.

Source

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.

Source

pub fn map_diagnosis(&self) -> Vec<(u16, String, u8)>

Map diagnosis messages to fleet-compatible tuples.

Source

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.

Source

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).

Trait Implementations§

Source§

impl StatusSource for StatusMonitor

Source§

fn get_status(&self) -> Value

Return current status as JSON.
Source§

fn get_name(&self) -> &str

Human-readable name for this source.
Source§

fn refresh_interval(&self) -> Duration

How often this source should be polled.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more