MCPcopy Index your code
hub / github.com/cortexproject/cortex / tokenForGroup

Function tokenForGroup

pkg/ruler/ruler.go:548–559  ·  view source on GitHub ↗
(g *rulespb.RuleGroupDesc)

Source from the content-addressed store, hash-verified

546var sep = []byte("/")
547
548func tokenForGroup(g *rulespb.RuleGroupDesc) uint32 {
549 ringHasher := fnv.New32a()
550
551 // Hasher never returns err.
552 _, _ = ringHasher.Write([]byte(g.User))
553 _, _ = ringHasher.Write(sep)
554 _, _ = ringHasher.Write([]byte(g.Namespace))
555 _, _ = ringHasher.Write(sep)
556 _, _ = ringHasher.Write([]byte(g.Name))
557
558 return ringHasher.Sum32()
559}
560
561func (r *Ruler) instanceOwnsRuleGroup(rr ring.ReadRing, g *rulespb.RuleGroupDesc, disabledRuleGroups validation.DisabledRuleGroups, forBackup bool) (bool, error) {
562

Callers 5

instanceOwnsRuleGroupMethod · 0.85
TestShardingFunction · 0.85
generateTokenForGroupsFunction · 0.85

Calls 1

WriteMethod · 0.45

Tested by 3

TestShardingFunction · 0.68
generateTokenForGroupsFunction · 0.68