couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r736837 - in /couchdb/trunk/src/couchdb: couch_db.hrl couch_httpd_view.erl couch_view.erl
Date Thu, 22 Jan 2009 22:42:45 GMT
Author: jchris
Date: Thu Jan 22 14:42:45 2009
New Revision: 736837

URL: http://svn.apache.org/viewvc?rev=736837&view=rev
Log:
change update=false to stale=ok

Modified:
    couchdb/trunk/src/couchdb/couch_db.hrl
    couchdb/trunk/src/couchdb/couch_httpd_view.erl
    couchdb/trunk/src/couchdb/couch_view.erl

Modified: couchdb/trunk/src/couchdb/couch_db.hrl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_db.hrl?rev=736837&r1=736836&r2=736837&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_db.hrl (original)
+++ couchdb/trunk/src/couchdb/couch_db.hrl Thu Jan 22 14:42:45 2009
@@ -144,7 +144,7 @@
     limit = 10000000000, % a huge huge default number. Picked so we don't have
                          % to do different logic for when there is no limit
                          % limit
-    update = true,
+    stale = false,
     direction = fwd,
     start_docid = nil,
     end_docid = {},

Modified: couchdb/trunk/src/couchdb/couch_httpd_view.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_view.erl?rev=736837&r1=736836&r2=736837&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_view.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_view.erl Thu Jan 22 14:42:45 2009
@@ -23,15 +23,15 @@
 
 design_doc_view(Req, Db, Id, ViewName, Keys) ->
     #view_query_args{
-        update = Update,
+        stale = Stale,
         reduce = Reduce
     } = QueryArgs = parse_view_query(Req, Keys),
     DesignId = <<"_design/", Id/binary>>,
-    case couch_view:get_map_view(Db, DesignId, ViewName, Update) of
+    case couch_view:get_map_view(Db, DesignId, ViewName, Stale) of
     {ok, View} ->    
         output_map_view(Req, View, Db, QueryArgs, Keys);
     {not_found, Reason} ->
-        case couch_view:get_reduce_view(Db, DesignId, ViewName, Update) of
+        case couch_view:get_reduce_view(Db, DesignId, ViewName, Stale) of
         {ok, ReduceView} ->
             parse_view_query(Req, Keys, true), % just for validation
             case Reduce of
@@ -256,8 +256,10 @@
             end;
         {"count", Value} ->
             throw({query_parse_error, "URL query parameter 'count' has been changed to 'limit'."});
+        {"stale", "ok"} ->
+            Args#view_query_args{stale=ok};
         {"update", "false"} ->
-            Args#view_query_args{update=false};
+            throw({query_parse_error, "URL query parameter 'update=false' has been changed
to 'stale=ok'."});
         {"descending", "true"} ->
             case Args#view_query_args.direction of
             fwd ->

Modified: couchdb/trunk/src/couchdb/couch_view.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_view.erl?rev=736837&r1=736836&r2=736837&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_view.erl (original)
+++ couchdb/trunk/src/couchdb/couch_view.erl Thu Jan 22 14:42:45 2009
@@ -41,10 +41,14 @@
         throw(Error)
     end.
     
-get_group(Db, GroupId, Update) ->
+get_group(Db, GroupId, Stale) ->
+    MinUpdateSeq = case Stale of
+    ok -> 0;
+    _Else -> couch_db:get_update_seq(Db)
+    end,
     couch_view_group:request_group(
             get_group_server(couch_db:name(Db), GroupId),
-            if Update -> couch_db:get_update_seq(Db); true -> 0 end).
+            MinUpdateSeq).
 
 
 get_temp_group(Db, Type, MapSrc, RedSrc) ->
@@ -136,8 +140,8 @@
     {ok, #group{views=[View]}} = get_temp_group(Db, Type, Src, []),
     {ok, View}.
 
-get_map_view(Db, GroupId, Name, Update) ->
-    case get_group(Db, GroupId, Update) of
+get_map_view(Db, GroupId, Name, Stale) ->
+    case get_group(Db, GroupId, Stale) of
     {ok, #group{views=Views}} ->
         get_map_view0(Name, Views);
     Error ->



Mime
View raw message