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 {
15 private static final long serialVersionUID = 1L;
17 // true if follower contained entry matching
18 // prevLogIndex and prevLogTerm
19 private final boolean success;
21 // The index of the last entry in the followers log
22 // This will be used to set the matchIndex for the follower on the
24 private final long logLastIndex;
26 private final long logLastTerm;
28 // The followerId - this will be used to figure out which follower is
30 private final String followerId;
32 public AppendEntriesReply(String followerId, long term, boolean success, long logLastIndex, long logLastTerm) {
35 this.followerId = followerId;
36 this.success = success;
37 this.logLastIndex = logLastIndex;
38 this.logLastTerm = logLastTerm;
41 public long getTerm() {
45 public boolean isSuccess() {
49 public long getLogLastIndex() {
53 public long getLogLastTerm() {
57 public String getFollowerId() {
61 @Override public String toString() {
62 final StringBuilder sb =
63 new StringBuilder("AppendEntriesReply{");
64 sb.append("term=").append(term);
65 sb.append(", success=").append(success);
66 sb.append(", logLastIndex=").append(logLastIndex);
67 sb.append(", logLastTerm=").append(logLastTerm);
68 sb.append(", followerId='").append(followerId).append('\'');