()
| 323 | } |
| 324 | |
| 325 | func (cfg *config) Leader() (bool, int) { |
| 326 | cfg.mu.Lock() |
| 327 | defer cfg.mu.Unlock() |
| 328 | |
| 329 | for i := 0; i < cfg.n; i++ { |
| 330 | _, is_leader := cfg.kvservers[i].rf.GetState() |
| 331 | if is_leader { |
| 332 | return true, i |
| 333 | } |
| 334 | } |
| 335 | return false, 0 |
| 336 | } |
| 337 | |
| 338 | // Partition servers into 2 groups and put current leader in minority |
| 339 | func (cfg *config) make_partition() ([]int, []int) { |
no test coverage detected