Add forwarding cache (#1204)

Fixes #51.
This commit is contained in:
Sergey Kuznetsov
2024-03-05 18:09:29 +00:00
committed by GitHub
parent dc8d1658e3
commit 58a1833cf2
21 changed files with 605 additions and 29 deletions

View File

@@ -23,6 +23,7 @@
#include "etl/ETLHelpers.hpp"
#include "etl/ETLState.hpp"
#include "etl/Source.hpp"
#include "etl/impl/ForwardingCache.hpp"
#include "feed/SubscriptionManager.hpp"
#include "util/config/Config.hpp"
#include "util/log/Logger.hpp"
@@ -72,10 +73,12 @@ private:
static constexpr std::uint32_t DEFAULT_DOWNLOAD_RANGES = 16;
util::Logger log_{"ETL"};
// Forwarding cache must be destroyed after sources because sources have a callnack to invalidate cache
std::optional<impl::ForwardingCache> forwardingCache_;
std::vector<Source> sources_;
std::optional<ETLState> etlState_;
std::uint32_t downloadRanges_ =
DEFAULT_DOWNLOAD_RANGES; /*< The number of markers to use when downloading intial ledger */
DEFAULT_DOWNLOAD_RANGES; /*< The number of markers to use when downloading initial ledger */
std::atomic_bool hasForwardingSource_{false};
public:
@@ -164,7 +167,7 @@ public:
boost::json::object const& request,
std::optional<std::string> const& clientIp,
boost::asio::yield_context yield
) const;
);
/**
* @brief Return state of ETL nodes.