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 更新服务的信息
Click to show internal directories.
Click to hide internal directories.