diff options
author | Russell Branca <chewbranca@apache.org> | 2017-08-17 17:21:35 +0000 |
---|---|---|
committer | Joan Touzet <joant@atypical.net> | 2017-10-10 17:23:37 -0400 |
commit | 2f49de81c8f85d8ab34483c524e71e092de542c5 (patch) | |
tree | 6eab7617f0128a4877aba1ef5729ddb8c6b130c0 | |
parent | a0e08857dbfc4a5d941b7ec2e90457df1c87c38e (diff) | |
download | couchdb-2f49de81c8f85d8ab34483c524e71e092de542c5.tar.gz |
Make couch_peruser a proper Erlang app
-rw-r--r-- | rel/overlay/etc/default.ini | 1 | ||||
-rw-r--r-- | src/couch_peruser/src/couch_peruser.app.src | 5 | ||||
-rw-r--r-- | src/couch_peruser/src/couch_peruser_app.erl | 26 | ||||
-rw-r--r-- | src/couch_peruser/src/couch_peruser_sup.erl | 29 |
4 files changed, 59 insertions, 2 deletions
diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini index 122853542..56f91474e 100644 --- a/rel/overlay/etc/default.ini +++ b/rel/overlay/etc/default.ini @@ -254,7 +254,6 @@ uuids={couch_uuids, start, []} auth_cache={couch_auth_cache, start_link, []} os_daemons={couch_os_daemons, start_link, []} compaction_daemon={couch_compaction_daemon, start_link, []} -couch_peruser={couch_peruser, start_link, []} [mango] ; Set to true to disable the "index all fields" text index, which can lead diff --git a/src/couch_peruser/src/couch_peruser.app.src b/src/couch_peruser/src/couch_peruser.app.src index fb6d45bf1..777446d94 100644 --- a/src/couch_peruser/src/couch_peruser.app.src +++ b/src/couch_peruser/src/couch_peruser.app.src @@ -14,5 +14,8 @@ {description, "couch_peruser - maintains per-user databases in CouchDB"}, {vsn, git}, {registered, []}, - {applications, [kernel, stdlib, config, couch, fabric]} + {applications, [kernel, stdlib, config, couch, fabric]}, + {mod, {couch_peruser_app, []}}, + {env, []}, + {modules, [couch_peruser, couch_peruser_app, couch_peruser_sup]} ]}. diff --git a/src/couch_peruser/src/couch_peruser_app.erl b/src/couch_peruser/src/couch_peruser_app.erl new file mode 100644 index 000000000..770c08237 --- /dev/null +++ b/src/couch_peruser/src/couch_peruser_app.erl @@ -0,0 +1,26 @@ +% 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_peruser_app). + +-behaviour(application). + +-export([start/2, stop/1]). + + +start(_Type, _StartArgs) -> + couch_peruser_sup:start_link(). + + +stop(_State) -> + ok. + diff --git a/src/couch_peruser/src/couch_peruser_sup.erl b/src/couch_peruser/src/couch_peruser_sup.erl new file mode 100644 index 000000000..b89a36324 --- /dev/null +++ b/src/couch_peruser/src/couch_peruser_sup.erl @@ -0,0 +1,29 @@ +% 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_peruser_sup). + +-behaviour(supervisor). + +-export([start_link/0, init/1]). + +%% Helper macro for declaring children of supervisor +-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}). + + +start_link() -> + supervisor:start_link({local, ?MODULE}, ?MODULE, []). + + +init([]) -> + {ok, { {one_for_one, 5, 10}, [?CHILD(couch_peruser, worker)]}}. + |