backend

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Srv

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

Srv represents a backend server instance.

func NewServer

func NewServer(beSrvCfg engine.Server) (Srv, error)

NewServer creates a backend server from a config fetched from a storage engine.

func (*Srv) Cfg

func (s *Srv) Cfg() engine.Server

Cfg returns engine.Server config of the backend server instance.

func (*Srv) URL

func (s *Srv) URL() *url.URL

URL return the backend server URL.

func (*Srv) URLKey

func (s *Srv) URLKey() SrvURLKey

URLKey returns the backend server SrvURLKey to be used as a key in maps.

type SrvURLKey

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

SrvURLKey represents a server URL when it needs to be used as a map key.

func NewSrvURLKey

func NewSrvURLKey(u *url.URL) SrvURLKey

NewSrvURLKey creates an SrvURLKey from a server URL.

type T

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

T represents a backend type. It maintains a list of backend servers and returns them via Snapshot() functions.

func New

func New(beCfg engine.Backend, opts proxy.Options, beSrvs []Srv) (*T, error)

New creates a new backend instance from a config fetched from a storage engine and proxy options. An initial list of backend servers can be provided.

func (*T) Close

func (be *T) Close() error

Close closes all idle connections to backends.

func (*T) DeleteServer

func (be *T) DeleteServer(beSrvKey engine.ServerKey) bool

DeleteServer deletes a new backend server.

func (*T) HTTPBackendSettings added in v0.9.2

func (be *T) HTTPBackendSettings() engine.HTTPBackendSettings

func (*T) Key

func (be *T) Key() engine.BackendKey

Key returns storage backend key.

func (*T) Server

func (be *T) Server(beSrvKey engine.ServerKey) (Srv, bool)

Server returns a backend server by a storage key if exists.

func (*T) Snapshot

func (be *T) Snapshot() (*http.Transport, []Srv)

Snapshot returns configured HTTP transport instance and a list of backend servers. Due to copy-on-write semantic it is the returned server list is immutable from callers prospective and it is efficient to call this function as frequently as you want for it won't make excessive allocations.

func (*T) String

func (be *T) String() string

String returns string backend representation to be used in logs.

func (*T) Update

func (be *T) Update(beCfg engine.Backend, opts proxy.Options) (bool, error)

Update updates the instance configuration.

func (*T) UpsertServer

func (be *T) UpsertServer(beSrvCfg engine.Server) (bool, error)

UpsertServer upserts a new backend server.

Jump to

Keyboard shortcuts

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