couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From beno...@apache.org
Subject [55/57] [abbrv] git commit: updated refs/heads/1994-merge-rcouch to 868a284
Date Tue, 07 Jan 2014 00:37:15 GMT
make the couch_replicator a full Erlang application


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

Branch: refs/heads/1994-merge-rcouch
Commit: d4f89a8fd0fa38aa0142e46822ae0a1d4814c494
Parents: d28d6be
Author: Benoit Chesneau <benoitc@apache.org>
Authored: Tue Jan 7 00:15:26 2014 +0100
Committer: Benoit Chesneau <benoitc@apache.org>
Committed: Tue Jan 7 00:15:26 2014 +0100

----------------------------------------------------------------------
 apps/couch/src/couch_primary_sup.erl            | 12 ----
 .../src/couch_replicator.app.src                | 23 +++-----
 .../src/couch_replicator_app.erl                | 29 ++++++++++
 .../src/couch_replicator_manager_sup.erl        | 47 ++++++++++++++++
 .../src/couch_replicator_sup.erl                | 59 ++++++++++++++++++++
 etc/couchdb/default.ini.tpl.in                  |  1 -
 6 files changed, 144 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/d4f89a8f/apps/couch/src/couch_primary_sup.erl
----------------------------------------------------------------------
diff --git a/apps/couch/src/couch_primary_sup.erl b/apps/couch/src/couch_primary_sup.erl
index 150b92e..3bb5875 100644
--- a/apps/couch/src/couch_primary_sup.erl
+++ b/apps/couch/src/couch_primary_sup.erl
@@ -43,18 +43,6 @@ init([]) ->
             brutal_kill,
             worker,
             dynamic},
-        {couch_replication_event,
-            {gen_event, start_link, [{local, couch_replication}]},
-            permanent,
-            brutal_kill,
-            worker,
-            dynamic},
-        {couch_replicator_job_sup,
-            {couch_replicator_job_sup, start_link, []},
-            permanent,
-            infinity,
-            supervisor,
-            [couch_replicator_job_sup]},
         {couch_log,
             {couch_log, start_link, []},
             permanent,

http://git-wip-us.apache.org/repos/asf/couchdb/blob/d4f89a8f/apps/couch_replicator/src/couch_replicator.app.src
----------------------------------------------------------------------
diff --git a/apps/couch_replicator/src/couch_replicator.app.src b/apps/couch_replicator/src/couch_replicator.app.src
index 750eaad..1e62edf 100644
--- a/apps/couch_replicator/src/couch_replicator.app.src
+++ b/apps/couch_replicator/src/couch_replicator.app.src
@@ -13,21 +13,16 @@
 {application, couch_replicator, [
     {description, "CouchDB replicator"},
     {vsn, "%version%"},
-    {modules, [  
-        couch_replicator_api_wrap,
-        couch_replicator_httpc,
-        couch_replicator_httpd,
-        couch_replicator_job_sup,
-        couch_replicator_notifier,
-        couch_replicator_manager,
-        couch_replicator_httpc_pool,
-        couch_replicator_utils,
-        couch_replicator_worker,
-        couch_replicator
-    ]},
+    {modules, []},
     {registered, [
-        couch_replicator_job_sup
+        couch_replicator_manager_sup,
+        couch_replicator_job_sup,
+        couch_replicator_sup
     ]},
-    {applications, [kernel, stdlib]}
+    {applications, [kernel, stdlib, crypto, sasl, inets, oauth, ibrowse,
+                   couch]},
+
+    {mod, { couch_replicator_app, []}},
+    {env, []}
 ]}.
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/d4f89a8f/apps/couch_replicator/src/couch_replicator_app.erl
----------------------------------------------------------------------
diff --git a/apps/couch_replicator/src/couch_replicator_app.erl b/apps/couch_replicator/src/couch_replicator_app.erl
new file mode 100644
index 0000000..4083db6
--- /dev/null
+++ b/apps/couch_replicator/src/couch_replicator_app.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_replicator_app).
+
+-behaviour(application).
+
+%% Application callbacks
+-export([start/2, stop/1]).
+
+%% ===================================================================
+%% Application callbacks
+%% ===================================================================
+
+start(_StartType, _StartArgs) ->
+    couch_util:start_app_deps(couch_replicator),
+    couch_replicator_sup:start_link().
+
+stop(_State) ->
+    ok.

