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:40:28 UTC

[46/50] [abbrv] couch commit: updated refs/heads/import-rcouch to e2dbc79

couch_server_sup -> couch_sup


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

Branch: refs/heads/import-rcouch
Commit: 0e4ef2d9238fc9d72a626944fcb5e5a64ecccdef
Parents: c5c34fe
Author: benoitc <be...@apache.org>
Authored: Mon Jan 13 23:06:26 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Thu Feb 6 11:38:30 2014 -0600

----------------------------------------------------------------------
 src/couch.app.src.script |   2 +-
 src/couch.erl            |   4 +-
 src/couch_app.erl        |   2 +-
 src/couch_log.erl        |   2 +-
 src/couch_server.erl     |   2 +-
 src/couch_server_sup.erl | 117 ------------------------------------------
 src/couch_sup.erl        | 117 ++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 123 insertions(+), 123 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/0e4ef2d9/src/couch.app.src.script
----------------------------------------------------------------------
diff --git a/src/couch.app.src.script b/src/couch.app.src.script
index 1e14e3d..ac8156d 100644
--- a/src/couch.app.src.script
+++ b/src/couch.app.src.script
@@ -54,7 +54,7 @@ end,
             couch_query_servers,
             couch_secondary_services,
             couch_server,
-            couch_server_sup,
+            couch_sup,
             couch_stats_aggregator,
             couch_stats_collector,
             couch_task_status

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/0e4ef2d9/src/couch.erl
----------------------------------------------------------------------
diff --git a/src/couch.erl b/src/couch.erl
index 4b2032a..fe4f1a8 100644
--- a/src/couch.erl
+++ b/src/couch.erl
@@ -60,9 +60,9 @@ restart() ->
     end.
 
 reload() ->
-    case supervisor:terminate_child(couch_server_sup, couch_config) of
+    case supervisor:terminate_child(couch_sup, couch_config) of
     ok ->
-        supervisor:restart_child(couch_server_sup, couch_config);
+        supervisor:restart_child(couch_sup, couch_config);
     {error, Reason} ->
         {error, Reason}
     end.

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/0e4ef2d9/src/couch_app.erl
----------------------------------------------------------------------
diff --git a/src/couch_app.erl b/src/couch_app.erl
index 414a5c9..1d537e6 100644
--- a/src/couch_app.erl
+++ b/src/couch_app.erl
@@ -23,7 +23,7 @@
 start(_Type, _Args) ->
     couch_util:start_app_deps(couch),
     IniFiles = get_ini_files(),
-    couch_server_sup:start_link(IniFiles).
+    couch_sup:start_link(IniFiles).
 
 stop(_) ->
     ok.

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/0e4ef2d9/src/couch_log.erl
----------------------------------------------------------------------
diff --git a/src/couch_log.erl b/src/couch_log.erl
index cd4bbbb..7cfd47b 100644
--- a/src/couch_log.erl
+++ b/src/couch_log.erl
@@ -73,7 +73,7 @@ stop() ->
 init([]) ->
     % read config and register for configuration changes
 
