registry

package
v0.0.0-...-b9bbc83 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

Option 设置服务注册参数

func Addresses

func Addresses(addresses []string) Option

Addresses 设置etcd地址

func Password

func Password(password string) Option

Password 设置etcd密码

func Prefix

func Prefix(prefix string) Option

Prefix 设置服务发现前缀

func TTL

func TTL(ttl time.Duration) Option

TTL 设置服务存活时间

func Timeout

func Timeout(timeout time.Duration) Option

Timeout 设置etcd超时时间

func Username

func Username(userName string) Option

Username 设置etcd用户名

type Options

type Options struct {
	Addresses []string      // etcd地址
	Username  string        // etcd用户名
	Password  string        // etcd密码
	Prefix    string        //服务注册前缀
	Timeout   time.Duration // etcd超时时间
	TTL       time.Duration // 服务存活时间
}

Options 服务注册参数

func (*Options) CreateServiceKey

func (c *Options) CreateServiceKey(srv *service.Service) string

CreateServiceKey 生成服务注册key

type Registry

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

Registry 服务注册主件

func NewRegistry

func NewRegistry(srv *service.Service, opts ...Option) *Registry

NewRegistry 创建服务注册组件

func (*Registry) Start

func (c *Registry) Start() error

Start 开启服务注册

func (*Registry) Stop

func (c *Registry) Stop() error

Stop 停止服务注册

Jump to

Keyboard shortcuts

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