diff --git a/store/heap_test.go b/store/heap_test.go index 3102c4093..ad52f4d39 100644 --- a/store/heap_test.go +++ b/store/heap_test.go @@ -28,7 +28,7 @@ func TestHeapPushPop(t *testing.T) { for i := 0; i < 10; i++ { path := fmt.Sprintf("%v", 10-i) m := time.Duration(10 - i) - n := newKV(nil, path, path, 0, nil, "", time.Now().Add(time.Second*m)) + n := newKV(nil, path, path, 0, nil, time.Now().Add(time.Second*m)) h.push(n) } @@ -54,7 +54,7 @@ func TestHeapUpdate(t *testing.T) { for i := range kvs { path := fmt.Sprintf("%v", 10-i) m := time.Duration(10 - i) - n := newKV(nil, path, path, 0, nil, "", time.Now().Add(time.Second*m)) + n := newKV(nil, path, path, 0, nil, time.Now().Add(time.Second*m)) kvs[i] = n h.push(n) } diff --git a/store/node.go b/store/node.go index 76cd38ae2..e41eec2aa 100644 --- a/store/node.go +++ b/store/node.go @@ -45,7 +45,6 @@ type node struct { Parent *node `json:"-"` // should not encode this field! avoid circular dependency. ExpireTime time.Time - ACL string Value string // for key-value pair Children map[string]*node // for directory @@ -54,15 +53,12 @@ type node struct { } // newKV creates a Key-Value pair -func newKV(store *store, nodePath string, value string, createdIndex uint64, - parent *node, ACL string, expireTime time.Time) *node { - +func newKV(store *store, nodePath string, value string, createdIndex uint64, parent *node, expireTime time.Time) *node { return &node{ Path: nodePath, CreatedIndex: createdIndex, ModifiedIndex: createdIndex, Parent: parent, - ACL: ACL, store: store, ExpireTime: expireTime, Value: value, @@ -70,15 +66,12 @@ func newKV(store *store, nodePath string, value string, createdIndex uint64, } // newDir creates a directory -func newDir(store *store, nodePath string, createdIndex uint64, parent *node, - ACL string, expireTime time.Time) *node { - +func newDir(store *store, nodePath string, createdIndex uint64, parent *node, expireTime time.Time) *node { return &node{ Path: nodePath, CreatedIndex: createdIndex, ModifiedIndex: createdIndex, Parent: parent, - ACL: ACL, ExpireTime: expireTime, Children: make(map[string]*node), store: store, @@ -369,12 +362,12 @@ func (n *node) Compare(prevValue string, prevIndex uint64) (ok bool, which int) // If the node is a key-value pair, it will clone the pair. func (n *node) Clone() *node { if !n.IsDir() { - newkv := newKV(n.store, n.Path, n.Value, n.CreatedIndex, n.Parent, n.ACL, n.ExpireTime) + newkv := newKV(n.store, n.Path, n.Value, n.CreatedIndex, n.Parent, n.ExpireTime) newkv.ModifiedIndex = n.ModifiedIndex return newkv } - clone := newDir(n.store, n.Path, n.CreatedIndex, n.Parent, n.ACL, n.ExpireTime) + clone := newDir(n.store, n.Path, n.CreatedIndex, n.Parent, n.ExpireTime) clone.ModifiedIndex = n.ModifiedIndex for key, child := range n.Children { diff --git a/store/store.go b/store/store.go index dea54690d..fe2e2aaa0 100644 --- a/store/store.go +++ b/store/store.go @@ -85,9 +85,9 @@ func New(namespaces ...string) Store { func newStore(namespaces ...string) *store { s := new(store) s.CurrentVersion = defaultVersion - s.Root = newDir(s, "/", s.CurrentIndex, nil, "", Permanent) + s.Root = newDir(s, "/", s.CurrentIndex, nil, Permanent) for _, namespace := range namespaces { - s.Root.Add(newDir(s, namespace, s.CurrentIndex, s.Root, "", Permanent)) + s.Root.Add(newDir(s, namespace, s.CurrentIndex, s.Root, Permanent)) } s.Stats = newStats() s.WatcherHub = newWatchHub(1000) @@ -516,12 +516,12 @@ func (s *store) internalCreate(nodePath string, dir bool, value string, unique, valueCopy := value eNode.Value = &valueCopy - n = newKV(s, nodePath, value, nextIndex, d, "", expireTime) + n = newKV(s, nodePath, value, nextIndex, d, expireTime) } else { // create directory eNode.Dir = true - n = newDir(s, nodePath, nextIndex, d, "", expireTime) + n = newDir(s, nodePath, nextIndex, d, expireTime) } // we are sure d is a directory and does not have the children with name n.Name @@ -612,7 +612,7 @@ func (s *store) checkDir(parent *node, dirName string) (*node, *etcdErr.Error) { return nil, etcdErr.NewError(etcdErr.EcodeNotDir, node.Path, s.CurrentIndex) } - n := newDir(s, path.Join(parent.Path, dirName), s.CurrentIndex+1, parent, parent.ACL, Permanent) + n := newDir(s, path.Join(parent.Path, dirName), s.CurrentIndex+1, parent, Permanent) parent.Children[dirName] = n