Просмотр исходного кода

Change unsupported call error in boltdb backend to use general store error

Signed-off-by: Alexandre Beslic <abronan@docker.com>
Alexandre Beslic 9 лет назад
Родитель
Сommit
15e5d4067a

+ 3 - 5
libnetwork/internal/kvstore/boltdb/boltdb.go

@@ -21,8 +21,6 @@ var (
 	ErrBoltBucketNotFound = errors.New("boltdb bucket doesn't exist")
 	// ErrBoltBucketOptionMissing is thrown when boltBcuket config option is missing
 	ErrBoltBucketOptionMissing = errors.New("boltBucket config option missing")
-	// ErrBoltAPIUnsupported is thrown when an APIs unsupported by BoltDB backend is called
-	ErrBoltAPIUnsupported = errors.New("API not supported by BoltDB backend")
 )
 
 //BoltDB type implements the Store interface
@@ -313,15 +311,15 @@ func (b *BoltDB) DeleteTree(keyPrefix string) error {
 
 // NewLock has to implemented at the library level since its not supported by BoltDB
 func (b *BoltDB) NewLock(key string, options *store.LockOptions) (store.Locker, error) {
-	return nil, ErrBoltAPIUnsupported
+	return nil, store.ErrCallNotSupported
 }
 
 // Watch has to implemented at the library level since its not supported by BoltDB
 func (b *BoltDB) Watch(key string, stopCh <-chan struct{}) (<-chan *store.KVPair, error) {
-	return nil, ErrBoltAPIUnsupported
+	return nil, store.ErrCallNotSupported
 }
 
 // WatchTree has to implemented at the library level since its not supported by BoltDB
 func (b *BoltDB) WatchTree(directory string, stopCh <-chan struct{}) (<-chan []*store.KVPair, error) {
-	return nil, ErrBoltAPIUnsupported
+	return nil, store.ErrCallNotSupported
 }

+ 4 - 4
libnetwork/internal/kvstore/kvstore.go

@@ -21,10 +21,10 @@ const (
 )
 
 var (
-	// ErrNotSupported is thrown when the backend k/v store is not supported by libkv
-	ErrNotSupported = errors.New("Backend storage not supported yet, please choose one of")
-	// ErrNotImplemented is thrown when a method is not implemented by the current backend
-	ErrNotImplemented = errors.New("Call not implemented in current backend")
+	// ErrBackendNotSupported is thrown when the backend k/v store is not supported by libkv
+	ErrBackendNotSupported = errors.New("Backend storage not supported yet, please choose one of")
+	// ErrCallNotSupported is thrown when a method is not implemented/supported by the current backend
+	ErrCallNotSupported = errors.New("The current call is not supported with this backend")
 	// ErrNotReachable is thrown when the API cannot be reached for issuing common store operations
 	ErrNotReachable = errors.New("Api not reachable")
 	// ErrCannotLock is thrown when there is an error acquiring a lock on a key

+ 1 - 1
libnetwork/internal/kvstore/kvstore_manage.go

@@ -92,7 +92,7 @@ func NewStore(backend store.Backend, addrs []string, options *store.Config) (sto
 		return init(addrs, options)
 	}
 
-	return nil, fmt.Errorf("%s %s", store.ErrNotSupported.Error(), supportedBackend)
+	return nil, fmt.Errorf("%s %s", store.ErrBackendNotSupported.Error(), supportedBackend)
 }
 
 // AddStore adds a new store backend to libkv