loadbalence

package
v0.0.0-...-90f907d Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const UsageLB = "usageLB"

Variables

View Source
var ErrLoadBalancingPolicy = errors.New("LoadBalancingPolicy is empty or not apply")

Functions

func GetNodeInfo

func GetNodeInfo(attr resolver.Address) *register.Options

func NewUsageLB

func NewUsageLB(opt ...ClientOptions) (resolver.Builder, error)

func SetNodeInfo

func SetNodeInfo(addr resolver.Address, hInfo *register.Options) resolver.Address

Types

type ClientOptions

type ClientOptions func(*Options)

func SetEtcdConf

func SetEtcdConf(conf clientv3.Config) ClientOptions

func SetLoadBalancingPolicy

func SetLoadBalancingPolicy(name string) ClientOptions

func SetName

func SetName(name string) ClientOptions

type NodeArray

type NodeArray struct {
	Node []register.Options `json:"node"`
}

type Opt

type Opt struct {
	*register.Options
	// contains filtered or unexported fields
}

type Options

type Options struct {
	EtcdConf            clientv3.Config `json:"-"`
	SrvName             string
	LoadBalancingPolicy string
}

type ULBPicker

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

func (*ULBPicker) Pick

func (*ULBPicker) RandNode

func (p *ULBPicker) RandNode() balancer.SubConn

type ULbPickerBuild

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

func (*ULbPickerBuild) Build

type UsageLBConf

type UsageLBConf struct {
	Node sync.Map
	// contains filtered or unexported fields
}

func (*UsageLBConf) AddNode

func (d *UsageLBConf) AddNode(key, val []byte) error

func (*UsageLBConf) Build

Build 当调用`grpc.Dial()`时执行

func (*UsageLBConf) Close

func (s *UsageLBConf) Close()

func (*UsageLBConf) DelNode

func (d *UsageLBConf) DelNode(key []byte) error

func (*UsageLBConf) GetAddress

func (d *UsageLBConf) GetAddress() []resolver.Address

func (*UsageLBConf) ResolveNow

func (s *UsageLBConf) ResolveNow(rn resolver.ResolveNowOptions)

func (*UsageLBConf) Scheme

func (d *UsageLBConf) Scheme() string

Jump to

Keyboard shortcuts

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