This PR introduces futures. At a high level, a future works as follows:
Client submits operation to raft and returns an OperationFuture in response. This represents the future result of the operation.
Client awaits the future. Once the operation has been applied to the StateMachine, raft will populate the future with the result. If the raft server loses leadership, it will populate the future with a NotLeaderError.
If the future has not been populated within the time duration specified by the client, an error is returned indicating the operation timed out.
For testing, the test library had to be adapted to handle this, but the tests remain the same for the most part.
This PR introduces futures. At a high level, a future works as follows:
raft
and returns anOperationFuture
in response. This represents the future result of the operation.StateMachine
,raft
will populate the future with the result. If theraft
server loses leadership, it will populate the future with aNotLeaderError
.For testing, the test library had to be adapted to handle this, but the tests remain the same for the most part.