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 2015/10/01 17:06:56 UTC
[1/3] couch commit: updated refs/heads/master to 4ca9e41
Repository: couchdb-couch
Updated Branches:
refs/heads/master 0430a7fb1 -> 4ca9e4184
Update to new couch_epi API
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/a27ce338
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/a27ce338
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/a27ce338
Branch: refs/heads/master
Commit: a27ce338ee26ee3f294d32f225de20c56a76409d
Parents: 9afa6a0
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Mon Sep 28 09:39:26 2015 -0700
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Mon Sep 28 09:43:53 2015 -0700
----------------------------------------------------------------------
src/couch_db_epi.erl | 51 +++++++++++++++++++++++++++++++++++++
src/couch_secondary_sup.erl | 7 ++---
src/test_util.erl | 4 +--
test/couch_db_plugin_tests.erl | 48 ++++++++++++++++++++++++++--------
4 files changed, 93 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/a27ce338/src/couch_db_epi.erl
----------------------------------------------------------------------
diff --git a/src/couch_db_epi.erl b/src/couch_db_epi.erl
new file mode 100644
index 0000000..5ff8cfc
--- /dev/null
+++ b/src/couch_db_epi.erl
@@ -0,0 +1,51 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+% http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(couch_db_epi).
+
+-behaviour(couch_epi_plugin).
+
+-export([
+ app/0,
+ providers/0,
+ services/0,
+ data_subscriptions/0,
+ data_providers/0,
+ processes/0,
+ notify/3
+]).
+
+app() ->
+ couch.
+
+providers() ->
+ [
+ {chttpd_handlers, couch_httpd_handlers}
+ ].
+
+
+services() ->
+ [
+ {couch_db, couch_db_plugin}
+ ].
+
+data_subscriptions() ->
+ [].
+
+data_providers() ->
+ [].
+
+processes() ->
+ [].
+
+notify(_Key, _Old, _New) ->
+ ok.
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/a27ce338/src/couch_secondary_sup.erl
----------------------------------------------------------------------
diff --git a/src/couch_secondary_sup.erl b/src/couch_secondary_sup.erl
index 0f62575..1aeb303 100644
--- a/src/couch_secondary_sup.erl
+++ b/src/couch_secondary_sup.erl
@@ -18,7 +18,6 @@ start_link() ->
supervisor:start_link({local,couch_secondary_services}, ?MODULE, []).
init([]) ->
- couch_epi:register_service(couch_db),
SecondarySupervisors = [
{couch_plugin_event,
{gen_event, start_link, [{local, couch_plugin}]},
@@ -27,10 +26,8 @@ init([]) ->
worker,
dynamic}
],
- ServiceProviders = [
- chttpd_handlers:provider(couch, couch_httpd_handlers)
- ],
- Children = SecondarySupervisors ++ ServiceProviders ++ [
+ ServiceProcesses = couch_epi:register_service(couch_db_epi),
+ Children = SecondarySupervisors ++ ServiceProcesses ++ [
begin
{ok, {Module, Fun, Args}} = couch_util:parse_term(SpecStr),
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/a27ce338/src/test_util.erl
----------------------------------------------------------------------
diff --git a/src/test_util.erl b/src/test_util.erl
index 6064b77..d13f850 100644
--- a/src/test_util.erl
+++ b/src/test_util.erl
@@ -70,7 +70,7 @@ start_couch(IniFiles, ExtraApps) ->
ok = application:set_env(config, ini_files, IniFiles),
Apps = start_applications(
- [goldrush, lager, inets, ibrowse, ssl, config, couch_event, couch]
+ [goldrush, lager, inets, ibrowse, ssl, config, couch_epi, couch_event, couch]
++ ExtraApps),
#test_context{started = Apps}.
@@ -222,7 +222,7 @@ start(Module, ExtraApps) ->
start(Module, ExtraApps, []).
start(Module, ExtraApps, Options) ->
- Apps = start_applications([config, ioq|ExtraApps]),
+ Apps = start_applications([config, ioq, couch_epi | ExtraApps]),
ToMock = [config, couch_stats] -- proplists:get_value(dont_mock, Options, []),
mock(ToMock),
#test_context{module = Module, mocked = ToMock, started = Apps}.
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/a27ce338/test/couch_db_plugin_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_db_plugin_tests.erl b/test/couch_db_plugin_tests.erl
index cd563b6..77d9529 100644
--- a/test/couch_db_plugin_tests.erl
+++ b/test/couch_db_plugin_tests.erl
@@ -21,23 +21,51 @@
on_delete/2
]).
+-export([ %% couch_epi_plugin behaviour
+ app/0,
+ providers/0,
+ services/0,
+ data_providers/0,
+ data_subscriptions/0,
+ processes/0,
+ notify/3
+]).
+
-include_lib("couch/include/couch_eunit.hrl").
-include_lib("couch/include/couch_db.hrl").
-record(ctx, {pid, handle}).
+%% couch_epi_plugin behaviour
+
+app() -> test_app.
+providers() -> [{couch_db, ?MODULE}].
+services() -> [].
+data_providers() -> [].
+data_subscriptions() -> [].
+processes() -> [].
+notify(_, _, _) -> ok.
+
+start_epi() ->
+ application:load(couch_epi),
+ Plugins = application:get_env(couch_epi, plugins, []),
+ ok = application:set_env(couch_epi, plugins, append_if_missing(Plugins, ?MODULE)),
+ ok = application:start(couch_epi).
+
+append_if_missing(List, Value) ->
+ case lists:member(Value, List) of
+ true -> List;
+ false -> [Value | List]
+ end.
+
setup() ->
error_logger:tty(false),
- application:start(couch_epi),
- {ok, FunctionsPid} = couch_epi_functions:start_link(
- test_app, {epi_key, couch_db}, {modules, [?MODULE]},
- [{interval, 100}]),
- ok = couch_epi_functions:wait(FunctionsPid),
- #ctx{pid = FunctionsPid, handle = couch_epi:get_handle(couch_db)}.
-
-teardown(#ctx{pid = FunctionsPid}) ->
- erlang:unlink(FunctionsPid),
- couch_epi_functions:stop(FunctionsPid),
+ start_epi(),
+ #ctx{handle = couch_epi:get_handle(couch_db)}.
+
+teardown(#ctx{}) ->
+ Plugins = application:get_env(couch_epi, plugins, []),
+ application:set_env(couch_epi, plugins, Plugins -- [?MODULE]),
application:stop(couch_epi),
ok.
[2/3] couch commit: updated refs/heads/master to 4ca9e41
Posted by rn...@apache.org.
Pass supervisor's children to couch_epi
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/b00635c8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/b00635c8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/b00635c8
Branch: refs/heads/master
Commit: b00635c8ca0ab2f2e11ae49d763fba72dd6d0ea8
Parents: a27ce33
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Tue Sep 29 13:03:34 2015 -0700
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Tue Sep 29 13:03:34 2015 -0700
----------------------------------------------------------------------
src/couch_secondary_sup.erl | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/b00635c8/src/couch_secondary_sup.erl
----------------------------------------------------------------------
diff --git a/src/couch_secondary_sup.erl b/src/couch_secondary_sup.erl
index 1aeb303..0c3b7aa 100644
--- a/src/couch_secondary_sup.erl
+++ b/src/couch_secondary_sup.erl
@@ -26,8 +26,7 @@ init([]) ->
worker,
dynamic}
],
- ServiceProcesses = couch_epi:register_service(couch_db_epi),
- Children = SecondarySupervisors ++ ServiceProcesses ++ [
+ Children = SecondarySupervisors ++ [
begin
{ok, {Module, Fun, Args}} = couch_util:parse_term(SpecStr),
@@ -40,4 +39,5 @@ init([]) ->
end
|| {Name, SpecStr}
<- config:get("daemons"), SpecStr /= ""],
- {ok, {{one_for_one, 50, 3600}, Children}}.
+ {ok, {{one_for_one, 50, 3600},
+ couch_epi:register_service(couch_db_epi, Children)}}.
[3/3] couch commit: updated refs/heads/master to 4ca9e41
Posted by rn...@apache.org.
Merge remote-tracking branch 'cloudant/simplify_couch_epi'
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/4ca9e418
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/4ca9e418
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/4ca9e418
Branch: refs/heads/master
Commit: 4ca9e4184e3a56a34e22550a3b62cbb6ab9e46c5
Parents: 0430a7f b00635c
Author: Robert Newson <rn...@apache.org>
Authored: Thu Oct 1 16:06:49 2015 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Thu Oct 1 16:06:49 2015 +0100
----------------------------------------------------------------------
src/couch_db_epi.erl | 51 +++++++++++++++++++++++++++++++++++++
src/couch_secondary_sup.erl | 9 +++----
src/test_util.erl | 4 +--
test/couch_db_plugin_tests.erl | 48 ++++++++++++++++++++++++++--------
4 files changed, 94 insertions(+), 18 deletions(-)
----------------------------------------------------------------------