// Iterate through replicas and commit all entries up to the given index.
for (NodeReplicator replica : replicaMap.values()) {
replica.replicate(index).whenComplete((resultIndex, error) -> {
// Once the commit succeeds, check the commit index of all replicas.
if (error == null) {
quorum.succeed();
checkCommits();
} else {
quorum.fail();
}
});