retry_plus library
Composable retry policies for Dart.
Classes
-
AttemptOutcome<
T> - Captures the result or error from one attempt.
-
AttemptOutcomeError<
T> - A failed attempt outcome.
-
AttemptOutcomeResult<
T> - A successful attempt outcome.
- CallbackTelemetryListener
- Listener backed by a callback.
- CancellationToken
- Cooperative cancellation token for retry waits and retry boundaries.
- CircuitBreaker
- Stateful circuit breaker.
- CircuitBreakerControl
- Manual circuit control surface.
-
CircuitBreakerStrategy<
T> - Pipeline strategy that applies a shared CircuitBreaker.
- CircuitClosedContext
- Metadata provided when a circuit closes.
- CircuitFailureContext
- Context used to classify circuit breaker failures.
- CircuitFailurePredicate
- Predicate that decides whether a failure counts for the circuit breaker.
- CircuitHalfOpenContext
- Metadata provided when an open circuit moves to half-open.
- CircuitMeter
- Stateful circuit metering contract.
- CircuitMeterSample
- A single execution sample observed by a circuit breaker meter.
- CircuitOpenContext
- Metadata provided when a circuit opens.
- CircuitRejectedContext
- Metadata provided when a circuit rejects execution.
- CircuitStateProvider
- Read-only view of circuit breaker state.
- ConcurrencyLimiter
- FIFO concurrency limiter.
-
ContextPredicate<
C, Self extends ContextPredicate< C, Self> > - Predicate evaluated against a context value.
- DelayPolicy
- Policy that computes the wait before the next attempt.
-
FallbackContext<
T> - Context passed to fallback callbacks.
-
FallbackPredicate<
T> - Predicate that decides whether fallback handles a final failure.
-
FallbackStrategy<
T> - Strategy that converts final pipeline failures into results.
- FixedWindowLimiter
- Fixed window limiter with lazy window rollover.
-
HedgingActionContext<
T> - Context supplied when creating or executing a hedged action.
-
HedgingOutcomeContext<
T> - Context passed to hedging predicates.
-
HedgingPredicate<
T> - Predicate that decides whether a hedging outcome is handled.
-
HedgingScheduledContext<
T> - Context passed when a hedged action is scheduled.
-
HedgingSelectedContext<
T> - Context passed when a hedging outcome is selected.
-
HedgingStrategy<
T> - Strategy that races primary execution with optional hedged actions.
-
InjectionBehaviorStrategy<
T> - Strategy that runs custom behavior before the inner pipeline.
-
InjectionDelayStrategy<
T> - Strategy that waits for a generated delay before running the inner pipeline.
-
InjectionResultStrategy<
T> - Strategy that returns a generated result when triggered.
-
InjectionThrowStrategy<
T> - Strategy that throws a generated error when triggered.
-
InjectionTrigger<
T> - Predicate that decides whether injection applies.
- InMemoryTelemetryListener
- Test-friendly listener that stores received events.
- Jitter
- Jitter applied to a computed delay.
-
OutcomeContext<
T> - Context that carries a strategy outcome and common execution metadata.
-
OutcomePredicate<
T> - Predicate that classifies strategy outcomes.
- RateLimitContext
- Context supplied when acquiring a rate-limit lease.
- RateLimiter
- Public contract for rate-limiter implementations.
-
RateLimiterStrategy<
T> - Pipeline strategy that guards execution with a RateLimiter.
- RateLimitLease
- Lease returned by a RateLimiter.
- RateLimitRejectedContext
- Metadata provided when a rate limiter rejects execution.
-
Retry<
T> - A reusable retry facade for async and sync operations.
-
RetryAttemptContext<
T> - Metadata available when deciding whether to schedule another retry.
-
RetryFuture<
T> - Future-compatible handle for one retry execution.
-
RetryIf<
T> - Decision that determines whether another retry attempt should be scheduled.
-
RetryPipeline<
T> - Lower-level engine that applies ordered strategies to an operation.
-
RetryPipelineContext<
T> - Context for one retry pipeline execution.
-
RetryPipelineStrategy<
T> - Strategy base class for wrapping pipeline execution.
-
RetryStrategy<
T> - Retry configuration and pipeline strategy.
- SlidingWindowLimiter
- Sliding window limiter backed by fixed-size time segments.
-
StrategyOutcome<
T> - Captures a result or error observed by a pipeline strategy.
-
StrategyOutcomeError<
T> - A failed strategy outcome.
-
StrategyOutcomeResult<
T> - A successful strategy outcome.
-
TelemetryEvent<
T> - Structured telemetry event emitted by pipeline execution and strategies.
- TelemetryListener
- Listener that consumes telemetry events.
- TelemetryOptions
- Telemetry configuration.
- TelemetrySink
- Emits telemetry events to configured listeners.
- TelemetrySource
- Identifies where telemetry originated.
-
TimeoutContext<
T> - Context passed to timeout hooks.
-
TimeoutStrategy<
T> - Strategy that limits execution time.
- TokenBucketLimiter
- Token bucket limiter with lazy, clock-driven refill.
Enums
- CircuitBreakerState
- Circuit breaker state.
- RetryPhase
- Current lifecycle phase for a retry execution.
- TelemetrySeverity
- Severity assigned to telemetry events.
Extension Types
- TelemetryEventType
- Type of telemetry event emitted by retry_plus.
Extensions
-
OutcomeContextAccess
on OutcomeContext<
T> - Shared helpers for reading data from outcome-aware strategy contexts.
Functions
-
defaultTelemetrySeverity(
TelemetryEvent< Object?> event) → TelemetrySeverity -
Returns the default severity for
event. -
retry<
T> (FutureOr< T> operation(), {int maxRetries = 3, Duration initialDelay = const Duration(milliseconds: 200), double delayFactor = 2, Duration? maxDelay = const Duration(seconds: 5), Jitter? jitter, RetryIf<T> ? retryIf, FutureOr<void> onRetry(RetryAttemptContext<T> attempt)?, FutureOr<void> onGiveUp(RetryAttemptContext<T> attempt)?, TimeoutStrategy<T> ? timeout, FallbackStrategy<T> ? fallback, CircuitBreaker? circuitBreaker, TelemetryOptions telemetry = const TelemetryOptions(), String? pipelineKey, CancellationToken? cancellationToken, String? operationKey}) → RetryFuture<T> -
Executes
operationwith one-off retry configuration.
Typedefs
-
TelemetrySeverityProvider
= TelemetrySeverity Function(TelemetryEvent<
Object?> event) - Callback that can change or suppress telemetry event severity.
Exceptions / Errors
- CircuitOpenException
- Thrown when a circuit breaker rejects execution.
- RateLimitRejectedException
- Thrown when a rate limiter rejects execution.
- RetryCancelledException
- Thrown when retry execution is cancelled.
- RetryTimeoutException
- Thrown when a timeout strategy expires.