Skip to main content

arm_reporter

Function arm_reporter 

Source
pub unsafe fn arm_reporter(
    executor: &mut Executor<'_>,
    domain_id: u32,
    slot: &mut Option<DiagSink>,
) -> bool
Expand description

Arm one executor’s /diagnostics reporter in slot, and point the executor’s violation sink at it — THE arming step, shared by install_contract_monitors (Rust) and nros-cpp’s nros_cpp_install_monitors (C and C++).

  • Idempotent: a slot already holding a reporter keeps it.
  • A CENSUS run arms nothing ([crate::census_hooks::recording_run]): it never spins, so the reporter could never publish, and the recorder has no node open yet to attribute it to — it refused the publisher, and the C/C++ road turned that refusal into a failed setup that recorded nothing.
  • The publisher opens on the image’s PRIMARY node. Armed before any node exists – the usual case, since the tables must precede every entity – it opens when the primary node is registered, and a failure then fails that registration (the node’s build() returns it). An image that registers no node opens it at its first spin instead, and spin returns the failure (a temporary path; see Executor::open_pending_on_configured_name).
  • Armed after a node exists, it opens now, and a publisher that cannot be created is REPORTED here, not fatal: the tables stay installed and every violation still reaches the log (the floor).

Returns whether a reporter is armed (or waiting for the primary node) after the call.

§Safety

slot must not move, and must outlive every spin of executor, until the sink is removed (set_violation_sink(None)) or the executor is dropped — DiagSink::hook’s contract.