20 #include <ripple/app/consensus/RCLValidations.h>
21 #include <ripple/app/ledger/InboundLedgers.h>
22 #include <ripple/app/ledger/InboundTransactions.h>
23 #include <ripple/app/ledger/LedgerCleaner.h>
24 #include <ripple/app/ledger/LedgerMaster.h>
25 #include <ripple/app/ledger/LedgerReplayer.h>
26 #include <ripple/app/ledger/LedgerToJson.h>
27 #include <ripple/app/ledger/OpenLedger.h>
28 #include <ripple/app/ledger/OrderBookDB.h>
29 #include <ripple/app/ledger/PendingSaves.h>
30 #include <ripple/app/ledger/TransactionMaster.h>
31 #include <ripple/app/main/Application.h>
32 #include <ripple/app/main/BasicApp.h>
33 #include <ripple/app/main/DBInit.h>
34 #include <ripple/app/main/GRPCServer.h>
35 #include <ripple/app/main/LoadManager.h>
36 #include <ripple/app/main/NodeIdentity.h>
37 #include <ripple/app/main/NodeStoreScheduler.h>
38 #include <ripple/app/main/Tuning.h>
39 #include <ripple/app/misc/AmendmentTable.h>
40 #include <ripple/app/misc/HashRouter.h>
41 #include <ripple/app/misc/LoadFeeTrack.h>
42 #include <ripple/app/misc/NetworkOPs.h>
43 #include <ripple/app/misc/SHAMapStore.h>
44 #include <ripple/app/misc/TxQ.h>
45 #include <ripple/app/misc/ValidatorKeys.h>
46 #include <ripple/app/misc/ValidatorSite.h>
47 #include <ripple/app/paths/PathRequests.h>
48 #include <ripple/app/rdb/Wallet.h>
49 #include <ripple/app/rdb/backend/PostgresDatabase.h>
50 #include <ripple/app/reporting/ReportingETL.h>
51 #include <ripple/app/tx/apply.h>
52 #include <ripple/basics/ByteUtilities.h>
53 #include <ripple/basics/PerfLog.h>
54 #include <ripple/basics/ResolverAsio.h>
55 #include <ripple/basics/random.h>
56 #include <ripple/basics/safe_cast.h>
57 #include <ripple/beast/asio/io_latency_probe.h>
58 #include <ripple/beast/core/LexicalCast.h>
59 #include <ripple/core/DatabaseCon.h>
60 #include <ripple/crypto/csprng.h>
61 #include <ripple/json/json_reader.h>
62 #include <ripple/nodestore/DatabaseShard.h>
63 #include <ripple/nodestore/DummyScheduler.h>
64 #include <ripple/overlay/Cluster.h>
65 #include <ripple/overlay/PeerReservationTable.h>
66 #include <ripple/overlay/PeerSet.h>
67 #include <ripple/overlay/make_Overlay.h>
68 #include <ripple/protocol/BuildInfo.h>
69 #include <ripple/protocol/Feature.h>
70 #include <ripple/protocol/Protocol.h>
71 #include <ripple/protocol/STParsedJSON.h>
72 #include <ripple/resource/Fees.h>
73 #include <ripple/rpc/ShardArchiveHandler.h>
74 #include <ripple/rpc/impl/RPCHelpers.h>
75 #include <ripple/shamap/NodeFamily.h>
76 #include <ripple/shamap/ShardFamily.h>
78 #include <boost/algorithm/string/predicate.hpp>
79 #include <boost/asio/steady_timer.hpp>
80 #include <boost/system/error_code.hpp>
82 #include <date/date.h>
114 boost::asio::io_service& ios)
128 template <
class Duration>
133 auto const lastSample = ceil<milliseconds>(elapsed);
137 if (lastSample >= 10ms)
139 if (lastSample >= 500ms)
142 <<
"io_service latency = " << lastSample.count();
251 #if RIPPLE_SINGLE_IO_SERVICE_THREAD
284 std::numeric_limits<
std::uint64_t>::max() - 1))
299 config_->section(SECTION_INSIGHT),
300 logs_->journal(
"Collector")))
327 logs_->journal(
"JobQueue"),
336 logs_->journal(
"SHAMapStore")))
343 logs_->journal(
"TaggedCache"))
350 logs_->journal(
"CachedSLEs"))
356 logs_->journal(
"Resource")))
368 logs_->journal(
"ShardStore")))
374 logs_->journal(
"PathRequest"),
381 logs_->journal(
"LedgerMaster")))
398 gotTXSet(set, fromAcquire);
411 logs_->journal(
"TaggedCache"))
423 logs_->journal(
"NetworkOPs"),
426 ,
cluster_(std::make_unique<Cluster>(
logs_->journal(
"Overlay")))
429 logs_->journal(
"PeerReservationTable")))
432 std::make_unique<ManifestCache>(
logs_->journal(
"ManifestCache")))
435 std::make_unique<ManifestCache>(
logs_->journal(
"ManifestCache")))
441 config_->legacy(
"database_path"),
442 logs_->journal(
"ValidatorList"),
456 std::make_unique<LoadFeeTrack>(
logs_->journal(
"LoadManager")))
466 logs_->journal(
"Validations"))
486 logs_->journal(
"Application"),
491 config_->reporting() ? std::make_unique<ReportingETL>(*
this)
519 setup(boost::program_options::variables_map
const& cmdline)
override;
521 start(
bool withTimers)
override;
605 boost::asio::io_service&
706 if (!handler->init())
709 <<
"Failed to initialize ShardArchiveHandler.";
725 <<
"ShardArchiveHandler already created at startup.";
733 if (!initAndSet(std::move(handler)))
743 if (!initAndSet(std::move(handler)))
862 Throw<ReportingShouldProxy>();
870 Throw<ReportingShouldProxy>();
884 assert(
txQ_.get() !=
nullptr);
929 setup.useGlobalPragma =
false;
936 <<
"Failed to initialize SQL databases: " << e.
what();
948 auto j =
logs_->journal(
"NodeObject");
959 JLOG(j.warn()) <<
"Starting node import from '" << source->getName()
963 auto const start = steady_clock::now();
968 duration_cast<seconds>(steady_clock::now() -
start);
969 JLOG(j.warn()) <<
"Node import from '" << source->getName()
970 <<
"' took " << elapsed.count() <<
" seconds.";
993 [
this](boost::system::error_code
const& e) {
994 if (e.value() == boost::system::errc::success)
997 jtSWEEP,
"sweep", [this]() { doSweep(); });
1000 if (e.value() != boost::system::errc::success &&
1001 e.value() != boost::asio::error::operation_aborted)
1004 JLOG(m_journal.error())
1005 <<
"Sweep timer got error '" << e.message()
1006 <<
"'. Restarting timer.";
1015 sweepTimer_.async_wait(std::move(*optionalCountedHandler));
1024 [
this](boost::system::error_code
const& e) {
1025 if (e.value() == boost::system::errc::success)
1027 crypto_prng().mix_entropy();
1031 if (e.value() != boost::system::errc::success &&
1032 e.value() != boost::asio::error::operation_aborted)
1035 JLOG(m_journal.error())
1036 <<
"Entropy timer got error '" << e.message()
1037 <<
"'. Restarting timer.";
1042 using namespace std::chrono_literals;
1044 entropyTimer_.async_wait(std::move(*optionalCountedHandler));
1076 #ifdef RIPPLED_REPORTING
1132 [
this](boost::system::error_code
const& ec,
int signum) {
1134 if (ec == boost::asio::error::operation_aborted)
1139 if (signum == SIGTERM || signum == SIGINT)
1143 auto debug_log =
config_->getDebugLogFile();
1145 if (!debug_log.empty())
1150 if (!
logs_->open(debug_log))
1151 std::cerr <<
"Can't open log file " << debug_log <<
'\n';
1164 JLOG(
m_journal.
warn()) <<
"Limited to a single I/O service thread by "
1165 "system configuration.";
1197 auto const supported = []() {
1200 supported.reserve(amendments.size());
1201 for (
auto const& [a, vote] : amendments)
1206 supported.emplace_back(a, *f, vote);
1210 Section const& downVoted =
config_->section(SECTION_VETO_AMENDMENTS);
1216 config().AMENDMENT_MAJORITY_TIME,
1220 logs_->journal(
"Amendments"));
1225 auto const startUp =
config_->START_UP;
1247 <<
"The specified ledger could not be loaded.";
1275 if (!
config().reporting())
1282 JLOG(
m_journal.
fatal()) <<
"Invalid entry in cluster configuration.";
1286 if (!
config().reporting())
1294 "ValidatorManifests",
1297 .section(SECTION_VALIDATOR_KEY_REVOCATION)
1301 <<
"Invalid configured validator manifest.";
1310 config().section(SECTION_VALIDATORS).values(),
1311 config().section(SECTION_VALIDATOR_LIST_KEYS).values()))
1314 <<
"Invalid entry in validator configuration.";
1320 config().section(SECTION_VALIDATOR_LIST_SITES).values()))
1323 <<
"Invalid entry in [" << SECTION_VALIDATOR_LIST_SITES <<
"]";
1373 setup.makeContexts();
1380 stream <<
"Unable to setup server handler";
1382 stream <<
": " << e.
what();
1396 <<
"No outbound peer connections will be made";
1412 JLOG(
m_journal.
warn()) <<
"*** The server is configured to allow the "
1413 "'sign' and 'sign_for'";
1414 JLOG(
m_journal.
warn()) <<
"*** commands. These commands have security "
1415 "implications and have";
1416 JLOG(
m_journal.
warn()) <<
"*** been deprecated. They will be removed "
1417 "in a future release of";
1419 JLOG(
m_journal.
warn()) <<
"*** If you do not use them to sign "
1420 "transactions please edit your";
1422 <<
"*** configuration file and remove the [enable_signing] stanza.";
1423 JLOG(
m_journal.
warn()) <<
"*** If you do use them to sign transactions "
1424 "please migrate to a";
1426 <<
"*** standalone signing solution as soon as possible.";
1432 for (
auto cmd :
config_->section(SECTION_RPC_STARTUP).lines())
1437 if (!jrReader.
parse(cmd, jvCommand))
1440 << SECTION_RPC_STARTUP <<
"]: '" << cmd;
1446 <<
"Startup RPC: " << jvCommand <<
std::endl;
1485 shardArchiveHandler = handler;
1490 <<
"Exception when starting ShardArchiveHandler from "
1498 if (shardArchiveHandler && !shardArchiveHandler->
start())
1500 JLOG(
m_journal.
fatal()) <<
"Failed to start ShardArchiveHandler.";
1516 JLOG(
m_journal.
info()) <<
"Application starting. Version is "
1573 boost::system::error_code ec;
1578 <<
"Application: sweepTimer cancel error: " << ec.message();
1586 <<
"Application: entropyTimer cancel error: " << ec.message();
1592 using namespace std::chrono_literals;
1711 std::make_shared<Ledger>(*genesis,
timeKeeper().closeTime());
1712 next->updateSkipList();
1716 next->setImmutable();
1737 ledger->setImmutable();
1740 ledger->setValidated();
1742 if (ledger->info().hash == hash)
1744 JLOG(j.trace()) <<
"Loaded ledger: " << hash;
1748 if (
auto stream = j.error())
1750 stream <<
"Failed on ledger";
1760 JLOG(j.warn()) <<
"Ledger in database: " << mn.
what();
1781 if (!reader.
parse(ledgerFile, jLedger))
1790 if (ledger.
get().isMember(
"result"))
1791 ledger = ledger.
get()[
"result"];
1793 if (ledger.
get().isMember(
"ledger"))
1794 ledger = ledger.
get()[
"ledger"];
1798 using namespace std::chrono_literals;
1799 auto closeTimeResolution = 30s;
1800 bool closeTimeEstimated =
false;
1803 if (ledger.
get().isMember(
"accountState"))
1805 if (ledger.
get().isMember(jss::ledger_index))
1807 seq = ledger.
get()[jss::ledger_index].asUInt();
1810 if (ledger.
get().isMember(
"close_time"))
1813 using d = tp::duration;
1814 closeTime = tp{d{ledger.
get()[
"close_time"].asUInt()}};
1816 if (ledger.
get().isMember(
"close_time_resolution"))
1819 closeTimeResolution =
1820 seconds{ledger.
get()[
"close_time_resolution"].asUInt()};
1822 if (ledger.
get().isMember(
"close_time_estimated"))
1824 closeTimeEstimated =
1825 ledger.
get()[
"close_time_estimated"].asBool();
1827 if (ledger.
get().isMember(
"total_coins"))
1829 totalDrops = beast::lexicalCastThrow<std::uint64_t>(
1830 ledger.
get()[
"total_coins"].asString());
1833 ledger = ledger.
get()[
"accountState"];
1836 if (!ledger.
get().isArrayOrNull())
1844 loadLedger->setTotalDrops(totalDrops);
1846 for (
Json::UInt index = 0; index < ledger.
get().size(); ++index)
1878 if (!loadLedger->addSLE(sle))
1881 <<
"Couldn't add serialized ledger: " << uIndex;
1891 loadLedger->setAccepted(
1892 closeTime, closeTimeResolution, !closeTimeEstimated);
1915 if (!ledgerID.
empty())
1918 else if (ledgerID.
length() == 64)
1929 auto il = std::make_shared<InboundLedger>(
1936 if (il->checkLocal())
1937 loadLedger = il->getLedger();
1941 else if (ledgerID.
empty() || boost::iequals(ledgerID,
"latest"))
1962 replayLedger = loadLedger;
1966 loadLedger =
loadByHash(replayLedger->info().parentHash, *
this);
1970 <<
"Loading parent ledger from node store";
1973 auto il = std::make_shared<InboundLedger>(
1975 replayLedger->info().parentHash,
1981 if (il->checkLocal())
1982 loadLedger = il->getLedger();
1992 using namespace std::chrono_literals;
1993 using namespace date;
1995 sys_days{January / 1 / 2018} - sys_days{January / 1 / 2000}};
1996 if (loadLedger->info().closeTime < ledgerWarnTimePoint)
1999 <<
"\n\n*** WARNING ***\n"
2000 "You are replaying a ledger from before "
2003 "This replay will not handle your ledger as it was "
2005 "handled.\nConsider running an earlier version of rippled "
2007 "get the older rules.\n*** CONTINUING ***\n";
2010 JLOG(
m_journal.
info()) <<
"Loading ledger " << loadLedger->info().hash
2011 <<
" seq:" << loadLedger->info().seq;
2013 if (loadLedger->info().accountHash.isZero())
2020 if (!loadLedger->walkLedger(
journal(
"Ledger"),
true))
2027 if (!loadLedger->assertSensible(
journal(
"Ledger")))
2035 loadLedger->info().seq, loadLedger->info().seq);
2038 loadLedger->setValidated();
2048 std::make_unique<LedgerReplay>(loadLedger, replayLedger);
2050 for (
auto const& [_, tx] : replayData->orderedTxns())
2053 auto txID = tx->getTransactionID();
2055 auto s = std::make_shared<Serializer>();
2073 <<
"While loading specified ledger: " << mn.
what();
2076 catch (boost::bad_lexical_cast&)
2079 <<
"Ledger specified '" << ledgerID <<
"' is not valid";
2089 if (!
config().ELB_SUPPORT)
2094 reason =
"Server is shutting down";
2098 if (
getOPs().isNeedNetworkLedger())
2100 reason =
"Not synchronized with network yet";
2104 if (
getOPs().isAmendmentBlocked())
2106 reason =
"Server version too old";
2110 if (
getOPs().isUNLBlocked())
2112 reason =
"No valid validator list available";
2118 reason =
"Not synchronized with network";
2127 reason =
"Too much load";
2144 assert(!
config_->standalone());
2149 <<
"The [shard_db] configuration setting must be set";
2186 return std::make_unique<ApplicationImp>(
2187 std::move(config), std::move(logs), std::move(timeKeeper));
A NodeStore::Scheduler which uses the JobQueue.
std::string const & name() const
Returns the name of this source.
std::unique_ptr< Resource::Manager > m_resourceManager
TxQ::Setup setup_TxQ(Config const &config)
Build a TxQ::Setup object from application configuration.
ReportingETL & getReportingETL() override
Simple NodeStore Scheduler that just peforms the tasks synchronously.
PublicKey const & getValidationPublicKey() const override
NodeCache m_tempNodeCache
Holds a collection of configuration values.
Provides server functionality for clients.
std::optional< OpenLedger > openLedger_
static std::unique_ptr< RelationalDatabase > init(Application &app, Config const &config, JobQueue &jobQueue)
init Creates and returns an appropriate RelationalDatabase instance based on configuration.
std::unique_ptr< LedgerReplayer > m_ledgerReplayer
std::unique_ptr< NodeStore::DatabaseShard > shardStore_
std::unique_ptr< PeerSet > make_DummyPeerSet(Application &app)
Make a dummy PeerSet that does not do anything.
virtual std::optional< LedgerIndex > getMaxLedgerSeq()=0
getMaxLedgerSeq Returns the maximum ledger sequence in the Ledgers table.
std::unique_ptr< LedgerCleaner > ledgerCleaner_
void activateDeadlockDetector()
Turn on deadlock detection.
std::unique_ptr< InboundTransactions > m_inboundTransactions
std::unique_ptr< DatabaseShard > make_ShardStore(Application &app, Scheduler &scheduler, int readThreads, beast::Journal j)
Family * getShardFamily() override
ValidatorList & validators() override
Persistency layer for NodeObject.
static std::unique_ptr< ShardArchiveHandler > makeShardArchiveHandler(Application &app)
CachedSLEs & cachedSLEs() override
NodeStore::Database & getNodeStore() override
bool start()
Starts downloading and importing archives.
RelationalDatabase & getRelationalDatabase() override
bool serverOkay(std::string &reason) override
std::shared_ptr< Ledger > loadByIndex(std::uint32_t ledgerIndex, Application &app, bool acquire)
std::unique_ptr< RelationalDatabase > mRelationalDatabase
RCLValidations mValidations
Manages partitions for logging.
TaggedCache< uint256, AcceptedLedger > & getAcceptedLedgerCache() override
std::unique_ptr< Overlay > make_Overlay(Application &app, Overlay::Setup const &setup, ServerHandler &serverHandler, Resource::Manager &resourceManager, Resolver &resolver, boost::asio::io_service &io_service, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
Creates the implementation of Overlay.
HashRouter & getHashRouter() override
Stream trace() const
Severity stream access functions.
std::unique_ptr< ValidatorSite > validatorSites_
std::unique_ptr< DatabaseCon > mWalletDB
PathRequests & getPathRequests() override
OrderBookDB m_orderBookDB
std::unique_ptr< LoadManager > make_LoadManager(Application &app, beast::Journal journal)
void onWrite(beast::PropertyStream::Map &stream) override
Subclass override.
InboundLedgers & getInboundLedgers() override
Writable ledger view that accumulates state and tx changes.
DatabaseCon::Setup setup_DatabaseCon(Config const &c, std::optional< beast::Journal > j=std::nullopt)
LedgerReplayer & getLedgerReplayer() override
static std::string shardDatabase()
bool trustedPublisher(PublicKey const &identity) const
Returns true if public key is a trusted publisher.
ClosureCounter< void, boost::system::error_code const & > waitHandlerCounter_
NetworkOPs & getOPs() override
std::unique_ptr< InboundLedgers > make_InboundLedgers(Application &app, InboundLedgers::clock_type &clock, beast::insight::Collector::ptr const &collector)
Provides the beast::insight::Collector service.
static std::string importNodeDatabase()
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
std::atomic< bool > isTimeToStop
TaggedCache< uint256, AcceptedLedger > m_acceptedLedgerCache
class to create database, launch online delete thread, and related SQLite database
ManifestCache & validatorManifests() override
DatabaseCon & getWalletDB() override
Retrieve the "wallet database".
std::tuple< std::shared_ptr< Ledger >, std::uint32_t, uint256 > getLatestLedger(Application &app)
CollectorManager & getCollectorManager() override
boost::asio::steady_timer sweepTimer_
std::unique_ptr< Cluster > cluster_
NodeStore::DatabaseShard * getShardStore() override
OpenLedger const & openLedger() const override
std::chrono::milliseconds getIOLatency() override
std::unique_ptr< SHAMapStore > m_shaMapStore
std::unique_ptr< CollectorManager > make_CollectorManager(Section const ¶ms, beast::Journal journal)
boost::asio::io_service & getIOService() override
std::unique_ptr< RPC::ShardArchiveHandler > shardArchiveHandler_
A namespace for easy access to logging severity values.
Singleton class that maintains performance counters and optionally writes Json-formatted data to a di...
Holds the serialized result of parsing an input JSON object.
Keeps track of which ledgers haven't been fully saved.
const Charge feeReferenceRPC
std::unique_ptr< LedgerCleaner > make_LedgerCleaner(Application &app, beast::Journal journal)
static void initPathTable()
ApplicationImp(std::unique_ptr< Config > config, std::unique_ptr< Logs > logs, std::unique_ptr< TimeKeeper > timeKeeper)
Cluster & cluster() override
Stopwatch & stopwatch()
Returns an instance of a wall clock.
std::unique_ptr< NetworkOPs > make_NetworkOPs(Application &app, NetworkOPs::clock_type &clock, bool standalone, std::size_t minPeerCount, bool startvalid, JobQueue &job_queue, LedgerMaster &ledgerMaster, ValidatorKeys const &validatorKeys, boost::asio::io_service &io_svc, beast::Journal journal, beast::insight::Collector::ptr const &collector)
std::unique_ptr< InboundTransactions > make_InboundTransactions(Application &app, beast::insight::Collector::ptr const &collector, std::function< void(std::shared_ptr< SHAMap > const &, bool)> gotSet)
LedgerMaster & getLedgerMaster() override
Unserialize a JSON document into a Value.
std::uint64_t instanceID() const override
Returns a 64-bit instance identifier, generated at startup.
std::optional< STObject > object
The STObject if the parse was successful.
static std::unique_ptr< ResolverAsio > New(boost::asio::io_service &, beast::Journal)
std::unique_ptr< NodeStore::Database > m_nodeStore
bool initRelationalDatabase()
static constexpr std::uint32_t XRP_LEDGER_EARLIEST_FEES
The XRP Ledger mainnet's earliest ledger with a FeeSettings object.
std::unique_ptr< perf::PerfLog > perfLog_
std::pair< PublicKey, SecretKey > nodeIdentity_
Validator keys and manifest as set in configuration file.
Routing table for objects identified by hash.
void forceValidity(HashRouter &router, uint256 const &txid, Validity validity)
Sets the validity of a given transaction in the cache.
const ValidatorKeys validatorKeys_
std::unique_ptr< TimeKeeper > timeKeeper_
@ SYNCING
fallen slightly behind
const std::uint64_t instanceCookie_
@ SigGoodOnly
Signature is good, but local checks fail.
RPC::ShardArchiveHandler * getShardArchiveHandler(bool tryRecovery) override
std::unique_ptr< InboundLedgers > m_inboundLedgers
std::unique_ptr< PeerReservationTable > peerReservations_
ServerHandler::Setup setup_ServerHandler(Config const &config, std::ostream &&log)
std::shared_ptr< Ledger > loadLedgerFromFile(std::string const &ledgerID)
bool checkSigs() const override
beast::Journal journal(std::string const &name) override
boost::asio::steady_timer entropyTimer_
LedgerIndex getMaxDisallowedLedger() override
Ensure that a newly-started validator does not sign proposals older than the last ledger it persisted...
std::unique_ptr< HashRouter > hashRouter_
Application::MutexType & getMasterMutex() override
std::unique_ptr< LedgerMaster > m_ledgerMaster
Status doCommand(RPC::JsonContext &context, Json::Value &result)
Execute an RPC command and store the results in a Json::Value.
Overlay::Setup setup_Overlay(BasicConfig const &config)
perf::PerfLog & getPerfLog() override
std::unique_ptr< JobQueue > m_jobQueue
std::atomic< bool > checkSigs_
std::unique_ptr< ServerHandler > make_ServerHandler(Application &app, boost::asio::io_service &io_service, JobQueue &jobQueue, NetworkOPs &networkOPs, Resource::Manager &resourceManager, CollectorManager &cm)
std::enable_if_t< std::is_integral< Integral >::value &&detail::is_engine< Engine >::value, Integral > rand_int(Engine &engine, Integral min, Integral max)
Return a uniformly distributed random integer.
std::shared_ptr< Ledger > loadByHash(uint256 const &ledgerHash, Application &app, bool acquire)
static std::size_t numberOfThreads(Config const &config)
SHAMapStore & getSHAMapStore() override
void add(Source &source)
Add a child source.
AmendmentTable & getAmendmentTable() override
bool loadOldLedger(std::string const &ledgerID, bool replay, bool isFilename)
std::size_t size() const noexcept
T hardware_concurrency(T... args)
Resource::Manager & getResourceManager() override
PeerReservationTable & peerReservations() override
ManifestCache & publisherManifests() override
std::unique_ptr< AmendmentTable > m_amendmentTable
Overlay & overlay() override
constexpr auto megabytes(T value) noexcept
PendingSaves & pendingSaves() override
std::unique_ptr< CollectorManager > m_collectorManager
static std::chrono::seconds getDefaultHoldTime()
void sample(Handler &&handler)
Initiate continuous i/o latency sampling.
TransactionMaster m_txMaster
A collection of historical shards.
Manages the current fee schedule.
bool set(T &target, std::string const &name, Section const §ion)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
bool listed(PublicKey const &identity) const
Returns true if public key is included on any lists.
ValidatorSite & validatorSites() override
std::pair< PublicKey, SecretKey > const & nodeIdentity() override
beast::insight::Event m_event
A metric for reporting event timing.
std::unique_ptr< Config > config_
std::string const & getVersionString()
Server version.
void setup(std::shared_ptr< ReadView const > const &ledger)
This class is responsible for continuously extracting data from a p2p node, and writing that data to ...
std::shared_ptr< Ledger > getLastFullLedger()
virtual time_point closeTime() const =0
Returns the close time, in network time.
bool configInvalid() const
The role of a ClosureCounter is to assist in shutdown by letting callers wait for the completion of c...
io_latency_sampler m_io_latency_sampler
A generic endpoint for log messages.
void gotTXSet(std::shared_ptr< SHAMap > const &set, bool fromAcquire)
void startGenesisLedger()
boost::asio::signal_set m_signals
Manages various times used by the server.
TimeKeeper & timeKeeper() override
void operator()(Duration const &elapsed)
virtual void sweep()=0
Remove expired entries from the positive and negative caches.
Manages the lifetime of inbound ledgers.
Represents the open ledger.
void flush()
Flush all current validations.
A pool of threads to perform work.
void setMaxDisallowedLedger()
Tracks load and resource consumption.
std::unique_ptr< ShardFamily > shardFamily_
std::atomic< std::chrono::milliseconds > lastSample_
std::unique_ptr< Overlay > overlay_
std::string const & getFullVersionString()
Full server version string.
OpenLedger & openLedger() override
PendingSaves pendingSaves_
std::unique_ptr< ResolverAsio > m_resolver
Remembers manifests with the highest sequence number.
void sweep()
Remove completed tasks.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
void initAccountIdCache(std::size_t count)
Initialize the global cache used to map AccountID to base58 conversions.
std::unique_ptr< Manager > make_Manager(beast::insight::Collector::ptr const &collector, beast::Journal journal)
NodeCache & getTempNodeCache() override
std::chrono::milliseconds get() const
void cancel()
Cancel all pending i/o.
Value removeMember(const char *key)
Remove and return the named member.
std::unique_ptr< GRPCServer > grpcServer_
std::condition_variable stoppingCondition_
void rawTxInsert(key_type const &key, std::shared_ptr< Serializer const > const &txn, std::shared_ptr< Serializer const > const &metaData) override
Add a transaction to the tx map.
static std::unique_ptr< ShardArchiveHandler > tryMakeRecoveryHandler(Application &app)
JobQueue & getJobQueue() override
int fdRequired() const override
Source(std::string const &name)
Manages the set of connected peers.
OrderBookDB & getOrderBookDB() override
LoadManager & getLoadManager() override
bool lexicalCastChecked(Out &out, In in)
Intelligently convert from one type to another.
std::unique_ptr< PeerSetBuilder > make_PeerSetBuilder(Application &app)
beast::io_latency_probe< std::chrono::steady_clock > m_probe
bool isStopping() const override
NodeStoreScheduler m_nodeStoreScheduler
std::unique_ptr< LoadManager > m_loadManager
const create_genesis_t create_genesis
InboundTransactions & getInboundTransactions() override
std::unique_ptr< DatabaseCon > makeWalletDB(DatabaseCon::Setup const &setup)
makeWalletDB Opens the wallet database and returns it.
bool parse(std::string const &document, Value &root)
Read a Value from a JSON document.
An endpoint that consumes resources.
constexpr unsigned int apiMaximumSupportedVersion
std::unique_ptr< LoadFeeTrack > mFeeTrack
LoadFeeTrack & getFeeTrack() override
void addJson(Json::Value &json, LedgerFill const &fill)
Given a Ledger and options, fill a Json::Object or Json::Value with a description of the ledger.
Handles the download and import of one or more shard archives.
Manages the lifetime of ledger replay tasks.
Config & config() override
std::unique_ptr< ValidatorList > validators_
LedgerCleaner & getLedgerCleaner() override
std::pair< PublicKey, SecretKey > getNodeIdentity(Application &app, boost::program_options::variables_map const &cmdline)
The cryptographic credentials identifying this server instance.
void join(char const *name, std::chrono::milliseconds wait, beast::Journal j)
Returns once all counted in-flight closures are destroyed.
std::mutex stoppingMutex_
io_latency_sampler(beast::insight::Event ev, beast::Journal journal, std::chrono::milliseconds interval, boost::asio::io_service &ios)
std::unique_ptr< ServerHandler > serverHandler_
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
Keylet const & fees() noexcept
The (fixed) index of the object containing the ledger fees.
std::unique_ptr< AmendmentTable > make_AmendmentTable(Application &app, std::chrono::seconds majorityTime, std::vector< AmendmentTable::FeatureInfo > const &supported, Section const &enabled, Section const &vetoed, beast::Journal journal)
std::unique_ptr< ManifestCache > validatorManifests_
std::unique_ptr< PathRequests > m_pathRequests
std::unique_ptr< NetworkOPs > m_networkOPs
Family & getNodeFamily() override
bool setup(boost::program_options::variables_map const &cmdline) override
std::unique_ptr< TxQ > txQ_
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
void expire(beast::Journal &j)
Expire old validation sets.
static Manager & instance()
Returns the instance of the manager singleton.
Application::MutexType m_masterMutex
virtual std::unique_ptr< Database > make_Database(std::size_t burstSize, Scheduler &scheduler, int readThreads, Section const &backendParameters, beast::Journal journal)=0
Construct a NodeStore database.
std::optional< uint256 > getRegisteredFeature(std::string const &name)
Check the ledger/transaction databases to make sure they have continuity.
boost::asio::io_service & get_io_service()
std::atomic< LedgerIndex > maxDisallowedLedger_
std::unique_ptr< SHAMapStore > make_SHAMapStore(Application &app, NodeStore::Scheduler &scheduler, beast::Journal journal)
void signalStop(std::string msg="") override
std::unique_ptr< ManifestCache > publisherManifests_
The amendment table stores the list of enabled and potential amendments.
TransactionMaster & getMasterTransaction() override
std::chrono::time_point< NetClock > time_point
std::map< std::string, VoteBehavior > const & supportedAmendments()
Amendments that this server supports and the default voting behavior.
std::unique_ptr< ReportingETL > reportingETL_
bool isObjectOrNull() const
RCLValidations & getValidations() override
std::unique_ptr< Application > make_Application(std::unique_ptr< Config > config, std::unique_ptr< Logs > logs, std::unique_ptr< TimeKeeper > timeKeeper)
void start(bool withTimers) override
void notify(std::chrono::duration< Rep, Period > const &value) const
Push an event notification.
std::unique_ptr< Logs > logs_
Manages the acquisition and lifetime of transaction sets.
std::string asString() const
Returns the unquoted string value.
std::optional< Substitute< Closure > > wrap(Closure &&closure)
Wrap the passed closure with a reference counter.