diff --git a/pkg/store/store.go b/pkg/store/store.go index d35ffaa0b4..4a77b79ba5 100644 --- a/pkg/store/store.go +++ b/pkg/store/store.go @@ -1,6 +1,12 @@ package store -import log "github.com/Sirupsen/logrus" +import ( + "crypto/tls" + "errors" + "time" + + log "github.com/Sirupsen/logrus" +) // Backend represents a KV Store Backend type Backend string @@ -14,9 +20,28 @@ const ( ZK = "zk" ) -// WatchCallback is used for watch methods on keys -// and is triggered on key change -type WatchCallback func(entries ...*KVPair) +var ( + // ErrNotSupported is exported + ErrNotSupported = errors.New("Backend storage not supported yet, please choose another one") + // ErrNotImplemented is exported + ErrNotImplemented = errors.New("Call not implemented in current backend") + // ErrNotReachable is exported + ErrNotReachable = errors.New("Api not reachable") + // ErrCannotLock is exported + ErrCannotLock = errors.New("Error acquiring the lock") + // ErrWatchDoesNotExist is exported + ErrWatchDoesNotExist = errors.New("No watch found for specified key") + // ErrKeyModified is exported + ErrKeyModified = errors.New("Unable to complete atomic operation, key modified") + // ErrKeyNotFound is exported + ErrKeyNotFound = errors.New("Key not found in store") +) + +// Config contains the options for a storage client +type Config struct { + TLS *tls.Config + Timeout time.Duration +} // Store represents the backend K/V storage // Each store should support every call listed @@ -72,6 +97,10 @@ type KVPair struct { LastIndex uint64 } +// WatchCallback is used for watch methods on keys +// and is triggered on key change +type WatchCallback func(entries ...*KVPair) + // Locker provides locking mechanism on top of the store. // Similar to `sync.Lock` except it may return errors. type Locker interface { diff --git a/pkg/store/structs.go b/pkg/store/structs.go deleted file mode 100644 index 005ff005df..0000000000 --- a/pkg/store/structs.go +++ /dev/null @@ -1,30 +0,0 @@ -package store - -import ( - "crypto/tls" - "errors" - "time" -) - -var ( - // ErrNotSupported is exported - ErrNotSupported = errors.New("Backend storage not supported yet, please choose another one") - // ErrNotImplemented is exported - ErrNotImplemented = errors.New("Call not implemented in current backend") - // ErrNotReachable is exported - ErrNotReachable = errors.New("Api not reachable") - // ErrCannotLock is exported - ErrCannotLock = errors.New("Error acquiring the lock") - // ErrWatchDoesNotExist is exported - ErrWatchDoesNotExist = errors.New("No watch found for specified key") - // ErrKeyModified is exported - ErrKeyModified = errors.New("Unable to complete atomic operation, key modified") - // ErrKeyNotFound is exported - ErrKeyNotFound = errors.New("Key not found in store") -) - -// Config contains the options for a storage client -type Config struct { - TLS *tls.Config - Timeout time.Duration -}