Map<String, String> peerAddresses = new HashMap<>();
Map<String, Boolean> peerVotingStates = new HashMap<>();
for(PeerInfo info: context.getPeers()) {
- peerVotingStates.put(info.getId(), info.getVotingState() != VotingState.NON_VOTING);
- peerAddresses.put(info.getId(), info.getAddress());
+ peerVotingStates.put(info.getId(), info.isVoting());
+ peerAddresses.put(info.getId(), info.getAddress() != null ? info.getAddress() : "");
}
final RaftActorBehavior currentBehavior = context.getCurrentBehavior();
for(String id: followerIds) {
final FollowerLogInformation info = leader.getFollower(id);
followerInfoList.add(new FollowerInfo(id, info.getNextIndex(), info.getMatchIndex(),
- info.isFollowerActive(), DurationFormatUtils.formatDurationHMS(info.timeSinceLastActivity())));
+ info.isFollowerActive(), DurationFormatUtils.formatDurationHMS(info.timeSinceLastActivity()),
+ context.getPeerInfo(info.getId()).isVoting()));
}
builder.followerInfoList(followerInfoList);
private final long matchIndex;
private final boolean isActive;
private final String timeSinceLastActivity;
+ private final boolean isVoting;
- @ConstructorProperties({"id","nextIndex", "matchIndex", "isActive", "timeSinceLastActivity"})
- public FollowerInfo(String id, long nextIndex, long matchIndex, boolean isActive, String timeSinceLastActivity) {
+ @ConstructorProperties({"id","nextIndex", "matchIndex", "isActive", "timeSinceLastActivity", "isVoting"})
+ public FollowerInfo(String id, long nextIndex, long matchIndex, boolean isActive, String timeSinceLastActivity,
+ boolean isVoting) {
this.id = id;
this.nextIndex = nextIndex;
this.matchIndex = matchIndex;
this.isActive = isActive;
this.timeSinceLastActivity = timeSinceLastActivity;
+ this.isVoting = isVoting;
}
public String getId() {
public String getTimeSinceLastActivity() {
return timeSinceLastActivity;
}
+
+ public boolean isVoting() {
+ return isVoting;
+ }
}