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:
CuMonitor::newis called once at runtime construction time.CuMonitor::startis called once before the first runtime iteration.- For each iteration,
CuMonitor::process_copperlistis called after component execution, thenCuMonitor::observe_copperlist_ioafter serialization accounting. CuMonitor::process_erroris called synchronously when a monitored component step fails.CuMonitor::process_panicis called when the runtime catches a panic (stdbuilds).CuMonitor::stopis called once during runtime shutdown.
Indexing model:
process_error(component_id, ..)uses component indices intometadata.components().process_copperlist(..., view)iterates CopperList slots with resolved component identity.
Error policy:
Decision::Ignorecontinues execution.Decision::Abortaborts the current operation (step/copperlist scope).Decision::Shutdowntriggers runtime shutdown.
Required Methods§
Sourcefn new(
metadata: CuMonitoringMetadata,
runtime: CuMonitoringRuntime,
) -> CuResult<Self>where
Self: Sized,
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.
Sourcefn process_copperlist(
&self,
_ctx: &CuContext,
view: CopperListView<'_>,
) -> CuResult<()>
fn process_copperlist( &self, _ctx: &CuContext, view: CopperListView<'_>, ) -> CuResult<()>
Called once per processed CopperList after component execution.
Sourcefn process_error(
&self,
component_id: ComponentId,
step: CuComponentState,
error: &CuError,
) -> Decision
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§
Sourcefn start(&mut self, _ctx: &CuContext) -> CuResult<()>
fn start(&mut self, _ctx: &CuContext) -> CuResult<()>
Called once before processing the first CopperList.
Sourcefn observe_copperlist_io(&self, _stats: CopperListIoStats)
fn observe_copperlist_io(&self, _stats: CopperListIoStats)
Called when runtime finishes CopperList serialization/IO accounting.
Sourcefn process_panic(&self, _panic_message: &str)
fn process_panic(&self, _panic_message: &str)
Called when the runtime catches a panic (std builds).
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.