store: remove unused ACL field

This commit is contained in:
Xiang Li 2015-02-26 14:49:42 -08:00 committed by Yicheng Qin
parent a4dab7ad75
commit d459ae0df3
3 changed files with 11 additions and 18 deletions

View File

@ -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)
}

View File

@ -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 {

View File

@ -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