We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d05fa31 commit c0fc380Copy full SHA for c0fc380
consistent_hash_code/consistent.go
@@ -78,7 +78,7 @@ func (c *Consistent) refreshHashSortNodes() {
78
79
func (c *Consistent) searchNearbyIndex(key string) int {
80
hashKey := hashKey(key)
81
- index := sort.Search(len(c.hashSortNodes), func(i int) bool { //key算出的节点,距离最近的node节点下标
+ index := sort.Search(len(c.hashSortNodes), func(i int) bool { //key算出的节点,距离最近的node节点下标 sort.Search数组需要升序排列好
82
return c.hashSortNodes[i] >= hashKey
83
})
84
if index >= len(c.hashSortNodes) {
0 commit comments