rippled
Loading...
Searching...
No Matches
Application.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_APP_MAIN_APPLICATION_H_INCLUDED
21#define RIPPLE_APP_MAIN_APPLICATION_H_INCLUDED
22
23#include <xrpld/core/Config.h>
24#include <xrpld/overlay/PeerReservationTable.h>
25
26#include <xrpl/basics/TaggedCache.h>
27#include <xrpl/beast/utility/PropertyStream.h>
28#include <xrpl/protocol/Protocol.h>
29#include <xrpl/shamap/TreeNodeCache.h>
30
31#include <boost/asio.hpp>
32#include <boost/program_options.hpp>
33
34#include <mutex>
35
36namespace ripple {
37
38namespace unl {
39class Manager;
40}
41namespace Resource {
42class Manager;
43}
44namespace NodeStore {
45class Database;
46} // namespace NodeStore
47namespace perf {
48class PerfLog;
49}
50
51// VFALCO TODO Fix forward declares required for header dependency loops
52class AmendmentTable;
53
54template <
55 class Key,
56 class T,
57 bool IsKeyCache,
58 class SharedWeakUnionPointer,
59 class SharedPointerType,
60 class Hash,
61 class KeyEqual,
62 class Mutex>
63class TaggedCache;
64class STLedgerEntry;
65using SLE = STLedgerEntry;
66using CachedSLEs = TaggedCache<uint256, SLE const>;
67
68class CollectorManager;
69class Family;
70class HashRouter;
71class Logs;
72class LoadFeeTrack;
73class JobQueue;
74class InboundLedgers;
75class InboundTransactions;
76class AcceptedLedger;
77class Ledger;
78class LedgerMaster;
79class LedgerCleaner;
80class LedgerReplayer;
81class LoadManager;
82class ManifestCache;
83class ValidatorKeys;
84class NetworkOPs;
85class OpenLedger;
86class OrderBookDB;
87class Overlay;
88class PathRequests;
89class PendingSaves;
90class PublicKey;
91class ServerHandler;
92class SecretKey;
93class STLedgerEntry;
94class TimeKeeper;
95class TransactionMaster;
96class TxQ;
97
98class ValidatorList;
99class ValidatorSite;
100class Cluster;
101
102class RelationalDatabase;
103class DatabaseCon;
104class SHAMapStore;
105
107
108template <class Adaptor>
109class Validations;
112
114{
115public:
116 /* VFALCO NOTE
117
118 The master mutex protects:
119
120 - The open ledger
121 - Server global state
122 * What the last closed ledger is
123 * State of the consensus engine
124
125 other things
126 */
128 virtual MutexType&
130
131public:
132 Application();
133
134 virtual ~Application() = default;
135
136 virtual bool
137 setup(boost::program_options::variables_map const& options) = 0;
138
139 virtual void
140 start(bool withTimers) = 0;
141 virtual void
142 run() = 0;
143 virtual void
145 virtual bool
146 checkSigs() const = 0;
147 virtual void
148 checkSigs(bool) = 0;
149 virtual bool
150 isStopping() const = 0;
151
152 //
153 // ---
154 //
155
157 virtual std::uint64_t
158 instanceID() const = 0;
159
160 virtual Logs&
161 logs() = 0;
162 virtual Config&
163 config() = 0;
164
165 virtual boost::asio::io_context&
167
168 virtual CollectorManager&
170 virtual Family&
172 virtual TimeKeeper&
174 virtual JobQueue&
176 virtual NodeCache&
178 virtual CachedSLEs&
180 virtual AmendmentTable&
182 virtual HashRouter&
184 virtual LoadFeeTrack&
186 virtual LoadManager&
188 virtual Overlay&
189 overlay() = 0;
190 virtual TxQ&
191 getTxQ() = 0;
192 virtual ValidatorList&
194 virtual ValidatorSite&
196 virtual ManifestCache&
198 virtual ManifestCache&
200 virtual Cluster&
201 cluster() = 0;
202 virtual PeerReservationTable&
204 virtual RCLValidations&
206 virtual NodeStore::Database&
208 virtual InboundLedgers&
210 virtual InboundTransactions&
212
215
216 virtual LedgerMaster&
218 virtual LedgerCleaner&
220 virtual LedgerReplayer&
222 virtual NetworkOPs&
223 getOPs() = 0;
224 virtual OrderBookDB&
226 virtual ServerHandler&
228 virtual TransactionMaster&
230 virtual perf::PerfLog&
232
235
238
239 virtual Resource::Manager&
241 virtual PathRequests&
243 virtual SHAMapStore&
245 virtual PendingSaves&
247 virtual OpenLedger&
249 virtual OpenLedger const&
250 openLedger() const = 0;
251 virtual RelationalDatabase&
253
256
257 virtual bool
259
260 virtual beast::Journal
262
263 /* Returns the number of file descriptors the application needs */
264 virtual int
265 fdRequired() const = 0;
266
268 virtual DatabaseCon&
270
273 virtual LedgerIndex
275
276 virtual std::optional<uint256> const&
277 trapTxID() const = 0;
278};
279
284 std::unique_ptr<TimeKeeper> timeKeeper);
285
286} // namespace ripple
287
288#endif
A generic endpoint for log messages.
Definition Journal.h:60
Subclasses can be called to write to a stream and have children.
std::string const & name() const
Returns the name of this source.
The amendment table stores the list of enabled and potential amendments.
virtual bool serverOkay(std::string &reason)=0
virtual std::optional< uint256 > const & trapTxID() const =0
virtual CollectorManager & getCollectorManager()=0
virtual CachedSLEs & cachedSLEs()=0
virtual Config & config()=0
virtual void start(bool withTimers)=0
virtual Overlay & overlay()=0
virtual LoadFeeTrack & getFeeTrack()=0
virtual OpenLedger & openLedger()=0
virtual beast::Journal journal(std::string const &name)=0
virtual SHAMapStore & getSHAMapStore()=0
virtual bool setup(boost::program_options::variables_map const &options)=0
virtual bool isStopping() const =0
virtual LedgerCleaner & getLedgerCleaner()=0
virtual NodeStore::Database & getNodeStore()=0
virtual RCLValidations & getValidations()=0
virtual ServerHandler & getServerHandler()=0
virtual std::chrono::milliseconds getIOLatency()=0
virtual bool checkSigs() const =0
virtual OrderBookDB & getOrderBookDB()=0
virtual InboundTransactions & getInboundTransactions()=0
virtual LedgerReplayer & getLedgerReplayer()=0
virtual TimeKeeper & timeKeeper()=0
virtual TaggedCache< uint256, AcceptedLedger > & getAcceptedLedgerCache()=0
virtual MutexType & getMasterMutex()=0
virtual NodeCache & getTempNodeCache()=0
virtual void run()=0
virtual JobQueue & getJobQueue()=0
virtual ValidatorSite & validatorSites()=0
virtual DatabaseCon & getWalletDB()=0
Retrieve the "wallet database".
virtual Resource::Manager & getResourceManager()=0
virtual NetworkOPs & getOPs()=0
virtual InboundLedgers & getInboundLedgers()=0
virtual ValidatorList & validators()=0
virtual Family & getNodeFamily()=0
virtual std::optional< PublicKey const > getValidationPublicKey() const =0
virtual LedgerMaster & getLedgerMaster()=0
virtual ~Application()=default
virtual std::uint64_t instanceID() const =0
Returns a 64-bit instance identifier, generated at startup.
virtual RelationalDatabase & getRelationalDatabase()=0
virtual ManifestCache & validatorManifests()=0
virtual int fdRequired() const =0
virtual PathRequests & getPathRequests()=0
virtual TxQ & getTxQ()=0
virtual PeerReservationTable & peerReservations()=0
virtual perf::PerfLog & getPerfLog()=0
virtual Cluster & cluster()=0
virtual LedgerIndex getMaxDisallowedLedger()=0
Ensure that a newly-started validator does not sign proposals older than the last ledger it persisted...
virtual void checkSigs(bool)=0
virtual LoadManager & getLoadManager()=0
virtual TransactionMaster & getMasterTransaction()=0
virtual AmendmentTable & getAmendmentTable()=0
virtual Logs & logs()=0
virtual ManifestCache & publisherManifests()=0
virtual HashRouter & getHashRouter()=0
virtual boost::asio::io_context & getIOContext()=0
virtual void signalStop(std::string msg)=0
virtual std::pair< PublicKey, SecretKey > const & nodeIdentity()=0
virtual PendingSaves & pendingSaves()=0
virtual OpenLedger const & openLedger() const =0
Provides the beast::insight::Collector service.
Routing table for objects identified by hash.
Definition HashRouter.h:97
Manages the lifetime of inbound ledgers.
Manages the acquisition and lifetime of transaction sets.
A pool of threads to perform work.
Definition JobQueue.h:58
Check the ledger/transaction databases to make sure they have continuity.
Manages the lifetime of ledger replay tasks.
Manages the current fee schedule.
Manages load sources.
Definition LoadManager.h:46
Manages partitions for logging.
Definition Log.h:52
Remembers manifests with the highest sequence number.
Definition Manifest.h:256
Provides server functionality for clients.
Definition NetworkOPs.h:89
Persistency layer for NodeObject.
Definition Database.h:51
Represents the open ledger.
Definition OpenLedger.h:52
Manages the set of connected peers.
Definition Overlay.h:49
Keeps track of which ledgers haven't been fully saved.
Generic validations adaptor class for RCL.
Tracks load and resource consumption.
class to create database, launch online delete thread, and related SQLite database
Definition SHAMapStore.h:38
Manages various times used by the server.
Definition TimeKeeper.h:32
Transaction Queue.
Definition TxQ.h:61
Maintains current and recent ledger validations.
Singleton class that maintains performance counters and optionally writes Json-formatted data to a di...
Definition PerfLog.h:52
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
std::unique_ptr< Application > make_Application(std::unique_ptr< Config > config, std::unique_ptr< Logs > logs, std::unique_ptr< TimeKeeper > timeKeeper)
TaggedCache< uint256, SLE const > CachedSLEs
Definition CachedSLEs.h:28
STLedgerEntry SLE