couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject couch commit: updated refs/heads/master to 04312dc
Date Wed, 17 Jun 2015 09:23:07 GMT
Repository: couchdb-couch
Updated Branches:
  refs/heads/master 3d97e7792 -> 04312dc9a


Introduce couch_db:normalize_dbname

Move duplicated logic into couch_db:normalize_dbname. We could use this
helper function anywhere we need to extract dbname from shard path.

COUCHDB-2715


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

Branch: refs/heads/master
Commit: 04312dc9a7157dcd66ef3d06220a7bb6df6ca595
Parents: 3d97e77
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Mon Jun 15 05:59:24 2015 -0700
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Mon Jun 15 06:04:46 2015 -0700

----------------------------------------------------------------------
 src/couch_db.erl     | 6 ++++++
 src/couch_server.erl | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/04312dc9/src/couch_db.erl
----------------------------------------------------------------------
diff --git a/src/couch_db.erl b/src/couch_db.erl
index ae80123..bbfbe0d 100644
--- a/src/couch_db.erl
+++ b/src/couch_db.erl
@@ -33,6 +33,7 @@
 -export([load_validation_funs/1]).
 -export([check_md5/2, with_stream/3]).
 -export([monitored_by/1]).
+-export([normalize_dbname/1]).
 
 -include_lib("couch/include/couch_db.hrl").
 
@@ -1469,3 +1470,8 @@ select_gt(V1, _V2) -> V1.
 
 select_lt(V1, V2) when V1 > V2 -> V2;
 select_lt(V1, _V2) -> V1.
+
+normalize_dbname(<<"shards/", _/binary>> = Path) ->
+    lists:last(binary:split(mem3:dbname(Path), <<"/">>, [global]));
+normalize_dbname(DbName) ->
+    DbName.

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/04312dc9/src/couch_server.erl
----------------------------------------------------------------------
diff --git a/src/couch_server.erl b/src/couch_server.erl
index 77105ed..6c718ce 100644
--- a/src/couch_server.erl
+++ b/src/couch_server.erl
@@ -140,7 +140,7 @@ maybe_add_sys_db_callbacks(DbName, Options) ->
     end.
 
 path_ends_with(Path, Suffix) ->
-    Suffix == lists:last(binary:split(mem3:dbname(Path), <<"/">>, [global])).
+    Suffix == couch_db:normalize_dbname(Path).
 
 check_dbname(#server{dbname_regexp=RegExp}, DbName) ->
     case re:run(DbName, RegExp, [{capture, none}]) of


Mime
View raw message