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

Function conflictingTokensExist

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

Source from the content-addressed store, hash-verified

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

Callers 2

mergeWithTimeMethod · 0.85
FindDifferenceMethod · 0.85

Calls 2

GetMethod · 0.65
PutMethod · 0.65

Tested by

no test coverage detected