From 67ddab6a918f1844ec5d15ac5613f70ef763c356 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Thu, 10 Jun 2010 09:43:22 -0400 Subject: remove unused code --- src/partitions.erl | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) (limited to 'src') diff --git a/src/partitions.erl b/src/partitions.erl index d64d405a..cfc1d90b 100644 --- a/src/partitions.erl +++ b/src/partitions.erl @@ -53,6 +53,7 @@ for_key(DbName, Key) -> range = ['$1','$2'], ref = '_' }, + % TODO these conditions assume A < B, which we don't require Conditions = [{'<', '$1', HashKey}, {'<', HashKey, '$2'}], case ets:select(partitions, [{Head, Conditions, ['$_']}]) of [] -> @@ -69,15 +70,6 @@ all_parts(DbName) -> Else end. -% %% @doc for the given key, return a list of {Node,Part} tuples. Nodes are both -% %% primary and replication partner nodes, and should number N. -% int_node_parts_for_key(Key) -> -% Config = configuration:get_config(), -% Hash = lib_misc:hash(Key), -% Part = partitions:hash_to_partition(Hash, Config#config.q), -% NodePartList = all_nodes_parts(true), -% lists:filter(fun({_N,P}) -> P =:= Part end, NodePartList). - %%==================================================================== %% Internal functions %%==================================================================== @@ -191,32 +183,3 @@ shard_name(Part, DbName) when is_list(DbName) -> shard_name(Part, DbName) -> PartHex = ?l2b(showroom_utils:int_to_hexstr(Part)), <<"x", PartHex/binary, "/", DbName/binary, "_", PartHex/binary>>. - -% %% @doc given an int and a partition map from ets cache table, -% %% get the first part greater than Int. -% int_to_nps(_, [], _, Acc) -> Acc; -% int_to_nps(Int, [{_,{N,P}} | Rest], CurrentPart, NPAcc) -> -% case P > Int of -% true -> -% case P =/= CurrentPart of -% true -> NPAcc; -% _ -> -% NewAcc = [{N,P}|NPAcc], -% int_to_nps(Int, Rest, P, NewAcc) -% end; -% _ -> int_to_nps(Int, Rest, P, NPAcc) -% end. - - -% % get parts -% {_,NPs} = lists:unzip(Map), -% {_,AllParts} = lists:unzip(NPs), -% Parts = lists:usort(AllParts), -% % lookup part -% Rem = lists:dropwhile(fun(E) -> E < Int end, Parts), -% Part = case Rem of -% [] -> 0; % wrap-around-ring case (back to 0) -% [H|_T] -> H -% end, -% % get nodes/parts -% ok. -- cgit v1.2.3