github.com/Cloud-Foundations/Dominator@v0.3.4/lib/retry/api.go (about)

     1  package retry
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/Cloud-Foundations/Dominator/lib/backoffdelay"
     7  )
     8  
     9  type Params struct {
    10  	MaxRetries   uint64               // Default: unlimited.
    11  	RetryTimeout time.Duration        // Default: unlimited.
    12  	Sleeper      backoffdelay.Sleeper // Default: 100 milliseconds.
    13  }
    14  
    15  // Retry will run the specified function until it returns true or retry limits
    16  // are exceeded. It returns an error if retry limits are exceeded.
    17  func Retry(fn func() bool, params Params) error {
    18  	return retry(fn, params)
    19  }