Skip to main content

CuMonitor

Trait CuMonitor 

Source
pub trait CuMonitor: Sized {
    // Required methods
    fn new(
        metadata: CuMonitoringMetadata,
        runtime: CuMonitoringRuntime,
    ) -> Result<Self, CuError>
       where Self: Sized;
    fn process_copperlist(
        &self,
        _ctx: &CuContext,
        view: CopperListView<'_>,
    ) -> Result<(), CuError>;
    fn process_error(
        &self,
        component_id: ComponentId,
        step: CuComponentState,
        error: &CuError,
    ) -> Decision;

    // Provided methods
    fn start(&mut self, _ctx: &CuContext) -> Result<(), CuError> { ... }
    fn observe_copperlist_io(&self, _stats: CopperListIoStats) { ... }
    fn process_panic(&self, _panic_message: &str) { ... }
    fn stop(&mut self, _ctx: &CuContext) -> Result<(), CuError> { ... }
}
Expand description

Runtime monitoring contract implemented by monitor components.

Lifecycle:

  1. CuMonitor::new is called once at runtime construction time.
  2. CuMonitor::start is called once before the first runtime iteration.
  3. For each iteration, CuMonitor::process_copperlist is called after component execution, then CuMonitor::observe_copperlist_io after serialization accounting.
  4. CuMonitor::process_error is called synchronously when a monitored component step fails.
  5. CuMonitor::process_panic is called when the runtime catches a panic (std builds).
  6. CuMonitor::stop is called once during runtime shutdown.

Indexing model:

  • process_error(component_id, ..) uses component indices into metadata.components().
  • process_copperlist(..., view) iterates CopperList slots with resolved component identity.

Error policy:

Required Methods§

Source

fn new( metadata: CuMonitoringMetadata, runtime: CuMonitoringRuntime, ) -> Result<Self, CuError>
where Self: Sized,

Construct the monitor once, before component execution starts.

metadata contains mission/config/topology/static mapping information. runtime exposes dynamic runtime handles (for example execution probes). Use metadata.monitor_config() to decode monitor-specific parameters.

Source

fn process_copperlist( &self, _ctx: &CuContext, view: CopperListView<'_>, ) -> Result<(), CuError>

Called once per processed CopperList after component execution.

Source

fn process_error( &self, component_id: ComponentId, step: CuComponentState, error: &CuError, ) -> Decision

Called when a monitored component step fails; must return an immediate runtime decision.

component_id is an index into CuMonitoringMetadata::components.

Provided Methods§

Source

fn start(&mut self, _ctx: &CuContext) -> Result<(), CuError>

Called once before processing the first CopperList.

Source

fn observe_copperlist_io(&self, _stats: CopperListIoStats)

Called when runtime finishes CopperList serialization/IO accounting.

Source

fn process_panic(&self, _panic_message: &str)

Called when the runtime catches a panic (std builds).

Source

fn stop(&mut self, _ctx: &CuContext) -> Result<(), CuError>

Called once during runtime shutdown.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<M0, M1> CuMonitor for (M0, M1)
where M0: CuMonitor, M1: CuMonitor,

Source§

fn new( metadata: CuMonitoringMetadata, runtime: CuMonitoringRuntime, ) -> Result<(M0, M1), CuError>
where (M0, M1): Sized,

Source§

fn start(&mut self, ctx: &CuContext) -> Result<(), CuError>

Source§

fn process_copperlist( &self, ctx: &CuContext, view: CopperListView<'_>, ) -> Result<(), CuError>

Source§

fn observe_copperlist_io(&self, stats: CopperListIoStats)

Source§

fn process_error( &self, component_id: ComponentId, step: CuComponentState, error: &CuError, ) -> Decision

Source§

fn process_panic(&self, panic_message: &str)

Source§

fn stop(&mut self, ctx: &CuContext) -> Result<(), CuError>

Source§

impl<M0, M1, M2> CuMonitor for (M0, M1, M2)
where M0: CuMonitor, M1: CuMonitor, M2: CuMonitor,

Source§

fn new( metadata: CuMonitoringMetadata, runtime: CuMonitoringRuntime, ) -> Result<(M0, M1, M2), CuError>

Source§

fn start(&mut self, ctx: &CuContext) -> Result<(), CuError>

Source§

fn process_copperlist( &self, ctx: &CuContext, view: CopperListView<'_>, ) -> Result<(), CuError>

Source§

fn observe_copperlist_io(&self, stats: CopperListIoStats)

Source§

fn process_error( &self, component_id: ComponentId, step: CuComponentState, error: &CuError, ) -> Decision

Source§

fn process_panic(&self, panic_message: &str)

Source§

fn stop(&mut self, ctx: &CuContext) -> Result<(), CuError>

Source§

impl<M0, M1, M2, M3> CuMonitor for (M0, M1, M2, M3)
where M0: CuMonitor, M1: CuMonitor, M2: CuMonitor, M3: CuMonitor,

Source§

impl<M0, M1, M2, M3, M4> CuMonitor for (M0, M1, M2, M3, M4)
where M0: CuMonitor, M1: CuMonitor, M2: CuMonitor, M3: CuMonitor, M4: CuMonitor,

Source§

impl<M0, M1, M2, M3, M4, M5> CuMonitor for (M0, M1, M2, M3, M4, M5)
where M0: CuMonitor, M1: CuMonitor, M2: CuMonitor, M3: CuMonitor, M4: CuMonitor, M5: CuMonitor,

Implementors§