couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From beno...@apache.org
Subject [1/2] couchdb commit: updated refs/heads/1994-merge-rcouch to c246549
Date Sat, 08 Feb 2014 23:46:36 GMT
Updated Branches:
  refs/heads/1994-merge-rcouch 1e6114c56 -> c24654992


couch_mrview: add HTTP handler to retrieve the infos on a view.


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

Branch: refs/heads/1994-merge-rcouch
Commit: 0bbd65cdd6dc412c9944f7b49c10d63c61622267
Parents: 1e6114c
Author: Benoit Chesneau <benoitc@apache.org>
Authored: Sat Feb 8 23:15:28 2014 +0100
Committer: Benoit Chesneau <benoitc@apache.org>
Committed: Sat Feb 8 23:15:28 2014 +0100

----------------------------------------------------------------------
 apps/couch_mrview/src/couch_mrview.erl      |  6 +++---
 apps/couch_mrview/src/couch_mrview_http.erl | 12 ++++++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/0bbd65cd/apps/couch_mrview/src/couch_mrview.erl
----------------------------------------------------------------------
diff --git a/apps/couch_mrview/src/couch_mrview.erl b/apps/couch_mrview/src/couch_mrview.erl
index e5b0d99..a578b85 100644
--- a/apps/couch_mrview/src/couch_mrview.erl
+++ b/apps/couch_mrview/src/couch_mrview.erl
@@ -161,11 +161,11 @@ get_view_info(Db, DDoc, VName) ->
     {ok, TotalSeqs} = case SeqBtree of
         nil -> {ok, 0};
         _ ->
-            {ok, {Count, _Reds}} = couch_btree:full_reduce(SeqBtree),
-            {ok, Count}
+            couch_btree:full_reduce(SeqBtree)
     end,
 
-    {ok, [{update_seq, View#mrview.update_seq},
+    {ok, [{seq_indexed, View#mrview.seq_indexed},
+          {update_seq, View#mrview.update_seq},
           {purge_seq, View#mrview.purge_seq},
           {total_rows, TotalRows},
           {total_seqs, TotalSeqs}]}.

http://git-wip-us.apache.org/repos/asf/couchdb/blob/0bbd65cd/apps/couch_mrview/src/couch_mrview_http.erl
----------------------------------------------------------------------
diff --git a/apps/couch_mrview/src/couch_mrview_http.erl b/apps/couch_mrview/src/couch_mrview_http.erl
index 4801e27..c5ba622 100644
--- a/apps/couch_mrview/src/couch_mrview_http.erl
+++ b/apps/couch_mrview/src/couch_mrview_http.erl
@@ -48,6 +48,18 @@ handle_all_docs_req(Req, _Db) ->
     couch_httpd:send_method_not_allowed(Req, "GET,POST,HEAD").
 
 
+handle_view_req(#httpd{method='GET',
+                      path_parts=[_, _, DDocName, _, VName, <<"_info">>]}=Req,
+                Db, DDoc) ->
+
+    DDocId = <<"_design/", DDocName/binary >>,
+    {ok, Info} = couch_mrview:get_view_info(Db#db.name, DDocId, VName),
+
+    FinalInfo = [{db_name, Db#db.name},
+                 {ddoc, DDocId},
+                 {view, VName}] ++ Info,
+    couch_httpd:send_json(Req, 200, {FinalInfo});
+
 handle_view_req(#httpd{method='GET'}=Req, Db, DDoc) ->
     [_, _, _, _, ViewName] = Req#httpd.path_parts,
     couch_stats_collector:increment({httpd, view_reads}),


Mime
View raw message