mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver/api/v2v3: fix "getDir" with "sorted"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
26e46702a2
commit
ba7cc04bac
@ -18,6 +18,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -94,6 +95,9 @@ func (s *v2v3Store) Get(nodePath string, recursive, sorted bool) (*v2store.Event
|
||||
func (s *v2v3Store) getDir(nodePath string, recursive, sorted bool, rev int64) ([]*v2store.NodeExtern, error) {
|
||||
rootNodes, err := s.getDirDepth(nodePath, 1, rev)
|
||||
if err != nil || !recursive {
|
||||
if sorted {
|
||||
sort.Sort(v2store.NodeExterns(rootNodes))
|
||||
}
|
||||
return rootNodes, err
|
||||
}
|
||||
nextNodes := rootNodes
|
||||
@ -110,6 +114,10 @@ func (s *v2v3Store) getDir(nodePath string, recursive, sorted bool, rev int64) (
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if sorted {
|
||||
sort.Sort(v2store.NodeExterns(rootNodes))
|
||||
}
|
||||
return rootNodes, nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user