|
@@ -2,7 +2,6 @@ package datastore
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
- "reflect"
|
|
|
"strings"
|
|
|
"sync"
|
|
|
"time"
|
|
@@ -132,17 +131,6 @@ func Key(key ...string) string {
|
|
|
return str + "/"
|
|
|
}
|
|
|
|
|
|
-// ParseKey provides convenient method to unpack the key to complement the Key function
|
|
|
-func ParseKey(key string) ([]string, error) {
|
|
|
- chain := strings.Split(strings.Trim(key, "/"), "/")
|
|
|
-
|
|
|
- // The key must at least be equal to the rootChain in order to be considered as valid
|
|
|
- if len(chain) <= len(rootChain) || !reflect.DeepEqual(chain[0:len(rootChain)], rootChain) {
|
|
|
- return nil, types.BadRequestErrorf("invalid Key : %s", key)
|
|
|
- }
|
|
|
- return chain[len(rootChain):], nil
|
|
|
-}
|
|
|
-
|
|
|
// newClient used to connect to KV Store
|
|
|
func newClient(kv string, addr string, config *store.Config) (*Store, error) {
|
|
|
if config == nil {
|