4#include "etl/ETLState.hpp"
5#include "etl/InitialLoadObserverInterface.hpp"
8#include <boost/asio/spawn.hpp>
9#include <boost/json/object.hpp>
10#include <boost/json/value.hpp>
11#include <org/xrpl/rpc/v1/ledger.pb.h>
12#include <xrpl/proto/org/xrpl/rpc/v1/get_ledger.pb.h>
42 using RawLedgerObjectType = org::xrpl::rpc::v1::RawLedgerObject;
43 using GetLedgerResponseType = org::xrpl::rpc::v1::GetLedgerResponse;
44 using OptionalGetLedgerResponseType = std::optional<GetLedgerResponseType>;
63 std::chrono::steady_clock::duration retryAfter = std::chrono::seconds{2}
79 [[nodiscard]]
virtual OptionalGetLedgerResponseType
81 uint32_t ledgerSequence,
83 bool getObjectNeighbors,
84 std::chrono::steady_clock::duration retryAfter = std::chrono::seconds{2}
92 [[nodiscard]]
virtual boost::json::value
104 [[nodiscard]]
virtual std::expected<boost::json::object, rpc::CombinedError>
106 boost::json::object
const& request,
107 std::optional<std::string>
const& clientIp,
109 boost::asio::yield_context yield
116 [[nodiscard]]
virtual std::optional<ETLState>
126 stop(boost::asio::yield_context yield) = 0;
InitialLedgerLoadError
Represents possible errors for initial ledger load.
Definition LoadBalancerInterface.hpp:26
std::expected< std::vector< std::string >, InitialLedgerLoadError > InitialLedgerLoadResult
The result type of the initial ledger load.
Definition LoadBalancerInterface.hpp:35
An interface for LoadBalancer.
Definition LoadBalancerInterface.hpp:40
virtual std::optional< ETLState > getETLState() noexcept=0
Return state of ETL nodes.
virtual InitialLedgerLoadResult loadInitialLedger(uint32_t sequence, InitialLoadObserverInterface &loader, std::chrono::steady_clock::duration retryAfter=std::chrono::seconds{2})=0
Load the initial ledger, writing data to the queue.
virtual OptionalGetLedgerResponseType fetchLedger(uint32_t ledgerSequence, bool getObjects, bool getObjectNeighbors, std::chrono::steady_clock::duration retryAfter=std::chrono::seconds{2})=0
Fetch data for a specific ledger.
virtual boost::json::value toJson() const =0
Represent the state of this load balancer as a JSON object.
virtual std::expected< boost::json::object, rpc::CombinedError > forwardToRippled(boost::json::object const &request, std::optional< std::string > const &clientIp, bool isAdmin, boost::asio::yield_context yield)=0
Forward a JSON RPC request to a randomly selected rippled node.
virtual void stop(boost::asio::yield_context yield)=0
Stop the load balancer. This will stop all subscription sources.
The interface for observing the initial ledger load.
Definition InitialLoadObserverInterface.hpp:17