libkv: github.com/docker/libkv/store/etcd Index | Files

package etcd

import "github.com/docker/libkv/store/etcd"

Index

Package Files

etcd.go

Variables

var (
    // ErrAbortTryLock is thrown when a user stops trying to seek the lock
    // by sending a signal to the stop chan, this is used to verify if the
    // operation succeeded
    ErrAbortTryLock = errors.New("lock operation aborted")
)

func New Uses

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 Uses

func Register()

Register registers etcd to libkv

type Etcd Uses

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

Etcd is the receiver type for the Store interface

func (*Etcd) AtomicDelete Uses

func (s *Etcd) AtomicDelete(key string, previous *store.KVPair) (bool, 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 Uses

func (s *Etcd) AtomicPut(key string, value []byte, previous *store.KVPair, opts *store.WriteOptions) (bool, *store.KVPair, 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 Uses

func (s *Etcd) Close()

Close closes the client connection

func (*Etcd) Delete Uses

func (s *Etcd) Delete(key string) error

Delete a value at "key"

func (*Etcd) DeleteTree Uses

func (s *Etcd) DeleteTree(directory string) error

DeleteTree deletes a range of keys under a given directory

func (*Etcd) Exists Uses

func (s *Etcd) Exists(key string) (bool, error)

Exists checks if the key exists inside the store

func (*Etcd) Get Uses

func (s *Etcd) Get(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 Uses

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

List child nodes of a given directory

func (*Etcd) NewLock Uses

func (s *Etcd) NewLock(key string, options *store.LockOptions) (lock store.Locker, err error)

NewLock returns a handle to a lock struct which can be used to provide mutual exclusion on a key

func (*Etcd) Put Uses

func (s *Etcd) Put(key string, value []byte, opts *store.WriteOptions) error

Put a value at "key"

func (*Etcd) Watch Uses

func (s *Etcd) Watch(key string, stopCh <-chan struct{}) (<-chan *store.KVPair, 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 Uses

func (s *Etcd) WatchTree(directory string, stopCh <-chan struct{}) (<-chan []*store.KVPair, 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.

Package etcd imports 11 packages (graph) and is imported by 309 packages. Updated 2017-12-19. Refresh now. Tools for package owners.