1#include <xrpld/core/Config.h>
2#include <xrpld/core/TimeKeeper.h>
3#include <xrpld/overlay/Cluster.h>
4#include <xrpld/overlay/ClusterNode.h>
6#include <xrpl/basics/Log.h>
7#include <xrpl/basics/StringUtilities.h>
8#include <xrpl/protocol/tokens.h>
10#include <boost/regex.hpp>
23 auto iter =
nodes_.find(identity);
46 auto iter =
nodes_.find(identity);
50 if (reportTime <= iter->getReportTime())
59 nodes_.emplace_hint(iter, identity, name, loadFee, reportTime);
67 for (
auto const& ni :
nodes_)
74 static boost::regex
const re(
86 for (
auto const& n : nodes.
values())
90 if (!boost::regex_match(n,
match, re))
92 JLOG(
j_.
error()) <<
"Malformed entry: '" << n <<
"'";
101 JLOG(
j_.
error()) <<
"Invalid node identity: " <<
match[1];
107 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)