circuitbreaker

package
v1.6.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 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 CircuitBreaker

type CircuitBreaker interface {
	plugin.Plugin
	// CheckResource get the resource circuitbreaker status
	CheckResource(model.Resource) model.CircuitBreakerStatus
	// Report report resource invoke result stat
	Report(*model.ResourceStat) error
}

CircuitBreaker 【扩展点接口】资源熔断(实例熔断、方法熔断、服务熔断)

type Proxy

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

Proxy .proxy of InstanceCircuitBreaker

func (*Proxy) CheckResource

func (p *Proxy) CheckResource(res model.Resource) model.CircuitBreakerStatus

Stat proxy InstanceCircuitBreaker stat

func (*Proxy) Report

func (p *Proxy) Report(stat *model.ResourceStat) error

CircuitBreak proxy InstanceCircuitBreaker CircuitBreak

func (*Proxy) SetRealPlugin

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

SetRealPlugin 设置

type Result

type Result struct {
	Now time.Time
	// 需要开启熔断器的实例ID
	InstancesToOpen model.HashSet
	// 需要转换成半开状态的实例ID
	InstancesToHalfOpen model.HashSet
	// 需要关闭熔断器的实例ID
	InstancesToClose model.HashSet
	// 该熔断器在实例进入半开状态后最多允许的请求数
	RequestCountAfterHalfOpen int
}

Result 熔断结算结果

func NewCircuitBreakerResult

func NewCircuitBreakerResult(now time.Time) *Result

NewCircuitBreakerResult 创建熔断结果对象

func (*Result) IsEmpty

func (r *Result) IsEmpty() bool

IsEmpty result has status changing instances

func (*Result) Merge

func (r *Result) Merge(result *Result)

Merge merge results

Jump to

Keyboard shortcuts

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