Documentation ¶
Index ¶
- type NotifyInfo
- type RegisterAPI
- type ResolverAPI
- func NewEtcdResolver(endpoints []string, timeout time.Duration) (ResolverAPI, error)
- func NewEtcdResolverPasswordAuth(endpoints []string, timeout time.Duration, uname, pwd string) (ResolverAPI, error)
- func NewEtcdResolverTLSAuth(endpoints []string, timeout time.Duration, tlscfg *tls.Config, ...) (ResolverAPI, error)
- func NewZookeeperResolver(endpoints []string, timeout time.Duration) (ResolverAPI, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NotifyInfo ¶
NotifyInfo descript the info return from storage server
type RegisterAPI ¶
type RegisterAPI interface {
Stop()
}
RegisterAPI used to stop a service and delete the node
func NewEtcdNode ¶
func NewEtcdNode(basePath, sname, targetValue, target string, endpoints []string, sessionTimeout time.Duration) (_ RegisterAPI, err error)
NewEtcdNode create a etcd node for service discovery basePath is the parent path of the service; all the service should group by the basePath sname os the service name target will be the key of the node which should layout as "ip:port" or "schema://ip:port"; the node path is "basePath/sname/target" targetValue should contain the meta data like hid, groupid etd. endpoints is the etcd server addr sessionTimeout indicate the node's ttl
func NewZookeeperNode ¶
func NewZookeeperNode(basePath, sname, targetValue, target string, endpoints []string, sessionTimeout time.Duration) (_ RegisterAPI, err error)
NewZookeeperNode create a zk node for service discovery basePath is the parent path of the service; all the service should group by the basePath sname os the service name target will be the key of the node which should layout as "ip:port" or "schema://ip:port"; the node path is "basePath/sname/target" targetValue should contain the meta data like hid, groupid etd. endpoints is the etcd server addr sessionTimeout indicate the node's ttl
type ResolverAPI ¶
type ResolverAPI interface { // Start begin the resolver Start() error // Stop close the resolver Stop() // SubService watch the service; any change will be notify by the ch // unsub used to unsuband remove the notification SubService(spath string) (ch <-chan []*NotifyInfo, unsub func(), err error) }
ResolverAPI is the interface of the discover
func NewEtcdResolver ¶
func NewEtcdResolver(endpoints []string, timeout time.Duration) (ResolverAPI, error)
NewEtcdResolver used to create a etcd service discover
func NewEtcdResolverPasswordAuth ¶
func NewEtcdResolverPasswordAuth(endpoints []string, timeout time.Duration, uname, pwd string) (ResolverAPI, error)
NewEtcdResolverPasswordAuth used to create a etcd service discover with username and password as auth token
func NewEtcdResolverTLSAuth ¶
func NewEtcdResolverTLSAuth(endpoints []string, timeout time.Duration, tlscfg *tls.Config, certfile, keyfile, cacertfile string) (ResolverAPI, error)
NewEtcdResolverTLSAuth used to create a etcd service discover with tls
func NewZookeeperResolver ¶
func NewZookeeperResolver(endpoints []string, timeout time.Duration) (ResolverAPI, error)
NewZookeeperResolver used to create a zookeeper discovery