Documentation
¶
Overview ¶
Package retry provides configurable retry strategies with exponential backoff, jitter, and context-aware cancellation for the ResolveAgent platform. It integrates with the feedback loop to emit retry outcome signals.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Policy ¶
type Policy struct {
// MaxAttempts is the total number of attempts (including the first call).
MaxAttempts int
// InitialDelay is the delay before the first retry.
InitialDelay time.Duration
// MaxDelay caps the backoff delay.
MaxDelay time.Duration
// Multiplier is the backoff multiplier (default 2.0).
Multiplier float64
// Jitter adds random jitter up to this fraction of the delay (0.0–1.0).
Jitter float64
// RetryIf is an optional predicate; if set, only retry when it returns true.
RetryIf func(err error) bool
// Observer receives retry lifecycle events for feedback loop integration.
Observer RetryObserver
}
Policy defines retry behavior.
func DefaultPolicy ¶
func DefaultPolicy() Policy
DefaultPolicy returns a sensible default retry policy.
type RetryObserver ¶
type RetryObserver interface {
// OnRetrySuccess is called when the operation succeeds after retries.
OnRetrySuccess(ctx context.Context, attempts int, totalDuration time.Duration)
// OnRetryExhausted is called when all retry attempts are exhausted.
OnRetryExhausted(ctx context.Context, attempts int, totalDuration time.Duration, lastErr error)
}
RetryObserver receives lifecycle events from the retry loop, enabling the feedback subsystem to track retry outcomes.
Click to show internal directories.
Click to hide internal directories.