Skip to main content

Crate stop_cigarette

Crate stop_cigarette 

Source
Expand description

Cooperative, first-wins STOP signals.

The Cocoshiga STOP principle has four invariants:

  1. the first valid STOP wins;
  2. its actor and reason remain immutable;
  3. all clones observe the same STOP;
  4. 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§

CocoshigaStop
A cloneable cooperative STOP signal.
StopOutcome
Result of a valid STOP request.
StopRecord
Immutable provenance for the first accepted STOP request.
Stopped
Error returned when a checkpoint observes STOP.

Enums§

RequestError
Validation failure for a STOP request.
StopStatus
Whether a request established STOP or found it already established.