use of com.alipay.sofa.jraft.rpc.CliRequests.LearnersOpResponse in project sofa-jraft by sofastack.
the class CliServiceImpl method processLearnersOpResponse.
private Status processLearnersOpResponse(final String groupId, final Message result, final String fmt, final Object... formatArgs) {
if (result instanceof LearnersOpResponse) {
final LearnersOpResponse resp = (LearnersOpResponse) result;
final Configuration oldConf = new Configuration();
for (final String peerIdStr : resp.getOldLearnersList()) {
final PeerId oldPeer = new PeerId();
oldPeer.parse(peerIdStr);
oldConf.addLearner(oldPeer);
}
final Configuration newConf = new Configuration();
for (final String peerIdStr : resp.getNewLearnersList()) {
final PeerId newPeer = new PeerId();
newPeer.parse(peerIdStr);
newConf.addLearner(newPeer);
}
LOG.info("Learners of replication group {} changed from {} to {} after {}.", groupId, oldConf, newConf, String.format(fmt, formatArgs));
return Status.OK();
} else {
return statusFromResponse(result);
}
}
Aggregations