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 ¶ added in v0.2.0
func (e *Etcd) GetResponseByPrefix(key string) (*clientv3.GetResponse, error)
GetResponseByPrefix .
type NodeStateType ¶ added in v0.2.0
type NodeStateType int32
const ( UP NodeStateType = 0 DOWN NodeStateType = 1 )
type ServiceNode ¶ added in v0.2.0
type ServiceNode struct {
// contains filtered or unexported fields
}
ServiceNode .
func NewServiceNode ¶ added in v0.2.0
func NewServiceNode(endpoints []string, dc string) *ServiceNode
NewServiceNode .
func (*ServiceNode) GetEventChannel ¶ added in v0.2.0
func (sn *ServiceNode) GetEventChannel() string
GetEventChannel .
func (*ServiceNode) GetRPCChannel ¶ added in v0.2.0
func (sn *ServiceNode) GetRPCChannel() string
GetRPCChannel .
func (*ServiceNode) RegisterNode ¶ added in v0.2.0
func (sn *ServiceNode) RegisterNode(serviceName string, name string, ID string)
RegisterNode register a new node.
type ServiceRegistry ¶ added in v0.2.0
type ServiceRegistry struct { Scheme string // contains filtered or unexported fields }
ServiceRegistry lib
func NewServiceRegistry ¶ added in v0.2.0
func NewServiceRegistry(endpoints []string, scheme string) *ServiceRegistry
NewServiceRegistry ServiceRegistry factory method
func (*ServiceRegistry) GetServiceNodes ¶ added in v0.2.0
func (r *ServiceRegistry) GetServiceNodes(serviceName string) ([]Node, error)
GetServiceNodes returns a list of active service nodes
func (*ServiceRegistry) RegisterServiceNode ¶ added in v0.2.0
func (r *ServiceRegistry) RegisterServiceNode(serviceName string, node Node) error
RegisterServiceNode .
type ServiceWatchCallback ¶ added in v0.2.0
type ServiceWatchCallback func(service string, state NodeStateType, nodes Node)
ServiceWatchCallback .
type ServiceWatcher ¶ added in v0.2.0
type ServiceWatcher struct {
// contains filtered or unexported fields
}
ServiceWatcher .
func NewServiceWatcher ¶ added in v0.2.0
func NewServiceWatcher(endpoints []string, dc string) *ServiceWatcher
NewServiceWatcher .
func (*ServiceWatcher) DeleteNodesByID ¶ added in v0.2.0
func (sw *ServiceWatcher) DeleteNodesByID(ID string) bool
func (*ServiceWatcher) GetNodes ¶ added in v0.2.0
func (sw *ServiceWatcher) GetNodes(service string) (map[string]Node, bool)
func (*ServiceWatcher) GetNodesByID ¶ added in v0.2.0
func (sw *ServiceWatcher) GetNodesByID(ID string) (*Node, bool)
func (*ServiceWatcher) WatchNode ¶ added in v0.2.0
func (sw *ServiceWatcher) WatchNode(ch clientv3.WatchChan)
func (*ServiceWatcher) WatchServiceNode ¶ added in v0.2.0
func (sw *ServiceWatcher) WatchServiceNode(serviceName string, callback ServiceWatchCallback)
WatchServiceNode .
type WatchCallback ¶
Click to show internal directories.
Click to hide internal directories.