etcd

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ETCD

type ETCD struct {
	Address []string      //注册地址
	Timeout time.Duration //注册超时时长
	// contains filtered or unexported fields
}

ETCD etcd客户端包装信息

func (*ETCD) Close added in v1.0.3

func (e *ETCD) Close()

func (*ETCD) Discover

func (e *ETCD) Discover(name string) error

func (*ETCD) Register

func (e *ETCD) Register(opt Option) (string, error)

func (*ETCD) ServerNode added in v1.0.6

func (e *ETCD) ServerNode(name string) ([]string, error)

func (*ETCD) Unregister

func (e *ETCD) Unregister() error

func (*ETCD) Watch

func (e *ETCD) Watch(name string)

type Option

type Option struct {
	Name    string //服务名称
	Address string //服务GRPC地址
	Version string //服务版本
}

Option 服务信息

type Registry

type Registry interface {
	Register(Option) (string, error)     //注册
	Unregister() error                   //反注册
	Discover(string) error               //发现所有服务
	ServerNode(string) ([]string, error) //获取服务节点地址
	Watch(string)                        //监控
	Close()                              //关闭
}

Registry 获取etcd客户端

func NewEtcdClient

func NewEtcdClient(opt *ETCD) (Registry, error)

NewEtcdClient etcd客户端

Jump to

Keyboard shortcuts

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