Skip to main content

install_contract_monitors

Function install_contract_monitors 

Source
pub unsafe fn install_contract_monitors(
    executor: *mut c_void,
    monitors: &'static [MonitorSpec],
    ages: &'static [AgeMonitorSpec],
    reporter: &'static ContractReporter,
) -> Result<(), &'static str>
Expand description

Install a contracted Rust image’s monitor tables on one executor, and arm its /diagnostics reporter — issue 1676.

The Rust spelling of nros_cpp_install_monitors. Call BEFORE any node is created on the executor: a publisher attaches its counter cell by exact topic match at create time, so a table installed later monitors nothing. nros::main! emits this ahead of the parameter services and the node registrations on every executor it builds (the single one, and each tier’s).

The tables are refused, not truncated, when they exceed the executor’s MAX_MONITORS / MAX_AGE_MONITORS (the baked tables also carry a compile-time assert naming the knob). Empty tables install nothing and arm no reporter — an uncontracted image carries none of this. A reporter is armed once per reporter; a second install keeps the first.

If the /diagnostics publisher cannot be created the tables stay installed and violations reach the log only — reported, not fatal, which is what nros_cpp_install_monitors does too (both through arm_reporter; a census run arms none). Returns Err only for a refused table.

§Safety

executor must be the live *mut Executor<'static> handle a RuntimeCtx hands out (runtime.executor_handle()), or NULL, and nothing else may hold a reference into that executor for the call.