Documentation
¶
Index ¶
- type CircuitBreaker
- func (cb *CircuitBreaker) Clone() internal.Configurable
- func (cb *CircuitBreaker) Disable() *CircuitBreaker
- func (cb *CircuitBreaker) Enable() *CircuitBreaker
- func (cb *CircuitBreaker) Get() interface{}
- func (cb *CircuitBreaker) GetLabel() string
- func (cb *CircuitBreaker) Init() error
- func (cb *CircuitBreaker) IsEnabled() bool
- func (cb *CircuitBreaker) Set(data interface{})
- func (cb *CircuitBreaker) Validate() error
- type WebSocketBreaker
- func (wb *WebSocketBreaker) Clone() internal.Configurable
- func (wb *WebSocketBreaker) Disable() *WebSocketBreaker
- func (wb *WebSocketBreaker) Enable() *WebSocketBreaker
- func (wb *WebSocketBreaker) Get() interface{}
- func (wb *WebSocketBreaker) GetLabel() string
- func (wb *WebSocketBreaker) Init() error
- func (wb *WebSocketBreaker) IsEnabled() bool
- func (wb *WebSocketBreaker) Set(data interface{})
- func (wb *WebSocketBreaker) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CircuitBreaker ¶
type CircuitBreaker struct {
ModuleName string `mapstructure:"module-name" yaml:"module-name" json:"moduleName"` // 模块名称
Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` // 是否启用断路器
FailureThreshold int `mapstructure:"failure-threshold" yaml:"failure-threshold" json:"failureThreshold"` // 失败阈值
SuccessThreshold int `mapstructure:"success-threshold" yaml:"success-threshold" json:"successThreshold"` // 成功阈值
Timeout int64 `mapstructure:"timeout" yaml:"timeout" json:"timeout"` // 熔断后恢复时间
VolumeThreshold int `mapstructure:"volume-threshold" yaml:"volume-threshold" json:"volumeThreshold"` // 最小请求量阈值
SlidingWindowSize int `mapstructure:"sliding-window-size" yaml:"sliding-window-size" json:"slidingWindowSize"` // 滑动窗口大小
SlidingWindowBucket int64 `mapstructure:"sliding-window-bucket" yaml:"sliding-window-bucket" json:"slidingWindowBucket"` // 滑动窗口桶大小
PreventionPaths []string `mapstructure:"prevention-paths" yaml:"prevention-paths" json:"preventionPaths"` // 需要保护的路径
ExcludePaths []string `mapstructure:"exclude-paths" yaml:"exclude-paths" json:"excludePaths"` // 排除的路径
}
CircuitBreaker 断路器配置
func (*CircuitBreaker) Clone ¶
func (cb *CircuitBreaker) Clone() internal.Configurable
Clone 返回配置的副本
type WebSocketBreaker ¶
type WebSocketBreaker struct {
ModuleName string `mapstructure:"module-name" yaml:"module-name" json:"moduleName"` // 模块名称
Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` // 是否启用
FailureThreshold int `mapstructure:"failure-threshold" yaml:"failure-threshold" json:"failureThreshold"` // 失败阈值
SuccessThreshold int `mapstructure:"success-threshold" yaml:"success-threshold" json:"successThreshold"` // 成功阈值
Timeout int64 `mapstructure:"timeout" yaml:"timeout" json:"timeout"` // 熔断恢复时间
MaxRetries int `mapstructure:"max-retries" yaml:"max-retries" json:"maxRetries"` // 最大重试次数
RetryBackoffFactor float64 `mapstructure:"retry-backoff-factor" yaml:"retry-backoff-factor" json:"retryBackoffFactor"` // 重试退避因子
HealthCheckInterval int64 `mapstructure:"health-check-interval" yaml:"health-check-interval" json:"healthCheckInterval"` // 健康检查间隔
MessageQueueSize int `mapstructure:"message-queue-size" yaml:"message-queue-size" json:"messageQueueSize"` // 消息队列大小
}
WebSocketBreaker WebSocket 专用断路器配置
func DefaultWebSocketBreaker ¶
func DefaultWebSocketBreaker() *WebSocketBreaker
DefaultWebSocketBreaker 创建默认 WebSocket 断路器配置
func (*WebSocketBreaker) Clone ¶
func (wb *WebSocketBreaker) Clone() internal.Configurable
Clone 返回 WebSocket 断路器配置的副本
func (*WebSocketBreaker) Disable ¶
func (wb *WebSocketBreaker) Disable() *WebSocketBreaker
Disable 禁用 WebSocket 断路器
func (*WebSocketBreaker) Enable ¶
func (wb *WebSocketBreaker) Enable() *WebSocketBreaker
Enable 启用 WebSocket 断路器
Click to show internal directories.
Click to hide internal directories.