lbagent

package
v0.0.0-...-288f2f5 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: GPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

func New

func New(name string, tags map[string]string, dialer Dialer) *Agent

New creates and returns a new Agent with the specified name and tags. The other parameters are required to establish a GRPC connection to the load balancer registry.

func (*Agent) Inc

func (a *Agent) Inc(n uint64)

Inc increments the internal request counter by the specified amount.

func (*Agent) RegisterUtilization

func (a *Agent) RegisterUtilization(dimension string, kind lbpb.Utilization_Kind, fn UtilFunc)

RegisterUtilization registers an utilization callback for the specified dimension. Must be called before Start(). Registering multiple callbacks for the same dimension will produce unpredictable results.

func (*Agent) SetReady

func (a *Agent) SetReady(ready bool)

SetReady tells the Agent if we're ready to serve or not.

func (*Agent) SetUpdateInterval

func (a *Agent) SetUpdateInterval(interval time.Duration)

SetUpdateInterval tells the Agent how often to send status updates. Must be called before Start().

func (*Agent) Start

func (a *Agent) Start()

Start the Agent in the background. Will return immediately.

func (*Agent) Stop

func (a *Agent) Stop()

Stop the Agent.

type Dialer

type Dialer interface {
	Update(context.Context, *lbpb.NodeStatus) error
	Close()
}

func NewGRPCDialer

func NewGRPCDialer(lbAddr string, grpcOpts ...grpc.DialOption) (Dialer, error)

type UtilFunc

type UtilFunc func() float64

Jump to

Keyboard shortcuts

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