Documentation ¶
Index ¶
- type Backend
- type Client
- func (c *Client) AddBackend(ctx context.Context, pattern string, b Backend) error
- func (c *Client) AddPool(ctx context.Context, pattern string, pt pb.PoolType, hcs HealthChecks) error
- func (c *Client) PoolHealth(ctx context.Context, pattern string, healthy, sick bool) (*pb.PoolHealth, error)
- func (c *Client) RemoveBackend(ctx context.Context, pattern string, b Backend) error
- func (c *Client) RemovePool(ctx context.Context, pattern string) error
- type HealthCheck
- type HealthChecks
- type IPBackend
- type StatusCheck
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
// contains filtered or unexported methods
}
Backend represents a load balancer backend.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client to the Quote of the day server.
func (*Client) AddBackend ¶
AddBackend adds backend "b" from the pool serving "pattern".
func (*Client) AddPool ¶
func (c *Client) AddPool(ctx context.Context, pattern string, pt pb.PoolType, hcs HealthChecks) error
AddPool adds a pool that serves "pattern" using a PoolType that controls how the pool load balances traffic and a HealthCheck to determine if a node is healthy.
func (*Client) PoolHealth ¶
func (c *Client) PoolHealth(ctx context.Context, pattern string, healthy, sick bool) (*pb.PoolHealth, error)
PoolHealth queries the server for the health of the pool that serves "pattern". healthy and sick determine what node information is included.
func (*Client) RemoveBackend ¶
RemoveBackend removes backend "b" from the pool serving "pattern".
type HealthCheck ¶
type HealthCheck interface {
// contains filtered or unexported methods
}
HealthCheck defines a health check that must pass for a backend in a Pool to be considered healthy.
type HealthChecks ¶
type HealthChecks struct { // HealthChecks are the checks to run against the backends. HealthChecks []HealthCheck // Interval is the between checks. Interval time.Duration }
HealthChecks are a set of backend health checks that a backend must pass in order to be considered healthy.
type StatusCheck ¶
type StatusCheck struct { // URLPath is the path to the health status page, like "/health". URLPath string // HealthValues are values that the URLPath can return and the service // is considered healthy. HealthyValues []string }
StatusCheck implements HealthCheck to check a node at "URLPath" for any string in "HealthyValues". If found, the node is said to be healthy.