Skip to main content

CuMonitor

Trait CuMonitor 

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

    // Provided methods
    fn start(&mut self, _ctx: &CuContext) -> CuResult<()> { ... }
    fn observe_copperlist_io(&self, _stats: CopperListIoStats) { ... }
    fn process_panic(&self, _panic_message: &str) { ... }
    fn stop(&mut self, _ctx: &CuContext) -> CuResult<()> { ... }
}
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, ) -> CuResult<Self>
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<'_>, ) -> CuResult<()>

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) -> CuResult<()>

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) -> CuResult<()>

Called once during runtime shutdown.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

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

Source§

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

Source§

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

Source§

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

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) -> CuResult<()>

Source§

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

Source§

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

Source§

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

Source§

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

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) -> CuResult<()>

Source§

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

Source§

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

Source§

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

Source§

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

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) -> CuResult<()>

Source§

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

Source§

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

Source§

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

Source§

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

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) -> CuResult<()>

Source§

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

Source§

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

Source§

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

Source§

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

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) -> CuResult<()>

Implementors§