common

package
v0.0.0-...-767ff25 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MinimumFailureCountForFailover - threshold beyond which failover can be done to the backup server
	MinimumFailureCountForFailover = 10
	// MaximumFailureDurationForFailover - max duration after which failover is attempted
	MaximumFailureDurationForFailover = 1 * time.Minute
	// MinimumSuccessCount - minimum number of successes to reset the proxy health
	MinimumSuccessCount = 5
)
View Source
const (
	DefaultCertFile             = "tls.crt"
	DefaultKeyFile              = "tls.key"
	DefaultTLSCertDirName       = "tls"
	DefaultCertDirName          = "certs"
	DefaultConfigFileName       = "config"
	DefaultConfigDir            = "deploy"
	TestConfigDir               = "test-config"
	TempConfigDir               = "test-config/tmp"
	TestConfigFileName          = "config.yaml"
	EnvCertDirName              = "X_CSI_REVPROXY_CERT_DIR"
	EnvTLSCertDirName           = "X_CSI_REVPROXY_TLS_CERT_DIR"
	EnvWatchNameSpace           = "X_CSI_REVPROXY_WATCH_NAMESPACE"
	EnvConfigFileName           = "X_CSI_REVPROXY_CONFIG_FILE_NAME"
	EnvConfigDirName            = "X_CSI_REVPROXY_CONFIG_DIR"
	EnvInClusterConfig          = "X_CSI_REVRPOXY_IN_CLUSTER"
	EnvIsLeaderElectionEnabled  = "X_CSI_REVPROXY_IS_LEADER_ENABLED"
	DefaultNameSpace            = "powermax"
	MaxActiveReadRequests       = 5
	MaxOutStandingWriteRequests = 50
	MaxActiveWriteRequests      = 4
	MaxOutStandingReadRequests  = 50
)

Constants for the proxy

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	UserName string `json:"username"`
	Password string `json:"password"`
}

Credentials represent a pair of username and password

type Envoy

type Envoy interface {
	SetPrimary(*Proxy) Envoy
	SetBackup(*Proxy) Envoy
	GetPrimary() *Proxy
	GetBackup() *Proxy
	GetActiveProxy() *Proxy
	SetPrimaryHTTPClient(*http.Client) Envoy
	SetBackupHTTPClient(*http.Client) Envoy
	GetPrimaryHTTPClient() *http.Client
	GetBackupHTTPClient() *http.Client
	GetActiveHTTPClient() *http.Client
	RemoveBackupProxy()
	RemoveBackupHTTPClient()
	ConfigureHealthParams(int, int, time.Duration)
	HasHealthDeteriorated() bool
}

Envoy is an interface for failover/failback enabled proxy clients

func NewEnvoy

func NewEnvoy(proxy *Proxy) Envoy

NewEnvoy creates an envoy object which implements Envoy interface

type Limits

type Limits struct {
	MaxActiveRead       int `yaml:"maxActiveRead,omitempty"`
	MaxActiveWrite      int `yaml:"maxActiveWrite,omitempty"`
	MaxOutStandingRead  int `yaml:"maxOutStandingRead,omitempty"`
	MaxOutStandingWrite int `yaml:"maxOutStandingWrite,omitempty"`
}

Limits is used for storing the various types of limits applied for a particular proxy instance

type LockType

type LockType string

LockType represents the type of locks being taken against Unisphere currently the supported values are Read and Write

type Proxy

type Proxy struct {
	ReverseProxy *httputil.ReverseProxy
	URL          url.URL
	Limits       Limits
}

Proxy - interface which is implemented by different types of Proxies

func (*Proxy) ModifyResponse

func (proxy *Proxy) ModifyResponse(res *http.Response) error

ModifyResponse - callback function which is called by the reverseproxy currently not implemented

type ProxyHealth

type ProxyHealth interface {
	ReportFailure() bool
	ReportSuccess()
	SetThreshold(int, int, time.Duration)
	HasDeteriorated() bool
}

ProxyHealth - interface which is implemented by the different proxies for tracking their health

func NewProxyHealth

func NewProxyHealth() ProxyHealth

NewProxyHealth - creates and returns a new proxyHealth instance

type SymmURL

type SymmURL struct {
	SymmetrixID string
	URL         url.URL
}

SymmURL - represents a combination of a symmetrix id and the corresponding management URL

type Transport

type Transport struct {
	http.RoundTripper
	HealthHandler func(bool)
}

Transport - represents the custom http transport implementation

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip - this method is called every time after the completion of the reverseproxy request

Jump to

Keyboard shortcuts

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