You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2018/07/10 10:50:48 UTC
[couchdb] 01/02: ?partition=foo
This is an automated email from the ASF dual-hosted git repository.
rnewson pushed a commit to branch user-partitioned-dbs-wip
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 03956d789bc641a4c59dccd9bd36cd8b37f02d89
Author: Robert Newson <rn...@apache.org>
AuthorDate: Mon Jul 9 23:16:45 2018 +0100
?partition=foo
---
src/couch_mrview/include/couch_mrview.hrl | 2 +-
src/couch_mrview/src/couch_mrview_http.erl | 4 ++--
src/couch_mrview/src/couch_mrview_util.erl | 32 +++++++++++++++---------------
3 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/couch_mrview/include/couch_mrview.hrl b/src/couch_mrview/include/couch_mrview.hrl
index 09faf51..094b1d5 100644
--- a/src/couch_mrview/include/couch_mrview.hrl
+++ b/src/couch_mrview/include/couch_mrview.hrl
@@ -89,7 +89,7 @@
callback,
sorted = true,
partitioned,
- partition_key,
+ partition,
extra = []
}).
diff --git a/src/couch_mrview/src/couch_mrview_http.erl b/src/couch_mrview/src/couch_mrview_http.erl
index 5ff7285..fac1d42 100644
--- a/src/couch_mrview/src/couch_mrview_http.erl
+++ b/src/couch_mrview/src/couch_mrview_http.erl
@@ -582,8 +582,8 @@ parse_param(Key, Val, Args, IsDecoded) ->
Args#mrargs{callback=couch_util:to_binary(Val)};
"sorted" ->
Args#mrargs{sorted=parse_boolean(Val)};
- "partition_key" ->
- Args#mrargs{partition_key=couch_util:to_binary(Val)};
+ "partition" ->
+ Args#mrargs{partition=couch_util:to_binary(Val)};
_ ->
BKey = couch_util:to_binary(Key),
BVal = couch_util:to_binary(Val),
diff --git a/src/couch_mrview/src/couch_mrview_util.erl b/src/couch_mrview/src/couch_mrview_util.erl
index aa67c88..a5e3840 100644
--- a/src/couch_mrview/src/couch_mrview_util.erl
+++ b/src/couch_mrview/src/couch_mrview_util.erl
@@ -560,15 +560,15 @@ validate_args(Args) ->
_ -> mrverror(<<"Invalid value for `sorted`.">>)
end,
- case {Args#mrargs.partitioned, Args#mrargs.partition_key} of
+ case {Args#mrargs.partitioned, Args#mrargs.partition} of
{true, undefined} ->
- mrverror(<<"`partition_key` parameter is mandatory for queries to this database.">>);
- {true, _PartitionKey} ->
+ mrverror(<<"`partition` parameter is mandatory for queries to this database.">>);
+ {true, _Partition} ->
ok;
{undefined, undefined} ->
ok;
- {undefined, _PartitionKey} ->
- mrverror(<<"`partition_key` parameter is not supported in this database.">>)
+ {undefined, _Partition} ->
+ mrverror(<<"`partition` parameter is not supported in this database.">>)
end,
Args.
@@ -592,23 +592,23 @@ update_args(#mrargs{} = Args) ->
HighestKey = {[{<<239, 191, 176>>, null}]}, % \ufff0
{StartKey, EndKey} = case Args of
- #mrargs{partition_key=undefined} ->
+ #mrargs{partition=undefined} ->
{Args#mrargs.start_key, Args#mrargs.end_key};
- #mrargs{partition_key=PKey0} when not is_binary(PKey0) ->
- mrverror(<<"`partition_key` must be a string.">>);
+ #mrargs{partition=P0} when not is_binary(P0) ->
+ mrverror(<<"`partition` must be a string.">>);
- #mrargs{partition_key=PKey0, start_key=undefined, end_key=undefined} ->
- {[PKey0, LowestKey], [PKey0, HighestKey]};
+ #mrargs{partition=P0, start_key=undefined, end_key=undefined} ->
+ {[P0, LowestKey], [P0, HighestKey]};
- #mrargs{partition_key=PKey0, start_key=SK0, end_key=undefined} ->
- {[PKey0, SK0], [PKey0, HighestKey]};
+ #mrargs{partition=P0, start_key=SK0, end_key=undefined} ->
+ {[P0, SK0], [P0, HighestKey]};
- #mrargs{partition_key=PKey0, start_key=undefined, end_key=EK0} ->
- {[PKey0, LowestKey], [PKey0, EK0]};
+ #mrargs{partition=P0, start_key=undefined, end_key=EK0} ->
+ {[P0, LowestKey], [P0, EK0]};
- #mrargs{partition_key=PKey0, start_key=SK0, end_key=EK0} ->
- {[PKey0, SK0], [PKey0, EK0]}
+ #mrargs{partition=P0, start_key=SK0, end_key=EK0} ->
+ {[P0, SK0], [P0, EK0]}
end,
Args#mrargs{