Documentation ¶
Overview ¶
Package etcd includes etcd clients ops related
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
Connect to etcd client addr format like: http://host:port
func ProviderHeartbeat ¶
func ProviderHeartbeat(ctx context.Context, provider ServerProvider, opt *ProvideOptions, )
ProviderHeartbeat ... ref to: http://ralphbupt.github.io/2017/05/04/etcd-%E6%9C%8D%E5%8A%A1%E6%B3%A8%E5%86%8C%E4%B8%8E%E5%8F%91%E7%8E%B0/
Types ¶
type ProvideOptions ¶
type ProvideOptions struct { NamePrefix string // ServerName Prefix if "" means no prefix SetOpts *client.SetOptions // etcd client SetOptions TTLDuration time.Duration // ttl time.Duration HeartbeatDuration time.Duration // HeartbeatDuration duration }
ProvideOptions ...
type Server ¶
type Server struct { Name string `json:"name"` Addr string `json:"addr"` Alive bool `json:"alive"` }
Server ...
type ServerProvider ¶
type ServerProvider interface { Name() string Addr() string KeysAPI() client.KeysAPI // Provide support set key-value to etcd Provide(*ProvideOptions) error // Quit while should be called while Server quit Quit(*ProvideOptions) error }
ServerProvider ....
func NewProvider ¶
func NewProvider(kapi client.KeysAPI, name, addr string) ServerProvider
NewProvider ...
type Watcher ¶
Watcher ... ref to http://daizuozhuo.github.io/etcd-service-discovery/
func NewWatcher ¶
NewWatcher ...
Click to show internal directories.
Click to hide internal directories.