You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2020/08/05 18:34:05 UTC
[couchdb] 03/05: Prepare for reduce functions
This is an automated email from the ASF dual-hosted git repository.
davisp pushed a commit to branch prototype/fdb-layer-ebtree-views
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 65ca46b75c14c1978eea06ef810e1e457fc48571
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Wed Aug 5 12:46:18 2020 -0500
Prepare for reduce functions
---
src/couch_views/src/couch_views_reader.erl | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/couch_views/src/couch_views_reader.erl b/src/couch_views/src/couch_views_reader.erl
index 3a21834..6342f61 100644
--- a/src/couch_views/src/couch_views_reader.erl
+++ b/src/couch_views/src/couch_views_reader.erl
@@ -31,10 +31,10 @@ read(Db, Mrst0, ViewName, UserCallback, UserAcc0, Args) ->
views = Views
} = Mrst = couch_views_fdb:set_trees(TxDb, Mrst0),
- View = get_view(Lang, Args, ViewName, Views),
- Fun = fun handle_row/4,
+ View = get_map_view(Lang, Args, ViewName, Views),
+ Fun = fun handle_map_row/4,
- Meta = get_meta(TxDb, Mrst, View, Args),
+ Meta = get_map_meta(TxDb, Mrst, View, Args),
UserAcc1 = maybe_stop(UserCallback(Meta, UserAcc0)),
Acc0 = #{
@@ -68,23 +68,23 @@ read(Db, Mrst0, ViewName, UserCallback, UserAcc0, Args) ->
end.
-get_meta(TxDb, Mrst, View, #mrargs{update_seq = true}) ->
+get_map_meta(TxDb, Mrst, View, #mrargs{update_seq = true}) ->
TotalRows = couch_views_fdb:get_row_count(TxDb, View),
ViewSeq = couch_views_fdb:get_update_seq(TxDb, Mrst),
{meta, [{update_seq, ViewSeq}, {total, TotalRows}, {offset, null}]};
-get_meta(TxDb, _Mrst, View, #mrargs{}) ->
+get_map_meta(TxDb, _Mrst, View, #mrargs{}) ->
TotalRows = couch_views_fdb:get_row_count(TxDb, View),
{meta, [{total, TotalRows}, {offset, null}]}.
-handle_row(_DocId, _Key, _Value, #{skip := Skip} = Acc) when Skip > 0 ->
+handle_map_row(_DocId, _Key, _Value, #{skip := Skip} = Acc) when Skip > 0 ->
Acc#{skip := Skip - 1};
-handle_row(_DocID, _Key, _Value, #{limit := 0, acc := UserAcc}) ->
+handle_map_row(_DocID, _Key, _Value, #{limit := 0, acc := UserAcc}) ->
throw({complete, UserAcc});
-handle_row(DocId, Key, Value, Acc) ->
+handle_map_row(DocId, Key, Value, Acc) ->
#{
db := TxDb,
limit := Limit,
@@ -115,7 +115,7 @@ handle_row(DocId, Key, Value, Acc) ->
Acc#{limit := Limit - 1, acc := UserAcc1}.
-get_view(Lang, Args, ViewName, Views) ->
+get_map_view(Lang, Args, ViewName, Views) ->
case couch_mrview_util:extract_view(Lang, Args, ViewName, Views) of
{map, View, _Args} -> View;
{red, {_Idx, _Lang, View}, _} -> View