Documentation
¶
Index ¶
- Variables
- type Backend
- type BackendCluster
- type BackendNode
- func (b *BackendNode) Cfg() *config.Backend
- func (b *BackendNode) Fetch(rule *config.Rule, inCtx *fasthttp.RequestCtx, inReq *fasthttp.Request) (outReq *fasthttp.Request, outResp *fasthttp.Response, ...)
- func (b *BackendNode) ID() string
- func (b *BackendNode) IsHealthy() error
- func (b *BackendNode) Name() string
- func (b *BackendNode) Refresh(entry *model.Entry) error
- type Upstream
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotHealthyStatusCode = errors.New("bad status code") ErrRefreshUpstreamBadStatusCode = errors.New("invalid upstream status code") )
View Source
var ( ErrNoBackendsConfigured = errors.New("cluster: no backends configured") ErrNoRatesConfigured = errors.New("cluster: no backend rates configured") ErrAllBackendsAreBusy = errors.New("cluster: all backends are busy") ErrAllBackendsAreGone = errors.New("cluster: all backends are gone") )
Functions ¶
This section is empty.
Types ¶
type BackendCluster ¶
type BackendCluster struct {
// contains filtered or unexported fields
}
func NewBackendCluster ¶
func (*BackendCluster) Fetch ¶
func (c *BackendCluster) Fetch( rule *config.Rule, inCtx *fasthttp.RequestCtx, inReq *fasthttp.Request, ) (outReq *fasthttp.Request, outResp *fasthttp.Response, releaser func(*fasthttp.Request, *fasthttp.Response), err error)
Fetch - proxy method which takes first allowed backend and do request. Errors:
- ErrAllBackendsAreBusy
- ErrAllBackendsAreGone
type BackendNode ¶
type BackendNode struct {
// contains filtered or unexported fields
}
func NewBackend ¶
func NewBackend(cfg *config.Backend) *BackendNode
NewBackend creates a new instance of BackendNode.
func (*BackendNode) Cfg ¶
func (b *BackendNode) Cfg() *config.Backend
func (*BackendNode) Fetch ¶
func (b *BackendNode) Fetch(rule *config.Rule, inCtx *fasthttp.RequestCtx, inReq *fasthttp.Request) ( outReq *fasthttp.Request, outResp *fasthttp.Response, releaser func(*fasthttp.Request, *fasthttp.Response), err error, )
Fetch actually performs the HTTP request to backend and parses the response. Note: that rule is optional and if not provided response will not delete unavailable headers for store. Also remember that you need provide only one argument: inCtx or inReq.
func (*BackendNode) ID ¶
func (b *BackendNode) ID() string
func (*BackendNode) IsHealthy ¶
func (b *BackendNode) IsHealthy() error
func (*BackendNode) Name ¶
func (b *BackendNode) Name() string
type Upstream ¶
type Upstream interface {
Fetch(rule *config.Rule, inCtx *fasthttp.RequestCtx, inReq *fasthttp.Request) (
outReq *fasthttp.Request, outResp *fasthttp.Response, releaser func(*fasthttp.Request, *fasthttp.Response), err error,
)
Refresh(entry *model.Entry) error
}
Upstream defines the interface for external backends. Note: you need provide just one argument of inCtx or inReq.
Click to show internal directories.
Click to hide internal directories.