Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TimeToLive = timeToLive
TimeToLive is seconds to live in etcd.
Functions ¶
This section is empty.
Types ¶
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 ¶
func NewPublisher(endpoints []string, key, value string, opts ...PublisherOption) *Publisher
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 PublisherOption ¶
type PublisherOption func(client *Publisher)
PublisherOption defines the method to customize a Publisher.
type SubOption ¶
type SubOption func(opts *subOptions)
SubOption defines the method to customize a Subscriber.
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
A Subscriber is used to subscribe the given key on a 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.