discov

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeToLive = timeToLive

TimeToLive is seconds to live in etcd.

Functions

This section is empty.

Types

type EtcdConf

type EtcdConf struct {
	Hosts []string
	Key   string
}

EtcdConf is the config item with the given key on etcd.

func (EtcdConf) Validate

func (c EtcdConf) Validate() error

Validate validates c.

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.

func (*Publisher) KeepAlive

func (p *Publisher) KeepAlive() error

KeepAlive keeps key:value alive.

func (*Publisher) Pause

func (p *Publisher) Pause()

Pause pauses the renewing of key:value.

func (*Publisher) Resume

func (p *Publisher) Resume()

Resume resumes the renewing of key:value.

func (*Publisher) Stop

func (p *Publisher) Stop()

Stop stops the renewing and revokes the registration.

type PublisherOption

type PublisherOption func(client *Publisher)

PublisherOption defines the method to customize a Publisher.

func WithId

func WithId(id int64) PublisherOption

WithId customizes a Publisher with the id.

type SubOption

type SubOption func(opts *subOptions)

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.

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.

Directories

Path Synopsis
Package internal is a generated GoMock package.
Package internal is a generated GoMock package.

Jump to

Keyboard shortcuts

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