couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [18/50] chttpd commit: updated refs/heads/master to 58020ab
Date Thu, 28 Aug 2014 11:59:41 GMT
Support "seq_interval" qs param on _changes

Supplying seq_interval=N will cause the changes feed to include a
sequence on every Nth row but set seq: null otherwise.  It's a
performance hack until we can deploy a more efficient format.

BugzID: 23637


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

Branch: refs/heads/master
Commit: 34c147567dc1f94d2bdace0e456834fc4ddcd56a
Parents: 1fc39d2
Author: Adam Kocoloski <adam@cloudant.com>
Authored: Tue Oct 1 21:47:50 2013 -0400
Committer: Robert Newson <rnewson@apache.org>
Committed: Tue Jul 29 18:17:33 2014 +0100

----------------------------------------------------------------------
 src/chttpd_db.erl | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/34c14756/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 7d27bd9..a6c6594 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -1224,6 +1224,7 @@ parse_doc_query(Req) ->
     end, #doc_query_args{}, chttpd:qs(Req)).
 
 parse_changes_query(Req) ->
+    erlang:erase(changes_seq_interval),
     ChangesArgs = lists:foldl(fun({Key, Value}, Args) ->
         case {string:to_lower(Key), Value} of
         {"feed", _} ->
@@ -1250,6 +1251,16 @@ parse_changes_query(Req) ->
             Args#changes_args{conflicts=true};
         {"filter", _} ->
             Args#changes_args{filter=Value};
+        {"seq_interval", _} ->
+            try list_to_integer(Value) of
+                V when V > 0 ->
+                    erlang:put(changes_seq_interval, V),
+                    Args;
+                _ ->
+                    throw({bad_request, invalid_seq_interval})
+            catch error:badarg ->
+                throw({bad_request, invalid_seq_interval})
+            end;
         _Else -> % unknown key value pair, ignore.
             Args
         end


Mime
View raw message