20 #include <ripple/app/main/Application.h>
21 #include <ripple/core/DatabaseCon.h>
22 #include <ripple/core/Stoppable.h>
23 #include <ripple/app/consensus/RCLValidations.h>
24 #include <ripple/app/main/DBInit.h>
25 #include <ripple/app/main/BasicApp.h>
26 #include <ripple/app/main/Tuning.h>
27 #include <ripple/app/ledger/InboundLedgers.h>
28 #include <ripple/app/ledger/LedgerMaster.h>
29 #include <ripple/app/ledger/LedgerToJson.h>
30 #include <ripple/app/ledger/OpenLedger.h>
31 #include <ripple/app/ledger/OrderBookDB.h>
32 #include <ripple/app/ledger/PendingSaves.h>
33 #include <ripple/app/ledger/InboundTransactions.h>
34 #include <ripple/app/ledger/TransactionMaster.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/misc/AmendmentTable.h>
39 #include <ripple/app/misc/HashRouter.h>
40 #include <ripple/app/misc/LoadFeeTrack.h>
41 #include <ripple/app/misc/NetworkOPs.h>
42 #include <ripple/app/misc/SHAMapStore.h>
43 #include <ripple/app/misc/TxQ.h>
44 #include <ripple/app/misc/ValidatorSite.h>
45 #include <ripple/app/misc/ValidatorKeys.h>
46 #include <ripple/app/paths/PathRequests.h>
47 #include <ripple/app/tx/apply.h>
48 #include <ripple/basics/ByteUtilities.h>
49 #include <ripple/basics/ResolverAsio.h>
50 #include <ripple/basics/safe_cast.h>
51 #include <ripple/basics/Sustain.h>
52 #include <ripple/basics/PerfLog.h>
53 #include <ripple/json/json_reader.h>
54 #include <ripple/nodestore/DummyScheduler.h>
55 #include <ripple/nodestore/DatabaseShard.h>
56 #include <ripple/overlay/Cluster.h>
57 #include <ripple/overlay/PeerReservationTable.h>
58 #include <ripple/overlay/make_Overlay.h>
59 #include <ripple/protocol/BuildInfo.h>
60 #include <ripple/protocol/Feature.h>
61 #include <ripple/protocol/STParsedJSON.h>
62 #include <ripple/protocol/Protocol.h>
63 #include <ripple/resource/Fees.h>
64 #include <ripple/rpc/impl/RPCHelpers.h>
65 #include <ripple/beast/asio/io_latency_probe.h>
66 #include <ripple/beast/core/LexicalCast.h>
67 #include <ripple/rpc/ShardArchiveHandler.h>
69 #include <boost/algorithm/string/predicate.hpp>
70 #include <ripple/app/main/GRPCServer.h>
71 #include <boost/asio/steady_timer.hpp>
72 #include <boost/system/error_code.hpp>
129 ,
treecache_ (
"TreeNodeCache", 65536,
std::chrono::minutes {1},
132 collectorManager.collector(),
137 ,
j_ (app.journal(
"SHAMap"))
195 "Missing node in " << seq;
270 boost::asio::io_service& ios)
284 template <
class Duration>
288 auto const lastSample = date::ceil<milliseconds>(elapsed);
292 if (lastSample >= 10ms)
294 if (lastSample >= 500ms)
297 "io_service latency = " << lastSample.count();
404 #if RIPPLE_SINGLE_IO_SERVICE_THREAD
434 perf::setup_PerfLog(
config_->section(
"perf"),
config_->CONFIG_DIR),
445 logs_->journal(
"SHAMapStore")))
453 config_->section (SECTION_INSIGHT),
logs_->journal(
"Collector")))
477 logs_->journal(
"ShardStore")))
486 logs_->journal(
"LedgerMaster")))
501 gotTXSet (set, fromAcquire);
512 ,
cluster_ (std::make_unique<Cluster> (
513 logs_->journal(
"Overlay")))
518 logs_->journal(
"ManifestCache")))
521 logs_->journal(
"ManifestCache")))
526 logs_->journal(
"ValidatorList"),
config_->VALIDATION_QUORUM))
534 ,
mFeeTrack (std::make_unique<LoadFeeTrack>(
logs_->journal(
"LoadManager")))
587 bool setup()
override;
588 void doStart(
bool withTimers)
override;
831 assert(
txQ_.get() !=
nullptr);
837 assert (
mTxnDB.get() !=
nullptr);
860 assert (
mTxnDB.get () ==
nullptr);
869 mTxnDB = std::make_unique <DatabaseCon>(
875 boost::str(boost::format(
"PRAGMA cache_size=-%d;") %
879 if (!
setup.standAlone ||
888 soci::statement st = (
mTxnDB->getSession().prepare <<
889 (
"PRAGMA table_info(AccountTransactions);"),
894 soci::into(dflt_value, ind),
903 "AccountTransactions database "
904 "should not have a primary key";
911 mLedgerDB = std::make_unique <DatabaseCon>(
917 boost::str(boost::format(
"PRAGMA cache_size=-%d;") %
922 mWalletDB = std::make_unique <DatabaseCon>(
931 "Failed to initialize SQLite databases: " << e.
what();
943 auto j =
logs_->journal(
"NodeObject");
956 "Starting node import from '" << source->getName() <<
960 auto const start = steady_clock::now();
964 auto const elapsed = duration_cast <seconds>
965 (steady_clock::now() -
start);
967 "Node import from '" << source->getName() <<
968 "' took " << elapsed.count() <<
" seconds.";
975 seconds{config_->getValueFor(SizedItem::nodeCacheAge)});
979 seconds{config_->getValueFor(SizedItem::ledgerAge)});
989 void signalled(
const boost::system::error_code& ec,
int signal_number)
991 if (ec == boost::asio::error::operation_aborted)
999 <<
" with error: " << ec.message();
1022 using namespace std::chrono_literals;
1057 boost::system::error_code ec;
1062 <<
"Application: sweepTimer cancel error: "
1071 <<
"Application: entropyTimer cancel error: "
1077 using namespace std::chrono_literals;
1115 [
this] (boost::system::error_code
const& e)
1117 if ((e.value() == boost::system::errc::success) &&
1118 (! m_jobQueue->isStopped()))
1121 jtSWEEP,
"sweep", [this] (Job&) { doSweep(); });
1124 if (e.value() != boost::system::errc::success &&
1125 e.value() != boost::asio::error::operation_aborted)
1128 JLOG (m_journal.error())
1129 <<
"Sweep timer got error '" << e.message()
1130 <<
"'. Restarting timer.";
1138 sweepTimer_.async_wait (std::move (*optionalCountedHandler));
1146 [
this] (boost::system::error_code
const& e)
1148 if (e.value() == boost::system::errc::success)
1150 crypto_prng().mix_entropy();
1154 if (e.value() != boost::system::errc::success &&
1155 e.value() != boost::asio::error::operation_aborted)
1158 JLOG (m_journal.error())
1159 <<
"Entropy timer got error '" << e.message()
1160 <<
"'. Restarting timer.";
1165 using namespace std::chrono_literals;
1167 entropyTimer_.async_wait (std::move (*optionalCountedHandler));
1175 boost::filesystem::space_info space =
1176 boost::filesystem::space (
config_->legacy (
"database_path"));
1181 <<
"Remaining free disk space is less than 512MB";
1187 boost::system::error_code ec;
1188 boost::optional<std::uint64_t> dbSize =
1189 boost::filesystem::file_size(dbPath, ec);
1193 <<
"Error checking transaction db file size: "
1198 auto db =
mTxnDB->checkoutDb();
1199 static auto const pageSize = [&]{
1201 *db <<
"PRAGMA page_size;", soci::into(ps);
1204 static auto const maxPages = [&]{
1206 *db <<
"PRAGMA max_page_count;" , soci::into(mp);
1210 *db <<
"PRAGMA page_count;", soci::into(pageCount);
1213 safe_cast<std::uint64_t>(freePages) * pageSize;
1215 <<
"Transaction DB pathname: " << dbPath.string()
1216 <<
"; file size: " << dbSize.value_or(-1) <<
" bytes"
1217 <<
"; SQLite page size: " << pageSize <<
" bytes"
1218 <<
"; Free pages: " << freePages
1219 <<
"; Free space: " << freeSpace <<
" bytes; "
1220 <<
"Note that this does not take into account available disk "
1226 <<
"Free SQLite space for transaction db is less than "
1227 "512MB. To fix this, rippled must be executed with the "
1228 "vacuum <sqlitetmpdir> parameter before restarting. "
1229 "Note that this activity can take multiple days, "
1230 "depending on database size.";
1302 std::placeholders::_1, std::placeholders::_2));
1304 assert (
mTxnDB ==
nullptr);
1306 auto debug_log =
config_->getDebugLogFile ();
1308 if (!debug_log.empty ())
1313 if (!
logs_->open(debug_log))
1314 std::cerr <<
"Can't open log file " << debug_log <<
'\n';
1326 "Limited to a single I/O service thread by system configuration.";
1372 for (
auto const&
name : sa)
1379 Section supportedAmendments (
"Supported Amendments");
1380 supportedAmendments.append (saHashes);
1382 Section enabledAmendments =
config_->section (SECTION_AMENDMENTS);
1387 supportedAmendments,
1389 config_->section (SECTION_VETO_AMENDMENTS),
1390 logs_->journal(
"Amendments"));
1395 auto const startUp =
config_->START_UP;
1407 "Loading specified Ledger";
1414 "The specified ledger could not be loaded.";
1437 JLOG(
m_journal.
fatal()) <<
"Invalid entry in cluster configuration.";
1447 config().section (SECTION_VALIDATOR_KEY_REVOCATION).values ()))
1449 JLOG(
m_journal.
fatal()) <<
"Invalid configured validator manifest.";
1459 config().section (SECTION_VALIDATORS).values (),
1460 config().section (SECTION_VALIDATOR_LIST_KEYS).values ()))
1463 "Invalid entry in validator configuration.";
1469 config().section (SECTION_VALIDATOR_LIST_SITES).values ()))
1472 "Invalid entry in [" << SECTION_VALIDATOR_LIST_SITES <<
"]";
1516 setup.makeContexts();
1523 stream <<
"Unable to setup server handler";
1525 stream <<
": " << e.
what();
1539 <<
"No outbound peer connections will be made";
1556 "*** The server is configured to allow the 'sign' and 'sign_for'";
1558 "*** commands. These commands have security implications and have";
1560 "*** been deprecated. They will be removed in a future release of";
1564 "*** If you do not use them to sign transactions please edit your";
1566 "*** configuration file and remove the [enable_signing] stanza.";
1568 "*** If you do use them to sign transactions please migrate to a";
1570 "*** standalone signing solution as soon as possible.";
1576 for (
auto cmd :
config_->section(SECTION_RPC_STARTUP).lines())
1581 if (! jrReader.
parse (cmd, jvCommand))
1584 "Couldn't parse entry in [" << SECTION_RPC_STARTUP <<
1616 using namespace boost::filesystem;
1624 if (exists(stateDb) &&
1625 is_regular_file(stateDb) &&
1634 if (!handler->initFromDB())
1637 <<
"Failed to initialize ShardArchiveHandler.";
1642 if (!handler->start())
1645 <<
"Failed to start ShardArchiveHandler.";
1654 <<
"Exception when starting ShardArchiveHandler from "
1655 "state database: " << e.
what();
1729 needed +=
static_cast<int>(0.5 + (1.5 *
overlay_->limit()));
1758 std::make_shared<Ledger>(
1765 auto const next = std::make_shared<Ledger>(
1767 next->updateSkipList ();
1768 next->setImmutable (*
config_);
1770 logs_->journal(
"OpenLedger"));
1782 auto const [ledger, seq, hash] =
1788 ledger->setImmutable(*
config_);
1791 ledger->setValidated ();
1793 if (ledger->info().hash == hash)
1795 JLOG (j.trace()) <<
"Loaded ledger: " << hash;
1799 if (
auto stream = j.error())
1801 stream <<
"Failed on ledger";
1812 "Ledger in database: " << mn.
what();
1828 "Unable to open file '" <<
name <<
"'";
1835 if (!reader.
parse (ledgerFile, jLedger))
1838 "Unable to parse ledger JSON";
1845 if (ledger.
get().isMember (
"result"))
1846 ledger = ledger.
get()[
"result"];
1848 if (ledger.
get().isMember (
"ledger"))
1849 ledger = ledger.
get()[
"ledger"];
1853 using namespace std::chrono_literals;
1854 auto closeTimeResolution = 30s;
1855 bool closeTimeEstimated =
false;
1858 if (ledger.
get().isMember (
"accountState"))
1860 if (ledger.
get().isMember (jss::ledger_index))
1862 seq = ledger.
get()[jss::ledger_index].asUInt();
1865 if (ledger.
get().isMember (
"close_time"))
1868 using d = tp::duration;
1869 closeTime = tp{d{ledger.
get()[
"close_time"].asUInt()}};
1871 if (ledger.
get().isMember (
"close_time_resolution"))
1874 closeTimeResolution =
seconds{
1875 ledger.
get()[
"close_time_resolution"].asUInt()};
1877 if (ledger.
get().isMember (
"close_time_estimated"))
1879 closeTimeEstimated =
1880 ledger.
get()[
"close_time_estimated"].asBool();
1882 if (ledger.
get().isMember (
"total_coins"))
1885 beast::lexicalCastThrow<std::uint64_t>
1886 (ledger.
get()[
"total_coins"].asString());
1889 ledger = ledger.
get()[
"accountState"];
1892 if (!ledger.
get().isArrayOrNull ())
1895 <<
"State nodes must be an array";
1899 auto loadLedger = std::make_shared<Ledger> (
1901 loadLedger->setTotalDrops(totalDrops);
1903 for (
Json::UInt index = 0; index < ledger.
get().size(); ++index)
1910 <<
"Invalid entry in ledger";
1919 <<
"Invalid entry in ledger";
1930 <<
"Invalid entry in ledger";
1938 if (! loadLedger->addSLE (sle))
1941 <<
"Couldn't add serialized ledger: "
1947 loadLedger->stateMap().flushDirty (
1950 loadLedger->setAccepted (closeTime,
1951 closeTimeResolution, ! closeTimeEstimated,
1959 "Ledger contains invalid data: " << x.
what();
1965 std::string const& ledgerID,
bool replay,
bool isFileName)
1973 if (!ledgerID.
empty())
1976 else if (ledgerID.
length () == 64)
1980 if (hash.
SetHex (ledgerID))
1987 auto il = std::make_shared <InboundLedger> (
1990 if (il->checkLocal ())
1991 loadLedger = il->getLedger ();
1995 else if (ledgerID.
empty () || boost::iequals(ledgerID,
"latest"))
2016 replayLedger = loadLedger;
2020 loadLedger =
loadByHash (replayLedger->info().parentHash, *
this);
2023 JLOG(
m_journal.
info()) <<
"Loading parent ledger from node store";
2026 auto il = std::make_shared <InboundLedger> (
2027 *
this, replayLedger->info().parentHash,
2030 if (il->checkLocal ())
2031 loadLedger = il->getLedger ();
2041 using namespace std::chrono_literals;
2042 using namespace date;
2044 sys_days{January/1/2018} - sys_days{January/1/2000}};
2045 if (loadLedger->info().closeTime < ledgerWarnTimePoint)
2048 "\n\n*** WARNING ***\n"
2049 "You are replaying a ledger from before " <<
2050 to_string(ledgerWarnTimePoint) <<
" UTC.\n"
2051 "This replay will not handle your ledger as it was originally "
2052 "handled.\nConsider running an earlier version of rippled to "
2053 "get the older rules.\n*** CONTINUING ***\n";
2057 "Loading ledger " << loadLedger->info().hash <<
2058 " seq:" << loadLedger->info().seq;
2060 if (loadLedger->info().accountHash.isZero ())
2067 if (!loadLedger->walkLedger (
journal (
"Ledger")))
2074 if (!loadLedger->assertSane (
journal (
"Ledger")))
2082 loadLedger->info().seq,
2083 loadLedger->info().seq);
2086 loadLedger->setValidated();
2089 logs_->journal(
"OpenLedger"));
2096 std::make_unique<LedgerReplay>(loadLedger, replayLedger);
2098 for (
auto const& [_, tx] : replayData->orderedTxns())
2101 auto txID = tx->getTransactionID();
2103 auto s = std::make_shared <Serializer> ();
2123 "While loading specified ledger: " << mn.
what();
2126 catch (boost::bad_lexical_cast&)
2129 <<
"Ledger specified '" << ledgerID <<
"' is not valid";
2138 if (!
config().ELB_SUPPORT)
2143 reason =
"Server is shutting down";
2147 if (
getOPs ().isNeedNetworkLedger ())
2149 reason =
"Not synchronized with network yet";
2155 reason =
"Not synchronized with network";
2164 reason =
"Too much load";
2168 if (
getOPs ().isAmendmentBlocked ())
2170 reason =
"Server version too old";
2186 assert(!
config_->standalone());
2191 "The [shard_db] configuration setting must be set";
2197 "Invalid [shard_db] configuration";
2207 assert(!
config_->standalone());
2212 "The [shard_db] configuration setting must be set";
2218 "Invalid [shard_db] configuration";
2227 boost::optional <LedgerIndex> seq;
2230 *db <<
"SELECT MAX(LedgerSeq) FROM Ledgers;", soci::into(seq);
2255 return std::make_unique<ApplicationImp> (
2256 std::move(config), std::move(logs),
2257 std::move(timeKeeper));
A NodeStore::Scheduler which uses the JobQueue and implements the Stoppable API.
void expire()
Expire old validation sets.
AppFamily(AppFamily const &)=delete
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.
DatabaseCon & getTxnDB() override
Simple NodeStore Scheduler that just peforms the tasks synchronously.
std::unique_ptr< DatabaseCon > mTxnDB
NodeCache m_tempNodeCache
Holds a collection of configuration values.
Provides server functionality for clients.
std::unique_ptr< NodeStore::DatabaseShard > shardStore_
std::tuple< std::shared_ptr< Ledger >, std::uint32_t, uint256 > loadLedgerHelper(std::string const &sqlSuffix, Application &app, bool acquire)
static boost::filesystem::path getDownloadDirectory(Config const &config)
constexpr auto WalletDBName
void missing_node(uint256 const &hash, std::uint32_t seq) override
TreeNodeCache & treecache() override
DatabaseCon & getLedgerDB() override
void activateDeadlockDetector()
Turn on deadlock detection.
std::unique_ptr< InboundTransactions > m_inboundTransactions
std::vector< std::unique_ptr< Stoppable > > websocketServers_
ValidatorList & validators() override
Persistency layer for NodeObject.
CachedSLEs & cachedSLEs() override
NodeStore::Database & getNodeStore() override
std::pair< PublicKey, SecretKey > loadNodeIdentity(Application &app)
The cryptographic credentials identifying this server instance.
bool serverOkay(std::string &reason) override
std::shared_ptr< Ledger > loadByIndex(std::uint32_t ledgerIndex, Application &app, bool acquire)
RCLValidations mValidations
TaggedCache< uint256, AcceptedLedger > & getAcceptedLedgerCache() override
void stopped()
Called by derived classes to indicate that the stoppable has stopped.
HashRouter & getHashRouter() override
Stream trace() const
Severity stream access functions.
std::unique_ptr< detail::AppFamily > shardFamily_
std::unique_ptr< ValidatorSite > validatorSites_
std::unique_ptr< DatabaseCon > mWalletDB
PathRequests & getPathRequests() override
OrderBookDB m_orderBookDB
void onStop() override
Override called when the stop notification is issued.
void onWrite(beast::PropertyStream::Map &stream) override
Subclass override.
InboundLedgers & getInboundLedgers() override
AccountIDCache const & accountIDCache() const override
Writable ledger view that accumulates state and tx changes.
void missing_node(std::uint32_t seq) override
static pointer recoverInstance(Application &app, Stoppable &parent)
static std::string shardDatabase()
std::unique_ptr< AmendmentTable > make_AmendmentTable(std::chrono::seconds majorityTime, int majorityFraction, Section const &supported, Section const &enabled, Section const &vetoed, beast::Journal journal)
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< Overlay > make_Overlay(Application &app, Overlay::Setup const &setup, Stoppable &parent, 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.
Provides the beast::insight::Collector service.
static std::string importNodeDatabase()
TaggedCache< uint256, AcceptedLedger > m_acceptedLedgerCache
class to create database, launch online delete thread, and related SQLite database
std::unique_ptr< LoadManager > make_LoadManager(Application &app, Stoppable &parent, beast::Journal journal)
ManifestCache & validatorManifests() override
DatabaseCon & getWalletDB() override
Retrieve the "wallet database".
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
boost::optional< OpenLedger > openLedger_
std::unique_ptr< SHAMapStore > m_shaMapStore
boost::asio::io_service & getIOService() override
constexpr auto kilobytes(T value) noexcept
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
static void initPathTable()
boost::filesystem::path dataDir
ApplicationImp(std::unique_ptr< Config > config, std::unique_ptr< Logs > logs, std::unique_ptr< TimeKeeper > timeKeeper)
void signalStop() override
Cluster & cluster() override
Stopwatch & stopwatch()
Returns an instance of a wall clock.
constexpr std::chrono::seconds fullBelowExpiration
std::string to_string(ListDisposition disposition)
LedgerMaster & getLedgerMaster() override
Unserialize a JSON document into a Value.
static std::unique_ptr< CollectorManager > New(Section const ¶ms, beast::Journal journal)
Family & family() override
static std::unique_ptr< ResolverAsio > New(boost::asio::io_service &, beast::Journal)
detail::AppFamily family_
NodeStore::Database & db_
std::unique_ptr< NodeStore::Database > m_nodeStore
constexpr std::array< char const *, 5 > LgrDBInit
std::unique_ptr< perf::PerfLog > perfLog_
Caches the base58 representations of AccountIDs.
std::pair< PublicKey, SecretKey > nodeIdentity_
Validator keys and manifest as set in configuration file.
std::unique_ptr< DatabaseCon > mLedgerDB
AppFamily(Application &app, NodeStore::Database &db, CollectorManager &collectorManager)
std::unique_ptr< InboundLedgers > make_InboundLedgers(Application &app, InboundLedgers::clock_type &clock, Stoppable &parent, beast::insight::Collector::ptr const &collector)
FullBelowCache & fullbelow() override
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.
virtual InboundLedgers & getInboundLedgers()=0
void onStart() override
Override called during start.
const ValidatorKeys validatorKeys_
std::unique_ptr< TimeKeeper > timeKeeper_
@ SYNCING
fallen slightly behind
const PublicKey & getValidationPublicKey() const override
std::condition_variable cv_
@ SigGoodOnly
Signature is good, but local checks fail.
void prepare()
Prepare all contained Stoppable objects.
AppFamily & operator=(AppFamily const &)=delete
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
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, Stoppable &parent, ValidatorKeys const &validatorKeys, boost::asio::io_service &io_svc, beast::Journal journal, beast::insight::Collector::ptr const &collector)
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
void stop(beast::Journal j)
Notify a root stoppable and children to stop, and block until stopped.
static std::uint32_t getDefaultRecoverLimit()
std::unique_ptr< LedgerMaster > m_ledgerMaster
bool isStopped() const
Returns true if the requested stop has completed.
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_
DatabaseCon::Setup setup_DatabaseCon(Config const &c)
std::shared_ptr< Ledger > loadByHash(uint256 const &ledgerHash, Application &app, bool acquire)
static std::size_t numberOfThreads(Config const &config)
LockedSociSession checkoutDb()
constexpr std::array< char const *, 3 > LgrDBPragma
SHAMapStore & getSHAMapStore() override
void add(Source &source)
Add a child source.
AmendmentTable & getAmendmentTable() override
bool loadOldLedger(std::string const &ledgerID, bool replay, bool isFilename)
virtual LedgerMaster & getLedgerMaster()=0
virtual std::shared_ptr< Ledger const > acquire(uint256 const &hash, std::uint32_t seq, InboundLedger::Reason)=0
void sweep()
Remove expired cache items.
std::size_t size() const noexcept
T hardware_concurrency(T... args)
Caches SLEs by their digest.
Resource::Manager & getResourceManager() override
PeerReservationTable & peerReservations() override
ManifestCache & publisherManifests() override
void doStart(bool withTimers) 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.
TreeNodeCache const & treecache() const override
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,...
void expire()
Discard expired entries.
std::unique_ptr< InboundTransactions > make_InboundTransactions(Application &app, InboundLedgers::clock_type &clock, Stoppable &parent, beast::insight::Collector::ptr const &collector, std::function< void(std::shared_ptr< SHAMap > const &, bool)> gotSet)
FullBelowCache fullbelow_
bool listed(PublicKey const &identity) const
Returns true if public key is included on any lists.
constexpr unsigned int ApiMaximumSupportedVersion
ValidatorSite & validatorSites() override
bool SetHex(const char *psz, bool bStrict=false)
Parse a hex string into a base_uint The input can be:
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)
std::shared_ptr< Ledger > getLastFullLedger()
virtual time_point closeTime() const =0
Returns the close time, in network time.
bool configInvalid() const
io_latency_sampler m_io_latency_sampler
A generic endpoint for log messages.
bool isShutdown() override
void gotTXSet(std::shared_ptr< SHAMap > const &set, bool fromAcquire)
void startGenesisLedger()
boost::asio::signal_set m_signals
boost::optional< STObject > object
The STObject if the parse was successful.
Manages various times used by the server.
boost::optional< Wrapper< Closure > > wrap(Closure &&closure)
Wrap the passed closure with a reference counter.
TimeKeeper & timeKeeper() override
void operator()(Duration const &elapsed)
virtual void sweep()=0
Remove expired entries from the positive and negative caches.
std::unique_ptr< TxQ > make_TxQ(TxQ::Setup const &setup, beast::Journal j)
TxQ object factory.
Manages the lifetime of inbound ledgers.
Represents the open ledger.
virtual TreeNodeCache & treecache()=0
void flush()
Flush all current validations.
constexpr std::size_t fullBelowTargetSize
A pool of threads to perform work.
FullBelowCache const & fullbelow() const override
void setMaxDisallowedLedger()
NodeStore::Database & db() override
Tracks load and resource consumption.
Family * shardFamily() override
std::atomic< std::chrono::milliseconds > lastSample_
std::vector< std::string > const & supportedAmendments()
Amendments that this server supports, but doesn't enable by default.
std::unique_ptr< Overlay > overlay_
std::string const & getFullVersionString()
Full server version string.
static constexpr auto stateDBName
OpenLedger & openLedger() override
PendingSaves pendingSaves_
void setJobQueue(JobQueue &jobQueue)
std::unique_ptr< ResolverAsio > m_resolver
Remembers manifests with the highest sequence number.
void setTargetAge(clock_type::duration s)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::unique_ptr< Manager > make_Manager(beast::insight::Collector::ptr const &collector, beast::Journal journal)
virtual beast::Journal journal(std::string const &name)=0
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_
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.
JobQueue & getJobQueue() override
int fdRequired() const override
std::unique_ptr< SHAMapStore > make_SHAMapStore(Application &app, Stoppable &parent, NodeStore::Scheduler &scheduler, beast::Journal journal)
void setTargetSize(int s)
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.
beast::Journal const & journal() override
beast::io_latency_probe< std::chrono::steady_clock > m_probe
AccountIDCache accountIDCache_
NodeStoreScheduler m_nodeStoreScheduler
std::unique_ptr< LoadManager > m_loadManager
const create_genesis_t create_genesis
InboundTransactions & getInboundTransactions() override
bool parse(std::string const &document, Value &root)
Read a Value from a JSON document.
An endpoint that consumes resources.
void acquire(uint256 const &hash, std::uint32_t seq)
std::unique_ptr< LoadFeeTrack > mFeeTrack
static const int MAJORITY_FRACTION(204)
std::string StopSustain()
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.
void signalled(const boost::system::error_code &ec, int signal_number)
static bool hasInstance()
Config & config() override
std::unique_ptr< ValidatorList > validators_
void join(char const *name, std::chrono::milliseconds wait, beast::Journal j)
Returns once all counted in-flight closures are destroyed.
io_latency_sampler(beast::insight::Event ev, beast::Journal journal, std::chrono::milliseconds interval, boost::asio::io_service &ios)
std::unique_ptr< ServerHandler > serverHandler_
virtual FullBelowCache & fullbelow()=0
std::unique_ptr< ManifestCache > validatorManifests_
std::unique_ptr< PathRequests > m_pathRequests
std::unique_ptr< NetworkOPs > m_networkOPs
std::unique_ptr< TxQ > txQ_
constexpr std::array< char const *, 8 > TxDBInit
virtual std::unique_ptr< Database > make_Database(std::string const &name, Scheduler &scheduler, int readThreads, Stoppable &parent, Section const &backendParameters, beast::Journal journal)=0
Construct a NodeStore database.
static Manager & instance()
Returns the instance of the manager singleton.
constexpr std::array< char const *, 6 > WalletDBInit
Application::MutexType m_masterMutex
boost::asio::io_service & get_io_service()
std::atomic< LedgerIndex > maxDisallowedLedger_
uint256 getHashBySeq(std::uint32_t index)
Get a ledger's hash by sequence number using the cache.
std::unique_ptr< ManifestCache > publisherManifests_
The amendment table stores the list of enabled and potential amendments.
TransactionMaster & getMasterTransaction() override
constexpr std::array< char const *, 5 > TxDBPragma
std::chrono::time_point< NetClock > time_point
bool isShardBacked() const override
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)
NodeStore::Database const & db() const override
std::unique_ptr< ServerHandler > make_ServerHandler(Application &app, Stoppable &parent, boost::asio::io_service &io_service, JobQueue &jobQueue, NetworkOPs &networkOPs, Resource::Manager &resourceManager, CollectorManager &cm)
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.
void onPrepare() override
Override called during preparation.
std::string asString() const
Returns the unquoted string value.
boost::optional< uint256 > getRegisteredFeature(std::string const &name)