1#include <xrpld/overlay/Cluster.h>
3#include <xrpld/overlay/ClusterNode.h>
5#include <xrpl/basics/Log.h>
6#include <xrpl/basics/StringUtilities.h>
7#include <xrpl/basics/chrono.h>
8#include <xrpl/beast/utility/Journal.h>
9#include <xrpl/config/BasicConfig.h>
10#include <xrpl/protocol/PublicKey.h>
11#include <xrpl/protocol/tokens.h>
13#include <boost/regex/v5/regex.hpp>
14#include <boost/regex/v5/regex_match.hpp>
35 auto iter =
nodes_.find(identity);
58 auto iter =
nodes_.find(identity);
62 if (reportTime <= iter->getReportTime())
71 nodes_.emplace_hint(iter, identity, std::move(name), loadFee, reportTime);
79 for (
auto const& ni :
nodes_)
86 static boost::regex
const kRE(
98 for (
auto const& n : nodes.
values())
102 if (!boost::regex_match(n, match, kRE))
104 JLOG(
j_.error()) <<
"Malformed entry: '" << n <<
"'";
112 JLOG(
j_.error()) <<
"Invalid node identity: " << match[1];
118 JLOG(
j_.warn()) <<
"Duplicate node identity: " << match[1];
A generic endpoint for log messages.
Cluster(beast::Journal j)
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.
void forEach(std::function< void(ClusterNode const &)> func) const
Invokes the callback once for every cluster node.
std::optional< std::string > member(PublicKey const &node) const
Determines whether a node belongs in the cluster.
std::set< ClusterNode, Comparator > nodes_
bool load(Section const &nodes)
Load the list of cluster nodes.
std::size_t size() const
The number of nodes in the cluster list.
std::chrono::time_point< NetClock > time_point
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::optional< AccountID > parseBase58(std::string const &s)
Parse AccountID from checked, base58 string.
std::string trimWhitespace(std::string str)