mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-30 08:35:52 +00:00
@@ -90,7 +90,7 @@ BackendInterface::fetchLedgerObject(
|
||||
auto obj = cache_.get(key, sequence);
|
||||
if (obj) {
|
||||
LOG(gLog.trace()) << "Cache hit - " << ripple::strHex(key);
|
||||
return *obj;
|
||||
return obj;
|
||||
}
|
||||
|
||||
LOG(gLog.trace()) << "Cache miss - " << ripple::strHex(key);
|
||||
@@ -302,10 +302,17 @@ BackendInterface::fetchLedgerPage(
|
||||
|
||||
std::vector<ripple::uint256> keys;
|
||||
bool reachedEnd = false;
|
||||
|
||||
while (keys.size() < limit && !reachedEnd) {
|
||||
ripple::uint256 const& curCursor = !keys.empty() ? keys.back() : (cursor ? *cursor : firstKey);
|
||||
ripple::uint256 const& curCursor = [&]() {
|
||||
if (!keys.empty())
|
||||
return keys.back();
|
||||
return (cursor ? *cursor : firstKey);
|
||||
}();
|
||||
|
||||
std::uint32_t const seq = outOfOrder ? range->maxSequence : ledgerSequence;
|
||||
auto succ = fetchSuccessorKey(curCursor, seq, yield);
|
||||
|
||||
if (!succ) {
|
||||
reachedEnd = true;
|
||||
} else {
|
||||
|
||||
@@ -561,7 +561,7 @@ public:
|
||||
if (auto const res = executor_.read(yield, schema_->selectObject, key, sequence); res) {
|
||||
if (auto const result = res->template get<Blob>(); result) {
|
||||
if (result->size())
|
||||
return *result;
|
||||
return result;
|
||||
} else {
|
||||
LOG(log_.debug()) << "Could not fetch ledger object - no rows";
|
||||
}
|
||||
@@ -597,7 +597,7 @@ public:
|
||||
if (auto const result = res->template get<ripple::uint256>(); result) {
|
||||
if (*result == lastKey)
|
||||
return std::nullopt;
|
||||
return *result;
|
||||
return result;
|
||||
}
|
||||
|
||||
LOG(log_.debug()) << "Could not fetch successor - no rows";
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
/**
|
||||
* @return The specified keyspace
|
||||
*/
|
||||
[[nodiscard]] inline std::string
|
||||
[[nodiscard]] std::string
|
||||
getKeyspace() const
|
||||
{
|
||||
return keyspace_;
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
/**
|
||||
* @return The optional table prefix to use in all queries
|
||||
*/
|
||||
[[nodiscard]] inline std::optional<std::string>
|
||||
[[nodiscard]] std::optional<std::string>
|
||||
getTablePrefix() const
|
||||
{
|
||||
return tablePrefix_;
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
/**
|
||||
* @return The replication factor
|
||||
*/
|
||||
[[nodiscard]] inline uint16_t
|
||||
[[nodiscard]] uint16_t
|
||||
getReplicationFactor() const
|
||||
{
|
||||
return replicationFactor_;
|
||||
|
||||
@@ -49,7 +49,7 @@ struct Settings {
|
||||
*/
|
||||
struct ContactPoints {
|
||||
std::string contactPoints = "127.0.0.1"; // defaults to localhost
|
||||
std::optional<uint16_t> port = {};
|
||||
std::optional<uint16_t> port;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -87,16 +87,16 @@ struct Settings {
|
||||
std::size_t writeBatchSize = DEFAULT_BATCH_SIZE;
|
||||
|
||||
/** @brief Size of the IO queue */
|
||||
std::optional<uint32_t> queueSizeIO{};
|
||||
std::optional<uint32_t> queueSizeIO = std::nullopt; // NOLINT(readability-redundant-member-init)
|
||||
|
||||
/** @brief SSL certificate */
|
||||
std::optional<std::string> certificate{}; // ssl context
|
||||
std::optional<std::string> certificate = std::nullopt; // NOLINT(readability-redundant-member-init)
|
||||
|
||||
/** @brief Username/login */
|
||||
std::optional<std::string> username{};
|
||||
std::optional<std::string> username = std::nullopt; // NOLINT(readability-redundant-member-init)
|
||||
|
||||
/** @brief Password to match the `username` */
|
||||
std::optional<std::string> password{};
|
||||
std::optional<std::string> password = std::nullopt; // NOLINT(readability-redundant-member-init)
|
||||
|
||||
/**
|
||||
* @brief Creates a new Settings object as a copy of the current one with overridden contact points.
|
||||
@@ -105,7 +105,7 @@ struct Settings {
|
||||
withContactPoints(std::string_view contactPoints)
|
||||
{
|
||||
auto tmp = *this;
|
||||
tmp.connectionInfo = ContactPoints{std::string{contactPoints}};
|
||||
tmp.connectionInfo = ContactPoints{.contactPoints = std::string{contactPoints}, .port = std::nullopt};
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,8 @@ ETLService::monitor()
|
||||
}
|
||||
} catch (std::runtime_error const& e) {
|
||||
LOG(log_.fatal()) << "Failed to load initial ledger: " << e.what();
|
||||
return amendmentBlockHandler_.onAmendmentBlock();
|
||||
amendmentBlockHandler_.onAmendmentBlock();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ledger) {
|
||||
@@ -152,7 +153,7 @@ ETLService::monitor()
|
||||
ASSERT(rng.has_value(), "Ledger range can't be null");
|
||||
uint32_t nextSequence = rng->maxSequence + 1;
|
||||
|
||||
LOG(log_.debug()) << "Database is populated. " << "Starting monitor loop. sequence = " << nextSequence;
|
||||
LOG(log_.debug()) << "Database is populated. Starting monitor loop. sequence = " << nextSequence;
|
||||
|
||||
while (not isStopping()) {
|
||||
nextSequence = publishNextSequence(nextSequence);
|
||||
@@ -205,7 +206,7 @@ ETLService::monitorReadOnly()
|
||||
|
||||
if (!rng) {
|
||||
if (auto net = networkValidatedLedgers_->getMostRecent()) {
|
||||
return *net;
|
||||
return net;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ LoadBalancer::loadInitialLedger(uint32_t sequence, bool cacheOnly)
|
||||
auto [data, res] = source.loadInitialLedger(sequence, downloadRanges_, cacheOnly);
|
||||
|
||||
if (!res) {
|
||||
LOG(log_.error()) << "Failed to download initial ledger." << " Sequence = " << sequence
|
||||
LOG(log_.error()) << "Failed to download initial ledger. Sequence = " << sequence
|
||||
<< " source = " << source.toString();
|
||||
} else {
|
||||
response = std::move(data);
|
||||
@@ -282,7 +282,7 @@ LoadBalancer::execute(Func f, uint32_t ledgerSequence)
|
||||
numAttempts++;
|
||||
if (numAttempts % sources_.size() == 0) {
|
||||
LOG(log_.info()) << "Ledger sequence " << ledgerSequence
|
||||
<< " is not yet available from any configured sources. " << "Sleeping and trying again";
|
||||
<< " is not yet available from any configured sources. Sleeping and trying again";
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
return CallStatus::ERRORED;
|
||||
}
|
||||
if (!status_.ok()) {
|
||||
LOG(log_.error()) << "AsyncCallData status_ not ok: " << " code = " << status_.error_code()
|
||||
LOG(log_.error()) << "AsyncCallData status_ not ok: code = " << status_.error_code()
|
||||
<< " message = " << status_.error_message();
|
||||
return CallStatus::ERRORED;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ GrpcSource::loadInitialLedger(uint32_t const sequence, uint32_t const numMarkers
|
||||
auto result = ptr->process(stub_, cq, *backend_, abort, cacheOnly);
|
||||
if (result != etl::impl::AsyncCallData::CallStatus::MORE) {
|
||||
++numFinished;
|
||||
LOG(log_.debug()) << "Finished a marker. " << "Current number of finished = " << numFinished;
|
||||
LOG(log_.debug()) << "Finished a marker. Current number of finished = " << numFinished;
|
||||
|
||||
if (auto lastKey = ptr->getLastKey(); !lastKey.empty())
|
||||
edgeKeys.push_back(std::move(lastKey));
|
||||
|
||||
@@ -158,7 +158,7 @@ private:
|
||||
auto const end = std::chrono::system_clock::now();
|
||||
auto const duration = ((end - start).count()) / 1000000000.0;
|
||||
|
||||
LOG(log_.info()) << "Load phase of etl : " << "Successfully wrote ledger! Ledger info: "
|
||||
LOG(log_.info()) << "Load phase of ETL. Successfully wrote ledger! Ledger info: "
|
||||
<< util::toString(lgrInfo) << ". txn count = " << numTxns
|
||||
<< ". object count = " << numObjects << ". load time = " << duration
|
||||
<< ". load txns per second = " << numTxns / duration
|
||||
|
||||
@@ -85,8 +85,8 @@ public:
|
||||
|
||||
private:
|
||||
class HandlerImpl final {
|
||||
std::map<std::string, BookChange> tally_ = {};
|
||||
std::optional<uint32_t> offerCancel_ = {};
|
||||
std::map<std::string, BookChange> tally_;
|
||||
std::optional<uint32_t> offerCancel_;
|
||||
|
||||
public:
|
||||
[[nodiscard]] std::vector<BookChange>
|
||||
@@ -154,7 +154,11 @@ private:
|
||||
auto const g = to_string(deltaGets.issue());
|
||||
auto const p = to_string(deltaPays.issue());
|
||||
|
||||
auto const noswap = isXRP(deltaGets) ? true : (isXRP(deltaPays) ? false : (g < p));
|
||||
auto const noswap = [&]() {
|
||||
if (isXRP(deltaGets))
|
||||
return true;
|
||||
return isXRP(deltaPays) ? false : (g < p);
|
||||
}();
|
||||
|
||||
auto first = noswap ? deltaGets : deltaPays;
|
||||
auto second = noswap ? deltaPays : deltaGets;
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <boost/json/object.hpp>
|
||||
#include <boost/json/value.hpp>
|
||||
#include <boost/json/value_to.hpp>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
|
||||
#include <expected>
|
||||
#include <functional>
|
||||
|
||||
@@ -196,10 +196,7 @@ accountFromStringStrict(std::string const& account)
|
||||
result = ripple::parseBase58<ripple::AccountID>(account);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
return result.value();
|
||||
}
|
||||
return {};
|
||||
return result;
|
||||
}
|
||||
|
||||
std::pair<std::shared_ptr<ripple::STTx const>, std::shared_ptr<ripple::STObject const>>
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
|
||||
#include <boost/json/value.hpp>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
|
||||
#include <string_view>
|
||||
|
||||
|
||||
@@ -120,10 +120,10 @@ struct VoidOutput {};
|
||||
*/
|
||||
struct Context {
|
||||
boost::asio::yield_context yield;
|
||||
std::shared_ptr<web::ConnectionBase> session = {};
|
||||
std::shared_ptr<web::ConnectionBase> session = {}; // NOLINT(readability-redundant-member-init)
|
||||
bool isAdmin = false;
|
||||
std::string clientIp = {};
|
||||
uint32_t apiVersion = 0u; // invalid by default
|
||||
std::string clientIp = {}; // NOLINT(readability-redundant-member-init)
|
||||
uint32_t apiVersion = 0u; // invalid by default
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <fmt/core.h>
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
#include <ripple/protocol/tokens.h>
|
||||
|
||||
|
||||
@@ -77,19 +77,19 @@ public:
|
||||
std::expected<uint32_t, std::string>
|
||||
parse(boost::json::object const& request) const override;
|
||||
|
||||
inline uint32_t
|
||||
uint32_t
|
||||
getDefaultVersion() const
|
||||
{
|
||||
return defaultVersion_;
|
||||
}
|
||||
|
||||
inline uint32_t
|
||||
uint32_t
|
||||
getMinVersion() const
|
||||
{
|
||||
return minVersion_;
|
||||
}
|
||||
|
||||
inline uint32_t
|
||||
uint32_t
|
||||
getMaxVersion() const
|
||||
{
|
||||
return maxVersion_;
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/AMMCore.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/Issue.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
@@ -67,16 +66,16 @@ AccountChannelsHandler::addChannel(std::vector<ChannelResponse>& jsonChannels, r
|
||||
}
|
||||
|
||||
if (auto const& v = channelSle[~ripple::sfExpiration])
|
||||
channel.expiration = *v;
|
||||
channel.expiration = v;
|
||||
|
||||
if (auto const& v = channelSle[~ripple::sfCancelAfter])
|
||||
channel.cancelAfter = *v;
|
||||
channel.cancelAfter = v;
|
||||
|
||||
if (auto const& v = channelSle[~ripple::sfSourceTag])
|
||||
channel.sourceTag = *v;
|
||||
channel.sourceTag = v;
|
||||
|
||||
if (auto const& v = channelSle[~ripple::sfDestinationTag])
|
||||
channel.destinationTag = *v;
|
||||
channel.destinationTag = v;
|
||||
|
||||
jsonChannels.push_back(channel);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <boost/json/value.hpp>
|
||||
#include <boost/json/value_to.hpp>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <boost/json/value_to.hpp>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/Keylet.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <boost/json/value.hpp>
|
||||
#include <boost/json/value_to.hpp>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <boost/json/value_to.hpp>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include <ripple/basics/chrono.h>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <boost/json/value.hpp>
|
||||
#include <boost/json/value_to.hpp>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/beast/utility/Zero.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <boost/json/value_to.hpp>
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
#include <ripple/protocol/STLedgerEntry.h>
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/json/json_value.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/Issue.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/basics/chrono.h>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <ripple/protocol/nft.h>
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <boost/json/value_to.hpp>
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/Keylet.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
@@ -103,7 +102,7 @@ NFTOffersHandlerBase::iterateOfferDirectory(
|
||||
if (not sharedPtrBackend_->fetchLedgerObject(directory.key, lgrInfo.seq, yield))
|
||||
return Error{Status{RippledError::rpcOBJECT_NOT_FOUND, "notFound"}};
|
||||
|
||||
auto output = Output{input.nftID};
|
||||
auto output = Output{.nftID = input.nftID, .offers = {}, .limit = {}, .marker = {}};
|
||||
auto offers = std::vector<ripple::SLE>{};
|
||||
auto reserve = input.limit;
|
||||
auto cursor = uint256{};
|
||||
|
||||
@@ -57,13 +57,13 @@ public:
|
||||
* @brief A struct to hold the output data of the command
|
||||
*/
|
||||
struct Output {
|
||||
std::string nftID = {};
|
||||
std::vector<ripple::SLE> offers = {};
|
||||
std::string nftID;
|
||||
std::vector<ripple::SLE> offers;
|
||||
|
||||
// validated should be sent via framework
|
||||
bool validated = true;
|
||||
std::optional<uint32_t> limit = {};
|
||||
std::optional<std::string> marker = {};
|
||||
std::optional<uint32_t> limit;
|
||||
std::optional<std::string> marker;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <fmt/core.h>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
|
||||
@@ -90,10 +90,10 @@ public:
|
||||
* @brief A struct to hold the admin section of the output
|
||||
*/
|
||||
struct AdminSection {
|
||||
boost::json::object counters = {};
|
||||
std::optional<boost::json::object> backendCounters = {};
|
||||
boost::json::object subscriptions = {};
|
||||
boost::json::object etl = {};
|
||||
boost::json::object counters;
|
||||
std::optional<boost::json::object> backendCounters;
|
||||
boost::json::object subscriptions;
|
||||
boost::json::object etl;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
*/
|
||||
struct ValidatedLedgerSection {
|
||||
uint32_t age = 0;
|
||||
std::string hash = {};
|
||||
std::string hash;
|
||||
ripple::LedgerIndex seq = {};
|
||||
std::optional<ripple::Fees> fees = std::nullopt;
|
||||
};
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
*/
|
||||
struct InfoSection {
|
||||
std::optional<AdminSection> adminSection = std::nullopt;
|
||||
std::string completeLedgers = {};
|
||||
std::string completeLedgers;
|
||||
uint32_t loadFactor = 1u;
|
||||
std::chrono::time_point<std::chrono::system_clock> time = std::chrono::system_clock::now();
|
||||
std::chrono::seconds uptime = {};
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/basics/chrono.h>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
|
||||
|
||||
@@ -66,14 +66,16 @@ public:
|
||||
*/
|
||||
struct Output {
|
||||
uint32_t date = 0u;
|
||||
std::string hash{};
|
||||
std::string hash = {}; // NOLINT(readability-redundant-member-init)
|
||||
uint32_t ledgerIndex = 0u;
|
||||
std::optional<boost::json::object> meta{};
|
||||
std::optional<boost::json::object> tx{};
|
||||
std::optional<std::string> metaStr{};
|
||||
std::optional<std::string> txStr{};
|
||||
std::optional<std::string> ctid{}; // ctid when binary=true
|
||||
std::optional<ripple::LedgerHeader> ledgerHeader{}; // ledger hash when apiVersion >= 2
|
||||
std::optional<boost::json::object> meta = std::nullopt; // NOLINT(readability-redundant-member-init)
|
||||
std::optional<boost::json::object> tx = std::nullopt; // NOLINT(readability-redundant-member-init)
|
||||
std::optional<std::string> metaStr = std::nullopt; // NOLINT(readability-redundant-member-init)
|
||||
std::optional<std::string> txStr = std::nullopt; // NOLINT(readability-redundant-member-init)
|
||||
std::optional<std::string> ctid =
|
||||
std::nullopt; // NOLINT(readability-redundant-member-init) ctid when binary=true
|
||||
std::optional<ripple::LedgerHeader> ledgerHeader =
|
||||
std::nullopt; // NOLINT(readability-redundant-member-init) ledger hash when apiVersion >= 2
|
||||
uint32_t apiVersion = 0u;
|
||||
bool validated = true;
|
||||
};
|
||||
|
||||
@@ -42,7 +42,7 @@ inline constexpr struct AssociatedExecutorExtractor {
|
||||
} extractAssociatedExecutor;
|
||||
|
||||
template <typename CtxType>
|
||||
[[nodiscard]] inline constexpr auto
|
||||
[[nodiscard]] constexpr auto
|
||||
getTimeoutHandleIfNeeded(CtxType& ctx, SomeOptStdDuration auto timeout, SomeStopSource auto& stopSource)
|
||||
{
|
||||
using TimerType = typename CtxType::Timer;
|
||||
@@ -57,7 +57,7 @@ getTimeoutHandleIfNeeded(CtxType& ctx, SomeOptStdDuration auto timeout, SomeStop
|
||||
}
|
||||
|
||||
template <SomeStopSource StopSourceType>
|
||||
[[nodiscard]] inline constexpr auto
|
||||
[[nodiscard]] constexpr auto
|
||||
outcomeForHandler(auto&& fn)
|
||||
{
|
||||
if constexpr (SomeHandlerWith<decltype(fn), typename StopSourceType::Token>) {
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "util/prometheus/Histogram.hpp"
|
||||
#include "util/prometheus/MetricBase.hpp"
|
||||
|
||||
#include <concepts>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "util/prometheus/MetricBuilder.hpp"
|
||||
#include "util/prometheus/OStream.hpp"
|
||||
|
||||
#include <concepts>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "util/prometheus/MetricsFamily.hpp"
|
||||
#include "util/prometheus/OStream.hpp"
|
||||
|
||||
#include <concepts>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
@@ -151,7 +151,9 @@ private:
|
||||
if (!range) {
|
||||
// for error that happened before the handler, we don't attach any warnings
|
||||
rpcEngine_->notifyNotReady();
|
||||
return web::impl::ErrorHelper(connection, std::move(request)).sendNotReadyError();
|
||||
web::impl::ErrorHelper(connection, std::move(request)).sendNotReadyError();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
auto const context = [&] {
|
||||
@@ -185,7 +187,9 @@ private:
|
||||
// we count all those as BadSyntax - as the WS path would.
|
||||
// Although over HTTP these will yield a 400 status with a plain text response (for most).
|
||||
rpcEngine_->notifyBadSyntax();
|
||||
return web::impl::ErrorHelper(connection, std::move(request)).sendError(err);
|
||||
web::impl::ErrorHelper(connection, std::move(request)).sendError(err);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
auto [result, timeDiff] = util::timed([&]() { return rpcEngine_->buildResponse(*context); });
|
||||
@@ -262,7 +266,9 @@ private:
|
||||
LOG(log_.error()) << connection->tag() << "Caught exception: " << ex.what();
|
||||
|
||||
rpcEngine_->notifyInternalError();
|
||||
return web::impl::ErrorHelper(connection, std::move(request)).sendInternalError();
|
||||
web::impl::ErrorHelper(connection, std::move(request)).sendInternalError();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
* @param ec The error code
|
||||
* @param message The message to include in the log
|
||||
*/
|
||||
inline void
|
||||
void
|
||||
fail(boost::system::error_code ec, char const* message)
|
||||
{
|
||||
if (ec == boost::asio::ssl::error::stream_truncated)
|
||||
@@ -285,8 +285,7 @@ private:
|
||||
onAccept(boost::beast::error_code ec, tcp::socket socket)
|
||||
{
|
||||
if (!ec) {
|
||||
auto ctxRef =
|
||||
ctx_ ? std::optional<std::reference_wrapper<boost::asio::ssl::context>>{ctx_.value()} : std::nullopt;
|
||||
auto ctxRef = ctx_ ? std::optional<std::reference_wrapper<boost::asio::ssl::context>>{ctx_} : std::nullopt;
|
||||
|
||||
std::make_shared<Detector<PlainSessionType, SslSessionType, HandlerType>>(
|
||||
std::move(socket), ctxRef, std::cref(tagFactory_), dosGuard_, handler_, adminVerification_
|
||||
|
||||
@@ -119,7 +119,7 @@ protected:
|
||||
util::Logger log_{"WebServer"};
|
||||
util::Logger perfLog_{"Performance"};
|
||||
|
||||
inline void
|
||||
void
|
||||
httpFail(boost::beast::error_code ec, char const* what)
|
||||
{
|
||||
// ssl::error::stream_truncated, also known as an SSL "short read",
|
||||
|
||||
Reference in New Issue
Block a user