func NewState(id int, electionTimeoutMS, heartbeatTimeoutMS int) *State {
	return &State{
		appendEntriesChan:  make(chan *AppendEntriesRequest),
		electionTimeoutMS:  electionTimeoutMS,
		heartbeatResetChan: make(chan struct{}),
		heartbeatTimeoutMS: heartbeatTimeoutMS,
		id:                 id,
		leaderID:           UnknownLeaderID,
		mu:                 &sync.Mutex{},
		state:              StateFollower,
		stateChangeChan:    make(chan int),
		term:               1,
		votedFor:           NoVote,
	}
}
// NewState initializes a new raft state.
NewState initializes a new raft state.
// NewState initializes a new raft state .
func NewState(id int, electionTimeoutMS, heartbeatTimeoutMS int) *State {
	return &State{
		appendEntriesChan:  make(chan *AppendEntriesRequest),
		electionTimeoutMS:  electionTimeoutMS,
		heartbeatResetChan: make(chan struct{}),
		heartbeatTimeoutMS: heartbeatTimeoutMS,
		id:                 id,
		leaderID:           UnknownLeaderID,
		mu:                 &sync.Mutex{},
		state:              StateFollower,
		stateChangeChan:    make(chan int),
		term:               1,
		votedFor:           NoVote,
	}
}
func NewState ( id int , electionTimeoutMS , heartbeatTimeoutMS int ) * State { return & State { appendEntriesChan : make ( chan * AppendEntriesRequest ) , electionTimeoutMS : electionTimeoutMS , heartbeatResetChan : make ( chan struct { } ) , heartbeatTimeoutMS : heartbeatTimeoutMS , id : id , leaderID : UnknownLeaderID , mu : & sync . Mutex { } , state : StateFollower , stateChangeChan : make ( chan int ) , term : 1 , votedFor : NoVote , } }
NewState initializes a new raft state.
NewState initializes a new raft state .