healthcheck

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 4 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
}

DetectResult 健康探测结果

type DetectResultImp

type DetectResultImp struct {
	Success        bool
	DetectTime     time.Time      // 探测时间
	DetectInstance model.Instance // 探测的实例
}

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

func (r *DetectResultImp) IsSuccess() bool

GetDetectType 探测类型,与探测插件名相同

type HealthChecker

type HealthChecker interface {
	plugin.Plugin
	// 对单个实例进行探测,返回探测结果
	// DetectInstance 每个探测方法自己去判断当前周期是否需要探测,如果无需探测,则返回nil
	DetectInstance(model.Instance) (DetectResult, error)
}

HealthChecker 【扩展点接口】主动健康探测策略

type Proxy

type Proxy struct {
	HealthChecker
	// contains filtered or unexported fields
}

proxy of HealthChecker

func (*Proxy) DetectInstance

func (p *Proxy) DetectInstance(inst model.Instance) (DetectResult, error)

proxy HealthChecker DetectInstance

func (*Proxy) SetRealPlugin

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

设置

Jump to

Keyboard shortcuts

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