healthcheck

package
v1.6.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 5 Imported by: 0

Documentation

Index

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) GetCode

func (r *DetectResultImp) GetCode() string

GetCode() return code

func (*DetectResultImp) GetDelay

func (r *DetectResultImp) GetDelay() time.Duration

GetDelay

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

Protocol .

func (*Proxy) SetRealPlugin

func (p *Proxy) SetRealPlugin(plug plugin.Plugin, engine model.Engine)

SetRealPlugin 设置

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL