You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2021/04/06 08:56:47 UTC
[couchdb] 02/02: remove couch_index_server:validate
This is an automated email from the ASF dual-hosted git repository.
garren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 8843083046ad28b4c987ac4da580103eb43fa15c
Author: garren smith <ga...@gmail.com>
AuthorDate: Wed Mar 31 10:39:55 2021 +0200
remove couch_index_server:validate
This makes it that the only way to validate a design doc is
through couch_mrview:validate_ddoc so that the correct couch_eval
will be used.
---
src/couch/src/couch_db.erl | 2 +-
src/couch_index/src/couch_index_server.erl | 21 +--------------------
2 files changed, 2 insertions(+), 21 deletions(-)
diff --git a/src/couch/src/couch_db.erl b/src/couch/src/couch_db.erl
index 60d2bb7..6587205 100644
--- a/src/couch/src/couch_db.erl
+++ b/src/couch/src/couch_db.erl
@@ -895,7 +895,7 @@ validate_doc_update(Db, Doc, GetDiskDocFun) ->
validate_ddoc(Db, DDoc) ->
try
- ok = couch_index_server:validate(Db, couch_doc:with_ejson_body(DDoc))
+ ok = couch_mrview:validate(Db, couch_doc:with_ejson_body(DDoc))
catch
throw:{invalid_design_doc, Reason} ->
{bad_request, invalid_design_doc, Reason};
diff --git a/src/couch_index/src/couch_index_server.erl b/src/couch_index/src/couch_index_server.erl
index 6bebff2..de2fa1c 100644
--- a/src/couch_index/src/couch_index_server.erl
+++ b/src/couch_index/src/couch_index_server.erl
@@ -16,7 +16,7 @@
-vsn(2).
--export([start_link/0, validate/2, get_index/4, get_index/3, get_index/2]).
+-export([start_link/0, get_index/4, get_index/3, get_index/2]).
-export([init/1, terminate/2, code_change/3]).
-export([handle_call/3, handle_cast/2, handle_info/2]).
@@ -41,25 +41,6 @@ start_link() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
-validate(Db, DDoc) ->
- LoadModFun = fun
- ({ModNameList, "true"}) ->
- try
- [list_to_existing_atom(ModNameList)]
- catch error:badarg ->
- []
- end;
- ({_ModNameList, _Enabled}) ->
- []
- end,
- ValidateFun = fun
- (ModName) ->
- ModName:validate(Db, DDoc)
- end,
- EnabledIndexers = lists:flatmap(LoadModFun, config:get("indexers")),
- lists:foreach(ValidateFun, EnabledIndexers).
-
-
get_index(Module, <<"shards/", _/binary>> = DbName, DDoc)
when is_record(DDoc, doc) ->
get_index(Module, DbName, DDoc, nil);