zerobreaker

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package zerobreaker

Package zerobreaker

Index

Constants

This section is empty.

Variables

View Source
var ErrServiceUnavailable = errors.New("circuit breaker is open")

ErrServiceUnavailable is returned when the Breaker state is open.

Functions

func NewBreaker

func NewBreaker(name string, opts ...Option) circuitbreaker.Breaker

NewBreaker returns a Breaker object. opts can be used to customize the Breaker.

Types

type Option

type Option func(breaker *circuitBreaker)

Option defines the method to customize a Breaker.

func WithName

func WithName(name string) Option

WithName returns a function to set the name of a Breaker.

type Promise

type Promise interface {
	// Accept tells the Breaker that the call is successful.
	Accept()
	// Reject tells the Breaker that the call is failed.
	Reject(reason string)
}

Promise interface defines the callbacks that returned by Breaker.Allow.

Directories

Path Synopsis
Package util
Package util

Jump to

Keyboard shortcuts

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