public final class FollowerLogInformation extends Object
Modifier and Type | Field and Description |
---|---|
static long |
NO_INDEX |
Constructor and Description |
---|
FollowerLogInformation(PeerInfo peerInfo,
RaftActorContext context)
Constructs an instance with no matching index.
|
Modifier and Type | Method and Description |
---|---|
void |
clearLeaderInstallSnapshotState()
Clears the LeaderInstallSnapshotState when an install snapshot is complete.
|
boolean |
decrNextIndex(long followerLastIndex)
Decrements the value of the follower's next index, taking into account its reported last log index.
|
String |
getId()
Returns the identifier of the follower.
|
LeaderInstallSnapshotState |
getInstallSnapshotState()
Returns the LeaderInstallSnapshotState for the in progress install snapshot.
|
long |
getMatchIndex()
Returns the index of highest log entry known to be replicated on the follower.
|
long |
getNextIndex()
Returns the index of the next log entry to send to the follower.
|
short |
getPayloadVersion()
Returns the log entry payload data version of the follower.
|
short |
getRaftVersion()
Returns the the raft version of the follower.
|
boolean |
hasStaleCommitIndex(long commitIndex) |
long |
incrMatchIndex()
Increments the value of the follower's match index.
|
boolean |
isFollowerActive()
Checks if the follower is active by comparing the time of the last activity with the election time out.
|
boolean |
isLogEntrySlicingInProgress()
Return whether or not log entry slicing is currently in progress.
|
void |
markFollowerActive()
Marks the follower as active.
|
void |
markFollowerInActive()
Marks the follower as inactive.
|
long |
nanosSinceLastActivity()
Returns the time since the last activity occurred for the follower.
|
String |
needsLeaderAddress(String leaderId) |
boolean |
okToReplicate(long commitIndex)
This method checks if the next replicate message can be sent to the follower.
|
void |
setLeaderInstallSnapshotState(LeaderInstallSnapshotState state)
Sets the LeaderInstallSnapshotState when an install snapshot is initiated.
|
boolean |
setMatchIndex(long matchIndex)
Sets the index of the follower's highest log entry.
|
void |
setNeedsLeaderAddress(boolean value) |
boolean |
setNextIndex(long nextIndex)
Sets the index of the follower's next log entry.
|
void |
setPayloadVersion(short payloadVersion)
Sets the payload data version of the follower.
|
void |
setRaftVersion(short raftVersion)
Sets the raft version of the follower.
|
void |
setSentCommitIndex(long commitIndex) |
void |
setSlicedLogEntryIndex(long index)
Sets the index of the log entry whose payload size exceeds the maximum size for a single message and thus
needs to be sliced into smaller chunks.
|
String |
toString() |
public static final long NO_INDEX
public FollowerLogInformation(PeerInfo peerInfo, RaftActorContext context)
peerInfo
- the associated PeerInfo of the follower.context
- the RaftActorContext.public boolean decrNextIndex(long followerLastIndex)
followerLastIndex
- follower's last reported index.public boolean setNextIndex(long nextIndex)
nextIndex
- the new index.public long incrMatchIndex()
public boolean setMatchIndex(long matchIndex)
matchIndex
- the new index.public String getId()
public long getNextIndex()
public long getMatchIndex()
public boolean isFollowerActive()
public void markFollowerActive()
public void markFollowerInActive()
public long nanosSinceLastActivity()
public boolean okToReplicate(long commitIndex)
commitIndex
- current commitIndexpublic short getPayloadVersion()
public void setPayloadVersion(short payloadVersion)
payloadVersion
- the payload data version.public short getRaftVersion()
public void setRaftVersion(short raftVersion)
raftVersion
- the raft version.@Nullable public LeaderInstallSnapshotState getInstallSnapshotState()
public void setLeaderInstallSnapshotState(@Nonnull LeaderInstallSnapshotState state)
state
- the LeaderInstallSnapshotStatepublic void clearLeaderInstallSnapshotState()
public void setSlicedLogEntryIndex(long index)
index
- the log entry index or NO_INDEX to clear itpublic boolean isLogEntrySlicingInProgress()
public void setNeedsLeaderAddress(boolean value)
public boolean hasStaleCommitIndex(long commitIndex)
public void setSentCommitIndex(long commitIndex)
Copyright © 2019 OpenDaylight. All rights reserved.