discover

package
v0.0.0-...-de11b45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NotifyInfo

type NotifyInfo struct {
	Key         string
	Val         string
	LastVersion uint64
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL