Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TimeToLive = timeToLive
TimeToLive is seconds to live in etcd.
Functions ¶
func RegisterAccount ¶
RegisterAccount registers the username/password to the given etcd cluster.
Types ¶
type EtcdConf ¶
type EtcdConf struct { Hosts []string Key string ID int64 `json:",optional"` User string `json:",optional"` Pass string `json:",optional"` CertFile string `json:",optional"` CertKeyFile string `json:",optional=CertFile"` CACertFile string `json:",optional=CertFile"` InsecureSkipVerify bool `json:",optional"` }
EtcdConf is the config item with the given key on etcd.
func (EtcdConf) HasAccount ¶
HasAccount returns if account provided.
type PubOption ¶
type PubOption func(client *Publisher)
PubOption defines the method to customize a Publisher.
func WithPubEtcdAccount ¶
WithPubEtcdAccount provides the etcd username/password.
func WithPubEtcdTLS ¶
WithPubEtcdTLS provides the etcd CertFile/CertKeyFile/CACertFile.
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
A Publisher can be used to publish the value to an etcd cluster on the given key.
func NewPublisher ¶
NewPublisher returns a Publisher. endpoints is the hosts of the etcd cluster. key:value are a pair to be published. opts are used to customize the Publisher.
type SubOption ¶
type SubOption func(sub *Subscriber)
SubOption defines the method to customize a Subscriber.
func Exclusive ¶
func Exclusive() SubOption
Exclusive means that key value can only be 1:1, which means later added value will remove the keys associated with the same value previously.
func WithExactMatch ¶
func WithExactMatch() SubOption
WithExactMatch turn off querying using key prefixes.
func WithSubEtcdAccount ¶
WithSubEtcdAccount provides the etcd username/password.
func WithSubEtcdTLS ¶
WithSubEtcdTLS provides the etcd CertFile/CertKeyFile/CACertFile.
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
A Subscriber is used to subscribe the given key on an etcd cluster.
func NewSubscriber ¶
func NewSubscriber(endpoints []string, key string, opts ...SubOption) (*Subscriber, error)
NewSubscriber returns a Subscriber. endpoints is the hosts of the etcd cluster. key is the key to subscribe. opts are used to customize the Subscriber.
func (*Subscriber) AddListener ¶
func (s *Subscriber) AddListener(listener func())
AddListener adds listener to s.
func (*Subscriber) Values ¶
func (s *Subscriber) Values() []string
Values returns all the subscription values.