etcdv3

package
v0.0.0-...-d799dea Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(addrs []string, options *store.Config) (store.Store, error)

New creates a new Etcd client given a list of endpoints and an optional tls config

func Register

func Register()

Register registers etcd to kvstore

Types

type Etcd

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

Etcd is the receiver type for the Store interface

func (*Etcd) AtomicDelete

func (s *Etcd) AtomicDelete(ctx context.Context, key string, previous *store.KVPair) error

AtomicDelete deletes a value at "key" if the key has not been modified in the meantime, throws an error if this is the case

func (*Etcd) AtomicPut

func (s *Etcd) AtomicPut(ctx context.Context, key, value string, previous *store.KVPair, opts *store.WriteOptions) error

AtomicPut puts a value at "key" if the key has not been modified in the meantime, throws an error if this is the case

func (*Etcd) Close

func (s *Etcd) Close()

Close closes the client connection

func (*Etcd) Compact

func (s *Etcd) Compact(ctx context.Context, rev uint64, wait bool) error

Compact compacts etcd KV history before the given rev.

func (*Etcd) Create

func (s *Etcd) Create(ctx context.Context, key, value string, opts *store.WriteOptions) error

Create is an alias for Put with key not exist

func (*Etcd) Delete

func (s *Etcd) Delete(ctx context.Context, key string) error

Delete a value at "key"

func (*Etcd) DeleteTree

func (s *Etcd) DeleteTree(ctx context.Context, directory string) error

DeleteTree deletes a range of keys under a given directory

func (*Etcd) Exists

func (s *Etcd) Exists(ctx context.Context, key string) (bool, error)

Exists checks if the key exists inside the store

func (*Etcd) Get

func (s *Etcd) Get(ctx context.Context, key string) (pair *store.KVPair, err error)

Get the value at "key", returns the last modified index to use in conjunction to Atomic calls

func (*Etcd) List

func (s *Etcd) List(ctx context.Context, directory string) ([]*store.KVPair, error)

List child nodes of a given directory

func (*Etcd) NewLock

func (s *Etcd) NewLock(key string, opt *store.LockOptions) store.Locker

NewLock creates a lock for a given key. The returned Locker is not held and must be acquired with `.Lock`. The Value is optional.

func (*Etcd) NewTxn

func (s *Etcd) NewTxn(ctx context.Context) (store.Txn, error)

NewTxn creates a transaction Txn.

func (*Etcd) Put

func (s *Etcd) Put(ctx context.Context, key, value string, opts *store.WriteOptions) error

Put a value at "key"

func (*Etcd) Update

func (s *Etcd) Update(ctx context.Context, key, value string, opts *store.WriteOptions) error

Update is an alias for Put with key exist

func (*Etcd) Watch

func (s *Etcd) Watch(ctx context.Context, key string, opt *store.WatchOptions) (<-chan *store.WatchResponse, error)

Watch for changes on a "key" It returns a channel that will receive changes or pass on errors. Upon creation, the current value will first be sent to the channel. Providing a non-nil stopCh can be used to stop watching.

func (*Etcd) WatchTree

func (s *Etcd) WatchTree(ctx context.Context, directory string, opt *store.WatchOptions) (<-chan *store.WatchResponse, error)

WatchTree watches for changes on a "directory" It returns a channel that will receive changes or pass on errors. Upon creating a watch, the current childs values will be sent to the channel. Providing a non-nil stopCh can be used to stop watching.

Jump to

Keyboard shortcuts

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