mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
store: remove unused ACL field
This commit is contained in:
parent
a4dab7ad75
commit
d459ae0df3
@ -28,7 +28,7 @@ func TestHeapPushPop(t *testing.T) {
|
|||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
path := fmt.Sprintf("%v", 10-i)
|
path := fmt.Sprintf("%v", 10-i)
|
||||||
m := time.Duration(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)
|
h.push(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ func TestHeapUpdate(t *testing.T) {
|
|||||||
for i := range kvs {
|
for i := range kvs {
|
||||||
path := fmt.Sprintf("%v", 10-i)
|
path := fmt.Sprintf("%v", 10-i)
|
||||||
m := time.Duration(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
|
kvs[i] = n
|
||||||
h.push(n)
|
h.push(n)
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,6 @@ type node struct {
|
|||||||
Parent *node `json:"-"` // should not encode this field! avoid circular dependency.
|
Parent *node `json:"-"` // should not encode this field! avoid circular dependency.
|
||||||
|
|
||||||
ExpireTime time.Time
|
ExpireTime time.Time
|
||||||
ACL string
|
|
||||||
Value string // for key-value pair
|
Value string // for key-value pair
|
||||||
Children map[string]*node // for directory
|
Children map[string]*node // for directory
|
||||||
|
|
||||||
@ -54,15 +53,12 @@ type node struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// newKV creates a Key-Value pair
|
// newKV creates a Key-Value pair
|
||||||
func newKV(store *store, nodePath string, value string, createdIndex uint64,
|
func newKV(store *store, nodePath string, value string, createdIndex uint64, parent *node, expireTime time.Time) *node {
|
||||||
parent *node, ACL string, expireTime time.Time) *node {
|
|
||||||
|
|
||||||
return &node{
|
return &node{
|
||||||
Path: nodePath,
|
Path: nodePath,
|
||||||
CreatedIndex: createdIndex,
|
CreatedIndex: createdIndex,
|
||||||
ModifiedIndex: createdIndex,
|
ModifiedIndex: createdIndex,
|
||||||
Parent: parent,
|
Parent: parent,
|
||||||
ACL: ACL,
|
|
||||||
store: store,
|
store: store,
|
||||||
ExpireTime: expireTime,
|
ExpireTime: expireTime,
|
||||||
Value: value,
|
Value: value,
|
||||||
@ -70,15 +66,12 @@ func newKV(store *store, nodePath string, value string, createdIndex uint64,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// newDir creates a directory
|
// newDir creates a directory
|
||||||
func newDir(store *store, nodePath string, createdIndex uint64, parent *node,
|
func newDir(store *store, nodePath string, createdIndex uint64, parent *node, expireTime time.Time) *node {
|
||||||
ACL string, expireTime time.Time) *node {
|
|
||||||
|
|
||||||
return &node{
|
return &node{
|
||||||
Path: nodePath,
|
Path: nodePath,
|
||||||
CreatedIndex: createdIndex,
|
CreatedIndex: createdIndex,
|
||||||
ModifiedIndex: createdIndex,
|
ModifiedIndex: createdIndex,
|
||||||
Parent: parent,
|
Parent: parent,
|
||||||
ACL: ACL,
|
|
||||||
ExpireTime: expireTime,
|
ExpireTime: expireTime,
|
||||||
Children: make(map[string]*node),
|
Children: make(map[string]*node),
|
||||||
store: store,
|
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.
|
// If the node is a key-value pair, it will clone the pair.
|
||||||
func (n *node) Clone() *node {
|
func (n *node) Clone() *node {
|
||||||
if !n.IsDir() {
|
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
|
newkv.ModifiedIndex = n.ModifiedIndex
|
||||||
return newkv
|
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
|
clone.ModifiedIndex = n.ModifiedIndex
|
||||||
|
|
||||||
for key, child := range n.Children {
|
for key, child := range n.Children {
|
||||||
|
@ -85,9 +85,9 @@ func New(namespaces ...string) Store {
|
|||||||
func newStore(namespaces ...string) *store {
|
func newStore(namespaces ...string) *store {
|
||||||
s := new(store)
|
s := new(store)
|
||||||
s.CurrentVersion = defaultVersion
|
s.CurrentVersion = defaultVersion
|
||||||
s.Root = newDir(s, "/", s.CurrentIndex, nil, "", Permanent)
|
s.Root = newDir(s, "/", s.CurrentIndex, nil, Permanent)
|
||||||
for _, namespace := range namespaces {
|
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.Stats = newStats()
|
||||||
s.WatcherHub = newWatchHub(1000)
|
s.WatcherHub = newWatchHub(1000)
|
||||||
@ -516,12 +516,12 @@ func (s *store) internalCreate(nodePath string, dir bool, value string, unique,
|
|||||||
valueCopy := value
|
valueCopy := value
|
||||||
eNode.Value = &valueCopy
|
eNode.Value = &valueCopy
|
||||||
|
|
||||||
n = newKV(s, nodePath, value, nextIndex, d, "", expireTime)
|
n = newKV(s, nodePath, value, nextIndex, d, expireTime)
|
||||||
|
|
||||||
} else { // create directory
|
} else { // create directory
|
||||||
eNode.Dir = true
|
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
|
// 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)
|
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
|
parent.Children[dirName] = n
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user