Documentation
¶
Index ¶
- type Backend
- func (c *Backend) CheckAndSet(ctx context.Context, key string, expected string, newValue string, ...) (bool, error)
- func (c *Backend) Close() error
- func (c *Backend) Delete(ctx context.Context, key string) error
- func (c *Backend) Get(ctx context.Context, key string) (string, error)
- func (c *Backend) GetCircuitBreakerFailureCount() int32
- func (c *Backend) GetCircuitBreakerState() breakerState
- func (c *Backend) Set(ctx context.Context, key string, value string, expiration time.Duration) error
- type BreakerConfig
- type CheckerConfig
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend provides automatic failover capability for rate limiting storage
func (*Backend) CheckAndSet ¶
func (c *Backend) CheckAndSet(ctx context.Context, key string, expected string, newValue string, expiration time.Duration) (bool, error)
CheckAndSet performs atomic compare-and-set with failover logic
func (*Backend) GetCircuitBreakerFailureCount ¶
GetCircuitBreakerFailureCount returns the internal failure count (for testing/debugging)
func (*Backend) GetCircuitBreakerState ¶
func (c *Backend) GetCircuitBreakerState() breakerState
GetCircuitBreakerState returns current circuit breaker state (for monitoring)
type BreakerConfig ¶
type BreakerConfig struct {
FailureThreshold int32 // Number of failures before tripping
RecoveryTimeout time.Duration // Time to wait before trying primary again
}
BreakerConfig holds configuration for circuit breaker
type CheckerConfig ¶
type CheckerConfig = healthchecker.Config
CheckerConfig is an alias for healthchecker.Config for backward compatibility
type Config ¶
type Config struct {
Primary backends.Backend // Primary/preferred backend
Secondary backends.Backend // Secondary/fallback backend
CircuitBreaker BreakerConfig // Circuit breaker configuration
HealthChecker CheckerConfig // Health check configuration (alias for backward compatibility)
}
Config holds configuration for the composite backend
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a configuration with sensible defaults
func (*Config) SetDefaults ¶
func (c *Config) SetDefaults()
SetDefaults sets reasonable defaults for configuration values
Click to show internal directories.
Click to hide internal directories.