pub struct Controller(/* private fields */);Expand description
Lifecycle state machine. Phase, winning action and exit status share one atomic word so a request is published as a whole.
Implementations§
Source§impl Controller
impl Controller
pub const fn new() -> Self
pub fn state(&self) -> State
pub fn is_running(&self) -> bool
Sourcepub fn request(&self, action: Action, status: u8) -> Result<(), State>
pub fn request(&self, action: Action, status: u8) -> Result<(), State>
Trusted request without privilege check, for platform code (for
example host signal handlers). Executables use request instead.
A single compare-and-exchange: safe in a POSIX signal handler on
targets with native 16-bit atomics. Targets without compare-and-swap
use portable-atomic, whose backend the firmware selects. It never
allocates or wakes; the supervisor polls Self::state.
Sourcepub async fn run<S: Stages>(
&self,
stages: &mut S,
budget: Duration,
) -> Result<(), Error>
pub async fn run<S: Stages>( &self, stages: &mut S, budget: Duration, ) -> Result<(), Error>
Run the pipeline once for the accepted request.
Any stage error moves to State::Failed and stops the pipeline: a
failed storage commit never reaches drivers or the final action.
Nothing is deallocated on failure. budget bounds quiescence on a
monotonic clock.
Sourcepub async fn run_forced<S: Stages>(
&self,
stages: &mut S,
budget: Duration,
) -> Result<Option<Error>, Error>
pub async fn run_forced<S: Stages>( &self, stages: &mut S, budget: Duration, ) -> Result<Option<Error>, Error>
Dangerous: continue to the final action after a quiescence, storage or driver failure. Uncommitted data is lost and live tasks are cut off. Only for trusted platform code that explicitly accepts that loss.
Returns the first skipped stage error if the final action returned.