An interface for LoadBalancer.
More...
#include <LoadBalancerInterface.hpp>
|
using | RawLedgerObjectType = org::xrpl::rpc::v1::RawLedgerObject |
|
using | GetLedgerResponseType = org::xrpl::rpc::v1::GetLedgerResponse |
|
using | OptionalGetLedgerResponseType = std::optional<GetLedgerResponseType> |
|
|
virtual std::vector< std::string > | loadInitialLedger (uint32_t sequence, etlng::InitialLoadObserverInterface &loader, std::chrono::steady_clock::duration retryAfter=std::chrono::seconds{2})=0 |
| Load the initial ledger, writing data to the queue.
|
|
virtual std::vector< std::string > | loadInitialLedger (uint32_t sequence, 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::ClioError > | 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 std::optional< etl::ETLState > | getETLState () noexcept=0 |
| Return state of ETL nodes.
|
|
An interface for LoadBalancer.
◆ fetchLedger()
virtual OptionalGetLedgerResponseType etlng::LoadBalancerInterface::fetchLedger |
( |
uint32_t | ledgerSequence, |
|
|
bool | getObjects, |
|
|
bool | getObjectNeighbors, |
|
|
std::chrono::steady_clock::duration | retryAfter = std::chrono::seconds{2} ) |
|
pure virtual |
Fetch data for a specific ledger.
This function will continuously try to fetch data for the specified ledger until the fetch succeeds, the ledger is found in the database, or the server is shutting down.
- Parameters
-
ledgerSequence | Sequence of the ledger to fetch |
getObjects | Whether to get the account state diff between this ledger and the prior one |
getObjectNeighbors | Whether to request object neighbors |
retryAfter | Time to wait between retries (2 seconds by default) |
- Returns
- The extracted data, if extraction was successful. If the ledger was found in the database or the server is shutting down, the optional will be empty
◆ forwardToRippled()
virtual std::expected< boost::json::object, rpc::ClioError > etlng::LoadBalancerInterface::forwardToRippled |
( |
boost::json::object const & | request, |
|
|
std::optional< std::string > const & | clientIp, |
|
|
bool | isAdmin, |
|
|
boost::asio::yield_context | yield ) |
|
pure virtual |
Forward a JSON RPC request to a randomly selected rippled node.
- Parameters
-
request | JSON-RPC request to forward |
clientIp | The IP address of the peer, if known |
isAdmin | Whether the request is from an admin |
yield | The coroutine context |
- Returns
- Response received from rippled node as JSON object on success or error on failure
◆ getETLState()
virtual std::optional< etl::ETLState > etlng::LoadBalancerInterface::getETLState |
( |
| ) |
|
|
pure virtualnoexcept |
Return state of ETL nodes.
- Returns
- ETL state, nullopt if etl nodes not available
◆ loadInitialLedger() [1/2]
virtual std::vector< std::string > etlng::LoadBalancerInterface::loadInitialLedger |
( |
uint32_t | sequence, |
|
|
etlng::InitialLoadObserverInterface & | loader, |
|
|
std::chrono::steady_clock::duration | retryAfter = std::chrono::seconds{2} ) |
|
pure virtual |
Load the initial ledger, writing data to the queue.
- Note
- This function will retry indefinitely until the ledger is downloaded.
- Parameters
-
sequence | Sequence of ledger to download |
loader | InitialLoadObserverInterface implementation |
retryAfter | Time to wait between retries (2 seconds by default) |
- Returns
- A std::vector<std::string> The ledger data
◆ loadInitialLedger() [2/2]
virtual std::vector< std::string > etlng::LoadBalancerInterface::loadInitialLedger |
( |
uint32_t | sequence, |
|
|
std::chrono::steady_clock::duration | retryAfter = std::chrono::seconds{2} ) |
|
pure virtual |
Load the initial ledger, writing data to the queue.
- Note
- This function will retry indefinitely until the ledger is downloaded.
- Parameters
-
sequence | Sequence of ledger to download |
retryAfter | Time to wait between retries (2 seconds by default) |
- Returns
- A std::vector<std::string> The ledger data
◆ toJson()
virtual boost::json::value etlng::LoadBalancerInterface::toJson |
( |
| ) |
const |
|
pure virtual |
Represent the state of this load balancer as a JSON object.
- Returns
- JSON representation of the state of this load balancer.
The documentation for this class was generated from the following file: