discovery

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discovery

type Discovery interface {

	// 注册服务
	Register(*ServiceDesc) error

	// 解注册服务
	Deregister(svcid string) error

	// 根据服务名查到可用的服务
	Query(name string) (ret []*ServiceDesc, err error)

	// 注册服务变化通知
	RegisterNotify(mode string) (ret chan struct{})

	// 解除服务变化通知
	DeregisterNotify(mode string, c chan struct{})

	// https://www.consul.io/intro/getting-started/kv.html
	// 设置值
	SetValue(key string, value []byte) error

	// 获取值
	GetValue(key string) ([]byte, bool, error)
}
var (
	Default Discovery
)

type ServiceDesc

type ServiceDesc struct {
	Name string
	ID   string // 所有service中唯一的id
	Host string
	Port int
}

func (*ServiceDesc) Address

func (self *ServiceDesc) Address() string

func (*ServiceDesc) String

func (self *ServiceDesc) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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