(normalizedIngesters map[string]InstanceDesc)
| 364 | var tokenMapPool = sync.Pool{New: func() interface{} { return make(map[uint32]struct{}) }} |
| 365 | |
| 366 | func 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 | // |
no test coverage detected