Use interface fun instead of direct #group access

BugzID: 13487

Conflicts:
        src/chttpd_view.erl


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

Branch: refs/heads/import
Commit: cb9c80676433de925bfeb2d1b26a30407d948592
Parents: cdd9d92
Author: Adam Kocoloski <[email protected]>
Authored: Tue Feb 26 16:23:39 2013 -0500
Committer: Robert Newson <[email protected]>
Committed: Wed Mar 6 12:22:38 2013 -0600

----------------------------------------------------------------------
 src/chttpd_show.erl |  4 ++--
 src/chttpd_view.erl | 11 +++++++----
 2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/cb9c8067/src/chttpd_show.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_show.erl b/src/chttpd_show.erl
index ebf533a..2acb8a9 100644
--- a/src/chttpd_show.erl
+++ b/src/chttpd_show.erl
@@ -186,8 +186,8 @@ handle_view_list(Req, Db, DDoc, LName, {ViewDesignName, 
ViewName}, Keys) ->
     {ok, VDoc} = fabric:open_doc(Db, <<"_design/", ViewDesignName/binary>>, 
[]),
     Group = couch_view_group:design_doc_to_view_group(VDoc),
     IsReduce = chttpd_view:get_reduce_type(Req),
-    ViewType = chttpd_view:extract_view_type(ViewName, Group#group.views,
-        IsReduce),
+    ViewType = chttpd_view:extract_view_type(ViewName,
+        couch_view_group:get_views(Group), IsReduce),
     QueryArgs = chttpd_view:parse_view_params(Req, Keys, ViewType),
     CB = fun list_callback/2,
     Etag = couch_uuids:new(),

http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/cb9c8067/src/chttpd_view.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_view.erl b/src/chttpd_view.erl
index 61128f7..2c64dda 100644
--- a/src/chttpd_view.erl
+++ b/src/chttpd_view.erl
@@ -21,7 +21,8 @@
 multi_query_view(Req, Db, DDoc, ViewName, Queries) ->
     Group = couch_view_group:design_doc_to_view_group(DDoc),
     IsReduce = get_reduce_type(Req),
-    ViewType = extract_view_type(ViewName, Group#group.views, IsReduce),
+    ViewType = extract_view_type(ViewName, couch_view_group:get_views(Group),
+        IsReduce),
     % TODO proper calculation of etag
     % Etag = view_group_etag(ViewGroup, Db, Queries),
     Etag = couch_uuids:new(),
@@ -52,7 +53,8 @@ multi_query_view(Req, Db, DDoc, ViewName, Queries) ->
 design_doc_view(Req, Db, DDoc, ViewName, Keys) ->
     Group = couch_view_group:design_doc_to_view_group(DDoc),
     IsReduce = get_reduce_type(Req),
-    ViewType = extract_view_type(ViewName, Group#group.views, IsReduce),
+    ViewType = extract_view_type(ViewName, couch_view_group:get_views(Group),
+        IsReduce),
     QueryArgs = parse_view_params(Req, Keys, ViewType),
     % TODO proper calculation of etag
     % Etag = view_group_etag(ViewGroup, Db, Keys),
@@ -367,8 +369,9 @@ validate_view_query(extra, _Value, Args) ->
 view_group_etag(Group, Db) ->
     view_group_etag(Group, Db, nil).
 
-view_group_etag(#group{sig=Sig,current_seq=CurrentSeq}, _Db, Extra) ->
-    % ?LOG_ERROR("Group ~p",[Group]),
+view_group_etag(Group, _Db, Extra) ->
+    Sig = couch_view_group:get_signature(Group),
+    CurrentSeq = couch_view_group:get_current_seq(Group),
     % This is not as granular as it could be.
     % If there are updates to the db that do not effect the view index,
     % they will change the Etag. For more granular Etags we'd need to keep

Reply via email to