Returns index of endpoint with closest hash to key's hash
(key string, ctx *routing.LBContext)
| 159 | |
| 160 | // Returns index of endpoint with closest hash to key's hash |
| 161 | func (ch *consistentHash) search(key string, ctx *routing.LBContext) int { |
| 162 | ringIndex := ch.searchRing(key, ctx) |
| 163 | return ch.hashRing[ringIndex].index |
| 164 | } |
| 165 | |
| 166 | func computeLoadAverage(ctx *routing.LBContext) float64 { |
| 167 | sum := 1.0 // add 1 to include the request that just arrived |