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

Function HashFP

pkg/util/hash_fp.go:12–14  ·  view source on GitHub ↗

HashFP simply moves entropy from the most significant 48 bits of the fingerprint into the least significant 16 bits (by XORing) so that a simple MOD on the result can be used to pick a mutex while still making use of changes in more significant bits of the fingerprint. (The fast fingerprinting funct

(fp model.Fingerprint)

Source from the content-addressed store, hash-verified

10// really want to make use of every change in the fingerprint to vary mutex
11// selection.)
12func HashFP(fp model.Fingerprint) uint32 {
13 return uint32(fp ^ (fp >> 32) ^ (fp >> 16))
14}

Callers 7

getShardMethod · 0.92
UpdateMetricMethod · 0.92
TrackMethod · 0.92
labelSetExistsMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected