refactor: Refactor main (#1555)

For #442.
This commit is contained in:
Sergey Kuznetsov
2024-08-01 10:53:17 +01:00
committed by GitHub
parent fb90fb27ae
commit 2fef03d766
36 changed files with 920 additions and 376 deletions

View File

@@ -20,6 +20,7 @@
#include "rpc/Errors.hpp"
#include "rpc/JS.hpp"
#include "util/OverloadSet.hpp"
#include <boost/json/object.hpp>
#include <xrpl/protocol/ErrorCodes.h>
@@ -36,17 +37,6 @@
using namespace std;
namespace {
template <typename... Ts>
struct overloadSet : Ts... {
using Ts::operator()...;
};
// explicit deduction guide (not needed as of C++20, but clang be clang)
template <typename... Ts>
overloadSet(Ts...) -> overloadSet<Ts...>;
} // namespace
namespace rpc {
WarningInfo const&
@@ -149,7 +139,7 @@ makeError(Status const& status)
auto wrapOptional = [](string_view const& str) { return str.empty() ? nullopt : make_optional(str); };
auto res = visit(
overloadSet{
util::OverloadSet{
[&status, &wrapOptional](RippledError err) {
if (err == ripple::rpcUNKNOWN)
return boost::json::object{{"error", status.message}, {"type", "response"}, {"status", "error"}};

View File

@@ -22,11 +22,11 @@
#include "data/BackendInterface.hpp"
#include "data/DBHelpers.hpp"
#include "feed/SubscriptionManagerInterface.hpp"
#include "main/Build.hpp"
#include "rpc/Errors.hpp"
#include "rpc/JS.hpp"
#include "rpc/common/Specs.hpp"
#include "rpc/common/Types.hpp"
#include "util/build/Build.hpp"
#include <boost/json/conversion.hpp>
#include <boost/json/object.hpp>
@@ -124,7 +124,7 @@ public:
uint32_t loadFactor = 1u;
std::chrono::time_point<std::chrono::system_clock> time = std::chrono::system_clock::now();
std::chrono::seconds uptime = {};
std::string clioVersion = Build::getClioVersionString();
std::string clioVersion = util::build::getClioVersionString();
std::string xrplVersion = ripple::BuildInfo::getVersionString();
std::optional<boost::json::object> rippledInfo = std::nullopt;
ValidatedLedgerSection validatedLedger = {};