(key proto.NodeKey)
| 257 | } |
| 258 | |
| 259 | func (c *Consistent) search(key proto.NodeKey) (i int) { |
| 260 | f := func(x int) bool { |
| 261 | //return c.sortedHashes[x] > key |
| 262 | return key.Less(&c.sortedHashes[x]) |
| 263 | } |
| 264 | i = sort.Search(len(c.sortedHashes), f) |
| 265 | if i >= len(c.sortedHashes) { |
| 266 | i = 0 |
| 267 | } |
| 268 | return |
| 269 | } |
| 270 | |
| 271 | // GetTwoNeighbors returns the two closest distinct nodes to the name input in the circle. |
| 272 | func (c *Consistent) GetTwoNeighbors(name string) (proto.Node, proto.Node, error) { |
no test coverage detected