retry

package
v0.30.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

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" }

Typical use:

flaky.service:retry=3

Index

Constants

View Source
const (
	BackoffConstant          = "constant"
	BackoffExponential       = "exponential"
	BackoffExponentialJitter = "exponential_jitter"
)
View Source
const ID = "retry"

Variables

This section is empty.

Functions

func Bundle

func Bundle(opts map[string]string) compiler.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

func BundleWithConfig(cfg Config) compiler.Bundle

BundleWithConfig returns the retry extension with an explicit policy.

Types

type Config

type Config struct {
	DefaultMax int           `nflow:"default_max" default:"3"`
	Backoff    string        `nflow:"backoff" default:"exponential_jitter"`
	MinBackoff time.Duration `nflow:"min_backoff" default:"10ms"`
	MaxBackoff time.Duration `nflow:"max_backoff" default:"2s"`
	RetryAll   bool          `nflow:"retry_all" default:"false"`
}

Config controls the retry policy installed by the adviser.

func ConfigFromOptions

func ConfigFromOptions(opts map[string]string) (Config, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL