pub struct RetryEngine { /* private fields */ }Expand description
Failure-classified retry engine.
Implementations§
Source§impl RetryEngine
impl RetryEngine
pub fn new() -> Self
Sourcepub fn configure_policy(
&mut self,
name: &str,
profiles: Vec<RetryProfile>,
budget: Option<RetryBudget>,
) -> WorkflowResult<String>
pub fn configure_policy( &mut self, name: &str, profiles: Vec<RetryProfile>, budget: Option<RetryBudget>, ) -> WorkflowResult<String>
Configure a retry policy.
Sourcepub fn get_policy(&self, policy_id: &str) -> WorkflowResult<&RetryPolicy>
pub fn get_policy(&self, policy_id: &str) -> WorkflowResult<&RetryPolicy>
Get a retry policy.
Sourcepub fn get_profile_for_failure(
&self,
policy_id: &str,
failure_class: &FailureClass,
) -> WorkflowResult<Option<&RetryProfile>>
pub fn get_profile_for_failure( &self, policy_id: &str, failure_class: &FailureClass, ) -> WorkflowResult<Option<&RetryProfile>>
Get retry profile for a specific failure class.
Sourcepub fn calculate_delay(&self, strategy: &RetryStrategy, attempt: u32) -> u64
pub fn calculate_delay(&self, strategy: &RetryStrategy, attempt: u32) -> u64
Calculate delay for next retry attempt.
Sourcepub fn within_budget(
&self,
policy_id: &str,
step_id: &str,
) -> WorkflowResult<bool>
pub fn within_budget( &self, policy_id: &str, step_id: &str, ) -> WorkflowResult<bool>
Check if retry is within budget.
Sourcepub fn record_attempt(&mut self, step_id: &str, failure_class: FailureClass)
pub fn record_attempt(&mut self, step_id: &str, failure_class: FailureClass)
Record a retry attempt.
Sourcepub fn get_stats(&self, step_id: &str) -> Option<&RetryStats>
pub fn get_stats(&self, step_id: &str) -> Option<&RetryStats>
Get retry stats for a step.
Sourcepub fn get_patterns(&self) -> Vec<RetryPattern>
pub fn get_patterns(&self) -> Vec<RetryPattern>
Get learned retry patterns.
Sourcepub fn list_policies(&self) -> Vec<&RetryPolicy>
pub fn list_policies(&self) -> Vec<&RetryPolicy>
List all policies.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RetryEngine
impl RefUnwindSafe for RetryEngine
impl Send for RetryEngine
impl Sync for RetryEngine
impl Unpin for RetryEngine
impl UnsafeUnpin for RetryEngine
impl UnwindSafe for RetryEngine
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