etcd

package
v0.0.0-...-c59394f Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() (*clientv3.Client, error)

New returns a new etcd client

Types

type Incrementer

type Incrementer struct {
	// contains filtered or unexported fields
}

Incrementer implements the models.Incrementer

func NewIncrementer

func NewIncrementer(kv *KV) *Incrementer

NewIncrementer returns a new Incrementer

func (*Incrementer) Increment

func (inc *Incrementer) Increment(key string, size int) (int64, error)

Increment try to increment the value of the key

type KV

type KV struct {
	// contains filtered or unexported fields
}

KV uses etcd as a KV

func NewKV

func NewKV() (*KV, error)

NewKV returns a new EtcdKV

func (*KV) Close

func (kv *KV) Close()

Close close db

func (*KV) Delete

func (kv *KV) Delete(key string) error

Delete deletes key/value

func (*KV) Get

func (kv *KV) Get(key string) (string, error)

Get gets the value for the key

func (*KV) Put

func (kv *KV) Put(key string, value string) error

Put puts key/value

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher watches a key

func NewWatcher

func NewWatcher(kv *KV) *Watcher

NewWatcher returns a new watcher

func (*Watcher) Close

func (w *Watcher) Close() error

Close closes the watch channel

func (*Watcher) Watch

func (w *Watcher) Watch(key string) <-chan string

Watch watches a key

Jump to

Keyboard shortcuts

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