Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionString ¶
ActionString is action function that returns string and error
type IRetryPolicy ¶
type IRetryPolicy interface { // RetryActionString try to execute action that returns string,error RetryActionString(action ActionString, handle ShouldRetryOnSpecificError) (value string, err error) // RetryAction try to execute action that returns only error RetryAction(action Action, handle ShouldRetryOnSpecificError) (err error) }
IRetryPolicy interface for retrypolicy
type RetryPolicy ¶
type RetryPolicy struct {
// contains filtered or unexported fields
}
RetryPolicy manages the retry policy of functions.
func NewRetryPolicy ¶
func NewRetryPolicy(instrumentationProvider instrumentation.IInstrumentationProvider, configuration *RetryPolicyConfiguration) *RetryPolicy
NewRetryPolicy Cto'r for retry policy object
func (*RetryPolicy) RetryAction ¶
func (r *RetryPolicy) RetryAction(action Action, shouldRetry ShouldRetryOnSpecificError) (err error)
RetryAction retry to run the action with retryPolicy
func (*RetryPolicy) RetryActionString ¶
func (r *RetryPolicy) RetryActionString(action ActionString, shouldRetry ShouldRetryOnSpecificError) (value string, err error)
RetryActionString retry to run the action with retryPolicy
type RetryPolicyConfiguration ¶
type RetryPolicyConfiguration struct { // RetryAttempts is the number of attempts that the request should be executed. RetryAttempts int // RetryDuration is the time duration between each retry - in milliseconds RetryDurationInMS int }
RetryPolicyConfiguration is the retry policy configuration that holds the relevant fields for executing retry policy.
func (*RetryPolicyConfiguration) GetBackOffDuration ¶
func (configuration *RetryPolicyConfiguration) GetBackOffDuration() time.Duration
GetBackOffDuration uses the RetryPolicyConfiguration instance's RetryDuration (int) and TimeUnit(string) to a return a time.Duration object of the backoff duration In case of invalid argument, use default values for retry policy.
type ShouldRetryOnSpecificError ¶
ShouldRetryOnSpecificError is function that gets an error and returns true or false if the retry should handle with this error Returns true in case that retry policy doesn't know how to handle with some error, so it will retry another time (according to the retry attempts and retry count) Returns false in case that the retry policy shouldn't retry another try on error specific error.