You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/02/13 01:01:18 UTC

[05/12] couch-index commit: updated refs/heads/1994-merge-rcouch to 7c1666b

make couch_index a standalone erlang app

With this change couch_index will be started by the release instead of
letting couchdb to start it. It also has its own supervision now.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/commit/dc6a557b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/tree/dc6a557b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/diff/dc6a557b

Branch: refs/heads/1994-merge-rcouch
Commit: dc6a557b13e38d64d77696aa4d0ecde1c85bc22c
Parents: 9b030c4
Author: benoitc <be...@apache.org>
Authored: Mon Jan 6 23:47:49 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 12 17:58:22 2014 -0600

----------------------------------------------------------------------
 src/couch_index.app.src |  8 +++-----
 src/couch_index_app.erl | 27 +++++++++++++++++++++++++++
 src/couch_index_sup.erl | 30 ++++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/dc6a557b/src/couch_index.app.src
----------------------------------------------------------------------
diff --git a/src/couch_index.app.src b/src/couch_index.app.src
index 141ed9d..687a2e2 100644
--- a/src/couch_index.app.src
+++ b/src/couch_index.app.src
@@ -13,10 +13,8 @@
 {application, couch_index, [
     {description, "CouchDB Secondary Index Manager"},
     {vsn, "@version@"},
-    {modules, [
-        couch_index,
-        couch_index_server
-    ]},
+    {modules, []},
     {registered, [couch_index_server]},
-    {applications, [kernel, stdlib]}
+    {applications, [kernel, stdlib, couch]},
+    {mod, {couch_index_app, []}}
 ]}.

http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/dc6a557b/src/couch_index_app.erl
----------------------------------------------------------------------
diff --git a/src/couch_index_app.erl b/src/couch_index_app.erl
new file mode 100644
index 0000000..6bafdcb
--- /dev/null
+++ b/src/couch_index_app.erl
@@ -0,0 +1,27 @@
+% 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_index_app).
+
+-behaviour(application).
+
+-include_lib("couch/include/couch_db.hrl").
+
+-export([start/2, stop/1]).
+
+start(_Type, _Args) ->
+    couch_util:start_app_deps(couch_index),
+    couch_index_sup:start_link().
+
+
+stop(_) ->
+    ok.

http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/dc6a557b/src/couch_index_sup.erl
----------------------------------------------------------------------
diff --git a/src/couch_index_sup.erl b/src/couch_index_sup.erl
new file mode 100644
index 0000000..d7b1033
--- /dev/null
+++ b/src/couch_index_sup.erl
@@ -0,0 +1,30 @@
+% 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_index_sup).
+-behaviour(supervisor).
+
+-export([start_link/0]).
+-export([init/1]).
+
+
+%% Helper macro for declaring children of supervisor
+-define(CHILD(I), {I, {I, start_link, []}, permanent, 5000, worker, [I]}).
+
+start_link() ->
+    supervisor:start_link({local, ?MODULE}, ?MODULE, []).
+
+
+init([]) ->
+    Server = ?CHILD(couch_index_server),
+    {ok, {{one_for_one, 10, 3600}, [Server]}}.
+