couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [04/48] mem3 commit: updated refs/heads/windsor-merge to ff02b9a
Date Fri, 01 Aug 2014 09:10:50 GMT
Moving shard maps _membership endpoint to _shards db handler


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/commit/a77e95f6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/a77e95f6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/a77e95f6

Branch: refs/heads/windsor-merge
Commit: a77e95f64cce417710897d9dee0c62d5169a44a3
Parents: d4e7748
Author: Russell Branca <chewbranca@gmail.com>
Authored: Fri Apr 12 16:48:14 2013 -0400
Committer: Robert Newson <rnewson@apache.org>
Committed: Wed Jul 23 18:12:09 2014 +0100

----------------------------------------------------------------------
 src/mem3_httpd.erl | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/a77e95f6/src/mem3_httpd.erl
----------------------------------------------------------------------
diff --git a/src/mem3_httpd.erl b/src/mem3_httpd.erl
index dc42924..2331e95 100644
--- a/src/mem3_httpd.erl
+++ b/src/mem3_httpd.erl
@@ -12,7 +12,7 @@
 
 -module(mem3_httpd).
 
--export([handle_membership_req/1]).
+-export([handle_membership_req/1, handle_shards_req/2]).
 
 %% includes
 -include_lib("mem3/include/mem3.hrl").
@@ -26,27 +26,25 @@ handle_membership_req(#httpd{method='GET',
     couch_httpd:send_json(Req, {[
         {all_nodes, lists:sort([node()|nodes()])},
         {cluster_nodes, lists:sort(ClusterNodes)}
-    ]});
-handle_membership_req(#httpd{method='GET',
-        path_parts=[<<"_membership">>, DbName]} = Req) ->
-    ClusterNodes = try mem3:nodes()
-    catch _:_ -> {ok,[]} end,
+    ]}).
+
+handle_shards_req(#httpd{method='GET',
+        path_parts=[_DbName, <<"_shards">>]} = Req, Db) ->
+    DbName = mem3:dbname(Db#db.name),
     Shards = mem3:shards(DbName),
     JsonShards = json_shards(Shards, dict:new()),
     couch_httpd:send_json(Req, {[
-        {all_nodes, lists:sort([node()|nodes()])},
-        {cluster_nodes, lists:sort(ClusterNodes)},
-        {partitions, JsonShards}
+        {shards, JsonShards}
     ]});
-handle_membership_req(#httpd{method='GET',
-        path_parts=[<<"_membership">>, DbName, DocId]} = Req) ->
+handle_shards_req(#httpd{method='GET',
+        path_parts=[_DbName, <<"_shards">>, DocId]} = Req, Db) ->
+    DbName = mem3:dbname(Db#db.name),
     Shards = mem3:shards(DbName, DocId),
     {[{Shard, Dbs}]} = json_shards(Shards, dict:new()),
     couch_httpd:send_json(Req, {[
         {range, Shard},
         {nodes, Dbs}
     ]}).
-
 %%
 %% internal
 %%


Mime
View raw message