InRegion returns every replica in the given DERP region excluding itself.
(regionID int32)
| 416 | |
| 417 | // InRegion returns every replica in the given DERP region excluding itself. |
| 418 | func (m *Manager) InRegion(regionID int32) []database.Replica { |
| 419 | m.mutex.Lock() |
| 420 | defer m.mutex.Unlock() |
| 421 | replicas := make([]database.Replica, 0) |
| 422 | for _, replica := range m.peers { |
| 423 | if replica.RegionID != regionID { |
| 424 | continue |
| 425 | } |
| 426 | replicas = append(replicas, replica) |
| 427 | } |
| 428 | return replicas |
| 429 | } |
| 430 | |
| 431 | // Regional returns all replicas in the same region excluding itself. |
| 432 | func (m *Manager) Regional() []database.Replica { |
no test coverage detected