+ public void setRaftVersion(final short raftVersion) {
+ checkArgument(raftVersion >= RaftVersions.FLUORINE_VERSION, "Unexpected version %s", raftVersion);
+ this.raftVersion = raftVersion;
+ }
+
+ /**
+ * Returns the LeaderInstallSnapshotState for the in progress install snapshot.
+ *
+ * @return the LeaderInstallSnapshotState if a snapshot install is in progress, null otherwise.
+ */
+ public @Nullable LeaderInstallSnapshotState getInstallSnapshotState() {
+ return installSnapshotState;
+ }
+
+ /**
+ * Sets the LeaderInstallSnapshotState when an install snapshot is initiated.
+ *
+ * @param state the LeaderInstallSnapshotState
+ */
+ public void setLeaderInstallSnapshotState(final @NonNull LeaderInstallSnapshotState state) {
+ if (installSnapshotState == null) {
+ installSnapshotState = requireNonNull(state);
+ }
+ }
+
+ /**
+ * Clears the LeaderInstallSnapshotState when an install snapshot is complete.
+ */
+ public void clearLeaderInstallSnapshotState() {
+ checkState(installSnapshotState != null);
+ installSnapshotState.close();
+ installSnapshotState = null;
+ }
+
+ /**
+ * 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.
+ *
+ * @param index the log entry index or NO_INDEX to clear it
+ */
+ public void setSlicedLogEntryIndex(final long index) {
+ slicedLogEntryIndex = index;
+ }
+
+ /**
+ * Return whether or not log entry slicing is currently in progress.
+ *
+ * @return true if slicing is currently in progress, false otherwise
+ */
+ public boolean isLogEntrySlicingInProgress() {
+ return slicedLogEntryIndex != NO_INDEX;
+ }
+
+ public void setNeedsLeaderAddress(final boolean value) {
+ needsLeaderAddress = value;
+ }
+
+ public @Nullable String needsLeaderAddress(final String leaderId) {
+ return needsLeaderAddress ? context.getPeerAddress(leaderId) : null;
+ }
+
+ public boolean hasStaleCommitIndex(final long commitIndex) {
+ return sentCommitIndex != commitIndex;
+ }
+
+ public void setSentCommitIndex(final long commitIndex) {
+ sentCommitIndex = commitIndex;
+ }
+
+ @Override
+ public String toString() {
+ return "FollowerLogInformation [id=" + getId() + ", nextIndex=" + nextIndex + ", matchIndex=" + matchIndex
+ + ", lastReplicatedIndex=" + lastReplicatedIndex + ", commitIndex=" + sentCommitIndex
+ + ", votingState=" + peerInfo.getVotingState()
+ + ", stopwatch=" + stopwatch.elapsed(TimeUnit.MILLISECONDS)
+ + ", followerTimeoutMillis=" + context.getConfigParams().getElectionTimeOutInterval().toMillis() + "]";
+ }