raft: make raft configurable

This commit is contained in:
Xiang Li
2015-03-21 18:15:58 -07:00
parent a552722f03
commit d9b5b56c82
9 changed files with 205 additions and 93 deletions

View File

@ -182,7 +182,16 @@ func (mn *multiNode) run() {
select {
case gc := <-mn.groupc:
// TODO(bdarnell): pass applied through gc and into newRaft. Or get rid of it?
r := newRaft(mn.id, nil, mn.election, mn.heartbeat, gc.storage, 0)
// TODO(bdarnell): make maxSizePerMsg(InflightMsgs) configurable
c := &Config{
ID: mn.id,
ElectionTick: mn.election,
HeartbeatTick: mn.heartbeat,
Storage: gc.storage,
MaxSizePerMsg: noLimit,
MaxInflightMsgs: 256,
}
r := newRaft(c)
group = &groupState{
id: gc.id,
raft: r,