registry

package
v0.0.0-...-f1b2c4c Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalIP

func GetLocalIP() (ip string, err error)

Types

type AppMeta

type AppMeta struct {
	IP       string `json:"ip"`
	Port     int    `json:"port"`
	Weight   int    `json:"weight"`
	MetaData string `json:"meta_data"`
}

type EtcdConf

type EtcdConf struct {
	Endpoints         []string      `yaml:"endpoints"`
	DialTimeout       time.Duration `yaml:"dial_timeout"`
	DialKeepAliveTime time.Duration `yaml:"dial_keepalive_time"`
	LeaseTTL          int64         `yaml:"lease_ttl"`
}

type EtcdRegistryCenter

type EtcdRegistryCenter struct {
	ErrC chan error
	// contains filtered or unexported fields
}

func NewEtcdRegistryCenter

func NewEtcdRegistryCenter(ctx context.Context, conf *EtcdConf) (reg *EtcdRegistryCenter, err error)

func (*EtcdRegistryCenter) GetServices

func (reg *EtcdRegistryCenter) GetServices(name string) (metas []AppMeta, err error)

func (*EtcdRegistryCenter) Register

func (reg *EtcdRegistryCenter) Register(name string, meta *AppMeta) error

func (*EtcdRegistryCenter) UnRegister

func (reg *EtcdRegistryCenter) UnRegister(name string) (err error)

type RegisterCenter

type RegisterCenter interface {
	Register(name string, meta *AppMeta) error
	UnRegister(name string) error
	GetServices(name string) ([]AppMeta, error)
}

type RegistryConf

type RegistryConf struct {
	Etcd *EtcdConf `yaml:"etcd"`
}

Jump to

Keyboard shortcuts

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