api_breaker

package
v0.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BreakResponseCode    int           `json:"break_response_code"`
	BreakResponseBody    *string       `json:"break_response_body,omitempty"`
	BreakResponseHeaders []Header      `json:"break_response_headers,omitempty"`
	MaxBreakerSec        int           `json:"max_breaker_sec"`
	Unhealthy            UnHealthCheck `json:"unhealthy"`
	Healthy              HealthCheck   `json:"healthy"`
}
type Header struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type HealthCheck

type HealthCheck struct {
	HTTPStatuses []int `json:"http_statuses"`
	Successes    *int  `json:"successes,omitempty"`
}

type Plugin

type Plugin struct {
	base.BasePlugin
	// contains filtered or unexported fields
}

func (*Plugin) Config

func (p *Plugin) Config() any

func (*Plugin) Handler

func (p *Plugin) Handler(next http.Handler) http.Handler

func (*Plugin) Init

func (p *Plugin) Init() error

func (*Plugin) PostInit

func (p *Plugin) PostInit() error

func (*Plugin) RunRequestPhase

func (p *Plugin) RunRequestPhase(w http.ResponseWriter, r *http.Request) base.RequestPhaseResult

RunRequestPhase performs the breaker decision and, on continuation, registers one request-local upstream-status observer.

func (*Plugin) SetState

func (p *Plugin) SetState(state *State)

SetState injects the generation-owned process-local counter store before PostInit. Direct package users retain an isolated fallback state.

type State

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

State owns the APISIX process-local breaker counters shared by every route and plugin instance in overlapping HTTP generations.

func NewState

func NewState() *State

func (*State) Close

func (state *State) Close()

Close releases all counters after the final generation resource lease has drained. Closed state fails open and cannot be reused.

type UnHealthCheck

type UnHealthCheck struct {
	HTTPStatuses []int `json:"http_statuses"`
	Failures     *int  `json:"failures,omitempty"`
}

Jump to

Keyboard shortcuts

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