致永远离开我们的一位程序员
原文被删除了,CSDN 公众号发布了一篇文章。 https://mp.weixin.qq.com/s/b6vz_4PwCeSYGwITaWQlp...阅读全文
原文被删除了,CSDN 公众号发布了一篇文章。 https://mp.weixin.qq.com/s/b6vz_4PwCeSYGwITaWQlp...阅读全文
package main //一致性哈希(Consistent Hashing) //author: Xiong Chuan Liang //date: 2015-2-20 import ( "fmt" "hash/crc32" "sort" "strconv" "sync" ) const DEFAULT_REPLICAS = 160 type HashRing []uint32 func (c HashRing) Len() int { return len(c) } func (c HashRing) Less(i, j int) bool { return c[i] < c[j] } func (c HashRing) Swap(i, j int) { c[i], c[j] = c[...阅读全文