MCPcopy Create free account
hub / github.com/cortexproject/cortex / searchToken

Function searchToken

pkg/ring/util.go:143–151  ·  view source on GitHub ↗

searchToken returns the offset of the tokens entry holding the range for the provided key.

(tokens []uint32, key uint32)

Source from the content-addressed store, hash-verified

141
142// searchToken returns the offset of the tokens entry holding the range for the provided key.
143func searchToken(tokens []uint32, key uint32) int {
144 i := sort.Search(len(tokens), func(x int) bool {
145 return tokens[x] > key
146 })
147 if i >= len(tokens) {
148 i = 0
149 }
150 return i
151}
152
153// GetFirstAddressOf returns the first IPv4 address of the supplied interface names, omitting any 169.254.x.x automatic private IPs if possible.
154func getFirstAddressOf(names []string, logger log.Logger) (string, error) {

Callers 2

GetMethod · 0.85
shuffleShardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected