discover

package
v5.1.2-release+incompa... Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2019 License: LGPL-3.0 Imports: 14 Imported by: 66

README

数据中心内部服务发现包

基于ETCD实现

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback interface {
	UpdateEndpoints(endpoints ...*config.Endpoint)
	//when watch occurred error,will exec this method
	Error(error)
}

Callback 每次返回全部节点

type CallbackUpdate

type CallbackUpdate interface {
	//TODO:
	//weight自动发现更改实现暂时不 Ready
	UpdateEndpoints(operation config.Operation, endpoints ...*config.Endpoint)
	//when watch occurred error,will exec this method
	Error(error)
}

CallbackUpdate 每次返还变化

type Discover

type Discover interface {
	AddProject(name string, callback Callback)
	AddUpdateProject(name string, callback CallbackUpdate)
	Stop()
}

Discover 后端服务自动发现

func GetDiscover

func GetDiscover(opt config.DiscoverConfig) (Discover, error)

GetDiscover 获取服务发现管理器

type KeepAlive

type KeepAlive struct {
	EtcdEndpoint []string
	ServerName   string
	HostName     string
	Endpoint     string
	TTL          int64
	LID          clientv3.LeaseID
	Done         chan struct{}
	// contains filtered or unexported fields
}

KeepAlive 服务注册

func CreateKeepAlive

func CreateKeepAlive(EtcdEndpoint []string, ServerName string, HostName string, HostIP string, Port int) (*KeepAlive, error)

CreateKeepAlive create keepalive for server

func (*KeepAlive) Start

func (k *KeepAlive) Start() error

Start 开始

func (*KeepAlive) Stop

func (k *KeepAlive) Stop() error

Stop 结束

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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