Disable cache on missing data (#1368)

For #1354
This commit is contained in:
Alex Kremer
2024-04-24 18:57:32 +01:00
committed by GitHub
parent 82b8316978
commit c00342c792
18 changed files with 405 additions and 70 deletions

View File

@@ -22,6 +22,7 @@
#include "data/DBHelpers.hpp"
#include "data/LedgerCache.hpp"
#include "data/Types.hpp"
#include "etl/CorruptionDetector.hpp"
#include "util/log/Logger.hpp"
#include <boost/asio/executor_work_guard.hpp>
@@ -44,6 +45,7 @@
#include <string>
#include <thread>
#include <type_traits>
#include <utility>
#include <vector>
namespace data {
@@ -138,6 +140,7 @@ protected:
mutable std::shared_mutex rngMtx_;
std::optional<LedgerRange> range;
LedgerCache cache_;
std::optional<etl::CorruptionDetector<LedgerCache>> corruptionDetector_;
public:
BackendInterface() = default;
@@ -162,6 +165,17 @@ public:
return cache_;
}
/**
* @brief Sets the corruption detector.
*
* @param detector The corruption detector to set
*/
void
setCorruptionDetector(etl::CorruptionDetector<LedgerCache> detector)
{
corruptionDetector_ = std::move(detector);
}
/**
* @brief Fetches a specific ledger by sequence number.
*
@@ -435,7 +449,7 @@ public:
std::uint32_t limit,
bool outOfOrder,
boost::asio::yield_context yield
) const;
);
/**
* @brief Fetches the successor object.