summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarren Smith <garren.smith@gmail.com>2020-03-31 15:26:03 +0200
committergarren smith <garren.smith@gmail.com>2020-04-06 17:55:49 +0200
commit5652e72e43406b7e4b743ee3fe7e2570aec77e95 (patch)
treed9a4431b06ec10571fdb15331f9012ccb09a5630
parent29ef7fb37007821edd8a0673226090cd47d48bab (diff)
downloadcouchdb-5652e72e43406b7e4b743ee3fe7e2570aec77e95.tar.gz
remove defer and load_ddocs from mango_utils
Clean up unused mango_utils functions.
-rw-r--r--src/mango/src/mango_idx.erl16
-rw-r--r--src/mango/src/mango_util.erl47
2 files changed, 0 insertions, 63 deletions
diff --git a/src/mango/src/mango_idx.erl b/src/mango/src/mango_idx.erl
index 99a35886f..9907cc781 100644
--- a/src/mango/src/mango_idx.erl
+++ b/src/mango/src/mango_idx.erl
@@ -19,7 +19,6 @@
-export([
list/1,
- recover/1,
new/2,
validate_new/2,
@@ -105,21 +104,6 @@ mango_sort_error(_Db, _Opts) ->
?MANGO_ERROR({no_usable_index, missing_sort_index}).
-recover(Db) ->
- {ok, DDocs0} = mango_util:open_ddocs(Db),
- Pred = fun({Props}) ->
- case proplists:get_value(<<"language">>, Props) of
- <<"query">> -> true;
- _ -> false
- end
- end,
- DDocs = lists:filter(Pred, DDocs0),
- Special = special(Db),
- {ok, Special ++ lists:flatmap(fun(Doc) ->
- from_ddoc(Db, Doc)
- end, DDocs)}.
-
-
get_sort_fields(Opts) ->
case lists:keyfind(sort, 1, Opts) of
{sort, Sort} ->
diff --git a/src/mango/src/mango_util.erl b/src/mango/src/mango_util.erl
index 18a643985..d649f95f1 100644
--- a/src/mango/src/mango_util.erl
+++ b/src/mango/src/mango_util.erl
@@ -15,13 +15,9 @@
-export([
open_doc/2,
- open_ddocs/1,
load_ddoc/2,
load_ddoc/3,
- defer/3,
- do_defer/3,
-
assert_ejson/1,
to_lower/1,
@@ -88,15 +84,6 @@ open_doc(Db, DocId, Options) ->
fabric2_db:open_doc(Db, DocId, Options).
-open_ddocs(Db) ->
- case mango_util:defer(fabric, design_docs, [Db]) of
- {ok, Docs} ->
- {ok, Docs};
- _ ->
- ?MANGO_ERROR(error_loading_ddocs)
- end.
-
-
load_ddoc(Db, DDocId) ->
load_ddoc(Db, DDocId, [deleted, ejson_body]).
@@ -112,40 +99,6 @@ load_ddoc(Db, DDocId, DbOpts) ->
end.
-defer(Mod, Fun, Args) ->
- {Pid, Ref} = erlang:spawn_monitor(?MODULE, do_defer, [Mod, Fun, Args]),
- receive
- {'DOWN', Ref, process, Pid, {mango_defer_ok, Value}} ->
- Value;
- {'DOWN', Ref, process, Pid, {mango_defer_throw, Value}} ->
- erlang:throw(Value);
- {'DOWN', Ref, process, Pid, {mango_defer_error, Value}} ->
- erlang:error(Value);
- {'DOWN', Ref, process, Pid, {mango_defer_exit, Value}} ->
- erlang:exit(Value)
- end.
-
-
-do_defer(Mod, Fun, Args) ->
- try erlang:apply(Mod, Fun, Args) of
- Resp ->
- erlang:exit({mango_defer_ok, Resp})
- catch
- throw:Error ->
- Stack = erlang:get_stacktrace(),
- couch_log:error("Defered error: ~w~n ~p", [{throw, Error}, Stack]),
- erlang:exit({mango_defer_throw, Error});
- error:Error ->
- Stack = erlang:get_stacktrace(),
- couch_log:error("Defered error: ~w~n ~p", [{error, Error}, Stack]),
- erlang:exit({mango_defer_error, Error});
- exit:Error ->
- Stack = erlang:get_stacktrace(),
- couch_log:error("Defered error: ~w~n ~p", [{exit, Error}, Stack]),
- erlang:exit({mango_defer_exit, Error})
- end.
-
-
assert_ejson({Props}) ->
assert_ejson_obj(Props);
assert_ejson(Vals) when is_list(Vals) ->