37 #include <boost/multi_index_container.hpp>
38 #include <boost/multi_index/member.hpp>
39 #include <boost/multi_index/ordered_index.hpp>
40 #include <boost/optional/optional.hpp>
42 #include "net/http_client.h"
46 namespace bootstrap_node
66 selector_auto(std::function<std::map<std::string, bool>()> get_nodes,
size_t max_nodes = 1000)
72 boost::optional<node_info>
next_node() final;
91 typedef boost::multi_index_container<
93 boost::multi_index::indexed_by<
94 boost::multi_index::ordered_unique<boost::multi_index::tag<by_address>, boost::multi_index::member<node, std::string, &node::address>>,
95 boost::multi_index::ordered_non_unique<boost::multi_index::tag<by_fails>, boost::multi_index::member<node, size_t, &node::fails>>
99 const std::function<std::map<std::string, bool>()>
m_get_nodes;
Definition: bootstrap_node_selector.h:64
void append_new_nodes()
Definition: bootstrap_node_selector.cpp:86
selector_auto(std::function< std::map< std::string, bool >()> get_nodes, size_t max_nodes=1000)
Definition: bootstrap_node_selector.h:66
boost::optional< node_info > next_node() final
Definition: bootstrap_node_selector.cpp:62
nodes_list m_nodes
Definition: bootstrap_node_selector.h:101
bool has_at_least_one_good_node() const
Definition: bootstrap_node_selector.cpp:81
void truncate()
Definition: bootstrap_node_selector.cpp:104
const std::function< std::map< std::string, bool >)> m_get_nodes
Definition: bootstrap_node_selector.h:99
boost::multi_index_container< node, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< by_address >, boost::multi_index::member< node, std::string, &node::address > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< by_fails >, boost::multi_index::member< node, size_t, &node::fails > > > > nodes_list
Definition: bootstrap_node_selector.h:97
void handle_result(const std::string &address, bool success) final
Definition: bootstrap_node_selector.cpp:50
const size_t m_max_nodes
Definition: bootstrap_node_selector.h:100
expect< void > success() noexcept
Definition: expect.h:397
const
Definition: build_protob.py:9
Holds cryptonote related classes and helpers.
Definition: blockchain_db.cpp:45
Definition: blockchain_ancestry.cpp:72
Definition: bootstrap_node_selector.h:50
boost::optional< epee::net_utils::http::login > credentials
Definition: bootstrap_node_selector.h:52
std::string address
Definition: bootstrap_node_selector.h:51
Definition: bootstrap_node_selector.h:88
Definition: bootstrap_node_selector.h:89
Definition: bootstrap_node_selector.h:81
size_t fails
Definition: bootstrap_node_selector.h:83
std::string address
Definition: bootstrap_node_selector.h:82
Definition: bootstrap_node_selector.h:56
virtual ~selector()=default
virtual void handle_result(const std::string &address, bool success)=0
virtual boost::optional< node_info > next_node()=0