pub struct ValidationStateMachine { /* private fields */ }Expand description
State machine governing transitions between validation tiers.
The machine enforces the following transition rules:
Validated ↔ Candidate— bidirectionalCandidate ↔ Experimental— bidirectionalAny → Blocked— one-way (terminal)Validated ↔ Validated— self-transition (no-op, succeeds)Candidate ↔ Candidate— self-transition (no-op, succeeds)Experimental ↔ Experimental— self-transition (no-op, succeeds)Blocked ↔ Blocked— self-transition (no-op, succeeds)
Illegal transitions return a TransitionError.
Implementations§
Source§impl ValidationStateMachine
impl ValidationStateMachine
Sourcepub fn register(&mut self, component_id: impl Into<String>)
pub fn register(&mut self, component_id: impl Into<String>)
Register a new component. Defaults to ValidationTier::Candidate.
If the component already exists, this is a no-op (preserves existing tier).
Sourcepub fn register_with_tier(
&mut self,
component_id: impl Into<String>,
tier: ValidationTier,
)
pub fn register_with_tier( &mut self, component_id: impl Into<String>, tier: ValidationTier, )
Register a component with an explicit initial tier.
If the component already exists, this is a no-op.
Sourcepub fn transition(
&mut self,
component_id: &str,
target: ValidationTier,
) -> Result<(), TransitionError>
pub fn transition( &mut self, component_id: &str, target: ValidationTier, ) -> Result<(), TransitionError>
Attempt to transition a component to a new tier.
Returns Ok(()) if the transition is legal, Err(TransitionError) otherwise.
Sourcepub fn tier(&self, component_id: &str) -> ValidationTier
pub fn tier(&self, component_id: &str) -> ValidationTier
Query the current tier of a component.
Returns ValidationTier::Candidate for unregistered components.
Sourcepub fn can_transition(&self, component_id: &str, target: ValidationTier) -> bool
pub fn can_transition(&self, component_id: &str, target: ValidationTier) -> bool
Check if a transition is legal without performing it.
Sourcepub fn entries(&self) -> &HashMap<String, ValidationTier>
pub fn entries(&self) -> &HashMap<String, ValidationTier>
Get all registered component IDs and their tiers.
Sourcepub fn force_set(
&mut self,
component_id: impl Into<String>,
tier: ValidationTier,
)
pub fn force_set( &mut self, component_id: impl Into<String>, tier: ValidationTier, )
Force-set a component’s tier without transition checks.
Used internally for loading persisted state or administrative overrides.
Trait Implementations§
Source§impl Clone for ValidationStateMachine
impl Clone for ValidationStateMachine
Source§impl Debug for ValidationStateMachine
impl Debug for ValidationStateMachine
Auto Trait Implementations§
impl Freeze for ValidationStateMachine
impl RefUnwindSafe for ValidationStateMachine
impl Send for ValidationStateMachine
impl Sync for ValidationStateMachine
impl Unpin for ValidationStateMachine
impl UnsafeUnpin for ValidationStateMachine
impl UnwindSafe for ValidationStateMachine
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more