Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
etl::ETLService Class Reference

This class is responsible for continuously extracting data from a p2p node, and writing that data to the databases. More...

#include <ETLService.hpp>

Inheritance diagram for etl::ETLService:
Collaboration diagram for etl::ETLService:

Public Member Functions

 ETLService (util::config::ClioConfigDefinition const &config, boost::asio::io_context &ioc, std::shared_ptr< BackendInterface > backend, std::shared_ptr< feed::SubscriptionManagerInterface > subscriptions, std::shared_ptr< etlng::LoadBalancerInterface > balancer, std::shared_ptr< NetworkValidatedLedgersInterface > ledgers)
 Create an instance of ETLService.
 
 ETLService (ETLService &&)=delete
 Move constructor is deleted because ETL service shares its fields by reference.
 
 ~ETLService () override
 Stops components and joins worker thread.
 
void stop () override
 Stop the ETL service.
 
std::uint32_t lastCloseAgeSeconds () const override
 Get time passed since last ledger close, in seconds.
 
bool isAmendmentBlocked () const override
 Check for the amendment blocked state.
 
bool isCorruptionDetected () const override
 Check whether Clio detected DB corruptions.
 
boost::json::object getInfo () const override
 Get state of ETL as a JSON object.
 
std::optional< etl::ETLStategetETLState () const noexcept override
 Get the etl nodes' state.
 
void run () override
 Start all components to run ETL service.
 
- Public Member Functions inherited from etlng::ETLServiceInterface

Static Public Member Functions

static std::shared_ptr< etlng::ETLServiceInterfacemakeETLService (util::config::ClioConfigDefinition const &config, boost::asio::io_context &ioc, std::shared_ptr< BackendInterface > backend, std::shared_ptr< feed::SubscriptionManagerInterface > subscriptions, std::shared_ptr< etlng::LoadBalancerInterface > balancer, std::shared_ptr< NetworkValidatedLedgersInterface > ledgers)
 A factory function to spawn new ETLService instances.
 

Detailed Description

This class is responsible for continuously extracting data from a p2p node, and writing that data to the databases.

Usually, multiple different processes share access to the same network accessible databases, in which case only one such process is performing ETL and writing to the database. The other processes simply monitor the database for new ledgers, and publish those ledgers to the various subscription streams. If a monitoring process determines that the ETL writer has failed (no new ledgers written for some time), the process will attempt to become the ETL writer.

If there are multiple monitoring processes that try to become the ETL writer at the same time, one will win out, and the others will fall back to monitoring/publishing. In this sense, this class dynamically transitions from monitoring to writing and from writing to monitoring, based on the activity of other processes running on different machines.

Constructor & Destructor Documentation

◆ ETLService()

etl::ETLService::ETLService ( util::config::ClioConfigDefinition const & config,
boost::asio::io_context & ioc,
std::shared_ptr< BackendInterface > backend,
std::shared_ptr< feed::SubscriptionManagerInterface > subscriptions,
std::shared_ptr< etlng::LoadBalancerInterface > balancer,
std::shared_ptr< NetworkValidatedLedgersInterface > ledgers )

Create an instance of ETLService.

Parameters
configThe configuration to use
iocio context to run on
backendBackendInterface implementation
subscriptionsSubscription manager
balancerLoad balancer to use
ledgersThe network validated ledgers datastructure

Member Function Documentation

◆ getETLState()

std::optional< etl::ETLState > etl::ETLService::getETLState ( ) const
inlineoverridevirtualnoexcept

Get the etl nodes' state.

Returns
The etl nodes' state, nullopt if etl nodes are not connected

Implements etlng::ETLServiceInterface.

◆ getInfo()

boost::json::object etl::ETLService::getInfo ( ) const
inlineoverridevirtual

Get state of ETL as a JSON object.

Returns
The state of ETL as a JSON object

Implements etlng::ETLServiceInterface.

◆ isAmendmentBlocked()

bool etl::ETLService::isAmendmentBlocked ( ) const
inlineoverridevirtual

Check for the amendment blocked state.

Returns
true if currently amendment blocked; false otherwise

Implements etlng::ETLServiceInterface.

◆ isCorruptionDetected()

bool etl::ETLService::isCorruptionDetected ( ) const
inlineoverridevirtual

Check whether Clio detected DB corruptions.

Returns
true if corruption of DB was detected and cache was stopped.

Implements etlng::ETLServiceInterface.

◆ lastCloseAgeSeconds()

std::uint32_t etl::ETLService::lastCloseAgeSeconds ( ) const
inlineoverridevirtual

Get time passed since last ledger close, in seconds.

Returns
Time passed since last ledger close

Implements etlng::ETLServiceInterface.

◆ makeETLService()

static std::shared_ptr< etlng::ETLServiceInterface > etl::ETLService::makeETLService ( util::config::ClioConfigDefinition const & config,
boost::asio::io_context & ioc,
std::shared_ptr< BackendInterface > backend,
std::shared_ptr< feed::SubscriptionManagerInterface > subscriptions,
std::shared_ptr< etlng::LoadBalancerInterface > balancer,
std::shared_ptr< NetworkValidatedLedgersInterface > ledgers )
inlinestatic

A factory function to spawn new ETLService instances.

Creates and runs the ETL service.

Parameters
configThe configuration to use
iocio context to run on
backendBackendInterface implementation
subscriptionsSubscription manager
balancerLoad balancer to use
ledgersThe network validated ledgers datastructure
Returns
A shared pointer to a new instance of ETLService

◆ run()

void etl::ETLService::run ( )
overridevirtual

Start all components to run ETL service.

Implements etlng::ETLServiceInterface.

◆ stop()

void etl::ETLService::stop ( )
inlineoverridevirtual

Stop the ETL service.

Note
This method blocks until the ETL service has stopped.

Implements etlng::ETLServiceInterface.


The documentation for this class was generated from the following files: