Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RetryConditionFromRegex ¶
func RetryConditionFromRegex(regexes ...regexp.Regexp) func(ruleResult rule.RuleResult) bool
RetryConditionFromRegex generates a retry condition func that matches messages from rule.Errored statuses.
Types ¶
type CreateOption ¶
type CreateOption func(*RetryableRule)
CreateOption is a function that acts on a RetryableRule and is used to construct such objects.
func WithBaseRule ¶
func WithBaseRule(baseRule rule.Rule) CreateOption
WithBaseRule sets the BaseRule of a RetryableRule.
func WithLogger ¶
func WithLogger(logger Logger) CreateOption
WithLogger the logger of a RetryableRule.
func WithMaxRetries ¶
func WithMaxRetries(maxRetries int) CreateOption
WithMaxRetries sets the MaxRetries of a RetryableRule.
func WithRetryCondition ¶
func WithRetryCondition(retryCondition func(ruleResult rule.RuleResult) bool) CreateOption
WithRetryCondition sets the RetryCondition of a RetryableRule.
type RetryableRule ¶
type RetryableRule struct { BaseRule rule.Rule MaxRetries int RetryCondition func(ruleResult rule.RuleResult) bool Logger Logger }
RetryableRule wraps rule.Rule and allows a rule to be retried when the retry condition is met.
func (*RetryableRule) Name ¶
func (rr *RetryableRule) Name() string
Name returns the name of the rule.
func (*RetryableRule) Run ¶
func (rr *RetryableRule) Run(ctx context.Context) (rule.RuleResult, error)
Run executes the base rule and retries when the retry condition is met and max retries are not reached yet.