mirror of
https://github.com/XRPLF/clio.git
synced 2026-04-29 15:37:53 +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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user