trigger

package
v1.6.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToErrorRateThreshold

func ToErrorRateThreshold(errorRatePercent int) float64

ToErrorRateThreshold 转换成熔断错误率阈值

Types

type ConsecutiveCounter

type ConsecutiveCounter struct {
	// contains filtered or unexported fields
}

func NewConsecutiveCounter

func NewConsecutiveCounter(name string, opt *Options) *ConsecutiveCounter

func (*ConsecutiveCounter) Report

func (c *ConsecutiveCounter) Report(success bool)

type ErrRateCounter

type ErrRateCounter struct {
	// contains filtered or unexported fields
}

func NewErrRateCounter

func NewErrRateCounter(name string, opt *Options) *ErrRateCounter

func (*ErrRateCounter) Report

func (c *ErrRateCounter) Report(success bool)

type Options

type Options struct {
	Resource      model.Resource
	Condition     *fault_tolerance.TriggerCondition
	StatusHandler StatusChangeHandler
	Log           log.Logger
	DelayExecutor func(delay time.Duration, f func())
}

Options

type StatusChangeHandler

type StatusChangeHandler interface {
	// CloseToOpen
	CloseToOpen(breaker string)
	// OpenToHalfOpen
	OpenToHalfOpen()
	// HalfOpenToClose
	HalfOpenToClose()
	// HalfOpenToOpen
	HalfOpenToOpen()
}

StatusChangeHandler

type TriggerCounter

type TriggerCounter interface {
	// Report .
	Report(success bool)
}

TriggerCounter .

Jump to

Keyboard shortcuts

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