MCPcopy Create free account
hub / github.com/zalando/skipper / search

Method search

loadbalancer/algorithm.go:161–164  ·  view source on GitHub ↗

Returns index of endpoint with closest hash to key's hash

(key string, ctx *routing.LBContext)

Source from the content-addressed store, hash-verified

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

Callers 2

TestConsistentHashSearchFunction · 0.45

Calls 1

searchRingMethod · 0.95

Tested by 1

TestConsistentHashSearchFunction · 0.36