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;
12 * Reply for the AppendEntriesRpc message
14 public class AppendEntriesReply extends AbstractRaftRPC {
16 // true if follower contained entry matching
17 // prevLogIndex and prevLogTerm
18 private final boolean success;
20 // The index of the last entry in the followers log
21 // This will be used to set the matchIndex for the follower on the
23 private final long logLastIndex;
25 private final long logLastTerm;
27 // The followerId - this will be used to figure out which follower is
29 private final String followerId;
31 public AppendEntriesReply(String followerId, long term, boolean success, long logLastIndex, long logLastTerm) {
34 this.followerId = followerId;
35 this.success = success;
36 this.logLastIndex = logLastIndex;
37 this.logLastTerm = logLastTerm;
40 public long getTerm() {
44 public boolean isSuccess() {
48 public long getLogLastIndex() {
52 public long getLogLastTerm() {
56 public String getFollowerId() {
60 @Override public String toString() {
61 final StringBuilder sb =
62 new StringBuilder("AppendEntriesReply{");
63 sb.append("term=").append(term);
64 sb.append(", success=").append(success);
65 sb.append(", logLastIndex=").append(logLastIndex);
66 sb.append(", logLastTerm=").append(logLastTerm);
67 sb.append(", followerId='").append(followerId).append('\'');