Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BreakerOptions ¶
BreakerOptions configures the Circuit Breaker behavior.
type CircuitBreakerStepWrapper ¶
type CircuitBreakerStepWrapper[T any] struct { BaseStep pipeline.Step[T] FallbackStep pipeline.Step[T] // contains filtered or unexported fields }
CircuitBreakerStepWrapper wraps a generation/retrieval step to provide fast failure and elegant fallback when the primary service degrades.
func WithCircuitBreakerAndFallback ¶
func WithCircuitBreakerAndFallback[T any](base pipeline.Step[T], fallback pipeline.Step[T], opts BreakerOptions) *CircuitBreakerStepWrapper[T]
WithCircuitBreakerAndFallback creates a new circuit breaker wrapper for any step type.
func (*CircuitBreakerStepWrapper[T]) Execute ¶
func (w *CircuitBreakerStepWrapper[T]) Execute(ctx context.Context, state T) error
func (*CircuitBreakerStepWrapper[T]) Name ¶
func (w *CircuitBreakerStepWrapper[T]) Name() string
type RateLimiterStepWrapper ¶
type RateLimiterStepWrapper[T any] struct { BaseStep pipeline.Step[T] // contains filtered or unexported fields }
RateLimiterStepWrapper wraps any pipeline Step with a Token Bucket rate limiter.
func WithRateLimiter ¶
func WithRateLimiter[T any](base pipeline.Step[T], limit rate.Limit, burst int) *RateLimiterStepWrapper[T]
WithRateLimiter creates a new rate limiter wrapper for any step type.
func (*RateLimiterStepWrapper[T]) Execute ¶
func (w *RateLimiterStepWrapper[T]) Execute(ctx context.Context, state T) error
func (*RateLimiterStepWrapper[T]) Name ¶
func (w *RateLimiterStepWrapper[T]) Name() string
Click to show internal directories.
Click to hide internal directories.