Skip to content

Commit

Permalink
store: add 0 as padding for better lexicographic sorting.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiang90 committed Aug 12, 2015
1 parent f468d8b commit 2bc4854
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Documentation/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,13 +423,13 @@ curl -s 'http://127.0.0.1:2379/v2/keys/queue?recursive=true&sorted=true'
"nodes": [
{
"createdIndex": 2,
"key": "/queue/2",
"key": "/queue/00000000000000000002",
"modifiedIndex": 2,
"value": "Job1"
},
{
"createdIndex": 3,
"key": "/queue/3",
"key": "/queue/00000000000000000003",
"modifiedIndex": 3,
"value": "Job2"
}
Expand Down
2 changes: 1 addition & 1 deletion store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ func (s *store) internalCreate(nodePath string, dir bool, value string, unique,
currIndex, nextIndex := s.CurrentIndex, s.CurrentIndex+1

if unique { // append unique item under the node path
nodePath += "/" + strconv.FormatUint(nextIndex, 10)
nodePath += "/" + fmt.Sprintf("%020s", strconv.FormatUint(nextIndex, 10))
}

nodePath = path.Clean(path.Join("/", nodePath))
Expand Down

0 comments on commit 2bc4854

Please sign in to comment.