Expand description
Cooperative, first-wins STOP signals.
The Cocoshiga STOP principle has four invariants:
- the first valid STOP wins;
- its actor and reason remain immutable;
- all clones observe the same STOP;
- subsequent requests are idempotent.
use stop_cigarette::{CocoshigaStop, StopStatus};
let signal = CocoshigaStop::new();
let worker_signal = signal.clone();
let outcome = signal.request_stop("operator", "unsafe condition")?;
assert_eq!(outcome.status(), StopStatus::StoppedNow);
assert!(worker_signal.is_stopped());
assert_eq!(
worker_signal.record().expect("a stop was requested").actor(),
"operator"
);Structs§
- Cocoshiga
Stop - A cloneable cooperative STOP signal.
- Stop
Outcome - Result of a valid STOP request.
- Stop
Record - Immutable provenance for the first accepted STOP request.
- Stopped
- Error returned when a checkpoint observes STOP.
Enums§
- Request
Error - Validation failure for a STOP request.
- Stop
Status - Whether a request established STOP or found it already established.