Documentation ¶
Index ¶
- type DetectResult
- type DetectResultImp
- func (r *DetectResultImp) GetCode() string
- func (r *DetectResultImp) GetDelay() time.Duration
- func (r *DetectResultImp) GetDetectInstance() model.Instance
- func (r *DetectResultImp) GetDetectTime() time.Time
- func (r *DetectResultImp) GetRetStatus() model.RetStatus
- func (r *DetectResultImp) IsSuccess() bool
- type HealthChecker
- type Proxy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DetectResult ¶
type DetectResult interface { // IsSuccess 是否探测成功 IsSuccess() bool // GetDetectTime 本次探测时间 GetDetectTime() time.Time // GetDetectInstance 探测是实例 GetDetectInstance() model.Instance // GetCode() return code GetCode() string // GetDelay GetDelay() time.Duration // GetRetStatus GetRetStatus() model.RetStatus }
DetectResult 健康探测结果
type DetectResultImp ¶
type DetectResultImp struct { Success bool DetectTime time.Time // 探测时间 DetectInstance model.Instance // 探测的实例 Code string }
DetectResultImp 探活返回的结果,plugin.DetectResult的实现
func (*DetectResultImp) GetDetectInstance ¶
func (r *DetectResultImp) GetDetectInstance() model.Instance
GetDetectInstance 获取探活的实例
func (*DetectResultImp) GetDetectTime ¶
func (r *DetectResultImp) GetDetectTime() time.Time
GetDetectTime 探测时间
func (*DetectResultImp) GetRetStatus ¶
func (r *DetectResultImp) GetRetStatus() model.RetStatus
func (*DetectResultImp) IsSuccess ¶
func (r *DetectResultImp) IsSuccess() bool
IsSuccess 探测类型,与探测插件名相同
type HealthChecker ¶
type HealthChecker interface { plugin.Plugin // DetectInstance 对单个实例进行探测,返回探测结果, 每个探测方法自己去判断当前周期是否需要探测,如果无需探测,则返回nil DetectInstance(model.Instance, *fault_tolerance.FaultDetectRule) (DetectResult, error) // Protocol . Protocol() fault_tolerance.FaultDetectRule_Protocol }
HealthChecker 【扩展点接口】主动健康探测策略
type Proxy ¶
type Proxy struct { HealthChecker // contains filtered or unexported fields }
Proxy .proxy of HealthChecker
func (*Proxy) DetectInstance ¶
func (p *Proxy) DetectInstance(inst model.Instance, rule *fault_tolerance.FaultDetectRule) (DetectResult, error)
DetectInstance proxy HealthChecker DetectInstance
func (*Proxy) Protocol ¶
func (p *Proxy) Protocol() fault_tolerance.FaultDetectRule_Protocol
Protocol .
Click to show internal directories.
Click to hide internal directories.