Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Interceptor ¶
func Interceptor(cb CircuitBreaker) grpc.UnaryClientInterceptor
Interceptor 熔断器拦截器
Types ¶
type CircuitBreaker ¶
type CircuitBreaker interface {
// Execute 执行请求
Execute(ctx context.Context, run func() error, fallback func(error) error) error
// State 获取当前状态
State() State
}
CircuitBreaker 断路器接口
func NewCircuitBreaker ¶
func NewCircuitBreaker(options ...Option) CircuitBreaker
type Option ¶
type Option func(*circuitBreaker)
Option 断路器配置选项
func WithFailureThreshold ¶
WithFailureThreshold 设置故障阈值
func WithHalfOpenRetryInterval ¶
WithHalfOpenRetryInterval 设置半开状态重试间隔
func WithIsFailureFunc ¶
WithIsFailureFunc 设置错误判断函数
func WithSuccessThreshold ¶
WithSuccessThreshold 设置成功阈值
Click to show internal directories.
Click to hide internal directories.