pub struct RiskScorer {
pub approval_threshold: u8,
pub max_timeout_ms: u64,
}Expand description
Risk score calculator for workflow steps
Fields§
§approval_threshold: u8Threshold above which approval is required (0-100)
max_timeout_ms: u64Maximum execution timeout for high-risk operations (milliseconds)
Implementations§
Source§impl RiskScorer
impl RiskScorer
Sourcepub fn with_threshold(approval_threshold: u8) -> Self
pub fn with_threshold(approval_threshold: u8) -> Self
Create a new risk scorer with custom settings
Sourcepub fn calculate_risk_score(&self, step: &WorkflowStep) -> u8
pub fn calculate_risk_score(&self, step: &WorkflowStep) -> u8
Calculate risk score for a workflow step
The risk score is calculated based on three factors:
- Impact (0-100): potential for data loss or system damage
- Reversibility (0-100): ability to undo the operation (inverted: lower is riskier)
- Complexity (0-100): number of dependencies and interactions
Formula: (impact + (100 - reversibility) + complexity) / 3
Sourcepub fn requires_approval(&self, risk_score: u8) -> bool
pub fn requires_approval(&self, risk_score: u8) -> bool
Check if a step requires approval based on risk score
Sourcepub fn assess_step(&self, step: &WorkflowStep) -> RiskAssessment
pub fn assess_step(&self, step: &WorkflowStep) -> RiskAssessment
Generate a risk assessment for a step
Sourcepub fn generate_report(
&self,
workflow_id: &str,
workflow_name: &str,
steps: &[WorkflowStep],
state: &WorkflowState,
) -> RiskAssessmentReport
pub fn generate_report( &self, workflow_id: &str, workflow_name: &str, steps: &[WorkflowStep], state: &WorkflowState, ) -> RiskAssessmentReport
Generate a risk assessment report for a completed workflow
Trait Implementations§
Source§impl Clone for RiskScorer
impl Clone for RiskScorer
Source§fn clone(&self) -> RiskScorer
fn clone(&self) -> RiskScorer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RiskScorer
impl Debug for RiskScorer
Auto Trait Implementations§
impl Freeze for RiskScorer
impl RefUnwindSafe for RiskScorer
impl Send for RiskScorer
impl Sync for RiskScorer
impl Unpin for RiskScorer
impl UnwindSafe for RiskScorer
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