labelSetExists is used for testing only to check the existence of a label set.
(userId string, hash uint64, labelSet labels.Labels)
| 82 | |
| 83 | // labelSetExists is used for testing only to check the existence of a label set. |
| 84 | func (m *LabelSetTracker) labelSetExists(userId string, hash uint64, labelSet labels.Labels) bool { |
| 85 | s := m.shards[util.HashFP(model.Fingerprint(hash))%numMetricShards] |
| 86 | s.RLock() |
| 87 | defer s.RUnlock() |
| 88 | userEntry, ok := s.userLabelSets[userId] |
| 89 | if !ok { |
| 90 | return false |
| 91 | } |
| 92 | set, ok := userEntry[hash] |
| 93 | if !ok { |
| 94 | return false |
| 95 | } |
| 96 | return labels.Compare(set, labelSet) == 0 |
| 97 | } |
| 98 | |
| 99 | // userExists is used for testing only to check the existence of a user. |
| 100 | func (m *LabelSetTracker) userExists(userId string) bool { |