MCPcopy
hub / github.com/grafana/dskit / conflictingTokensExist

Function conflictingTokensExist

ring/model.go:366–383  ·  view source on GitHub ↗
(normalizedIngesters map[string]InstanceDesc)

Source from the content-addressed store, hash-verified

364var tokenMapPool = sync.Pool{New: func() interface{} { return make(map[uint32]struct{}) }}
365
366func conflictingTokensExist(normalizedIngesters map[string]InstanceDesc) bool {
367 tokensMap := tokenMapPool.Get().(map[uint32]struct{})
368 defer func() {
369 for k := range tokensMap {
370 delete(tokensMap, k)
371 }
372 tokenMapPool.Put(tokensMap)
373 }()
374 for _, ing := range normalizedIngesters {
375 for _, t := range ing.Tokens {
376 if _, contains := tokensMap[t]; contains {
377 return true
378 }
379 tokensMap[t] = struct{}{}
380 }
381 }
382 return false
383}
384
385// This function resolves token conflicts, if there are any.
386//

Callers 1

mergeWithTimeMethod · 0.85

Calls 2

GetMethod · 0.65
PutMethod · 0.65

Tested by

no test coverage detected