discovery

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_CONSUL = "consul.rightpaddle.cn:8500"
)

Variables

This section is empty.

Functions

func Init added in v0.1.3

func Init(consulAddress string) *consulapi.Client

func NewDiscovery

func NewDiscovery(name, serviceName string, meta map[string]string, localIp string, port int, consuleAddress string) proto.IDiscovery

func NewRegistration

func NewRegistration(name, serviceName string, tags []string, meta map[string]string, advt string, port int, consulAddress string) proto.IRegister

Types

type Discovery

type Discovery struct {
	proto.IService
	proto.IRegister
	LocalIp string
	Port    int
}

func (*Discovery) GetService

func (dc *Discovery) GetService(blocking bool) ([]proto.IService, error)

func (*Discovery) RegisterService

func (dc *Discovery) RegisterService(service proto.IService)

type Registration

type Registration struct {
	Id          string
	ServiceName string
	Advt        string
	Port        int

	Meta map[string]string
	Tags []string

	LastIndex uint64
	// contains filtered or unexported fields
}

func (*Registration) GetAddr

func (reg *Registration) GetAddr() string

func (*Registration) GetAddressWithPort added in v0.1.6

func (reg *Registration) GetAddressWithPort() string

func (*Registration) GetHost added in v0.1.3

func (reg *Registration) GetHost() string

func (*Registration) GetMeta

func (reg *Registration) GetMeta() map[string]string

func (*Registration) GetMetaValue added in v0.1.1

func (reg *Registration) GetMetaValue(key string) string

func (*Registration) GetName

func (reg *Registration) GetName() string

func (*Registration) GetPort added in v0.1.3

func (reg *Registration) GetPort() int

func (*Registration) GetService

func (reg *Registration) GetService(blocking bool) ([]proto.IService, error)

func (*Registration) GetServiceName added in v0.1.6

func (reg *Registration) GetServiceName() string

func (*Registration) GetTags added in v0.1.1

func (reg *Registration) GetTags() []string

func (*Registration) Register

func (reg *Registration) Register(nodeName, serviceName string, tags []string, meta map[string]string, advt string, port int)

func (*Registration) Unregister

func (reg *Registration) Unregister()

type Service

type Service struct {
	Name        string
	ServiceName string
	Meta        map[string]string
	Addr        string
	Host        string
	Port        int
}

func (*Service) GetAddr

func (sv *Service) GetAddr() string

func (*Service) GetHost added in v0.1.3

func (sv *Service) GetHost() string

func (*Service) GetMeta

func (sv *Service) GetMeta() map[string]string

func (*Service) GetMetaValue

func (sv *Service) GetMetaValue(key string) string

func (*Service) GetName

func (sv *Service) GetName() string

func (*Service) GetPort added in v0.1.3

func (sv *Service) GetPort() int

func (*Service) GetServiceName added in v0.1.6

func (sv *Service) GetServiceName() string

func (*Service) GetTags

func (sv *Service) GetTags() []string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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