client

package
v0.0.0-...-746c951 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

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 New

func New(addr string) (*Client, error)

New is the constructor for Client. addr is the server's [host]:[port].

func (*Client) AddBackend

func (c *Client) AddBackend(ctx context.Context, pattern string, b Backend) error

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

func (c *Client) RemoveBackend(ctx context.Context, pattern string, b Backend) error

RemoveBackend removes backend "b" from the pool serving "pattern".

func (*Client) RemovePool

func (c *Client) RemovePool(ctx context.Context, pattern string) error

RemovePool removes the pool that is 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 IPBackend

type IPBackend struct {
	IP      net.IP
	Port    int32
	URLPath string
}

IPBackend implements Backend.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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