You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by bb...@apache.org on 2014/10/31 20:53:31 UTC
[16/41] couch-mrview commit: updated refs/heads/master to 28e51f3
couch_mrview: add HTTP handler to retrieve the infos on a view.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/727ed624
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/727ed624
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/727ed624
Branch: refs/heads/master
Commit: 727ed6248428addfcf05c6c8951f636370084455
Parents: a043479
Author: benoitc <be...@apache.org>
Authored: Sat Feb 8 23:15:28 2014 +0100
Committer: Benjamin Bastian <be...@gmail.com>
Committed: Thu Oct 30 13:38:34 2014 -0700
----------------------------------------------------------------------
src/couch_mrview.erl | 6 +++---
src/couch_mrview_http.erl | 12 ++++++++++++
2 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/727ed624/src/couch_mrview.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview.erl b/src/couch_mrview.erl
index 5b5ba25..4658781 100644
--- a/src/couch_mrview.erl
+++ b/src/couch_mrview.erl
@@ -216,11 +216,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-couch-mrview/blob/727ed624/src/couch_mrview_http.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_http.erl b/src/couch_mrview_http.erl
index f3d3286..dfa294b 100644
--- a/src/couch_mrview_http.erl
+++ b/src/couch_mrview_http.erl
@@ -51,6 +51,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:increment_counter([couchdb, httpd, view_reads]),