package
19.10.0+incompatible
Repository: https://github.com/safescale-dev-team/safescale.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# Functions

Action tries to executes 'run' following verdicts from arbiter, with delay decided by 'officer'.
Constant sleeps for duration duration.
Exponential sleeps for duration base * 2^tries.
Fibonacci sleeps for duration * fib(tries)TODO:See if we can use a context to prevent the full calculation for each try...
Incremental sleeps for duration + the number of tries.
LimitError ...
Linear sleeps for duration * the number of tries.
Max errors after a limited number of tries.
PrevailDone aggregates verdicts from Arbiters for a try : - Returns Abort and the error as soon as an Abort is decided.
PrevailRetry aggregates verdicts from Arbiters for a try : - Returns Abort and the error as soon as an arbiter decides for an Abort.
StopRetryError ...
Successful returns Retry when the try produced no error.
Timeout returns Abort after a duration of time passes since the first try.
TimeoutError ...
Unsuccessful returns Retry when the try produced an error.
UnsuccessfulWhereRetcode255 returns Retry when the try produced an error with code 255, all other codes are considered as successful and returns Done.
WhileSuccessful retries while 'run' is successful (ie 'run' returns an error == nil), waiting a duration of 'delay' after each try, expiring after a duration of 'timeout'.
WhileSuccessfulDelay1Second retries while 'run' is successful (ie 'run' returns an error == nil), waiting 1 second after each try, expiring after a duration of 'timeout'.
WhileSuccessfulDelay1SecondWithNotify retries while 'run' is successful (ie 'run' returns an error == nil), waiting 1 second after each try, expiring after a duration of 'timeout'.
WhileSuccessfulDelay5Seconds retries while 'run' is successful (ie 'run' returns an error == nil), waiting 5 seconds after each try, expiring after a duration of 'timeout'.
WhileSuccessfulDelay5SecondsWithNotify retries while 'run' is successful (ie 'run' returns an error == nil), waiting 5 seconds after each try, expiring after a duration of 'timeout'.
WhileSuccessfulWithNotify retries while 'run' is successful (ie 'run' returns an error == nil), waiting a duration of 'delay' after each try, expiring after a duration of 'timeout'.
WhileUnsuccessful retries every 'delay' while 'run' is unsuccessful with a 'timeout'.
WhileUnsuccessfulDelay1Second retries while 'run' is unsuccessful (ie 'run' returns an error != nil), waiting 1 second after each try, expiring after 'timeout'.
WhileUnsuccessfulDelay1SecondWithNotify retries while 'run' is unsuccessful (ie 'run' returns an error != nil), waiting 1 second after each try, expiring after a duration of 'timeout'.
WhileUnsuccessfulDelay5Seconds retries while 'run' is unsuccessful (ie 'run' returns an error != nil), waiting 5 seconds after each try, expiring after 'timeout'.
WhileUnsuccessfulDelay5SecondsTimeout ...
WhileUnsuccessfulDelay5SecondsWithNotify retries while 'run' is unsuccessful (ie 'run' returns an error != nil), waiting 5 seconds after each try, expiring after a duration of 'timeout'.
WhileUnsuccessfulTimeout retries every 'delay' while 'run' is unsuccessful with a 'timeout'.
WhileUnsuccessfulWhereRetcode255Delay5SecondsWithNotify retries while 'run' is unsuccessful (ie 'run' returns an error != nil and this error has 255 as exit status code), waiting 5 seconds after each try, expiring after a duration of 'timeout'.
WhileUnsuccessfulWhereRetcode255WithNotify retries while 'run' is unsuccessful (ie 'run' returns an error != nil and this error has 255 as exit status code), waiting 'delay' after each try, expiring after 'timeout'.
WhileUnsuccessfulWithNotify retries while 'run' is unsuccessful (ie 'run' returns an error != nil), waiting 'delay' after each try, expiring after 'timeout'.

# Variables

DefaultArbiter allows 10 retries, with a maximum duration of 30 seconds.
NotifyByLog logs the status of each try.

# Structs

ErrLimit is returned when the maximum attempts has been reached.
ErrStopRetry is returned when the maximum attempts has been reached.
Officer sleeps or selects any amount of time for each try.
Try keeps track of the number of tries, starting from 1.

# Type aliases

Arbiter sleeps or selects any amount of time for each attempt.
ErrTimeout is an alias for utils.ErrTimeout.
Notify ...