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 (*EndpointInfo) Marshal ¶
func (edi *EndpointInfo) Marshal() string
endpointInfo -> []byte -> string
type ServiceDiscovery ¶
type ServiceDiscovery struct {
// contains filtered or unexported fields
}
服务发现
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
Click to show internal directories.
Click to hide internal directories.