Documentation
¶
Overview ¶
Package etcd contains the etcd v2 store implementation.
Index ¶
- Variables
- func New(addrs []string, options *store.Config) (store.Store, error)
- func Register()
- type Etcd
- func (s *Etcd) AtomicDelete(ctx context.Context, key string, previous *store.KVPair) (bool, error)
- func (s *Etcd) AtomicPut(ctx context.Context, key string, value []byte, previous *store.KVPair, ...) (bool, *store.KVPair, error)
- func (s *Etcd) Close() error
- func (s *Etcd) Delete(ctx context.Context, key string) error
- func (s *Etcd) DeleteTree(ctx context.Context, directory string) error
- func (s *Etcd) Exists(ctx context.Context, key string, opts *store.ReadOptions) (bool, error)
- func (s *Etcd) Get(ctx context.Context, key string, opts *store.ReadOptions) (pair *store.KVPair, err error)
- func (s *Etcd) List(ctx context.Context, directory string, opts *store.ReadOptions) ([]*store.KVPair, error)
- func (s *Etcd) NewLock(_ context.Context, key string, options *store.LockOptions) (lock store.Locker, err error)
- func (s *Etcd) Put(ctx context.Context, key string, value []byte, opts *store.WriteOptions) error
- func (s *Etcd) Watch(ctx context.Context, key string, stopCh <-chan struct{}, ...) (<-chan *store.KVPair, error)
- func (s *Etcd) WatchTree(ctx context.Context, directory string, stopCh <-chan struct{}, ...) (<-chan []*store.KVPair, error)
Constants ¶
This section is empty.
Variables ¶
var ErrAbortTryLock = errors.New("lock operation aborted")
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.
Functions ¶
Types ¶
type Etcd ¶
type Etcd struct {
// contains filtered or unexported fields
}
Etcd is the receiver type for the Store interface.
func (*Etcd) AtomicDelete ¶
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 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) DeleteTree ¶
DeleteTree deletes a range of keys under a given directory.
func (*Etcd) Get ¶
func (s *Etcd) Get(ctx context.Context, key string, opts *store.ReadOptions) (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, opts *store.ReadOptions) ([]*store.KVPair, error)
List child nodes of a given directory.
func (*Etcd) NewLock ¶
func (s *Etcd) NewLock(_ context.Context, 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) Watch ¶
func (s *Etcd) Watch(ctx context.Context, key string, stopCh <-chan struct{}, opts *store.ReadOptions) (<-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 ¶
func (s *Etcd) WatchTree(ctx context.Context, directory string, stopCh <-chan struct{}, opts *store.ReadOptions) (<-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 children values will be sent to the channel. Providing a non-nil stopCh can be used to stop watching.