pub struct RetrySchedule { /* private fields */ }Expand description
A validated retry schedule for retrying fallible user code locally.
Unlike named retry policies installed through super::set_retry_policy, this schedule is
interpreted entirely by the component. It does not install a named policy or create a
host-managed retry sequence. The loop is ordinary guest execution, so its host calls retain
their normal durable replay and suspension behavior.
Implementations§
Source§impl RetrySchedule
impl RetrySchedule
Sourcepub async fn retry<T, E, Operation>(&self, operation: Operation) -> Result<T, E>where
Operation: AsyncFnMut() -> Result<T, E>,
pub async fn retry<T, E, Operation>(&self, operation: Operation) -> Result<T, E>where
Operation: AsyncFnMut() -> Result<T, E>,
Runs an async operation until it succeeds or this schedule gives up.
Use Self::retry_with_properties when the schedule contains filtered predicates.
Sourcepub async fn retry_with_properties<T, E, Operation, Properties, PropertyItems>(
&self,
operation: Operation,
properties: Properties,
) -> Result<T, E>where
Operation: AsyncFnMut() -> Result<T, E>,
Properties: FnMut(&E) -> PropertyItems,
PropertyItems: IntoIterator<Item = (String, PredicateValue)>,
pub async fn retry_with_properties<T, E, Operation, Properties, PropertyItems>(
&self,
operation: Operation,
properties: Properties,
) -> Result<T, E>where
Operation: AsyncFnMut() -> Result<T, E>,
Properties: FnMut(&E) -> PropertyItems,
PropertyItems: IntoIterator<Item = (String, PredicateValue)>,
Runs an async operation with retry properties projected from each failure.
properties is evaluated after every failure, so predicates can react to the current
error. When the schedule gives up, the most recent operation error is returned unchanged.