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