feat: ETLng loader basics (#1808)

For #1597
This commit is contained in:
Alex Kremer
2025-01-09 14:47:08 +00:00
committed by GitHub
parent 36a9f40a60
commit 48c8d85d0c
31 changed files with 1093 additions and 36 deletions

View File

@@ -19,6 +19,9 @@
#pragma once
#include "etl/ETLState.hpp"
#include "etlng/InitialLoadObserverInterface.hpp"
#include "etlng/LoadBalancerInterface.hpp"
#include "rpc/Errors.hpp"
#include "util/FakeFetchResponse.hpp"
@@ -28,10 +31,12 @@
#include <boost/json/value.hpp>
#include <gmock/gmock.h>
#include <chrono>
#include <cstdint>
#include <expected>
#include <optional>
#include <string>
#include <vector>
struct MockLoadBalancer {
using RawLedgerObjectType = FakeLedgerObject;
@@ -48,3 +53,36 @@ struct MockLoadBalancer {
(const)
);
};
struct MockNgLoadBalancer : etlng::LoadBalancerInterface {
using RawLedgerObjectType = FakeLedgerObject;
MOCK_METHOD(
std::vector<std::string>,
loadInitialLedger,
(uint32_t, etlng::InitialLoadObserverInterface&, std::chrono::steady_clock::duration),
(override)
);
MOCK_METHOD(
std::vector<std::string>,
loadInitialLedger,
(uint32_t, std::chrono::steady_clock::duration),
(override)
);
MOCK_METHOD(
OptionalGetLedgerResponseType,
fetchLedger,
(uint32_t, bool, bool, std::chrono::steady_clock::duration),
(override)
);
MOCK_METHOD(boost::json::value, toJson, (), (const, override));
MOCK_METHOD(std::optional<etl::ETLState>, getETLState, (), (noexcept, override));
using ForwardToRippledReturnType = std::expected<boost::json::object, rpc::ClioError>;
MOCK_METHOD(
ForwardToRippledReturnType,
forwardToRippled,
(boost::json::object const&, std::optional<std::string> const&, bool, boost::asio::yield_context),
(override)
);
};