failover

package
v2.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Failover

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

Failover is an http.Handler that can forward requests to the fallback handler when the main handler status is down.

func New

func New(hc *dynamic.HealthCheck) *Failover

New creates a new Failover handler.

func (*Failover) RegisterStatusUpdater

func (f *Failover) RegisterStatusUpdater(fn func(up bool)) error

RegisterStatusUpdater adds fn to the list of hooks that are run when the status of the Failover changes. Not thread safe.

func (*Failover) ServeHTTP

func (f *Failover) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Failover) SetFallbackHandler

func (f *Failover) SetFallbackHandler(handler http.Handler)

SetFallbackHandler sets the fallback http.Handler.

func (*Failover) SetFallbackHandlerStatus

func (f *Failover) SetFallbackHandlerStatus(ctx context.Context, up bool)

SetFallbackHandlerStatus sets the fallback handler status.

func (*Failover) SetHandler

func (f *Failover) SetHandler(handler http.Handler)

SetHandler sets the main http.Handler.

func (*Failover) SetHandlerStatus

func (f *Failover) SetHandlerStatus(ctx context.Context, up bool)

SetHandlerStatus sets the main handler status.

Jump to

Keyboard shortcuts

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