MCPcopy
hub / github.com/chaozh/MIT-6.824 / Leader

Method Leader

src/kvraft/config.go:325–336  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

323}
324
325func (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
339func (cfg *config) make_partition() ([]int, []int) {

Callers 1

make_partitionMethod · 0.95

Calls 1

GetStateMethod · 0.80

Tested by

no test coverage detected