diff options
author | Brad Anderson <brad@cloudant.com> | 2010-07-19 16:39:42 -0400 |
---|---|---|
committer | Adam Kocoloski <adam@cloudant.com> | 2010-08-12 01:24:31 -0400 |
commit | aceb96703ef4df50d080a9f9acd11a46c4db9fcb (patch) | |
tree | 2dbf22e2cc1a06c9932eddd2530e0615fd24c305 /src/mem3_httpd.erl | |
parent | 14f739cf46798d40a060e7280080f1a368c5093f (diff) |
make _membership/parts/dbname work for N>1, dumbass
Diffstat (limited to 'src/mem3_httpd.erl')
-rw-r--r-- | src/mem3_httpd.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mem3_httpd.erl b/src/mem3_httpd.erl index 958e9ef5..cbfaea95 100644 --- a/src/mem3_httpd.erl +++ b/src/mem3_httpd.erl @@ -20,7 +20,7 @@ handle_membership_req(#httpd{method='GET', ClusterNodes = try mem3:nodes() catch _:_ -> {ok,[]} end, Shards = mem3:shards(DbName), - JsonShards = json_shards(Shards, []), + JsonShards = json_shards(Shards, dict:new()), couch_httpd:send_json(Req, {[ {all_nodes, lists:sort([node()|nodes()])}, {cluster_nodes, lists:sort(ClusterNodes)}, @@ -31,7 +31,9 @@ handle_membership_req(#httpd{method='GET', %% internal %% -json_shards([], Acc) -> {lists:sort(Acc)}; +json_shards([], AccIn) -> + List = dict:to_list(AccIn), + {lists:sort(List)}; json_shards([#shard{node=Node, range=[B,_E]} | Rest], AccIn) -> HexBeg = couch_util:to_hex(<<B:32/integer>>), - json_shards(Rest, [{HexBeg,[Node]}|AccIn]). + json_shards(Rest, dict:append(HexBeg, Node, AccIn)). |