Skip to content

Commit

Permalink
remove useless hashfunction
Browse files Browse the repository at this point in the history
  • Loading branch information
calvin1978 committed Jan 23, 2017
1 parent 429f37b commit 457b1ae
Showing 1 changed file with 0 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
*
* 其中crc32基于JDK, murmurhash基于guava
*
* 3.无需哈希环的一致性哈希
*
* @author calvin
*/
public abstract class HashUtil {
Expand Down Expand Up @@ -246,18 +244,4 @@ public static long murmur128AsLong(@NotNull byte[] input) {
public static long murmur128AsLong(@NotNull String input) {
return Hashing.murmur3_128(MURMUR_SEED).hashString(input, Charsets.UTF_8).asLong();
}

///////////////// 一致性哈希//////////

/**
* 一致性哈希算法,无需构造一致性哈希环的
*
* @param input 输入值
* @param buckets 桶的数量, 必须>0
* @return 分配到的桶的index,从0开始
*/
public static int consistentHash(long input, int buckets) {
return Hashing.consistentHash(input, buckets);
}

}

0 comments on commit 457b1ae

Please sign in to comment.