use of com.jd.blockchain.consensus.Replica in project jdchain-core by blockchain-jd-com.
the class RaftConsensusSettingsBuilder method createSettings.
@Override
public ConsensusViewSettings createSettings(Properties props, Replica[] replicas) {
RaftConsensusConfig raftConsensusConfig = new RaftConsensusConfig();
List<NodeSettings> nodeSettings = new ArrayList<>(replicas.length);
RaftConfig raftSettings = new RaftConfig();
RaftNetworkConfig networkConfig = new RaftNetworkConfig();
for (Replica replica : replicas) {
RaftNodeConfig raftNodeSettings = new RaftNodeConfig();
raftNodeSettings.init(props, replica);
nodeSettings.add(raftNodeSettings);
}
raftSettings.init(props);
networkConfig.init(props);
raftConsensusConfig.init(props);
raftConsensusConfig.setNodeSettingsList(nodeSettings);
raftConsensusConfig.setRaftSettings(raftSettings);
raftConsensusConfig.setNetworkSettings(networkConfig);
return raftConsensusConfig;
}
Aggregations