From aceb96703ef4df50d080a9f9acd11a46c4db9fcb Mon Sep 17 00:00:00 2001 From: Brad Anderson Date: Mon, 19 Jul 2010 16:39:42 -0400 Subject: make _membership/parts/dbname work for N>1, dumbass --- src/mem3_httpd.erl | 8 +++++--- 1 file 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(<>), - json_shards(Rest, [{HexBeg,[Node]}|AccIn]). + json_shards(Rest, dict:append(HexBeg, Node, AccIn)). -- cgit v1.2.3