Plug couch_epi
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/commit/b208d8e4 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/tree/b208d8e4 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/diff/b208d8e4 Branch: refs/heads/split_out_httpd_stack Commit: b208d8e4ab36fa94dccb086a0b52013cccaeb22c Parents: bdca56a Author: ILYA Khlopotov <iil...@ca.ibm.com> Authored: Tue Mar 1 08:30:11 2016 -0800 Committer: ILYA Khlopotov <iil...@ca.ibm.com> Committed: Tue Mar 1 08:35:10 2016 -0800 ---------------------------------------------------------------------- src/couch_httpd.app.src | 1 + src/couch_httpd_app.erl | 21 ++++++++++++++++++ src/couch_httpd_epi.erl | 53 ++++++++++++++++++++++++++++++++++++++++++++ src/couch_httpd_sup.erl | 24 ++++++++++++++++++++ 4 files changed, 99 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/blob/b208d8e4/src/couch_httpd.app.src ---------------------------------------------------------------------- diff --git a/src/couch_httpd.app.src b/src/couch_httpd.app.src index e90e2ac..39d96af 100644 --- a/src/couch_httpd.app.src +++ b/src/couch_httpd.app.src @@ -27,5 +27,6 @@ config ]}, {included_applications, [mochiweb]}, + {mod, {couch_httpd_app, []}}, {env, []} ]}. http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/blob/b208d8e4/src/couch_httpd_app.erl ---------------------------------------------------------------------- diff --git a/src/couch_httpd_app.erl b/src/couch_httpd_app.erl new file mode 100644 index 0000000..87c1bdb --- /dev/null +++ b/src/couch_httpd_app.erl @@ -0,0 +1,21 @@ +% 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_httpd_app). +-behaviour(application). +-export([start/2, stop/1]). + +start(_Type, StartArgs) -> + couch_httpd_sup:start_link(StartArgs). + +stop(_State) -> + ok. http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/blob/b208d8e4/src/couch_httpd_epi.erl ---------------------------------------------------------------------- diff --git a/src/couch_httpd_epi.erl b/src/couch_httpd_epi.erl new file mode 100644 index 0000000..02d7a8c --- /dev/null +++ b/src/couch_httpd_epi.erl @@ -0,0 +1,53 @@ +% 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_httpd_epi). + +-behaviour(couch_epi_plugin). + +-export([ + app/0, + providers/0, + services/0, + data_subscriptions/0, + data_providers/0, + processes/0, + notify/3 +]). + +app() -> + couch_httpd. + +providers() -> + [ + ]. + + +services() -> + [ + {couch_httpd_auth, couch_httpd_auth_plugin}, + {couch_httpd_handlers, couch_httpd_handlers}, + {couch_httpd, couch_httpd_plugin} + ]. + +data_subscriptions() -> + []. + +data_providers() -> + []. + +processes() -> + []. + +notify(_Key, _Old, _New) -> + ok. http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/blob/b208d8e4/src/couch_httpd_sup.erl ---------------------------------------------------------------------- diff --git a/src/couch_httpd_sup.erl b/src/couch_httpd_sup.erl new file mode 100644 index 0000000..df974fe --- /dev/null +++ b/src/couch_httpd_sup.erl @@ -0,0 +1,24 @@ +% 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_httpd_sup). +-behaviour(supervisor). +-export([init/1]). + +-export([start_link/1]). + + +start_link(Args) -> + supervisor:start_link({local,?MODULE}, ?MODULE, Args). + +init([]) -> + {ok, {{one_for_one, 3, 10}, couch_epi:register_service(couch_httpd_epi, [])}}.