20 #include <ripple/app/main/Application.h>
21 #include <ripple/basics/Log.h>
22 #include <ripple/basics/StringUtilities.h>
23 #include <ripple/core/Config.h>
24 #include <ripple/core/TimeKeeper.h>
25 #include <ripple/overlay/Cluster.h>
26 #include <ripple/overlay/ClusterNode.h>
27 #include <ripple/protocol/jss.h>
28 #include <ripple/protocol/tokens.h>
29 #include <boost/regex.hpp>
43 auto iter =
nodes_.find(identity);
66 auto iter =
nodes_.find(identity);
70 if (reportTime <= iter->getReportTime())
79 nodes_.emplace_hint(iter, identity, name, loadFee, reportTime);
87 for (
auto const& ni :
nodes_)
94 static boost::regex
const re(
106 for (
auto const& n : nodes.
values())
110 if (!boost::regex_match(n, match, re))
112 JLOG(
j_.
error()) <<
"Malformed entry: '" << n <<
"'";
120 JLOG(
j_.
error()) <<
"Invalid node identity: " << match[1];
126 JLOG(
j_.
warn()) <<
"Duplicate node identity: " << match[1];
Holds a collection of configuration values.
Cluster(beast::Journal j)
std::optional< std::string > member(PublicKey const &node) const
Determines whether a node belongs in the cluster.
bool update(PublicKey const &identity, std::string name, std::uint32_t loadFee=0, NetClock::time_point reportTime=NetClock::time_point{})
Store information about the state of a cluster node.
std::string trim_whitespace(std::string str)
bool load(Section const &nodes)
Load the list of cluster nodes.
std::vector< std::string > const & values() const
Returns all the values in the section.
A generic endpoint for log messages.
std::size_t size() const
The number of nodes in the cluster list.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::set< ClusterNode, Comparator > nodes_
void for_each(std::function< void(ClusterNode const &)> func) const
Invokes the callback once for every cluster node.