discovery

package
v0.0.0-...-01d145f Latest Latest
Warning

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

Go to latest
Published: Jan 28, 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)

func (*EndPointInfo) Marshal

func (e *EndPointInfo) Marshal() string

type ServiceDiscovery

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

ServiceDiscovery 服务发现

func NewServiceDiscovery

func NewServiceDiscovery(ctx *context.Context) *ServiceDiscovery

NewServiceDiscovery 新建服务发现

func (*ServiceDiscovery) Close

func (s *ServiceDiscovery) Close() error

func (*ServiceDiscovery) WatchService

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

WatchService 初始化服务列表和监听

type ServiceRegister

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

ServiceRegister 服务发现

func NewServiceRegister

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

NewServiceRegister 新增注册服务

func (*ServiceRegister) Close

func (s *ServiceRegister) Close() error

func (*ServiceRegister) ListenLeaseRespChan

func (s *ServiceRegister) ListenLeaseRespChan()

ListenLeaseRespChan 监听续租情况

func (*ServiceRegister) UpdateValue

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

UpdateValue 更新服务的信息

Jump to

Keyboard shortcuts

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