pub enum PolicyState {
Pending,
Active,
Draining,
Disabled,
RepairRequired,
AuthenticationFailed,
}Expand description
The policy lifecycle, exactly as 04-subsystem-contracts.md draws it:
pending -> active | repair_required
active -> draining -> disabled -> pending
any -> authentication_failed (recoverable by re-authentication)Every transition outside that diagram is rejected, which b1’s
Definition of Done requires. Two consequences are worth stating because they
are surprising, and both are recorded as findings rather than papered over:
RepairRequiredhas no outgoing edge except theanyrule. A policy that enters it can never return toActivethrough this state machine.Disabled -> Pendingbegins a fresh lifecycle when an operator re-enables a policy that previously finished draining. Activation remains a separatePending -> Activetransition, preserving the normal entry-state checks.
The one edge here that the diagram does not draw as an arrow is
AuthenticationFailed -> Pending, which is the parenthetical “(recoverable
by re-authentication)” made executable; pending is where it lands because
that is the diagram’s only entry state.
Variants§
Implementations§
Source§impl PolicyState
impl PolicyState
pub const ALL: [PolicyState; 6]
Sourcepub const LEGAL: &'static [(PolicyState, PolicyState)]
pub const LEGAL: &'static [(PolicyState, PolicyState)]
The complete legal transition list. Nothing outside it is permitted, and a self-transition is not in it either.
pub fn can_transition_to(self, next: PolicyState) -> bool
Sourcepub const fn admits_new_runners(self) -> bool
pub const fn admits_new_runners(self) -> bool
True while the policy is allowed to be the reason a runner starts.
Trait Implementations§
Source§impl Clone for PolicyState
impl Clone for PolicyState
Source§fn clone(&self) -> PolicyState
fn clone(&self) -> PolicyState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PolicyState
Source§impl Debug for PolicyState
impl Debug for PolicyState
Source§impl<'de> Deserialize<'de> for PolicyState
impl<'de> Deserialize<'de> for PolicyState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for PolicyState
impl Display for PolicyState
impl Eq for PolicyState
Source§impl Hash for PolicyState
impl Hash for PolicyState
Source§impl Ord for PolicyState
impl Ord for PolicyState
Source§fn cmp(&self, other: &PolicyState) -> Ordering
fn cmp(&self, other: &PolicyState) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for PolicyState
impl PartialEq for PolicyState
Source§impl PartialOrd for PolicyState
impl PartialOrd for PolicyState
Source§impl Serialize for PolicyState
impl Serialize for PolicyState
impl StructuralPartialEq for PolicyState
Auto Trait Implementations§
impl Freeze for PolicyState
impl RefUnwindSafe for PolicyState
impl Send for PolicyState
impl Sync for PolicyState
impl Unpin for PolicyState
impl UnsafeUnpin for PolicyState
impl UnwindSafe for PolicyState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more