Update libkv dependency

This commit is contained in:
NicoMen 2017-11-17 17:22:03 +01:00 committed by Traefiker
parent cdab6b1796
commit 66e489addb
237 changed files with 62817 additions and 16116 deletions

View file

@ -12,12 +12,16 @@ type Backend string
const (
// CONSUL backend
CONSUL Backend = "consul"
// ETCD backend
// ETCD backend with v2 client (backward compatibility)
ETCD Backend = "etcd"
// ETCDV3 backend with v3 client
ETCDV3 Backend = "etcdv3"
// ZK backend
ZK Backend = "zk"
// BOLTDB backend
BOLTDB Backend = "boltdb"
// REDIS backend
REDIS Backend = "redis"
)
var (
@ -44,6 +48,7 @@ type Config struct {
ClientTLS *ClientTLSConfig
TLS *tls.Config
ConnectionTimeout time.Duration
SyncPeriod time.Duration
Bucket string
PersistConnection bool
Username string
@ -67,20 +72,20 @@ type Store interface {
Put(key string, value []byte, options *WriteOptions) error
// Get a value given its key
Get(key string) (*KVPair, error)
Get(key string, options *ReadOptions) (*KVPair, error)
// Delete the value at the specified key
Delete(key string) error
// Verify if a Key exists in the store
Exists(key string) (bool, error)
Exists(key string, options *ReadOptions) (bool, error)
// Watch for changes on a key
Watch(key string, stopCh <-chan struct{}) (<-chan *KVPair, error)
Watch(key string, stopCh <-chan struct{}, options *ReadOptions) (<-chan *KVPair, error)
// WatchTree watches for changes on child nodes under
// a given directory
WatchTree(directory string, stopCh <-chan struct{}) (<-chan []*KVPair, error)
WatchTree(directory string, stopCh <-chan struct{}, options *ReadOptions) (<-chan []*KVPair, error)
// NewLock creates a lock for a given key.
// The returned Locker is not held and must be acquired
@ -88,7 +93,7 @@ type Store interface {
NewLock(key string, options *LockOptions) (Locker, error)
// List the content of a given prefix
List(directory string) ([]*KVPair, error)
List(directory string, options *ReadOptions) ([]*KVPair, error)
// DeleteTree deletes a range of keys under a given directory
DeleteTree(directory string) error
@ -117,6 +122,16 @@ type WriteOptions struct {
TTL time.Duration
}
// ReadOptions contains optional request parameters
type ReadOptions struct {
// Consistent defines if the behavior of a Get operation is
// linearizable or not. Linearizability allows us to 'see'
// objects based on a real-time total order as opposed to
// an arbitrary order or with stale values ('inconsistent'
// scenario).
Consistent bool
}
// LockOptions contains optional request parameters
type LockOptions struct {
Value []byte // Optional, value to associate with the lock