retry
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcRetryContext¶
RetryContext is a basic wrapper around StateChangeConf that will just retrya function until it no longer returns an error.
Cancellation from the passed in context will propagate through to theunderlying StateChangeConf
Types¶
typeNotFoundError¶
type NotFoundError struct {LastErrorerrorLastRequest interface{}LastResponse interface{}MessagestringRetriesint}func (*NotFoundError)Error¶
func (e *NotFoundError) Error()string
func (*NotFoundError)Unwrap¶
func (e *NotFoundError) Unwrap()error
typeRetryError¶
RetryError is the required return type of RetryFunc. It forces client codeto choose whether or not a given error is retryable.
funcNonRetryableError¶
func NonRetryableError(errerror) *RetryError
NonRetryableError is a helper to create a RetryError that's _not_ retryablefrom a given error. To prevent logic errors, will return an error whenpassed a nil error.
funcRetryableError¶
func RetryableError(errerror) *RetryError
RetryableError is a helper to create a RetryError that's retryable from agiven error. To prevent logic errors, will return an error when passed anil error.
func (*RetryError)Unwrap¶
func (e *RetryError) Unwrap()error
typeStateChangeConf¶
type StateChangeConf struct {Delaytime.Duration// Wait this time before starting checksPending []string// States that are "allowed" and will continue tryingRefreshStateRefreshFunc// Refreshes the current stateTarget []string// Target stateTimeouttime.Duration// The amount of time to wait before timeoutMinTimeouttime.Duration// Smallest time to wait before refreshesPollIntervaltime.Duration// Override MinTimeout/backoff and only poll this oftenNotFoundChecksint// Number of times to allow not found (nil result from Refresh)// This is to work around inconsistent APIsContinuousTargetOccurenceint// Number of times the Target state has to occur continuously}StateChangeConf is the configuration struct used for `WaitForState`.
func (*StateChangeConf)WaitForStatedeprecated
func (conf *StateChangeConf) WaitForState() (interface{},error)
WaitForState watches an object and waits for it to achieve the statespecified in the configuration using the specified Refresh() func,waiting the number of seconds specified in the timeout configuration.
Deprecated: Please use WaitForStateContext to ensure proper plugin shutdown
func (*StateChangeConf)WaitForStateContext¶
func (conf *StateChangeConf) WaitForStateContext(ctxcontext.Context) (interface{},error)
WaitForStateContext watches an object and waits for it to achieve the statespecified in the configuration using the specified Refresh() func,waiting the number of seconds specified in the timeout configuration.
If the Refresh function returns an error, exit immediately with that error.
If the Refresh function returns a state other than the Target state or onelisted in Pending, return immediately with an error.
If the Timeout is exceeded before reaching the Target state, return anerror.
Otherwise, the result is the result of the first call to the Refresh function toreach the target state.
Cancellation from the passed in context will cancel the refresh loop
typeStateRefreshFunc¶
StateRefreshFunc is a function type used for StateChangeConf that isresponsible for refreshing the item being watched for a state change.
It returns three results. `result` is any object that will be returnedas the final object after waiting for state change. This allows you toreturn the final updated object, for example an EC2 instance after refreshingit. A nil result represents not found.
`state` is the latest state of that object. And `err` is any error thatmay have happened while refreshing the state.
typeTimeoutError¶
TimeoutError is returned when WaitForState times out
func (*TimeoutError)Error¶
func (e *TimeoutError) Error()string
func (*TimeoutError)Unwrap¶
func (e *TimeoutError) Unwrap()error
typeUnexpectedStateError¶
UnexpectedStateError is returned when Refresh returns a state that's neither in Target nor Pending
func (*UnexpectedStateError)Error¶
func (e *UnexpectedStateError) Error()string
func (*UnexpectedStateError)Unwrap¶
func (e *UnexpectedStateError) Unwrap()error