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/06 18:19:16 UTC
[18/26] couch-replicator commit: updated refs/heads/import-rcouch to
589d958
make the couch_replicator a full Erlang application
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/9953fe54
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/9953fe54
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/9953fe54
Branch: refs/heads/import-rcouch
Commit: 9953fe549003c48ceec241e8ac83a055a641f425
Parents: abaeaab
Author: benoitc <be...@apache.org>
Authored: Tue Jan 7 00:15:26 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Thu Feb 6 11:17:53 2014 -0600
----------------------------------------------------------------------
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 +++++++++++++++++++++++++++++++
4 files changed, 144 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/9953fe54/src/couch_replicator.app.src
----------------------------------------------------------------------
diff --git a/src/couch_replicator.app.src b/src/couch_replicator.app.src
index 750eaad..1e62edf 100644
--- a/src/couch_replicator.app.src
+++ b/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-couch-replicator/blob/9953fe54/src/couch_replicator_app.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_app.erl b/src/couch_replicator_app.erl
new file mode 100644
index 0000000..4083db6
--- /dev/null
+++ b/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-couch-replicator/blob/9953fe54/src/couch_replicator_manager_sup.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_manager_sup.erl b/src/couch_replicator_manager_sup.erl
new file mode 100644
index 0000000..f292546
--- /dev/null
+++ b/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-couch-replicator/blob/9953fe54/src/couch_replicator_sup.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_sup.erl b/src/couch_replicator_sup.erl
new file mode 100644
index 0000000..905e2cf
--- /dev/null
+++ b/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} }.