Browse Source

add documentation about sorting, change the argument name from sorting to sorted

evan-gu 12 years ago
parent
commit
38489bd846
2 changed files with 4 additions and 3 deletions
  1. 2 1
      Documentation/etcd-file-system.md
  2. 2 2
      file_system/file_system.go

+ 2 - 1
Documentation/etcd-file-system.md

@@ -23,12 +23,13 @@ Besides the file and directory difference, all nodes have common attributes and
   The path of access control list of the node.
 
 ### Operation:
-- **Get** (path, recursive)
+- **Get** (path, recursive, sorted)
 
   Get the content of the node
     - If the node is a file, the data of the file will be returned.
     - If the node is a directory, the child nodes of the directory will be returned.
     - If recursive is true, it will recursively get the nodes of the directory.
+    - If sorted is true, the result will be sorted based on the path.
 
 - **Create** (path, value[optional], ttl [optional])
 

+ 2 - 2
file_system/file_system.go

@@ -26,7 +26,7 @@ func New() *FileSystem {
 
 }
 
-func (fs *FileSystem) Get(nodePath string, recusive, sorting bool, index uint64, term uint64) (*Event, error) {
+func (fs *FileSystem) Get(nodePath string, recusive, sorted bool, index uint64, term uint64) (*Event, error) {
 	n, err := fs.InternalGet(nodePath, index, term)
 
 	if err != nil {
@@ -58,7 +58,7 @@ func (fs *FileSystem) Get(nodePath string, recusive, sorting bool, index uint64,
 
 		// eliminate hidden nodes
 		e.KVPairs = e.KVPairs[:i]
-		if sorting {
+		if sorted {
 			sort.Sort(e)
 		}
 	} else { // node is file