Documentation
¶
Overview ¶
Package retry adds retry resilience to individual Flow atoms through the AtomAdvise contract. When an atom carries :retry=N, the adviser consumes the modifier and installs the retry middleware before the modifier table sees the atom.
The `@require` options block can configure the default retry policy:
@require retry { default_max: "5", backoff: "exponential", retry_all: "false" }
A Go host may set Config.RetryPredicate to supply a typed Kernel retry classifier. Predicates are host configuration only; no predicate expression is available in NFlow syntax.
Typical use:
flaky.service:retry=3
Index ¶
Constants ¶
const ( BackoffConstant = "constant" BackoffExponential = "exponential" BackoffExponentialJitter = "exponential_jitter" )
const ID = "retry"
Variables ¶
This section is empty.
Functions ¶
func Bundle ¶
Bundle satisfies the standard BundleFactory signature, so native.Bundles() can mount it the same way as every other bundle. Options come from the @require block, or from BundleWithConfig when the caller wants to pin the policy in code.
func BundleWithConfig ¶
BundleWithConfig returns the retry extension with an explicit policy.
func OptionNames ¶ added in v0.32.0
func OptionNames() []string
OptionNames returns the recognized @require option keys.
Types ¶
type Config ¶
type Config struct {
DefaultMax int `nflow:"default_max"`
Backoff string `nflow:"backoff"`
MinBackoff time.Duration `nflow:"min_backoff"`
MaxBackoff time.Duration `nflow:"max_backoff"`
RetryAll bool `nflow:"retry_all"`
// RetryPredicate is a host-supplied error classifier used by Kernel's
// Builder.RetryIf. It is deliberately not an @require option and cannot be
// combined with RetryAll. It may be called concurrently by action runs, so
// captured mutable state must be synchronized by the host.
RetryPredicate action.RetryPredicate
}
Config controls the retry policy installed by the adviser.
func ConfigFromOptions ¶
ConfigFromOptions strictly decodes a `@require retry { ... }` options map. Missing values use the same defaults as Config.normalized; malformed, unknown, or out-of-range values are returned as errors.
func (Config) BackoffFunc ¶ added in v0.32.0
BackoffFunc creates the configured Kernel retry delay function.
func (Config) Normalized ¶ added in v0.32.0
Normalized returns the existing retry defaults for omitted settings.