couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [25/50] git commit: Remove cruft
Date Fri, 17 Jan 2014 21:54:43 GMT
Remove cruft


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

Branch: refs/heads/import
Commit: 255f33d3c2b320176ec7d0a47fb6e4706c78ff4f
Parents: d5f5ff2
Author: Robert Newson <robert.newson@cloudant.com>
Authored: Thu Sep 27 00:37:54 2012 +0100
Committer: Robert Newson <robert.newson@cloudant.com>
Committed: Thu Sep 27 13:48:07 2012 +0100

----------------------------------------------------------------------
 src/mem3.erl      | 24 ------------------------
 src/mem3_util.erl | 15 +--------------
 2 files changed, 1 insertion(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/255f33d3/src/mem3.erl
----------------------------------------------------------------------
diff --git a/src/mem3.erl b/src/mem3.erl
index 41ad579..044dbec 100644
--- a/src/mem3.erl
+++ b/src/mem3.erl
@@ -196,33 +196,9 @@ dbname(DbName) when is_binary(DbName) ->
 dbname(_) ->
     erlang:error(badarg).
 
-
-zones(Nodes) ->
-    BlacklistStr = couch_config:get("mem3", "blacklisted_zones", "[]"),
-    {ok, Blacklist0} = couch_util:parse_term(BlacklistStr),
-    Blacklist = [list_to_binary(Z) || Z <- Blacklist0],
-    lists:usort([mem3:node_info(Node, <<"zone">>) || Node <- Nodes]) --
-        Blacklist.
-
 nodes_in_zone(Nodes, Zone) ->
     [Node || Node <- Nodes, Zone == mem3:node_info(Node, <<"zone">>)].
 
-shuffle(List) ->
-    List1 = [{crypto:rand_uniform(1, 1000), Item} || Item <- List],
-    List2 = lists:sort(List1),
-    {_, Result} = lists:unzip(List2),
-    Result.
-
-apportion(Shares, Ways) ->
-    apportion(Shares, lists:duplicate(Ways, 0), Shares).
-
-apportion(_Shares, Acc, 0) ->
-    Acc;
-apportion(Shares, Acc, Remaining) ->
-    N = Remaining rem length(Acc),
-    [H|T] = lists:nthtail(N, Acc),
-    apportion(Shares, lists:sublist(Acc, N) ++ [H+1|T], Remaining - 1).
-
 live_shards(DbName, Nodes) ->
     [S || #shard{node=Node} = S <- shards(DbName), lists:member(Node, Nodes)].
 

http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/255f33d3/src/mem3_util.erl
----------------------------------------------------------------------
diff --git a/src/mem3_util.erl b/src/mem3_util.erl
index d733006..cc8a651 100644
--- a/src/mem3_util.erl
+++ b/src/mem3_util.erl
@@ -15,7 +15,7 @@
 -module(mem3_util).
 
 -export([hash/1, name_shard/2, create_partition_map/5, build_shards/2,
-    n_val/2, z_val/3, to_atom/1, to_integer/1, write_db_doc/1, delete_db_doc/1,
+    n_val/2, to_atom/1, to_integer/1, write_db_doc/1, delete_db_doc/1,
     shard_info/1, ensure_exists/1, open_db_doc/1]).
 -export([owner/2]).
 
@@ -164,19 +164,6 @@ n_val(N, _) when N < 1 ->
 n_val(N, _) ->
     N.
 
-z_val(undefined, NodeCount, ZoneCount) ->
-    z_val(couch_config:get("cluster", "z", "3"), NodeCount, ZoneCount);
-z_val(N, NodeCount, ZoneCount) when is_list(N) ->
-    z_val(list_to_integer(N), NodeCount, ZoneCount);
-z_val(N, NodeCount, ZoneCount) when N > NodeCount orelse N > ZoneCount ->
-    twig:log(error, "Request to create Z=~p DB but only ~p nodes(s) and ~p zone(s)",
-            [N, NodeCount, ZoneCount]),
-    erlang:min(NodeCount, ZoneCount);
-z_val(N, _, _) when N < 1 ->
-    1;
-z_val(N, _, _) ->
-    N.
-
 shard_info(DbName) ->
     [{n, mem3:n(DbName)},
      {q, length(mem3:shards(DbName)) div mem3:n(DbName)}].


Mime
View raw message