goraft/raft

Draft of new server.go

xiang90 opened this issue · 3 comments

@xiangli-cmu That's basically what I was thinking too. Looks good. Just a couple notes:

  1. Do we need separate goroutines for sendAndCollectVotes and commitCenter? It seems like those could be combined into the candidate and leader functions without spawning off something asynchronous.
  2. Can you rename the functions to be verbs? e.g. follower() -> follow(), candidate() -> promote(), leader() -> lead()?
  3. Change the constants to be initial-case: LEADER -> Leader. Go doesn't typically use all-caps.

For 1, probably we can do them in one select.

For 2 and 3, I will do it when I am going to write the codes.

What do you think about this structure?

@xiangli-cmu I think the structure looks great. Go for it.