http://git-wip-us.apache.org/repos/asf/couchdb/blob/d4f89a8f/apps/couch_replicator/src/couch_replicator_manager_sup.erl
----------------------------------------------------------------------
diff --git a/apps/couch_replicator/src/couch_replicator_manager_sup.erl b/apps/couch_replicator/src/couch_replicator_manager_sup.erl
new file mode 100644
index 0000000..f292546
--- /dev/null
+++ b/apps/couch_replicator/src/couch_replicator_manager_sup.erl
@@ -0,0 +1,47 @@
+
+% 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_replicator_manager_sup).
+
+-behaviour(supervisor).
+
+%% API
+-export([start_link/0]).
+
+%% Supervisor callbacks
+-export([init/1]).
+
+%% Helper macro for declaring children of supervisor
+-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}).
+
+%% ===================================================================
+%% API functions
+%% ===================================================================
+
+start_link() ->
+    supervisor:start_link({local, ?MODULE}, ?MODULE, []).
+
+%% ===================================================================
+%% Supervisor callbacks
+%% ===================================================================
+
+init([]) ->
+    Children = [
+        {couch_replicator_manager,
+            {couch_replicator_manager, start_link, []},
+            permanent,
+            brutal_kill,
+            worker,
+            [couch_replicator_manager]}
+    ],
+    {ok, { {one_for_one, 10, 3600}, Children} }.

http://git-wip-us.apache.org/repos/asf/couchdb/blob/d4f89a8f/apps/couch_replicator/src/couch_replicator_sup.erl
----------------------------------------------------------------------
diff --git a/apps/couch_replicator/src/couch_replicator_sup.erl b/apps/couch_replicator/src/couch_replicator_sup.erl
new file mode 100644
index 0000000..905e2cf
--- /dev/null
+++ b/apps/couch_replicator/src/couch_replicator_sup.erl
@@ -0,0 +1,59 @@
+
+% 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_replicator_sup).
+
+-behaviour(supervisor).
+
+%% API
+-export([start_link/0]).
+
+%% Supervisor callbacks
+-export([init/1]).
+
+%% Helper macro for declaring children of supervisor
+-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}).
+
+%% ===================================================================
+%% API functions
+%% ===================================================================
+
+start_link() ->
+    supervisor:start_link({local, ?MODULE}, ?MODULE, []).
+
+%% ===================================================================
+%% Supervisor callbacks
+%% ===================================================================
+
+init([]) ->
+    Children = [
+        {couch_replication_event,
+            {gen_event, start_link, [{local, couch_replication}]},
+            permanent,
+            brutal_kill,
+            worker,
+            dynamic},
+        {couch_replicator_job_sup,
+            {couch_replicator_job_sup, start_link, []},
+            permanent,
+            infinity,
+            supervisor,
+            [couch_replicator_job_sup]},
+        {couch_replicator_manager_sup,
+            {couch_replicator_manager_sup, start_link, []},
+            permanent,
+            infinity,
+            supervisor,
+            [couch_replicator_manager_sup]}
+    ],
+    {ok, { {one_for_one, 10, 3600}, Children} }.

http://git-wip-us.apache.org/repos/asf/couchdb/blob/d4f89a8f/etc/couchdb/default.ini.tpl.in
----------------------------------------------------------------------
diff --git a/etc/couchdb/default.ini.tpl.in b/etc/couchdb/default.ini.tpl.in
index 500a5a1..fb85fd7 100644
--- a/etc/couchdb/default.ini.tpl.in
+++ b/etc/couchdb/default.ini.tpl.in
@@ -141,7 +141,6 @@ stats_aggregator={couch_stats_aggregator, start, []}
 stats_collector={couch_stats_collector, start, []}
 uuids={couch_uuids, start, []}
 auth_cache={couch_auth_cache, start_link, []}
-replicator_manager={couch_replicator_manager, start_link, []}
 os_daemons={couch_os_daemons, start_link, []}
 compaction_daemon={couch_compaction_daemon, start_link, []}
 


Mime
View raw message