2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.cluster.raft.messages;
11 import java.io.Serializable;
14 * Invoked by candidates to gather votes (§5.2).
16 public class RequestVote extends AbstractRaftRPC implements Serializable{
18 // candidate requesting vote
19 private String candidateId;
21 // index of candidate’s last log entry (§5.4)
22 private long lastLogIndex;
24 // term of candidate’s last log entry (§5.4)
25 private long lastLogTerm;
27 public RequestVote(long term, String candidateId, long lastLogIndex,
30 this.candidateId = candidateId;
31 this.lastLogIndex = lastLogIndex;
32 this.lastLogTerm = lastLogTerm;
35 // added for testing while serialize-messages=on
36 public RequestVote() {
39 public long getTerm() {
43 public String getCandidateId() {
47 public long getLastLogIndex() {
51 public long getLastLogTerm() {
55 public void setCandidateId(String candidateId) {
56 this.candidateId = candidateId;
59 public void setLastLogIndex(long lastLogIndex) {
60 this.lastLogIndex = lastLogIndex;
63 public void setLastLogTerm(long lastLogTerm) {
64 this.lastLogTerm = lastLogTerm;