sre

package
v0.1.30 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotAllowed = errors.New("circuitbreaker: not allowed for circuit open")

Functions

This section is empty.

Types

type Opt added in v0.1.10

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

SreBreaker google sre 弹性熔断器

type Option added in v0.1.10

type Option func(*Opt)

SreBreaker google sre 弹性熔断器

func WithK added in v0.1.10

func WithK(k float64) Option

func WithPolicyOption added in v0.1.14

func WithPolicyOption(policy ...window.Option) Option

func WithRequest added in v0.1.10

func WithRequest(request uint64) Option

type SreBreaker

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

SreBreaker google sre 弹性熔断器

func NewSreBreaker

func NewSreBreaker(opts ...Option) *SreBreaker

func (*SreBreaker) Allow

func (s *SreBreaker) Allow() error

Allow 是否允许改请求通过, 如果返回 error 说明被熔断了

func (*SreBreaker) MarkFailed

func (s *SreBreaker) MarkFailed()

MarkFailed 标记失败

func (*SreBreaker) MarkSuccess

func (s *SreBreaker) MarkSuccess()

MarkSuccess 标记成功

Jump to

Keyboard shortcuts

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