-    % just stop if one of the config settings change. couch_server_sup
+    % just stop if one of the config settings change. couch_sup
     % will restart us and then we will pick up the new settings.
     ok = couch_config:register(
         fun("log", "file") ->

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/0e4ef2d9/src/couch_server.erl
----------------------------------------------------------------------
diff --git a/src/couch_server.erl b/src/couch_server.erl
index 4b80dfb..91b4bc7 100644
--- a/src/couch_server.erl
+++ b/src/couch_server.erl
@@ -146,7 +146,7 @@ hash_admin_passwords(Persist) ->
 init([]) ->
     % read config and register for configuration changes
 
-    % just stop if one of the config settings change. couch_server_sup
+    % just stop if one of the config settings change. couch_sup
     % will restart us and then we will pick up the new settings.
 
     RootDir = couch_config:get("couchdb", "database_dir", "."),

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/0e4ef2d9/src/couch_server_sup.erl
----------------------------------------------------------------------
diff --git a/src/couch_server_sup.erl b/src/couch_server_sup.erl
deleted file mode 100644
index 7f37677..0000000
--- a/src/couch_server_sup.erl
+++ /dev/null
@@ -1,117 +0,0 @@
-% 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_server_sup).
--behaviour(supervisor).
-
-
--export([start_link/1,stop/0, couch_config_start_link_wrapper/2,
-        restart_core_server/0, config_change/2]).
-
--include("couch_db.hrl").
-
-%% supervisor callbacks
--export([init/1]).
-
-start_link(IniFiles) ->
-    case whereis(couch_server_sup) of
-    undefined ->
-        start_server(IniFiles);
-    _Else ->
-        {error, already_started}
-    end.
-
-restart_core_server() ->
-    init:restart().
-
-couch_config_start_link_wrapper(IniFiles, FirstConfigPid) ->
-    case is_process_alive(FirstConfigPid) of
-        true ->
-            link(FirstConfigPid),
-            {ok, FirstConfigPid};
-        false -> couch_config:start_link(IniFiles)
-    end.
-
-start_server(IniFiles) ->
-    case init:get_argument(pidfile) of
-    {ok, [PidFile]} ->
-        case file:write_file(PidFile, os:getpid()) of
-        ok -> ok;
-        {error, Reason} ->
-            io:format("Failed to write PID file ~s: ~s",
-                [PidFile, file:format_error(Reason)])
-        end;
-    _ -> ok
-    end,
-
-    {ok, ConfigPid} = couch_config:start_link(IniFiles),
-
-    LogLevel = couch_config:get("log", "level", "info"),
-    % announce startup
-    io:format("Apache CouchDB ~s (LogLevel=~s) is starting.~n", [
-        couch_server:get_version(),
-        LogLevel
-    ]),
-    case LogLevel of
-    "debug" ->
-        io:format("Configuration Settings ~p:~n", [IniFiles]),
-        [io:format("  [~s] ~s=~p~n", [Module, Variable, Value])
-            || {{Module, Variable}, Value} <- couch_config:all()];
-    _ -> ok
-    end,
-
-    BaseChildSpecs =
-    {{one_for_all, 10, 3600},
-        [{couch_config,
-            {couch_server_sup, couch_config_start_link_wrapper, [IniFiles, ConfigPid]},
-            permanent,
-            brutal_kill,
-            worker,
-            [couch_config]},
-        {couch_primary_services,
-            {couch_primary_sup, start_link, []},
-            permanent,
-            infinity,
-            supervisor,
-            [couch_primary_sup]},
-        {couch_secondary_services,
-            {couch_secondary_sup, start_link, []},
-            permanent,
-            infinity,
-            supervisor,
-            [couch_secondary_sup]}
-        ]},
-
-    % ensure these applications are running
-    application:start(ibrowse),
-    application:start(crypto),
-
-    {ok, Pid} = supervisor:start_link(
-        {local, couch_server_sup}, couch_server_sup, BaseChildSpecs),
-
-    % launch the icu bridge
-    % just restart if one of the config settings change.
-    couch_config:register(fun ?MODULE:config_change/2, Pid),
-
-    unlink(ConfigPid),
-
-    {ok, Pid}.
-
-stop() ->
-    catch exit(whereis(couch_server_sup), normal).
-
-config_change("daemons", _) ->
-    supervisor:terminate_child(couch_server_sup, couch_secondary_services),
-    supervisor:restart_child(couch_server_sup, couch_secondary_services).
-
-init(ChildSpecs) ->
-    {ok, ChildSpecs}.

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/0e4ef2d9/src/couch_sup.erl
----------------------------------------------------------------------
diff --git a/src/couch_sup.erl b/src/couch_sup.erl
new file mode 100644
index 0000000..1f04aea
--- /dev/null
+++ b/src/couch_sup.erl
@@ -0,0 +1,117 @@
+% 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_sup).
+-behaviour(supervisor).
+
+
+-export([start_link/1,stop/0, couch_config_start_link_wrapper/2,
+        restart_core_server/0, config_change/2]).
+
+-include("couch_db.hrl").
+
+%% supervisor callbacks
+-export([init/1]).
+
+start_link(IniFiles) ->
+    case whereis(couch_sup) of
+    undefined ->
+        start_server(IniFiles);
+    _Else ->
+        {error, already_started}
+    end.
+
+restart_core_server() ->
+    init:restart().
+
+couch_config_start_link_wrapper(IniFiles, FirstConfigPid) ->
+    case is_process_alive(FirstConfigPid) of
+        true ->
+            link(FirstConfigPid),
+            {ok, FirstConfigPid};
+        false -> couch_config:start_link(IniFiles)
+    end.
+
+start_server(IniFiles) ->
+    case init:get_argument(pidfile) of
+    {ok, [PidFile]} ->
+        case file:write_file(PidFile, os:getpid()) of
+        ok -> ok;
+        {error, Reason} ->
+            io:format("Failed to write PID file ~s: ~s",
+                [PidFile, file:format_error(Reason)])
+        end;
+    _ -> ok
+    end,
+
+    {ok, ConfigPid} = couch_config:start_link(IniFiles),
+
+    LogLevel = couch_config:get("log", "level", "info"),
+    % announce startup
+    io:format("Apache CouchDB ~s (LogLevel=~s) is starting.~n", [
+        couch_server:get_version(),
+        LogLevel
+    ]),
+    case LogLevel of
+    "debug" ->
+        io:format("Configuration Settings ~p:~n", [IniFiles]),
+        [io:format("  [~s] ~s=~p~n", [Module, Variable, Value])
+            || {{Module, Variable}, Value} <- couch_config:all()];
+    _ -> ok
+    end,
+
+    BaseChildSpecs =
+    {{one_for_all, 10, 3600},
+        [{couch_config,
+            {couch_sup, couch_config_start_link_wrapper, [IniFiles, ConfigPid]},
+            permanent,
+            brutal_kill,
+            worker,
+            [couch_config]},
+        {couch_primary_services,
+            {couch_primary_sup, start_link, []},
+            permanent,
+            infinity,
+            supervisor,
+            [couch_primary_sup]},
+        {couch_secondary_services,
+            {couch_secondary_sup, start_link, []},
+            permanent,
+            infinity,
+            supervisor,
+            [couch_secondary_sup]}
+        ]},
+
+    % ensure these applications are running
+    application:start(ibrowse),
+    application:start(crypto),
+
+    {ok, Pid} = supervisor:start_link(
+        {local, couch_sup}, couch_sup, BaseChildSpecs),
+
+    % launch the icu bridge
+    % just restart if one of the config settings change.
+    couch_config:register(fun ?MODULE:config_change/2, Pid),
+
+    unlink(ConfigPid),
+
+    {ok, Pid}.
+
+stop() ->
+    catch exit(whereis(couch_sup), normal).
+
+config_change("daemons", _) ->
+    supervisor:terminate_child(couch_sup, couch_secondary_services),
+    supervisor:restart_child(couch_sup, couch_secondary_services).
+
+init(ChildSpecs) ->
+    {ok, ChildSpecs}.