discovery

package
v0.0.0-...-d4bbc0e Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndpointInfo

type EndpointInfo struct {
	IP       string                 `json:"ip"`
	Port     string                 `json:"port"`
	MetaData map[string]interface{} `json:"meta"`
}

func UnMarshal

func UnMarshal(data []byte) (*EndpointInfo, error)

[]byte -> endpointInfo

func (*EndpointInfo) Marshal

func (edi *EndpointInfo) Marshal() string

endpointInfo -> []byte -> string

type ServiceDiscovery

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

服务发现

func NewServiceDiscovery

func NewServiceDiscovery(ctx *context.Context) *ServiceDiscovery

新建服务发现

func (*ServiceDiscovery) Close

func (s *ServiceDiscovery) Close() error

func (*ServiceDiscovery) WatchService

func (s *ServiceDiscovery) WatchService(prefix string, set, del func(key, value string)) error

初始化服务列表和监视

type ServiceRegister

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

创建租约注册服务

func NewServiceRegister

func NewServiceRegister(ctx *context.Context, key string, endPointInfo *EndpointInfo, lease int64) (*ServiceRegister, error)

新建注册服务

func (*ServiceRegister) Close

func (s *ServiceRegister) Close() error

func (*ServiceRegister) ListenLeaseRespChan

func (s *ServiceRegister) ListenLeaseRespChan()

监听/续租情况

func (*ServiceRegister) UpdateValue

func (s *ServiceRegister) UpdateValue(val *EndpointInfo) error

Jump to

Keyboard shortcuts

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