Documentation ¶
Index ¶
- func Close()
- func Del(key string, prefix bool)
- func GetByPrefix(key string) map[string]string
- func GetEventChannel(node Node) string
- func GetRPCChannel(node Node) string
- func Init(etcds []string)
- func Keep(key, val string)
- func UpdateLoad(ip string, port int)
- func Watch(key string, watchFunc WatchCallback, prefix bool)
- type Etcd
- type Node
- type NodeStateType
- type ServiceNode
- type ServiceRegistry
- type ServiceWatchCallback
- type ServiceWatcher
- func (sw *ServiceWatcher) DeleteNodesByID(ID string) bool
- func (sw *ServiceWatcher) GetNodes(service string) (map[string]Node, bool)
- func (sw *ServiceWatcher) GetNodesByID(ID string) (*Node, bool)
- func (sw *ServiceWatcher) WatchNode(ch clientv3.WatchChan)
- func (sw *ServiceWatcher) WatchServiceNode(serviceName string, callback ServiceWatchCallback)
- type WatchCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetByPrefix ¶
func UpdateLoad ¶
func Watch ¶
func Watch(key string, watchFunc WatchCallback, prefix bool)
Types ¶
type Etcd ¶
type Etcd struct {
// contains filtered or unexported fields
}
func (*Etcd) GetResponseByPrefix ¶
GetResponseByPrefix .
type ServiceNode ¶
type ServiceNode struct {
// contains filtered or unexported fields
}
ServiceNode .
func NewServiceNode ¶
func NewServiceNode(endpoints []string, dc string) *ServiceNode
NewServiceNode .
func (*ServiceNode) GetEventChannel ¶
func (sn *ServiceNode) GetEventChannel() string
GetEventChannel .
func (*ServiceNode) RegisterNode ¶
func (sn *ServiceNode) RegisterNode(serviceName string, name string)
RegisterNode register a new node.
func (*ServiceNode) UnregisterNode ¶ added in v0.3.4
func (sn *ServiceNode) UnregisterNode() error
RegisterNode register a new node.
type ServiceRegistry ¶
type ServiceRegistry struct { Scheme string // contains filtered or unexported fields }
ServiceRegistry lib
func NewServiceRegistry ¶
func NewServiceRegistry(endpoints []string, scheme string) *ServiceRegistry
NewServiceRegistry ServiceRegistry factory method
func (*ServiceRegistry) GetServiceNodes ¶
func (r *ServiceRegistry) GetServiceNodes(serviceName string) ([]Node, error)
GetServiceNodes returns a list of active service nodes
func (*ServiceRegistry) RegisterServiceNode ¶
func (r *ServiceRegistry) RegisterServiceNode(serviceName string, node Node) error
RegisterServiceNode .
type ServiceWatchCallback ¶
type ServiceWatchCallback func(service string, state NodeStateType, nodes Node)
ServiceWatchCallback .
type ServiceWatcher ¶
type ServiceWatcher struct {
// contains filtered or unexported fields
}
ServiceWatcher .
func NewServiceWatcher ¶
func NewServiceWatcher(endpoints []string, dc string) *ServiceWatcher
NewServiceWatcher .
func (*ServiceWatcher) DeleteNodesByID ¶
func (sw *ServiceWatcher) DeleteNodesByID(ID string) bool
func (*ServiceWatcher) GetNodes ¶
func (sw *ServiceWatcher) GetNodes(service string) (map[string]Node, bool)
func (*ServiceWatcher) GetNodesByID ¶
func (sw *ServiceWatcher) GetNodesByID(ID string) (*Node, bool)
func (*ServiceWatcher) WatchNode ¶
func (sw *ServiceWatcher) WatchNode(ch clientv3.WatchChan)
func (*ServiceWatcher) WatchServiceNode ¶
func (sw *ServiceWatcher) WatchServiceNode(serviceName string, callback ServiceWatchCallback)
WatchServiceNode .
type WatchCallback ¶
type WatchCallback func(clientv3.WatchChan)
Click to show internal directories.
Click to hide internal directories.