|
rippled
|
This class is used to manage connections to transaction processing processes This class spawns a listener for each etl source, which listens to messages on the ledgers stream (to keep track of which ledgers have been validated by the network, and the range of ledgers each etl source has). More...

Public Member Functions | |
| ETLLoadBalancer (ReportingETL &etl) | |
| void | add (std::string &host, std::string &websocketPort, std::string &grpcPort) |
| Add an ETL source. More... | |
| void | add (std::string &host, std::string &websocketPort) |
| Add an ETL source without gRPC support. More... | |
| void | loadInitialLedger (uint32_t sequence, ThreadSafeQueue< std::shared_ptr< SLE >> &writeQueue) |
| Load the initial ledger, writing data to the queue. More... | |
| std::optional< org::xrpl::rpc::v1::GetLedgerResponse > | fetchLedger (uint32_t ledgerSequence, bool getObjects) |
| Fetch data for a specific ledger. More... | |
| void | start () |
| Setup all of the ETL sources and subscribe to the necessary streams. More... | |
| void | stop () |
| bool | shouldPropagateTxnStream (ETLSource *in) const |
| Determine whether messages received on the transactions_proposed stream should be forwarded to subscribing clients. More... | |
| Json::Value | toJson () const |
| std::unique_ptr< org::xrpl::rpc::v1::XRPLedgerAPIService::Stub > | getP2pForwardingStub () const |
| Randomly select a p2p node to forward a gRPC request to. More... | |
| Json::Value | forwardToP2p (RPC::JsonContext &context) const |
| Forward a JSON RPC request to a randomly selected p2p node. More... | |
Private Member Functions | |
| template<class Func > | |
| bool | execute (Func f, uint32_t ledgerSequence) |
| f is a function that takes an ETLSource as an argument and returns a bool. More... | |
Private Attributes | |
| ReportingETL & | etl_ |
| beast::Journal | journal_ |
| std::vector< std::unique_ptr< ETLSource > > | sources_ |
This class is used to manage connections to transaction processing processes This class spawns a listener for each etl source, which listens to messages on the ledgers stream (to keep track of which ledgers have been validated by the network, and the range of ledgers each etl source has).
This class also allows requests for ledger data to be load balanced across all possible etl sources.
Definition at line 315 of file ETLSource.h.
| ripple::ETLLoadBalancer::ETLLoadBalancer | ( | ReportingETL & | etl | ) |
Definition at line 616 of file ETLSource.cpp.
| void ripple::ETLLoadBalancer::add | ( | std::string & | host, |
| std::string & | websocketPort, | ||
| std::string & | grpcPort | ||
| ) |
Add an ETL source.
| host | host or ip of ETL source |
| websocketPort | port where ETL source accepts websocket connections |
| grpcPort | port where ETL source accepts gRPC requests |
Definition at line 623 of file ETLSource.cpp.
| void ripple::ETLLoadBalancer::add | ( | std::string & | host, |
| std::string & | websocketPort | ||
| ) |
Add an ETL source without gRPC support.
This source will send messages on the ledgers and transactions_proposed streams, but will not be able to handle the gRPC requests that are used for ETL
| host | host or ip of ETL source |
| websocketPort | port where ETL source accepts websocket connections |
Definition at line 636 of file ETLSource.cpp.
| void ripple::ETLLoadBalancer::loadInitialLedger | ( | uint32_t | sequence, |
| ThreadSafeQueue< std::shared_ptr< SLE >> & | writeQueue | ||
| ) |
Load the initial ledger, writing data to the queue.
| sequence | sequence of ledger to download |
| writeQueue | queue to push downloaded data to |
Definition at line 646 of file ETLSource.cpp.
| std::optional< org::xrpl::rpc::v1::GetLedgerResponse > ripple::ETLLoadBalancer::fetchLedger | ( | uint32_t | ledgerSequence, |
| bool | getObjects | ||
| ) |
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.
| ledgerSequence | sequence of ledger to fetch data for |
| getObjects | if true, fetch diff between specified ledger and previous |
Definition at line 665 of file ETLSource.cpp.
| void ripple::ETLLoadBalancer::start | ( | ) |
Setup all of the ETL sources and subscribe to the necessary streams.
Definition at line 924 of file ETLSource.cpp.
| void ripple::ETLLoadBalancer::stop | ( | ) |
Definition at line 931 of file ETLSource.cpp.
| bool ripple::ETLLoadBalancer::shouldPropagateTxnStream | ( | ETLSource * | in | ) | const |
Determine whether messages received on the transactions_proposed stream should be forwarded to subscribing clients.
The server subscribes to transactions_proposed on multiple ETLSources, yet only forwards messages from one source at any given time (to avoid sending duplicate messages to clients).
| in | ETLSource in question |
Definition at line 377 of file ETLSource.h.
| Json::Value ripple::ETLLoadBalancer::toJson | ( | ) | const |
Definition at line 397 of file ETLSource.h.
| std::unique_ptr< org::xrpl::rpc::v1::XRPLedgerAPIService::Stub > ripple::ETLLoadBalancer::getP2pForwardingStub | ( | ) | const |
Randomly select a p2p node to forward a gRPC request to.
Definition at line 699 of file ETLSource.cpp.
| Json::Value ripple::ETLLoadBalancer::forwardToP2p | ( | RPC::JsonContext & | context | ) | const |
Forward a JSON RPC request to a randomly selected p2p node.
| context | context of the request |
Definition at line 721 of file ETLSource.cpp.
|
private |
f is a function that takes an ETLSource as an argument and returns a bool.
Attempt to execute f for one randomly chosen ETLSource that has the specified ledger. If f returns false, another randomly chosen ETLSource is used. The process repeats until f returns true.
| f | function to execute. This function takes the ETL source as an argument, and returns a bool. |
| ledgerSequence | f is executed for each ETLSource that has this ledger |
Definition at line 853 of file ETLSource.cpp.
|
private |
Definition at line 318 of file ETLSource.h.
|
private |
Definition at line 320 of file ETLSource.h.
|
private |
Definition at line 322 of file ETLSource.h.
1.8.17