Documentation ¶
Index ¶
- type DiscoverEvent
- type RegDiscover
- func (rd *RegDiscover) DiscoverService(key string) (<-chan *DiscoverEvent, error)
- func (rd *RegDiscover) GetServNodes(key string) ([]string, error)
- func (cc *RegDiscover) Ping() error
- func (rd *RegDiscover) RegisterAndWatchService(key string, data []byte) error
- func (rd *RegDiscover) Start() error
- func (rd *RegDiscover) Stop() error
- type RegDiscvServer
- type ZkRegDiscv
- func (zkRD *ZkRegDiscv) Discover(path string) (<-chan *DiscoverEvent, error)
- func (zkRD *ZkRegDiscv) GetServNodes(path string) ([]string, error)
- func (zkRD *ZkRegDiscv) Ping() error
- func (zkRD *ZkRegDiscv) RegisterAndWatch(path string, data []byte) error
- func (zkRD *ZkRegDiscv) Start() error
- func (zkRD *ZkRegDiscv) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscoverEvent ¶
DiscoverEvent if servers chenged, will create a discover event
type RegDiscover ¶
type RegDiscover struct {
// contains filtered or unexported fields
}
RegDiscover is data struct of register-discover
func NewRegDiscover ¶
func NewRegDiscover(serv string) *RegDiscover
NewRegDiscover used to create a object of RegDiscover
func NewRegDiscoverEx ¶
func NewRegDiscoverEx(serv string, timeOut time.Duration) *RegDiscover
NewRegDiscoverEx used to create a object of RegDiscover
func (*RegDiscover) DiscoverService ¶
func (rd *RegDiscover) DiscoverService(key string) (<-chan *DiscoverEvent, error)
DiscoverService used to discover the service that registered in `key`
func (*RegDiscover) GetServNodes ¶
func (rd *RegDiscover) GetServNodes(key string) ([]string, error)
func (*RegDiscover) RegisterAndWatchService ¶
func (rd *RegDiscover) RegisterAndWatchService(key string, data []byte) error
RegisterAndWatchService register service info into register-discover platform and then watch the service info, if not exist, then register again key is the index of registered service data is the service information
func (*RegDiscover) Start ¶
func (rd *RegDiscover) Start() error
Start the register and discover service
func (*RegDiscover) Stop ¶
func (rd *RegDiscover) Stop() error
Stop the register and discover service
type RegDiscvServer ¶
type RegDiscvServer interface { // Ping to ping server Ping() error // start the register and discover service Start() error // stop the register and discover service Stop() error // RegisterAndWatch register server info into registe-discover service platform, and watch the info, if not exist, then register again RegisterAndWatch(key string, data []byte) error // GetServNodes get server nodes GetServNodes(key string) ([]string, error) // discover server from the registe-discover service platform Discover(key string) (<-chan *DiscoverEvent, error) }
RegDiscvServer define the register and discover function interface
type ZkRegDiscv ¶
type ZkRegDiscv struct {
// contains filtered or unexported fields
}
ZkRegDiscv do register and discover by zookeeper
func NewZkRegDiscv ¶
func NewZkRegDiscv(serv string, timeOut time.Duration) *ZkRegDiscv
NewZkRegDiscv create a object of ZkRegDiscv
func (*ZkRegDiscv) Discover ¶
func (zkRD *ZkRegDiscv) Discover(path string) (<-chan *DiscoverEvent, error)
Discover watch the children
func (*ZkRegDiscv) GetServNodes ¶
func (zkRD *ZkRegDiscv) GetServNodes(path string) ([]string, error)
GetServNodes get server nodes by path
func (*ZkRegDiscv) RegisterAndWatch ¶
func (zkRD *ZkRegDiscv) RegisterAndWatch(path string, data []byte) error
RegisterAndWatch create ephemeral node for the service and watch it. if it exit, register again
func (*ZkRegDiscv) Start ¶
func (zkRD *ZkRegDiscv) Start() error
Start used to run register and discover server
func (*ZkRegDiscv) Stop ¶
func (zkRD *ZkRegDiscv) Stop() error
Stop used to stop register and discover server