@Override public Outcome handle( RaftMessages.PreVote.Request request, Outcome outcome, ReadableRaftState ctx, Log log ) throws IOException { Voting.declinePreVoteRequest( ctx, outcome, request ); return outcome; }
static void declinePreVoteRequest( ReadableRaftState state, Outcome outcome, RaftMessages.PreVote.Request voteRequest ) throws IOException { respondToPreVoteRequest( state, outcome, voteRequest, () -> false ); }
static void handlePreVoteRequest( ReadableRaftState state, Outcome outcome, RaftMessages.PreVote.Request voteRequest, Log log ) throws IOException { ThrowingBooleanSupplier<IOException> willVoteForCandidate = () -> shouldVoteFor( state, outcome, voteRequest, false, log ); respondToPreVoteRequest( state, outcome, voteRequest, willVoteForCandidate ); }
@Override public Outcome handle( RaftMessages.PruneRequest pruneRequest ) { Pruning.handlePruneRequest( outcome, pruneRequest ); return outcome; }
@Override public Outcome handle( AppendEntries.Request request ) throws IOException { Appending.handleAppendEntriesRequest( ctx, outcome, request, log ); return outcome; }
@Override public Outcome handle( RaftMessages.PreVote.Response response ) throws IOException { return preVoteResponseHandler.handle( response, outcome, ctx, log ); }
@Override public Outcome handle( RaftMessages.PreVote.Request request, Outcome outcome, ReadableRaftState ctx, Log log ) throws IOException { Voting.handlePreVoteRequest( ctx, outcome, request, log ); return outcome; }
@Override public Outcome handle( RaftMessages.Timeout.Heartbeat heartbeat ) throws IOException { sendHeartbeats( ctx, outcome ); return outcome; }
@Override public Outcome handle( Heartbeat heartbeat ) throws IOException { Heart.beat( ctx, outcome, heartbeat, log ); return outcome; }
@Override public Outcome handle( RaftMessages.Vote.Request request ) throws IOException { Voting.handleVoteRequest( ctx, outcome, request, log ); return outcome; }
@Override public Outcome handle( RaftMessages.PreVote.Request request ) throws IOException { return preVoteRequestHandler.handle( request, outcome, ctx, log ); }
@Override public Outcome handle( RaftMessages.Timeout.Election election ) throws IOException { return electionTimeoutHandler.handle( election, outcome, ctx, log ); }
@Override public Outcome handle( RaftMessages.RaftMessage message, ReadableRaftState ctx, Log log ) throws IOException { return message.dispatch( new Handler( ctx, log ) ); }
@Override public Outcome handle( RaftMessages.NewEntry.Request req ) throws IOException { ReplicatedContent content = req.content(); Appending.appendNewEntry( ctx, outcome, content ); return outcome; }
@Override public Outcome handle( RaftMessages.NewEntry.BatchRequest req ) throws IOException { List<ReplicatedContent> contents = req.contents(); Appending.appendNewEntries( ctx, outcome, contents ); return outcome; }
@Override public Outcome handle( RaftMessages.RaftMessage message, ReadableRaftState ctx, Log log ) throws IOException { return message.dispatch( visitor( ctx, log ) ); }
@Override public String getRole() { return raftMachine.currentRole().toString(); }
@Override public Outcome handle( RaftMessages.RaftMessage message, ReadableRaftState ctx, Log log ) throws IOException { return message.dispatch( new Handler( ctx, log ) ); }
@Override public Outcome handle( RaftMessages.PruneRequest pruneRequest ) { Pruning.handlePruneRequest( outcome, pruneRequest ); return outcome; } }
@Override public Outcome handle( RaftMessages.PruneRequest pruneRequest ) { Pruning.handlePruneRequest( outcome, pruneRequest ); return outcome; }