public class AppendResponse extends Message
AppendRequest.
Also contains information about the follower's log.
| Constructor and Description |
|---|
AppendResponse(int clusterId,
String senderId,
String recipientId,
long term,
Timestamp leaderTimestamp,
boolean success,
long matchIndex,
long lastLogIndex)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
calculateSize()
Calculate an upper bound on the number of bytes required by
writeTo(). |
long |
getLastLogIndex()
Get the index of the last log entry in the follower's log.
|
Timestamp |
getLeaderTimestamp()
Get the
leaderTimestamp from the corresponding AppendRequest. |
long |
getMatchIndex()
Get the index of the most recent log entry known to match leader.
|
boolean |
isSuccess()
Determine whether the request was successful, i.e., the previous log entry term and index matched.
|
String |
toString() |
void |
visit(MessageSwitch handler)
Apply the visitor pattern based on this instance's type.
|
void |
writeTo(ByteBuffer dest)
Serialize this instance into the given buffer.
|
calculateSize, calculateSize, calculateSize, decode, encode, getBoolean, getByteBuffer, getClusterId, getReads, getRecipientId, getSenderId, getString, getTerm, getTimestamp, getWrites, isLeaderMessage, putBoolean, putByteBuffer, putReads, putString, putTimestamp, putWritespublic AppendResponse(int clusterId,
String senderId,
String recipientId,
long term,
Timestamp leaderTimestamp,
boolean success,
long matchIndex,
long lastLogIndex)
clusterId - cluster IDsenderId - identity of senderrecipientId - identity of recipientterm - sender's current termleaderTimestamp - copy of AppendRequest.getLeaderTimestamp()success - if request successfully matchedmatchIndex - highest known matching log indexlastLogIndex - index of follower's last log entrypublic Timestamp getLeaderTimestamp()
leaderTimestamp from the corresponding AppendRequest.AppendRequest.getLeaderTimestamp()public boolean isSuccess()
public long getMatchIndex()
public long getLastLogIndex()
public void visit(MessageSwitch handler)
Messagepublic void writeTo(ByteBuffer dest)
Messageprotected int calculateSize()
MessagewriteTo().calculateSize in class MessageCopyright © 2016. All rights reserved.