Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlockUntilSuccess ¶
BlockUntilSuccess creates a transient watcher that fires the given retry function until success. This method takes a context object which will, if canceled, will stop the watcher. Returns if the function succeeds and false if the method was canceled.
Types ¶
type Retry ¶
type Retry interface {
// Some critical action, which should return true on success.
Retry() bool
}
Retry is the interface to something which are invoked until success.
type Watcher ¶
type Watcher interface {
// Start will *immediately* attempt to invoke the retry function. The
// watcher will re-invoke the retry function on failure, with a delay
// in between tries. On success, the watcher waits for a retry signal,
// at which point the process repeats. The channel returned will receive
// a value after the retry function returns true. The user should read a
// value from this channel after a retry request signal is sent, as this
// channel is un-buffered.
Start() <-chan struct{}
// Stop updates the watcher so that no future calls to the retry function
// are attempted.
Stop()
// Check requests watcher to re-invoke the retry function until success.
// If the watcher is already in a retry cycle, then this function should
// have no observable effect. This method must not be called after Stop.
Check()
}
Watcher invokes a Retry function until success.
