couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [7/9] couch commit: updated refs/heads/1843-feature-bigcouch to 20a53ef
Date Wed, 12 Feb 2014 19:45:32 GMT
Add dbs and nodes to the system dbs lists

These are the internal database names used by BigCouch for storing
cluster information.


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

Branch: refs/heads/1843-feature-bigcouch
Commit: f8c23352480c46bf4982daf5a95a468a0a1f5292
Parents: 68f9777
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Thu Feb 6 22:38:25 2014 -0600
Committer: Paul J. Davis <paul.joseph.davis@gmail.com>
Committed: Thu Feb 6 22:38:25 2014 -0600

----------------------------------------------------------------------
 src/couch_server.erl | 50 +++++++++++++++++++++++++----------------------
 1 file changed, 27 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/f8c23352/src/couch_server.erl
----------------------------------------------------------------------
diff --git a/src/couch_server.erl b/src/couch_server.erl
index e4de69e..64c87ef 100644
--- a/src/couch_server.erl
+++ b/src/couch_server.erl
@@ -110,29 +110,33 @@ delete(DbName, Options) ->
 maybe_add_sys_db_callbacks(DbName, Options) when is_binary(DbName) ->
     maybe_add_sys_db_callbacks(?b2l(DbName), Options);
 maybe_add_sys_db_callbacks(DbName, Options) ->
-    case config:get("replicator", "db", "_replicator") of
-    DbName ->
-        [
-            {before_doc_update, fun couch_replicator_manager:before_doc_update/2},
-            {after_doc_read, fun couch_replicator_manager:after_doc_read/2},
-            sys_db | Options
-        ];
-    _ ->
-        case config:get("couch_httpd_auth", "authentication_db", "_users") of
-        DbName ->
-        [
-            {before_doc_update, fun couch_users_db:before_doc_update/2},
-            {after_doc_read, fun couch_users_db:after_doc_read/2},
-            sys_db | Options
-        ];
-        _ ->
-            case config:get("mem3", "shard_db", "dbs") of
-            DbName ->
-                [sys_db | Options];
-            _ ->
-                Options
-            end
-        end
+    ReplicatorDbName = config:get("replicator", "db", "_replicator"),
+    ReplicatorDbOptions = [
+        {before_doc_update, fun couch_replicator_manager:before_doc_update/2},
+        {after_doc_read, fun couch_replicator_manager:after_doc_read/2},
+        sys_db
+    ] ++ Options,
+    UsersDbName = config:get("couch_httpd_auth", "authentication_db", "_users"),
+    UsersDbOptions = [
+        {before_doc_update, fun couch_users_db:before_doc_update/2},
+        {after_doc_read, fun couch_users_db:after_doc_read/2},
+        sys_db
+    ] ++ Options,
+    DbsDbName = config:get("mem3", "shard_db", "dbs"),
+    DbsDbOptions = [sys_db | Options],
+    NodesDbName = config:get("mem3", "node_db", "nodes"),
+    NodesDbOptions = [sys_db | Options],
+    KnownSysDbs = [
+        {ReplicatorDbName, ReplicatorDbOptions},
+        {UsersDbName, UsersDbOptions},
+        {DbsDbName, DbsDbOptions},
+        {NodesDbName, NodesDbOptions}
+    ],
+    case lists:keyfind(DbName, 1, KnownSysDbs) of
+        {DbName, SysOptions} ->
+            SysOptions;
+        false ->
+            Options
     end.
 
 check_dbname(#server{dbname_regexp=RegExp}, DbName) ->


Mime
View raw message