Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotAvailable is returned when no upstream endpoint is available. ErrNotAvailable = errors.New("no available upstream at the moment") )
Functions ¶
func Register ¶
func Register(names []string, h CreateBalancerHandler) error
Register registers a balancer handler under the given names.
Types ¶
type Balancer ¶
type Balancer interface {
Select(ctx context.Context, hzCtx *app.RequestContext) (*target.Endpoint, error)
}
Balancer selects an endpoint from available upstream targets.
type CreateBalancerHandler ¶
CreateBalancerHandler is a function that creates a Balancer from endpoints and params.
func Factory ¶
func Factory(name string) CreateBalancerHandler
Factory returns the registered balancer handler for the given name.
Click to show internal directories.
Click to hide internal directories.