summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Vatamaniuc <vatamane@gmail.com>2021-04-14 02:51:57 -0400
committerNick Vatamaniuc <vatamane@gmail.com>2021-04-15 12:32:01 -0400
commitce580b75c80e6140c9788625950c067fce34f8d1 (patch)
tree2c5efa414de5cc4a3046b679b36c2f60e3ef4343
parent846b1eaff02036e48055a68ef910b5c354a3d6a4 (diff)
downloadcouchdb-ce580b75c80e6140c9788625950c067fce34f8d1.tar.gz
Update all the applications to use the new couch_views utility functions
This is mostly a bulk search and replace to update fabric, couch_views, chttpd, mango and couch_replicator to use either the new included file or the new utility functions in couch_views. The `couch_views_http:transform_row/2` function was brought from the removed`fabric_view` module. It's used in only one place to it was copied there directly.
-rw-r--r--src/chttpd/src/chttpd_changes.erl2
-rw-r--r--src/chttpd/src/chttpd_db.erl12
-rw-r--r--src/chttpd/src/chttpd_misc.erl12
-rw-r--r--src/chttpd/src/chttpd_show.erl2
-rw-r--r--src/chttpd/src/chttpd_view.erl24
-rw-r--r--src/couch_replicator/src/couch_replicator_api_wrap.erl2
-rw-r--r--src/couch_views/src/couch_views.erl7
-rw-r--r--src/couch_views/src/couch_views_batch.erl2
-rw-r--r--src/couch_views/src/couch_views_batch_impl.erl2
-rw-r--r--src/couch_views/src/couch_views_fdb.erl1
-rw-r--r--src/couch_views/src/couch_views_http.erl32
-rw-r--r--src/couch_views/src/couch_views_indexer.erl1
-rw-r--r--src/couch_views/src/couch_views_jobs.erl1
-rw-r--r--src/couch_views/src/couch_views_reader.erl5
-rw-r--r--src/couch_views/src/couch_views_trees.erl1
-rw-r--r--src/couch_views/src/couch_views_updater.erl6
-rw-r--r--src/fabric/src/fabric2_db.erl2
-rw-r--r--src/fabric/src/fabric2_util.erl2
-rw-r--r--src/mango/src/mango_cursor_special.erl2
-rw-r--r--src/mango/src/mango_cursor_view.erl4
-rw-r--r--src/mango/src/mango_idx.erl2
-rw-r--r--src/mango/src/mango_json_bookmark.erl2
22 files changed, 68 insertions, 58 deletions
diff --git a/src/chttpd/src/chttpd_changes.erl b/src/chttpd/src/chttpd_changes.erl
index fcaee92df..79ca4d1b8 100644
--- a/src/chttpd/src/chttpd_changes.erl
+++ b/src/chttpd/src/chttpd_changes.erl
@@ -12,7 +12,7 @@
-module(chttpd_changes).
-include_lib("couch/include/couch_db.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
+-include_lib("couch_views/include/couch_views.hrl").
-export([
handle_db_changes/3,
diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl
index 8b9905927..8f08c7fe1 100644
--- a/src/chttpd/src/chttpd_db.erl
+++ b/src/chttpd/src/chttpd_db.erl
@@ -15,9 +15,7 @@
-compile(tuple_calls).
-include_lib("couch/include/couch_db.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
--include_lib("fabric/include/fabric.hrl").
--include_lib("mem3/include/mem3.hrl").
+-include_lib("couch_views/include/couch_views.hrl").
-export([handle_request/1, handle_compact_req/2, handle_design_req/2,
db_req/2, couch_doc_open/4,handle_changes_req/2,
@@ -573,7 +571,7 @@ db_req(#httpd{method='GET',path_parts=[_,OP]}=Req, Db) when ?IS_ALL_DOCS(OP) ->
db_req(#httpd{method='POST',
path_parts=[_, OP, <<"queries">>]}=Req, Db) when ?IS_ALL_DOCS(OP) ->
Props = chttpd:json_body_obj(Req),
- case couch_mrview_util:get_view_queries(Props) of
+ case couch_views_util:get_view_queries(Props) of
undefined ->
throw({bad_request,
<<"POST body must include `queries` parameter.">>});
@@ -890,7 +888,7 @@ send_all_docs_keys(Db, #mrargs{} = Args, VAcc0) ->
doc = DocValue
}
end,
- Row1 = fabric_view:transform_row(Row0),
+ Row1 = couch_views_http:transform_row(Row0),
view_cb(Row1, Acc)
end,
{ok, VAcc2} = fabric2_db:fold_docs(Db, Keys, CB, VAcc1, OpenOpts),
@@ -1131,7 +1129,7 @@ db_doc_req(#httpd{method='COPY'}=Req, Db, SourceDocId) ->
missing_rev -> nil;
Rev -> Rev
end,
- {TargetDocId0, TargetRevs} = couch_httpd_db:parse_copy_destination_header(Req),
+ {TargetDocId0, TargetRevs} = chttpd_util:parse_copy_destination_header(Req),
TargetDocId = list_to_binary(mochiweb_util:unquote(TargetDocId0)),
% open old doc
Doc = couch_doc_open(Db, SourceDocId, SourceRev, []),
@@ -1962,7 +1960,7 @@ set_namespace(<<"_local_docs">>, Args) ->
set_namespace(<<"_design_docs">>, Args) ->
set_namespace(<<"_design">>, Args);
set_namespace(NS, #mrargs{} = Args) ->
- couch_mrview_util:set_extra(Args, namespace, NS).
+ couch_views_util:set_extra(Args, namespace, NS).
%% /db/_bulk_get stuff
diff --git a/src/chttpd/src/chttpd_misc.erl b/src/chttpd/src/chttpd_misc.erl
index 5d9706abf..3f81c1b0c 100644
--- a/src/chttpd/src/chttpd_misc.erl
+++ b/src/chttpd/src/chttpd_misc.erl
@@ -30,7 +30,7 @@
]).
-include_lib("couch/include/couch_db.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
+-include_lib("couch_views/include/couch_views.hrl").
-import(chttpd,
[send_json/2,send_json/3,send_json/4,send_method_not_allowed/2,
@@ -115,7 +115,7 @@ handle_all_dbs_req(#httpd{method='GET'}=Req) ->
direction = Dir,
limit = Limit,
skip = Skip
- } = couch_mrview_http:parse_params(Req, undefined),
+ } = couch_views_http_util:parse_params(Req, undefined),
Options = [
{start_key, StartKey},
@@ -137,7 +137,7 @@ all_dbs_callback({meta, _Meta}, #vacc{resp=Resp0}=Acc) ->
{ok, Resp1} = chttpd:send_delayed_chunk(Resp0, "["),
{ok, Acc#vacc{resp=Resp1}};
all_dbs_callback({row, Row}, #vacc{resp=Resp0}=Acc) ->
- Prepend = couch_mrview_http:prepend_val(Acc),
+ Prepend = couch_views_http_util:prepend_val(Acc),
DbName = couch_util:get_value(id, Row),
{ok, Resp1} = chttpd:send_delayed_chunk(Resp0, [Prepend, ?JSON_ENCODE(DbName)]),
{ok, Acc#vacc{prepend=",", resp=Resp1}};
@@ -155,7 +155,7 @@ handle_dbs_info_req(#httpd{method = 'GET'} = Req) ->
handle_dbs_info_req(#httpd{method='POST', user_ctx=UserCtx}=Req) ->
chttpd:validate_ctype(Req, "application/json"),
Props = chttpd:json_body_obj(Req),
- Keys = couch_mrview_util:get_view_keys(Props),
+ Keys = couch_views_util:get_view_keys(Props),
case Keys of
undefined -> throw({bad_request, "`keys` member must exist."});
_ -> ok
@@ -248,7 +248,7 @@ send_db_infos(Req, ListFunctionName) ->
direction = Dir,
limit = Limit,
skip = Skip
- } = couch_mrview_http:parse_params(Req, undefined),
+ } = couch_views_http_util:parse_params(Req, undefined),
Options = [
{start_key, StartKey},
@@ -275,7 +275,7 @@ dbs_info_callback({meta, _Meta}, #vacc{resp = Resp0} = Acc) ->
{ok, Resp1} = chttpd:send_delayed_chunk(Resp0, "["),
{ok, Acc#vacc{resp = Resp1}};
dbs_info_callback({row, Props}, #vacc{resp = Resp0} = Acc) ->
- Prepend = couch_mrview_http:prepend_val(Acc),
+ Prepend = couch_views_http_util:prepend_val(Acc),
Chunk = [Prepend, ?JSON_ENCODE({Props})],
{ok, Resp1} = chttpd:send_delayed_chunk(Resp0, Chunk),
{ok, Acc#vacc{prepend = ",", resp = Resp1}};
diff --git a/src/chttpd/src/chttpd_show.erl b/src/chttpd/src/chttpd_show.erl
index b17309a0b..9fda7ff89 100644
--- a/src/chttpd/src/chttpd_show.erl
+++ b/src/chttpd/src/chttpd_show.erl
@@ -15,7 +15,7 @@
-export([handle_doc_update_req/3]).
-include_lib("couch/include/couch_db.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
+-include_lib("couch_views/include/couch_views.hrl").
maybe_open_doc(Db, DocId, Options) ->
diff --git a/src/chttpd/src/chttpd_view.erl b/src/chttpd/src/chttpd_view.erl
index 8d401013c..e0001da67 100644
--- a/src/chttpd/src/chttpd_view.erl
+++ b/src/chttpd/src/chttpd_view.erl
@@ -12,7 +12,7 @@
-module(chttpd_view).
-include_lib("couch/include/couch_db.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
+-include_lib("couch_views/include/couch_views.hrl").
-export([
handle_view_req/3,
@@ -35,10 +35,10 @@ multi_query_view(Req, Db, DDoc, ViewName, Queries) ->
stream_multi_query_view(Req, Db, DDoc, ViewName, Args0, Queries) ->
- {ok, #mrst{views=Views}} = couch_mrview_util:ddoc_to_mrst(Db, DDoc),
- Args1 = couch_mrview_util:set_view_type(Args0, ViewName, Views),
+ {ok, #mrst{views=Views}} = couch_views_util:ddoc_to_mrst(Db, DDoc),
+ Args1 = couch_views_util:set_view_type(Args0, ViewName, Views),
ArgQueries = parse_queries(Req, Args1, Queries, fun(QueryArg) ->
- couch_mrview_util:set_view_type(QueryArg, ViewName, Views)
+ couch_views_util:set_view_type(QueryArg, ViewName, Views)
end),
VAcc0 = #vacc{db=Db, req=Req, prepend="\r\n"},
FirstChunk = "{\"results\":[",
@@ -54,9 +54,9 @@ stream_multi_query_view(Req, Db, DDoc, ViewName, Args0, Queries) ->
paginate_multi_query_view(Req, Db, DDoc, ViewName, Args0, Queries) ->
- {ok, #mrst{views=Views}} = couch_mrview_util:ddoc_to_mrst(Db, DDoc),
+ {ok, #mrst{views=Views}} = couch_views_util:ddoc_to_mrst(Db, DDoc),
ArgQueries = parse_queries(Req, Args0, Queries, fun(QueryArg) ->
- couch_mrview_util:set_view_type(QueryArg, ViewName, Views)
+ couch_views_util:set_view_type(QueryArg, ViewName, Views)
end),
KeyFun = fun({Props}) ->
{couch_util:get_value(id, Props), couch_util:get_value(key, Props)}
@@ -76,7 +76,7 @@ paginate_multi_query_view(Req, Db, DDoc, ViewName, Args0, Queries) ->
design_doc_post_view(Req, Props, Db, DDoc, ViewName, Keys) ->
- Args = couch_mrview_http:parse_body_and_query(Req, Props, Keys),
+ Args = couch_views_http_util:parse_body_and_query(Req, Props, Keys),
fabric_query_view(Db, Req, DDoc, ViewName, Args).
design_doc_view(Req, Db, DDoc, ViewName, Keys) ->
@@ -134,7 +134,7 @@ handle_view_req(#httpd{method='POST',
path_parts=[_, _, _, _, ViewName, <<"queries">>]}=Req, Db, DDoc) ->
chttpd:validate_ctype(Req, "application/json"),
Props = couch_httpd:json_body_obj(Req),
- case couch_mrview_util:get_view_queries(Props) of
+ case couch_views_util:get_view_queries(Props) of
undefined ->
throw({bad_request,
<<"POST body must include `queries` parameter.">>});
@@ -156,8 +156,8 @@ handle_view_req(#httpd{method='POST',
path_parts=[_, _, _, _, ViewName]}=Req, Db, DDoc) ->
chttpd:validate_ctype(Req, "application/json"),
Props = couch_httpd:json_body_obj(Req),
- assert_no_queries_param(couch_mrview_util:get_view_queries(Props)),
- Keys = couch_mrview_util:get_view_keys(Props),
+ assert_no_queries_param(couch_views_util:get_view_queries(Props)),
+ Keys = couch_views_util:get_view_keys(Props),
couch_stats:increment_counter([couchdb, httpd, view_reads]),
design_doc_post_view(Req, Props, Db, DDoc, ViewName, Keys);
@@ -299,7 +299,7 @@ t_check_user_can_override_individual_query_type() ->
setup_all() ->
Views = [#mrview{reduce_funs = [{<<"v">>, <<"_count">>}]}],
- meck:expect(couch_mrview_util, ddoc_to_mrst, 2, {ok, #mrst{views = Views}}),
+ meck:expect(couch_views_util, ddoc_to_mrst, 2, {ok, #mrst{views = Views}}),
meck:expect(chttpd, start_delayed_json_response, 4, {ok, resp}),
meck:expect(couch_views, query, 6, {ok, #vacc{}}),
meck:expect(chttpd, send_delayed_chunk, 2, {ok, resp}),
@@ -314,7 +314,7 @@ setup() ->
meck:reset([
chttpd,
couch_views,
- couch_mrview_util
+ couch_views_util
]).
diff --git a/src/couch_replicator/src/couch_replicator_api_wrap.erl b/src/couch_replicator/src/couch_replicator_api_wrap.erl
index 1df8ee0c7..17e5bf2d6 100644
--- a/src/couch_replicator/src/couch_replicator_api_wrap.erl
+++ b/src/couch_replicator/src/couch_replicator_api_wrap.erl
@@ -19,7 +19,7 @@
% Many options and apis aren't yet supported here, they are added as needed.
-include_lib("couch/include/couch_db.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
+-include_lib("couch_views/include/couch_views.hrl").
-include("couch_replicator_api_wrap.hrl").
-export([
diff --git a/src/couch_views/src/couch_views.erl b/src/couch_views/src/couch_views.erl
index 179e2b35b..5804db092 100644
--- a/src/couch_views/src/couch_views.erl
+++ b/src/couch_views/src/couch_views.erl
@@ -26,7 +26,6 @@
]).
-include("couch_views.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
query(Db, DDoc, ViewName, Callback, Acc0, Args0) ->
@@ -46,8 +45,8 @@ query(Db, DDoc, ViewName, Callback, Acc0, Args0) ->
} = Mrst,
Args1 = to_mrargs(Args0),
- Args2 = couch_mrview_util:set_view_type(Args1, ViewName, Views),
- Args3 = couch_mrview_util:validate_args(Args2),
+ Args2 = couch_views_util:set_view_type(Args1, ViewName, Views),
+ Args3 = couch_views_validate:validate_args(Args2),
ok = check_range(Mrst, ViewName, Args3),
try
@@ -199,7 +198,7 @@ check_range(Mrst, ViewName, Args) ->
language = Lang,
views = Views
} = Mrst,
- View = case couch_mrview_util:extract_view(Lang, Args, ViewName, Views) of
+ View = case couch_views_util:extract_view(Lang, Args, ViewName, Views) of
{map, V, _} -> V;
{red, {_, _, V}, _} -> V
end,
diff --git a/src/couch_views/src/couch_views_batch.erl b/src/couch_views/src/couch_views_batch.erl
index ba2a22782..555eac9ed 100644
--- a/src/couch_views/src/couch_views_batch.erl
+++ b/src/couch_views/src/couch_views_batch.erl
@@ -20,7 +20,7 @@
]).
--include_lib("couch_mrview/include/couch_mrview.hrl").
+-include_lib("couch_views/include/couch_views.hrl").
-type update_stats() :: #{
docs_read => non_neg_integer(),
diff --git a/src/couch_views/src/couch_views_batch_impl.erl b/src/couch_views/src/couch_views_batch_impl.erl
index 9b3a4ad06..d17b5b1ec 100644
--- a/src/couch_views/src/couch_views_batch_impl.erl
+++ b/src/couch_views/src/couch_views_batch_impl.erl
@@ -22,7 +22,7 @@
]).
--include_lib("couch_mrview/include/couch_mrview.hrl").
+-include_lib("couch_views/include/couch_views.hrl").
-record(batch_st, {
diff --git a/src/couch_views/src/couch_views_fdb.erl b/src/couch_views/src/couch_views_fdb.erl
index b0fb82e85..d8c981300 100644
--- a/src/couch_views/src/couch_views_fdb.erl
+++ b/src/couch_views/src/couch_views_fdb.erl
@@ -38,7 +38,6 @@
-include("couch_views.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
-include_lib("fabric/include/fabric2.hrl").
diff --git a/src/couch_views/src/couch_views_http.erl b/src/couch_views/src/couch_views_http.erl
index 769d8c36c..67e2a7708 100644
--- a/src/couch_views/src/couch_views_http.erl
+++ b/src/couch_views/src/couch_views_http.erl
@@ -13,7 +13,7 @@
-module(couch_views_http).
-include_lib("couch/include/couch_db.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
+-include_lib("couch_views/include/couch_views.hrl").
-export([
parse_body_and_query/2,
@@ -24,7 +24,8 @@
row_to_obj/2,
view_cb/2,
paginated/5,
- paginated/6
+ paginated/6,
+ transform_row/1
]).
-define(BOOKMARK_VSN, 1).
@@ -63,7 +64,7 @@ parse_params(Props, Keys, #mrargs{}=Args, Options) ->
_ ->
throw({bad_request, "Cannot use `bookmark` with other options"})
end,
- couch_mrview_http:parse_params(Props, Keys, Args, Options).
+ couch_views_http_util:parse_params(Props, Keys, Args, Options).
row_to_obj(Row) ->
@@ -72,11 +73,11 @@ row_to_obj(Row) ->
row_to_obj(Id, Row) ->
- couch_mrview_http:row_to_obj(Id, Row).
+ couch_views_http_util:row_to_obj(Id, Row).
view_cb(Msg, #vacc{paginated = false}=Acc) ->
- couch_mrview_http:view_cb(Msg, Acc);
+ couch_views_http_util:view_cb(Msg, Acc);
view_cb(Msg, #vacc{paginated = true}=Acc) ->
paginated_cb(Msg, Acc).
@@ -279,6 +280,25 @@ mask_to_index(Mask, Pos, Acc) when is_integer(Mask), Mask > 0 ->
mask_to_index(Mask bsr 1, Pos + 1, NewAcc).
+transform_row(#view_row{value={[{reduce_overflow_error, Msg}]}}) ->
+ {row, [{key,null}, {id,error}, {value,reduce_overflow_error}, {reason,Msg}]};
+
+transform_row(#view_row{key=Key, id=reduced, value=Value}) ->
+ {row, [{key,Key}, {value,Value}]};
+
+transform_row(#view_row{key=Key, id=undefined}) ->
+ {row, [{key,Key}, {id,error}, {value,not_found}]};
+
+transform_row(#view_row{key=Key, id=Id, value=Value, doc=undefined}) ->
+ {row, [{id,Id}, {key,Key}, {value,Value}]};
+
+transform_row(#view_row{key=Key, id=_Id, value=_Value, doc={error,Reason}}) ->
+ {row, [{id,error}, {key,Key}, {value,Reason}]};
+
+transform_row(#view_row{key=Key, id=Id, value=Value, doc=Doc}) ->
+ {row, [{id,Id}, {key,Key}, {value,Value}, {doc,Doc}]}.
+
+
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
@@ -351,4 +371,4 @@ check_completion_test() ->
check_completion(2, 3, [1, 2, 3, 4, 5])
),
ok.
--endif. \ No newline at end of file
+-endif.
diff --git a/src/couch_views/src/couch_views_indexer.erl b/src/couch_views/src/couch_views_indexer.erl
index df537977f..88b1ff623 100644
--- a/src/couch_views/src/couch_views_indexer.erl
+++ b/src/couch_views/src/couch_views_indexer.erl
@@ -30,7 +30,6 @@
-include("couch_views.hrl").
-include_lib("couch/include/couch_db.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
-include_lib("fabric/include/fabric2.hrl").
diff --git a/src/couch_views/src/couch_views_jobs.erl b/src/couch_views/src/couch_views_jobs.erl
index 022d27c7f..17f0118b4 100644
--- a/src/couch_views/src/couch_views_jobs.erl
+++ b/src/couch_views/src/couch_views_jobs.erl
@@ -26,7 +26,6 @@
-endif.
--include_lib("couch_mrview/include/couch_mrview.hrl").
-include("couch_views.hrl").
diff --git a/src/couch_views/src/couch_views_reader.erl b/src/couch_views/src/couch_views_reader.erl
index 0fc910f77..ae7a3c393 100644
--- a/src/couch_views/src/couch_views_reader.erl
+++ b/src/couch_views/src/couch_views_reader.erl
@@ -19,7 +19,6 @@
-include("couch_views.hrl").
-include_lib("couch/include/couch_db.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
-include_lib("fabric/include/fabric2.hrl").
@@ -245,14 +244,14 @@ maybe_finalize(Finalizer, Red) ->
get_map_view(Lang, Args, ViewName, Views) ->
- case couch_mrview_util:extract_view(Lang, Args, ViewName, Views) of
+ case couch_views_util:extract_view(Lang, Args, ViewName, Views) of
{map, View, _Args} -> View;
{red, {_Idx, _Lang, View}, _} -> View
end.
get_red_view(Lang, Args, ViewName, Views) ->
- case couch_mrview_util:extract_view(Lang, Args, ViewName, Views) of
+ case couch_views_util:extract_view(Lang, Args, ViewName, Views) of
{red, {Idx, Lang, View}, _} -> check_red_enabled({Idx, Lang, View});
_ -> throw({not_found, missing_named_view})
end.
diff --git a/src/couch_views/src/couch_views_trees.erl b/src/couch_views/src/couch_views_trees.erl
index 51c1e46cf..9aafbb276 100644
--- a/src/couch_views/src/couch_views_trees.erl
+++ b/src/couch_views/src/couch_views_trees.erl
@@ -32,7 +32,6 @@
-include("couch_views.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
-include_lib("fabric/include/fabric2.hrl").
diff --git a/src/couch_views/src/couch_views_updater.erl b/src/couch_views/src/couch_views_updater.erl
index 7e5466eb8..defdb6ba6 100644
--- a/src/couch_views/src/couch_views_updater.erl
+++ b/src/couch_views/src/couch_views_updater.erl
@@ -17,7 +17,7 @@
-include_lib("couch/include/couch_db.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
+-include_lib("couch_views/include/couch_views.hrl").
% If the doc revision doesn't not match the NewRevId passed here we can ignore
% the document since it is then a conflict document and it doesn't need
@@ -52,7 +52,7 @@ index_int(Db, #doc{id = <<?DESIGN_DOC_PREFIX, _/binary>>,
case couch_views_ddoc:is_interactive(DDoc) of
true ->
- {ok, Mrst} = couch_mrview_util:ddoc_to_mrst(DbName, DDoc),
+ {ok, Mrst} = couch_views_util:ddoc_to_mrst(DbName, DDoc),
case couch_views_fdb:get_creation_vs(Db, Mrst) of
not_found ->
couch_views_fdb:new_interactive_index(Db, Mrst, Seq),
@@ -87,7 +87,7 @@ write_doc(Db, #doc{deleted = Deleted} = Doc) ->
},
lists:foreach(fun(DDoc) ->
- {ok, Mrst0} = couch_mrview_util:ddoc_to_mrst(DbName, DDoc),
+ {ok, Mrst0} = couch_views_util:ddoc_to_mrst(DbName, DDoc),
Mrst1 = couch_views_trees:open(Db, Mrst0),
case should_index_doc(Doc, Mrst1) of
diff --git a/src/fabric/src/fabric2_db.erl b/src/fabric/src/fabric2_db.erl
index aab80a803..0074865a0 100644
--- a/src/fabric/src/fabric2_db.erl
+++ b/src/fabric/src/fabric2_db.erl
@@ -2144,7 +2144,7 @@ validate_doc_update(Db, Doc, PrevDoc) ->
validate_ddoc(Db, DDoc) ->
try
- ok = couch_mrview:validate(Db, couch_doc:with_ejson_body(DDoc))
+ ok = couch_views_validate:validate_ddoc(Db, DDoc)
catch
throw:{invalid_design_doc, Reason} ->
throw({bad_request, invalid_design_doc, Reason});
diff --git a/src/fabric/src/fabric2_util.erl b/src/fabric/src/fabric2_util.erl
index 136762b34..7c212521d 100644
--- a/src/fabric/src/fabric2_util.erl
+++ b/src/fabric/src/fabric2_util.erl
@@ -50,7 +50,7 @@
-include_lib("couch/include/couch_db.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
+-include_lib("couch_views/include/couch_views.hrl").
revinfo_to_revs(RevInfo) ->
diff --git a/src/mango/src/mango_cursor_special.erl b/src/mango/src/mango_cursor_special.erl
index df1f6d655..33a1f8c46 100644
--- a/src/mango/src/mango_cursor_special.erl
+++ b/src/mango/src/mango_cursor_special.erl
@@ -24,7 +24,7 @@
-include_lib("couch/include/couch_db.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
+-include_lib("couch_views/include/couch_views.hrl").
-include("mango_cursor.hrl").
diff --git a/src/mango/src/mango_cursor_view.erl b/src/mango/src/mango_cursor_view.erl
index 43a59ff92..992e9cf7d 100644
--- a/src/mango/src/mango_cursor_view.erl
+++ b/src/mango/src/mango_cursor_view.erl
@@ -27,9 +27,7 @@
-include_lib("couch/include/couch_db.hrl").
--include_lib("couch_mrview/include/couch_mrview.hrl").
--include_lib("fabric/include/fabric.hrl").
-
+-include_lib("couch_views/include/couch_views.hrl").
-include("mango_cursor.hrl").
-include("mango_idx_view.hrl").
diff --git a/src/mango/src/mango_idx.erl b/src/mango/src/mango_idx.erl
index 7108ae684..e27f327edf 100644
--- a/src/mango/src/mango_idx.erl
+++ b/src/mango/src/mango_idx.erl
@@ -60,7 +60,7 @@ list(Db) ->
case proplists:get_value(<<"language">>, Props) == <<"query">> of
true ->
- {ok, Mrst} = couch_mrview_util:ddoc_to_mrst(DbName, DDoc),
+ {ok, Mrst} = couch_views_util:ddoc_to_mrst(DbName, DDoc),
IsInteractive = couch_views_ddoc:is_interactive(DDoc),
BuildState = couch_views_fdb:get_build_status(Db, Mrst),
diff --git a/src/mango/src/mango_json_bookmark.erl b/src/mango/src/mango_json_bookmark.erl
index 83fd00f29..b60ecdb18 100644
--- a/src/mango/src/mango_json_bookmark.erl
+++ b/src/mango/src/mango_json_bookmark.erl
@@ -19,7 +19,7 @@
]).
--include_lib("couch_mrview/include/couch_mrview.hrl").
+-include_lib("couch_views/include/couch_views.hrl").
-include("mango_cursor.hrl").
-include("mango.hrl").