discovery

package
v0.0.0-...-680e691 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance interface {
	Id() string
	Addr() string
	Weight() uint32
	Tags() map[string]string
}

func NewInstance

func NewInstance(id, addr string, weight uint32, tags map[string]string) Instance

type Resolver

type Resolver interface {
	Name() string
	Resolve(ctx context.Context, service string) (*Result, error)
	Close() error
}

Resolver 用于解析service

可以是基于registry的服务发现
也可以是基于DNS的域名解析
或者返回固定IP

type Result

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

func NewResult

func NewResult(instances []Instance) *Result

func (*Result) Empty

func (r *Result) Empty() bool

func (*Result) HashCode

func (r *Result) HashCode() uint32

func (*Result) Instances

func (r *Result) Instances() []Instance

func (*Result) Len

func (r *Result) Len() int

func (*Result) Remove

func (r *Result) Remove(id string)

func (*Result) SetInstances

func (r *Result) SetInstances(ins []Instance)

func (*Result) Upsert

func (r *Result) Upsert(ins Instance)

Upsert 添加或更新

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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