diff options
author | Damien F. Katz <damien@apache.org> | 2008-11-11 19:45:50 +0000 |
---|---|---|
committer | Damien F. Katz <damien@apache.org> | 2008-11-11 19:45:50 +0000 |
commit | 9044fc0234ed65056f087a86c7c117922f2a2c75 (patch) | |
tree | ea87133de1e3617c5d3d7366983b7f7039d6cffd /src/couchdb/couch_key_tree.erl | |
parent | 538f455f2e2842d5caa33ed300d28b3cd52599b3 (diff) |
Check in of initial validation and authorization work. This work is incomplete, as there is not yet any way of restricting who can update the design docs.
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@713132 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_key_tree.erl')
-rw-r--r-- | src/couchdb/couch_key_tree.erl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/couchdb/couch_key_tree.erl b/src/couchdb/couch_key_tree.erl index 3a05fd4d..82c42265 100644 --- a/src/couchdb/couch_key_tree.erl +++ b/src/couchdb/couch_key_tree.erl @@ -13,7 +13,7 @@ -module(couch_key_tree). -export([merge/2, find_missing/2, get_key_leafs/2, get_full_key_paths/2, get/2]). --export([map/2, get_all_leafs/1, get_leaf_keys/1, count_leafs/1, remove_leafs/2]). +-export([map/2, get_all_leafs/1, get_leaf_keys/1, count_leafs/1, remove_leafs/2,get_all_leafs_full/1]). % a key tree looks like this: % Tree -> [] or [{Key, Value, ChildTree} | SiblingTree] @@ -137,6 +137,16 @@ get_full_key_paths([{KeyId, Value, SubTree} | RestTree], KeysToGet, KeyPathAcc) {KeysGotten2, KeysRemaining2} = get_full_key_paths(RestTree, KeysRemaining, KeyPathAcc), {CurrentNodeResult ++ KeysGotten ++ KeysGotten2, KeysRemaining2}. +get_all_leafs_full(Tree) -> + get_all_leafs_full(Tree, []). + +get_all_leafs_full([], _KeyPathAcc) -> + []; +get_all_leafs_full([{KeyId, Value, []} | RestTree], KeyPathAcc) -> + [[{KeyId, Value} | KeyPathAcc] | get_all_leafs_full(RestTree, KeyPathAcc)]; +get_all_leafs_full([{KeyId, Value, SubTree} | RestTree], KeyPathAcc) -> + get_all_leafs_full(SubTree, [{KeyId, Value} | KeyPathAcc]) ++ get_all_leafs_full(RestTree, KeyPathAcc). + get_all_leafs(Tree) -> get_all_leafs(Tree, []). |