import com.google.common.base.Preconditions;
import com.google.common.base.Stopwatch;
import java.util.concurrent.TimeUnit;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import org.opendaylight.controller.cluster.raft.behaviors.LeaderInstallSnapshotState;
public class FollowerLogInformationImpl implements FollowerLogInformation {
private final Stopwatch stopwatch = Stopwatch.createUnstarted();
private final PeerInfo peerInfo;
+ private LeaderInstallSnapshotState installSnapshotState;
+
public FollowerLogInformationImpl(PeerInfo peerInfo, long matchIndex, RaftActorContext context) {
this.nextIndex = context.getCommitIndex();
this.matchIndex = matchIndex;
this.raftVersion = raftVersion;
}
+ @Override
+ @Nullable
+ public LeaderInstallSnapshotState getInstallSnapshotState() {
+ return installSnapshotState;
+ }
+
+ @Override
+ public void setLeaderInstallSnapshotState(@Nonnull LeaderInstallSnapshotState state) {
+ this.installSnapshotState = Preconditions.checkNotNull(state);
+ }
+
+ @Override
+ public void clearLeaderInstallSnapshotState() {
+ installSnapshotState = null;
+ }
+
@Override
public String toString() {
return "FollowerLogInformationImpl [id=" + getId() + ", nextIndex=" + nextIndex + ", matchIndex=" + matchIndex