|
@@ -62,6 +62,10 @@
|
|
package libkv
|
|
package libkv
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "fmt"
|
|
|
|
+ "sort"
|
|
|
|
+ "strings"
|
|
|
|
+
|
|
"github.com/docker/libkv/store"
|
|
"github.com/docker/libkv/store"
|
|
"github.com/docker/libkv/store/consul"
|
|
"github.com/docker/libkv/store/consul"
|
|
"github.com/docker/libkv/store/etcd"
|
|
"github.com/docker/libkv/store/etcd"
|
|
@@ -78,6 +82,14 @@ var (
|
|
store.ETCD: etcd.New,
|
|
store.ETCD: etcd.New,
|
|
store.ZK: zookeeper.New,
|
|
store.ZK: zookeeper.New,
|
|
}
|
|
}
|
|
|
|
+ supportedBackend = func() string {
|
|
|
|
+ keys := make([]string, 0, len(initializers))
|
|
|
|
+ for k := range initializers {
|
|
|
|
+ keys = append(keys, string(k))
|
|
|
|
+ }
|
|
|
|
+ sort.Strings(keys)
|
|
|
|
+ return strings.Join(keys, ", ")
|
|
|
|
+ }()
|
|
)
|
|
)
|
|
|
|
|
|
// NewStore creates a an instance of store
|
|
// NewStore creates a an instance of store
|
|
@@ -86,5 +98,5 @@ func NewStore(backend store.Backend, addrs []string, options *store.Config) (sto
|
|
return init(addrs, options)
|
|
return init(addrs, options)
|
|
}
|
|
}
|
|
|
|
|
|
- return nil, store.ErrNotSupported
|
|
|
|
|
|
+ return nil, fmt.Errorf("%s %s", store.ErrNotSupported.Error(), supportedBackend)
|
|
}
|
|
}
|