AllPrimary returns every primary replica (not workspace proxy replicas), including itself.
()
| 401 | // AllPrimary returns every primary replica (not workspace proxy replicas), |
| 402 | // including itself. |
| 403 | func (m *Manager) AllPrimary() []database.Replica { |
| 404 | m.mutex.Lock() |
| 405 | defer m.mutex.Unlock() |
| 406 | replicas := make([]database.Replica, 0, len(m.peers)) |
| 407 | for _, replica := range append(m.peers, m.self) { |
| 408 | if !replica.Primary { |
| 409 | continue |
| 410 | } |
| 411 | |
| 412 | replicas = append(replicas, replica) |
| 413 | } |
| 414 | return replicas |
| 415 | } |
| 416 | |
| 417 | // InRegion returns every replica in the given DERP region excluding itself. |
| 418 | func (m *Manager) InRegion(regionID int32) []database.Replica { |