package org.opendaylight.controller.cluster.raft.messages;
+import java.io.Serializable;
+
/**
* Invoked by candidates to gather votes (§5.2).
*/
-public class RequestVote {
-
- // candidate’s term
- private final long term;
+public class RequestVote extends AbstractRaftRPC implements Serializable{
// candidate requesting vote
- private final String candidateId;
+ private String candidateId;
// index of candidate’s last log entry (§5.4)
- private final long lastLogIndex;
+ private long lastLogIndex;
// term of candidate’s last log entry (§5.4)
- private final long lastLogTerm;
+ private long lastLogTerm;
public RequestVote(long term, String candidateId, long lastLogIndex,
long lastLogTerm) {
- this.term = term;
+ super(term);
this.candidateId = candidateId;
this.lastLogIndex = lastLogIndex;
this.lastLogTerm = lastLogTerm;
}
+ // added for testing while serialize-messages=on
+ public RequestVote() {
+ }
+
public long getTerm() {
return term;
}
public long getLastLogTerm() {
return lastLogTerm;
}
+
+ public void setCandidateId(String candidateId) {
+ this.candidateId = candidateId;
+ }
+
+ public void setLastLogIndex(long lastLogIndex) {
+ this.lastLogIndex = lastLogIndex;
+ }
+
+ public void setLastLogTerm(long lastLogTerm) {
+ this.lastLogTerm = lastLogTerm;
+ }
}