discovery

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const CustomizeLB = "customize"

Variables

View Source
var ErrLoadBalancingPolicy = errors.New("LoadBalancingPolicy is empty or not supported")
View Source
var ErrNoMatchFoundConn = errors.New("no match found conn")
View Source
var ErrNotGetRightConn = errors.New("did not get the right conn")

Functions

func BuildCtxFilter

func BuildCtxFilter(ctx context.Context, data map[string]string) context.Context

func GetNodeInfo

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

func NewDiscovery

func NewDiscovery(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

func SetVersion

func SetVersion(version string) ClientOptions

type Discovery

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

func (*Discovery) AddNode

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

func (*Discovery) Build

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

func (*Discovery) Close

func (s *Discovery) Close()

func (*Discovery) DelNode

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

func (*Discovery) GetAddress

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

func (*Discovery) ResolveNow

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

func (*Discovery) Scheme

func (d *Discovery) Scheme() string

type NodeArray

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

type Options

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

Jump to

Keyboard shortcuts

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