Skip to content

Instantly share code, notes, and snippets.

@boorad
Created August 27, 2009 18:17
Show Gist options
  • Save boorad/176458 to your computer and use it in GitHub Desktop.
Save boorad/176458 to your computer and use it in GitHub Desktop.
%% nodeparts_for_key
handle_call({nodeparts_for_key, Key}, _From,
State = #membership{partitions=PMap}) ->
?prof(config),
Config = configuration:get_config(),
?forp(config),
?prof(hashing),
Hash = lib_misc:hash(Key),
Part = partitions:hash_to_partition(Hash, Config#config.q),
?forp(hashing),
?prof(nodes),
NodePartList = all_nodes_parts(PMap, true),
NodeParts = lists:filter(fun({_N,P}) -> P =:= Part end, NodePartList),
?forp(nodes),
{reply, NodeParts, State};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment