NewRetryer creates an instance of S2ARetryer using the defaultBackoff implementation.
var NewRetryer = func() *S2ARetryer { return &S2ARetryer{bo: &defaultBackoff{ cur: 100 * time.Millisecond, max: 30 * time.Second, mul: 2, }} }
func Run(ctx context.Context, f func() error)
Run uses S2ARetryer to execute the function passed in, until success or reaching max number of retry attempts.
func Sleep(ctx context.Context, d time.Duration) error
Sleep will wait for the specified duration or return on context expiration.
S2ARetryer implements a retry helper for talking to S2A gRPC server.
type S2ARetryer struct {
// contains filtered or unexported fields
}
func (r *S2ARetryer) Attempts() int
Attempts return the number of retries attempted.
func (r *S2ARetryer) Retry(err error) (time.Duration, bool)
Retry returns a boolean indicating whether retry should be performed and the backoff duration.