20#include <xrpld/core/Config.h>
21#include <xrpld/core/TimeKeeper.h>
22#include <xrpld/overlay/Cluster.h>
23#include <xrpld/overlay/ClusterNode.h>
25#include <xrpl/basics/Log.h>
26#include <xrpl/basics/StringUtilities.h>
27#include <xrpl/protocol/tokens.h>
29#include <boost/regex.hpp>
42 auto iter =
nodes_.find(identity);
65 auto iter =
nodes_.find(identity);
69 if (reportTime <= iter->getReportTime())
78 nodes_.emplace_hint(iter, identity, name, loadFee, reportTime);
86 for (
auto const& ni :
nodes_)
93 static boost::regex
const re(
105 for (
auto const& n : nodes.
values())
109 if (!boost::regex_match(n,
match, re))
111 JLOG(
j_.
error()) <<
"Malformed entry: '" << n <<
"'";
120 JLOG(
j_.
error()) <<
"Invalid node identity: " <<
match[1];
126 JLOG(
j_.
warn()) <<
"Duplicate node identity: " <<
match[1];
A generic endpoint for log messages.
std::set< ClusterNode, Comparator > nodes_
void for_each(std::function< void(ClusterNode const &)> func) const
Invokes the callback once for every cluster node.
std::size_t size() const
The number of nodes in the cluster list.
Cluster(beast::Journal j)
bool load(Section const &nodes)
Load the list of cluster nodes.
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::optional< std::string > member(PublicKey const &node) const
Determines whether a node belongs in the cluster.
Holds a collection of configuration values.
std::vector< std::string > const & values() const
Returns all the values in the section.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string trim_whitespace(std::string str)