Add RaftActorLeadershipTransferCohort and implement transfer in Leader
Added a transferLeadership method to Leader that takes a
RaftActorLeadershipTransferCohort to be notified when transfer is
complete.
The leader looks for a follower via AppendEntriesReply whose cached
matchIndex matches the leader's last index. If one is found, it sends
an additional AppendEntries to ensure the follower has applied all its
log entries to its state. It then sends an ElectionTimeout to immediately
start an electioni and notifies the RaftActorLeadershipTransferCohort
via transferComplete.
If no matching follower is found initially, the leader tries again at
the next heartbeat interval via AppendEntriesReply. This continues until
either a matching follower is found or the election timeout period
elapses. The latter is checked at each heartbeat interval via
beforeSendHeartbeat. On time out, it notifies the
RaftActorLeadershipTransferCohort via abortTransfer.
Change-Id: I841e13fdde27ee57b9789a4df6f69bf9901c1e79
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>