Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
etlng::LoadBalancerInterface Class Referenceabstract

An interface for LoadBalancer. More...

#include <LoadBalancerInterface.hpp>

Public Types

using RawLedgerObjectType = org::xrpl::rpc::v1::RawLedgerObject
 
using GetLedgerResponseType = org::xrpl::rpc::v1::GetLedgerResponse
 
using OptionalGetLedgerResponseType = std::optional<GetLedgerResponseType>
 

Public Member Functions

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::ClioErrorforwardToRippled (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::ETLStategetETLState () noexcept=0
 Return state of ETL nodes.
 

Detailed Description

An interface for LoadBalancer.

Member Function Documentation

◆ 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
ledgerSequenceSequence of the ledger to fetch
getObjectsWhether to get the account state diff between this ledger and the prior one
getObjectNeighborsWhether to request object neighbors
retryAfterTime 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
requestJSON-RPC request to forward
clientIpThe IP address of the peer, if known
isAdminWhether the request is from an admin
yieldThe 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
sequenceSequence of ledger to download
loaderInitialLoadObserverInterface implementation
retryAfterTime 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
sequenceSequence of ledger to download
retryAfterTime 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: