X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=inline;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fmessages%2FAppendEntriesReply.java;h=32ed85b281fee0feb4b0533c0b72cb5ade40093a;hb=9b43c3ce7c46eaae9060f3ed18e6c39f76ede2e5;hp=d811464cba9ba3f6427f3bda972c3fc888190cbb;hpb=789431e2c0c76d9d00bdc7599a08036e3720f170;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntriesReply.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntriesReply.java index d811464cba..32ed85b281 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntriesReply.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntriesReply.java @@ -11,19 +11,34 @@ package org.opendaylight.controller.cluster.raft.messages; /** * Reply for the AppendEntriesRpc message */ -public class AppendEntriesReply { - // currentTerm, for leader to update itself - private final long term; +public class AppendEntriesReply extends AbstractRaftRPC { + private static final long serialVersionUID = -7487547356392536683L; // true if follower contained entry matching // prevLogIndex and prevLogTerm private final boolean success; - public AppendEntriesReply(long term, boolean success) { - this.term = term; + // The index of the last entry in the followers log + // This will be used to set the matchIndex for the follower on the + // Leader + private final long logLastIndex; + + private final long logLastTerm; + + // The followerId - this will be used to figure out which follower is + // responding + private final String followerId; + + public AppendEntriesReply(String followerId, long term, boolean success, long logLastIndex, long logLastTerm) { + super(term); + + this.followerId = followerId; this.success = success; + this.logLastIndex = logLastIndex; + this.logLastTerm = logLastTerm; } + @Override public long getTerm() { return term; } @@ -31,4 +46,28 @@ public class AppendEntriesReply { public boolean isSuccess() { return success; } + + public long getLogLastIndex() { + return logLastIndex; + } + + public long getLogLastTerm() { + return logLastTerm; + } + + public String getFollowerId() { + return followerId; + } + + @Override public String toString() { + final StringBuilder sb = + new StringBuilder("AppendEntriesReply{"); + sb.append("term=").append(term); + sb.append(", success=").append(success); + sb.append(", logLastIndex=").append(logLastIndex); + sb.append(", logLastTerm=").append(logLastTerm); + sb.append(", followerId='").append(followerId).append('\''); + sb.append('}'); + return sb.toString(); + } }