rippled
|
This class manages a connection to a single ETL source. More...
Public Member Functions | |
bool | isConnected () const |
std::chrono::system_clock::time_point | getLastMsgTime () const |
void | setLastMsgTime () |
ETLSource (std::string ip, std::string wsPort, ReportingETL &etl) | |
Create ETL source without gRPC endpoint Fetch ledger and load initial ledger will fail for this source Primarly used in read-only mode, to monitor when ledgers are validated. More... | |
ETLSource (std::string ip, std::string wsPort, std::string grpcPort, ReportingETL &etl) | |
Create ETL source with gRPC endpoint. More... | |
bool | hasLedger (uint32_t sequence) const |
void | setValidatedRange (std::string const &range) |
process the validated range received on the ledgers stream. More... | |
std::string | getValidatedRange () const |
void | stop () |
Close the underlying websocket. More... | |
std::pair< grpc::Status, org::xrpl::rpc::v1::GetLedgerResponse > | fetchLedger (uint32_t ledgerSequence, bool getObjects=true) |
Fetch the specified ledger. More... | |
std::string | toString () const |
Json::Value | toJson () const |
bool | loadInitialLedger (uint32_t ledgerSequence, ThreadSafeQueue< std::shared_ptr< SLE >> &writeQueue) |
Download a ledger in full. More... | |
void | start () |
Begin sequence of operations to connect to the ETL source and subscribe to ledgers and transactions_proposed. More... | |
void | reconnect (boost::beast::error_code ec) |
Attempt to reconnect to the ETL source. More... | |
void | onResolve (boost::beast::error_code ec, boost::asio::ip::tcp::resolver::results_type results) |
Callback. More... | |
void | onConnect (boost::beast::error_code ec, boost::asio::ip::tcp::resolver::results_type::endpoint_type endpoint) |
Callback. More... | |
void | onHandshake (boost::beast::error_code ec) |
Callback. More... | |
void | onWrite (boost::beast::error_code ec, size_t size) |
Callback. More... | |
void | onRead (boost::beast::error_code ec, size_t size) |
Callback. More... | |
bool | handleMessage () |
Handle the most recently received message. More... | |
void | close (bool startAgain) |
Close the websocket. More... | |
std::unique_ptr< org::xrpl::rpc::v1::XRPLedgerAPIService::Stub > | getP2pForwardingStub () const |
Get grpc stub to forward requests to p2p node. More... | |
Json::Value | forwardToP2p (RPC::JsonContext &context) const |
Forward a JSON RPC request to a p2p node. More... | |
Private Attributes | |
std::string | ip_ |
std::string | wsPort_ |
std::string | grpcPort_ |
ReportingETL & | etl_ |
boost::asio::io_context & | ioc_ |
std::unique_ptr< org::xrpl::rpc::v1::XRPLedgerAPIService::Stub > | stub_ |
std::unique_ptr< boost::beast::websocket::stream< boost::beast::tcp_stream > > | ws_ |
boost::asio::ip::tcp::resolver | resolver_ |
boost::beast::flat_buffer | readBuffer_ |
std::vector< std::pair< uint32_t, uint32_t > > | validatedLedgers_ |
std::string | validatedLedgersRaw_ |
NetworkValidatedLedgers & | networkValidatedLedgers_ |
beast::Journal | journal_ |
Application & | app_ |
std::mutex | mtx_ |
size_t | numFailures_ = 0 |
std::atomic_bool | closing_ = false |
std::atomic_bool | connected_ = false |
std::atomic_bool | forwardingStream_ = false |
std::chrono::system_clock::time_point | lastMsgTime_ |
std::mutex | lastMsgTimeMtx_ |
boost::asio::steady_timer | timer_ |
This class manages a connection to a single ETL source.
This is almost always a p2p node, but really could be another reporting node. This class subscribes to the ledgers and transactions_proposed streams of the associated p2p node, and keeps track of which ledgers the p2p node has. This class also has methods for extracting said ledgers. Lastly this class forwards transactions received on the transactions_proposed streams to any subscribers.
Definition at line 46 of file ETLSource.h.
ripple::ETLSource::ETLSource | ( | std::string | ip, |
std::string | wsPort, | ||
ReportingETL & | etl | ||
) |
Create ETL source without gRPC endpoint Fetch ledger and load initial ledger will fail for this source Primarly used in read-only mode, to monitor when ledgers are validated.
Definition at line 31 of file ETLSource.cpp.
ripple::ETLSource::ETLSource | ( | std::string | ip, |
std::string | wsPort, | ||
std::string | grpcPort, | ||
ReportingETL & | etl | ||
) |
Create ETL source with gRPC endpoint.
Definition at line 47 of file ETLSource.cpp.
bool ripple::ETLSource::isConnected | ( | ) | const |
Definition at line 100 of file ETLSource.h.
std::chrono::system_clock::time_point ripple::ETLSource::getLastMsgTime | ( | ) | const |
Definition at line 106 of file ETLSource.h.
void ripple::ETLSource::setLastMsgTime | ( | ) |
Definition at line 113 of file ETLSource.h.
bool ripple::ETLSource::hasLedger | ( | uint32_t | sequence | ) | const |
sequence | ledger sequence to check for |
Definition at line 134 of file ETLSource.h.
void ripple::ETLSource::setValidatedRange | ( | std::string const & | range | ) |
process the validated range received on the ledgers stream.
set the appropriate member variable
range | validated range received on ledgers stream |
Definition at line 158 of file ETLSource.h.
std::string ripple::ETLSource::getValidatedRange | ( | ) | const |
Definition at line 195 of file ETLSource.h.
void ripple::ETLSource::stop | ( | ) |
Close the underlying websocket.
Definition at line 204 of file ETLSource.h.
std::pair< grpc::Status, org::xrpl::rpc::v1::GetLedgerResponse > ripple::ETLSource::fetchLedger | ( | uint32_t | ledgerSequence, |
bool | getObjects = true |
||
) |
Fetch the specified ledger.
ledgerSequence | sequence of the ledger to fetch @getObjects whether to get the account state diff between this ledger and the prior one |
Definition at line 624 of file ETLSource.cpp.
std::string ripple::ETLSource::toString | ( | ) | const |
Definition at line 222 of file ETLSource.h.
Json::Value ripple::ETLSource::toJson | ( | ) | const |
Definition at line 230 of file ETLSource.h.
bool ripple::ETLSource::loadInitialLedger | ( | uint32_t | ledgerSequence, |
ThreadSafeQueue< std::shared_ptr< SLE >> & | writeQueue | ||
) |
Download a ledger in full.
ledgerSequence | sequence of the ledger to download |
writeQueue | queue to push downloaded ledger objects |
Definition at line 557 of file ETLSource.cpp.
void ripple::ETLSource::start | ( | ) |
Begin sequence of operations to connect to the ETL source and subscribe to ledgers and transactions_proposed.
Definition at line 170 of file ETLSource.cpp.
void ripple::ETLSource::reconnect | ( | boost::beast::error_code | ec | ) |
Attempt to reconnect to the ETL source.
Definition at line 98 of file ETLSource.cpp.
void ripple::ETLSource::onResolve | ( | boost::beast::error_code | ec, |
boost::asio::ip::tcp::resolver::results_type | results | ||
) |
Callback.
Definition at line 182 of file ETLSource.cpp.
void ripple::ETLSource::onConnect | ( | boost::beast::error_code | ec, |
boost::asio::ip::tcp::resolver::results_type::endpoint_type | endpoint | ||
) |
Callback.
Definition at line 203 of file ETLSource.cpp.
void ripple::ETLSource::onHandshake | ( | boost::beast::error_code | ec | ) |
Callback.
Definition at line 245 of file ETLSource.cpp.
void ripple::ETLSource::onWrite | ( | boost::beast::error_code | ec, |
size_t | size | ||
) |
Callback.
Definition at line 279 of file ETLSource.cpp.
void ripple::ETLSource::onRead | ( | boost::beast::error_code | ec, |
size_t | size | ||
) |
Callback.
Definition at line 296 of file ETLSource.cpp.
bool ripple::ETLSource::handleMessage | ( | ) |
Handle the most recently received message.
Definition at line 319 of file ETLSource.cpp.
void ripple::ETLSource::close | ( | bool | startAgain | ) |
Close the websocket.
startAgain | whether to reconnect |
Definition at line 135 of file ETLSource.cpp.
std::unique_ptr< org::xrpl::rpc::v1::XRPLedgerAPIService::Stub > ripple::ETLSource::getP2pForwardingStub | ( | ) | const |
Get grpc stub to forward requests to p2p node.
Definition at line 791 of file ETLSource.cpp.
Json::Value ripple::ETLSource::forwardToP2p | ( | RPC::JsonContext & | context | ) | const |
Forward a JSON RPC request to a p2p node.
context | context of RPC request |
Definition at line 812 of file ETLSource.cpp.
|
private |
Definition at line 48 of file ETLSource.h.
|
private |
Definition at line 50 of file ETLSource.h.
|
private |
Definition at line 52 of file ETLSource.h.
|
private |
Definition at line 54 of file ETLSource.h.
|
private |
Definition at line 57 of file ETLSource.h.
|
private |
Definition at line 59 of file ETLSource.h.
|
private |
Definition at line 62 of file ETLSource.h.
|
private |
Definition at line 63 of file ETLSource.h.
|
private |
Definition at line 65 of file ETLSource.h.
|
private |
Definition at line 67 of file ETLSource.h.
|
private |
Definition at line 69 of file ETLSource.h.
|
private |
Definition at line 71 of file ETLSource.h.
|
private |
Definition at line 73 of file ETLSource.h.
|
private |
Definition at line 75 of file ETLSource.h.
|
mutableprivate |
Definition at line 77 of file ETLSource.h.
|
private |
Definition at line 79 of file ETLSource.h.
|
private |
Definition at line 81 of file ETLSource.h.
|
private |
Definition at line 83 of file ETLSource.h.
|
private |
Definition at line 89 of file ETLSource.h.
|
private |
Definition at line 92 of file ETLSource.h.
|
mutableprivate |
Definition at line 93 of file ETLSource.h.
|
private |
Definition at line 96 of file ETLSource.h.