couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject couchdb-mango git commit: Configurable default limit
Date Fri, 30 Sep 2016 11:52:35 GMT
Repository: couchdb-mango
Updated Branches:
  refs/heads/75444-mango-configurable-default [created] ddd6a4d44


Configurable default limit


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

Branch: refs/heads/75444-mango-configurable-default
Commit: ddd6a4d44019975efe660203859e67211da1d255
Parents: 610ccb6
Author: Robert Newson <rnewson@apache.org>
Authored: Fri Sep 30 12:40:31 2016 +0100
Committer: Robert Newson <rnewson@apache.org>
Committed: Fri Sep 30 12:40:51 2016 +0100

----------------------------------------------------------------------
 src/mango_cursor.hrl         | 4 ++--
 src/mango_cursor_special.erl | 2 +-
 src/mango_cursor_text.erl    | 2 +-
 src/mango_cursor_view.erl    | 2 +-
 src/mango_opts.erl           | 8 ++++++--
 5 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/ddd6a4d4/src/mango_cursor.hrl
----------------------------------------------------------------------
diff --git a/src/mango_cursor.hrl b/src/mango_cursor.hrl
index 5706b6b..58782e5 100644
--- a/src/mango_cursor.hrl
+++ b/src/mango_cursor.hrl
@@ -16,9 +16,9 @@
     ranges,
     selector,
     opts,
-    limit = 25,
+    limit,
     skip = 0,
     fields = undefined,
     user_fun,
     user_acc
-}).
\ No newline at end of file
+}).

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/ddd6a4d4/src/mango_cursor_special.erl
----------------------------------------------------------------------
diff --git a/src/mango_cursor_special.erl b/src/mango_cursor_special.erl
index 6058217..8404bc0 100644
--- a/src/mango_cursor_special.erl
+++ b/src/mango_cursor_special.erl
@@ -35,7 +35,7 @@ create(Db, Indexes, Selector, Opts) ->
     Composited = mango_cursor_view:composite_indexes(Indexes, FieldRanges),
     {Index, IndexRanges} = mango_cursor_view:choose_best_index(Db, Composited),
 
-    Limit = couch_util:get_value(limit, Opts, 10000000000),
+    Limit = couch_util:get_value(limit, Opts, mango_opts:default_limit()),
     Skip = couch_util:get_value(skip, Opts, 0),
     Fields = couch_util:get_value(fields, Opts, all_fields),
 

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/ddd6a4d4/src/mango_cursor_text.erl
----------------------------------------------------------------------
diff --git a/src/mango_cursor_text.erl b/src/mango_cursor_text.erl
index 920f6f7..a094b55 100644
--- a/src/mango_cursor_text.erl
+++ b/src/mango_cursor_text.erl
@@ -51,7 +51,7 @@ create(Db, Indexes, Selector, Opts0) ->
     Opts = unpack_bookmark(Db#db.name, Opts0),
 
     DreyfusLimit = get_dreyfus_limit(),
-    Limit = erlang:min(DreyfusLimit, couch_util:get_value(limit, Opts, 50)),
+    Limit = erlang:min(DreyfusLimit, couch_util:get_value(limit, Opts, mango_opts:default_limit())),
     Skip = couch_util:get_value(skip, Opts, 0),
     Fields = couch_util:get_value(fields, Opts, all_fields),
 

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/ddd6a4d4/src/mango_cursor_view.erl
----------------------------------------------------------------------
diff --git a/src/mango_cursor_view.erl b/src/mango_cursor_view.erl
index 5f109cd..302acd3 100644
--- a/src/mango_cursor_view.erl
+++ b/src/mango_cursor_view.erl
@@ -35,7 +35,7 @@ create(Db, Indexes, Selector, Opts) ->
     Composited = composite_indexes(Indexes, FieldRanges),
     {Index, IndexRanges} = choose_best_index(Db, Composited),
 
-    Limit = couch_util:get_value(limit, Opts, 10000000000),
+    Limit = couch_util:get_value(limit, Opts, mango_opts:default_limit()),
     Skip = couch_util:get_value(skip, Opts, 0),
     Fields = couch_util:get_value(fields, Opts, all_fields),
 

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/ddd6a4d4/src/mango_opts.erl
----------------------------------------------------------------------
diff --git a/src/mango_opts.erl b/src/mango_opts.erl
index 40e3504..af318d2 100644
--- a/src/mango_opts.erl
+++ b/src/mango_opts.erl
@@ -32,7 +32,9 @@
     validate_bookmark/1,
     validate_sort/1,
     validate_fields/1,
-    validate_bulk_delete/1
+    validate_bulk_delete/1,
+
+    default_limit/0
 ]).
 
 
@@ -93,7 +95,7 @@ validate_find({Props}) ->
         {<<"limit">>, [
             {tag, limit},
             {optional, true},
-            {default, 25},
+            {default, default_limit()},
             {validator, fun is_non_neg_integer/1}
         ]},
         {<<"skip">>, [
@@ -308,3 +310,5 @@ validate_opt(Name, [{validator, Fun} | Rest], Value) ->
     end.
 
 
+default_limit() ->
+    config:get_integer("mango", "default_limit", 25).


Mime
View raw message