@@ -31,30 +31,30 @@ pub trait RunFuture<O>: Future<Output = O> {
3131 ///
3232 /// If unspecified, the `run` will be retried using the [Restate invoker retry policy](https://docs.restate.dev/operate/configuration/server),
3333 /// which by default retries indefinitely.
34- fn with_retry_policy ( self , retry_policy : RunRetryPolicy ) -> Self ;
34+ fn retry_policy ( self , retry_policy : RunRetryPolicy ) -> Self ;
3535
3636 /// Define a name for this `run` operation.
3737 ///
3838 /// This is used mainly for observability.
39- fn named ( self , name : impl Into < String > ) -> Self ;
39+ fn name ( self , name : impl Into < String > ) -> Self ;
4040}
4141
4242/// This struct represents the policy to execute retries for run closures.
4343#[ derive( Debug , Clone ) ]
4444pub struct RunRetryPolicy {
45- pub ( crate ) initial_interval : Duration ,
45+ pub ( crate ) initial_delay : Duration ,
4646 pub ( crate ) factor : f32 ,
47- pub ( crate ) max_interval : Option < Duration > ,
47+ pub ( crate ) max_delay : Option < Duration > ,
4848 pub ( crate ) max_attempts : Option < u32 > ,
4949 pub ( crate ) max_duration : Option < Duration > ,
5050}
5151
5252impl Default for RunRetryPolicy {
5353 fn default ( ) -> Self {
5454 Self {
55- initial_interval : Duration :: from_millis ( 100 ) ,
55+ initial_delay : Duration :: from_millis ( 100 ) ,
5656 factor : 2.0 ,
57- max_interval : Some ( Duration :: from_secs ( 2 ) ) ,
57+ max_delay : Some ( Duration :: from_secs ( 2 ) ) ,
5858 max_attempts : None ,
5959 max_duration : Some ( Duration :: from_secs ( 50 ) ) ,
6060 }
@@ -65,29 +65,29 @@ impl RunRetryPolicy {
6565 /// Create a new retry policy.
6666 pub fn new ( ) -> Self {
6767 Self {
68- initial_interval : Duration :: from_millis ( 100 ) ,
68+ initial_delay : Duration :: from_millis ( 100 ) ,
6969 factor : 1.0 ,
70- max_interval : None ,
70+ max_delay : None ,
7171 max_attempts : None ,
7272 max_duration : None ,
7373 }
7474 }
7575
76- /// Initial interval for the first retry attempt.
77- pub fn with_initial_interval ( mut self , initial_interval : Duration ) -> Self {
78- self . initial_interval = initial_interval;
76+ /// Initial retry delay for the first retry attempt.
77+ pub fn initial_delay ( mut self , initial_interval : Duration ) -> Self {
78+ self . initial_delay = initial_interval;
7979 self
8080 }
8181
82- /// Maximum interval between retries .
83- pub fn with_factor ( mut self , factor : f32 ) -> Self {
82+ /// Exponentiation factor to use when computing the next retry delay .
83+ pub fn exponentiation_factor ( mut self , factor : f32 ) -> Self {
8484 self . factor = factor;
8585 self
8686 }
8787
88- /// Maximum interval between retries.
89- pub fn with_max_interval ( mut self , max_interval : Duration ) -> Self {
90- self . max_interval = Some ( max_interval) ;
88+ /// Maximum delay between retries.
89+ pub fn max_delay ( mut self , max_interval : Duration ) -> Self {
90+ self . max_delay = Some ( max_interval) ;
9191 self
9292 }
9393
@@ -98,7 +98,7 @@ impl RunRetryPolicy {
9898 /// This is due to the nature of the run operation, which executes the closure on the service and sends the result afterward to Restate.
9999 ///
100100 /// Infinite retries if this field and `max_duration` are unset.
101- pub fn with_max_attempts ( mut self , max_attempts : u32 ) -> Self {
101+ pub fn max_attempts ( mut self , max_attempts : u32 ) -> Self {
102102 self . max_attempts = Some ( max_attempts) ;
103103 self
104104 }
@@ -110,7 +110,7 @@ impl RunRetryPolicy {
110110 /// This is due to the nature of the run operation, which executes the closure on the service and sends the result afterward to Restate.
111111 ///
112112 /// Infinite retries if this field and `max_attempts` are unset.
113- pub fn with_max_duration ( mut self , max_duration : Duration ) -> Self {
113+ pub fn max_duration ( mut self , max_duration : Duration ) -> Self {
114114 self . max_duration = Some ( max_duration) ;
115115 self
116116 }
0 commit comments