Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions hashring.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ func (h *HashRing) GetNode(stringKey string) (node string, ok bool) {
return h.ring[h.sortedKeys[pos]], true
}

func (h* HashRing) GetNodeWithPos(pos int) (node string, ok bool) {
if pos < 0 || pos >= len(h.sortedKeys) {
return "",false
}
return h.ring[h.sortedKeys[pos]], true
}

func (h *HashRing) GetNodePos(stringKey string) (pos int, ok bool) {
if len(h.ring) == 0 {
return 0, false
Expand Down