Documentation ¶
Overview ¶
Example ¶
This is a example of using a circuit breaker Do() when return nil.
package main import ( "fmt" "github.com/go-kratos/aegis/circuitbreaker/sre" ) func main() { b := sre.NewBreaker() for i := 0; i < 1000; i++ { b.MarkSuccess() } for i := 0; i < 100; i++ { b.MarkFailed() } err := b.Allow() fmt.Printf("err=%v", err) }
Output: err=<nil>
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotAllowed = errors.New("circuitbreaker: not allowed for circuit open")
ErrNotAllowed error not allowed.
Functions ¶
This section is empty.
Types ¶
type CircuitBreaker ¶
type CircuitBreaker interface { Allow() error MarkSuccess() MarkFailed() }
CircuitBreaker is a circuit breaker.
Click to show internal directories.
Click to hide internal directories.