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#include <xrpld/shamap/FullBelowCache.h>
26#include <xrpld/shamap/TreeNodeCache.h>
27#include <xrpl/basics/TaggedCache.h>
28#include <xrpl/beast/utility/PropertyStream.h>
29#include <xrpl/protocol/Protocol.h>
30#include <boost/asio.hpp>
31#include <boost/program_options.hpp>
32#include <memory>
33#include <mutex>
34
35namespace ripple {
36
37namespace unl {
38class Manager;
39}
40namespace Resource {
41class Manager;
42}
43namespace NodeStore {
44class Database;
45} // namespace NodeStore
46namespace perf {
47class PerfLog;
48}
49
50// VFALCO TODO Fix forward declares required for header dependency loops
51class AmendmentTable;
52
53template <
54 class Key,
55 class T,
56 bool IsKeyCache,
57 class Hash,
58 class KeyEqual,
59 class Mutex>
60class TaggedCache;
61class STLedgerEntry;
62using SLE = STLedgerEntry;
64
66class Family;
67class HashRouter;
68class Logs;
69class LoadFeeTrack;
70class JobQueue;
71class InboundLedgers;
73class AcceptedLedger;
74class Ledger;
75class LedgerMaster;
76class LedgerCleaner;
77class LedgerReplayer;
78class LoadManager;
79class ManifestCache;
80class ValidatorKeys;
81class NetworkOPs;
82class OpenLedger;
83class OrderBookDB;
84class Overlay;
85class PathRequests;
86class PendingSaves;
87class PublicKey;
88class ServerHandler;
89class SecretKey;
90class STLedgerEntry;
91class TimeKeeper;
93class TxQ;
94
95class ValidatorList;
96class ValidatorSite;
97class Cluster;
98
100class DatabaseCon;
101class SHAMapStore;
102
104
105template <class Adaptor>
106class Validations;
109
111{
112public:
113 /* VFALCO NOTE
114
115 The master mutex protects:
116
117 - The open ledger
118 - Server global state
119 * What the last closed ledger is
120 * State of the consensus engine
121
122 other things
123 */
125 virtual MutexType&
127
128public:
129 Application();
130
131 virtual ~Application() = default;
132
133 virtual bool
134 setup(boost::program_options::variables_map const& options) = 0;
135
136 virtual void
137 start(bool withTimers) = 0;
138 virtual void
139 run() = 0;
140 virtual void
141 signalStop(std::string msg = "") = 0;
142 virtual bool
143 checkSigs() const = 0;
144 virtual void
145 checkSigs(bool) = 0;
146 virtual bool
147 isStopping() const = 0;
148
149 //
150 // ---
151 //
152
154 virtual std::uint64_t
155 instanceID() const = 0;
156
157 virtual Logs&
158 logs() = 0;
159 virtual Config&
160 config() = 0;
161
162 virtual boost::asio::io_service&
164
165 virtual CollectorManager&
167 virtual Family&
169 virtual TimeKeeper&
171 virtual JobQueue&
173 virtual NodeCache&
175 virtual CachedSLEs&
177 virtual AmendmentTable&
179 virtual HashRouter&
181 virtual LoadFeeTrack&
183 virtual LoadManager&
185 virtual Overlay&
186 overlay() = 0;
187 virtual TxQ&
188 getTxQ() = 0;
189 virtual ValidatorList&
191 virtual ValidatorSite&
193 virtual ManifestCache&
195 virtual ManifestCache&
197 virtual Cluster&
198 cluster() = 0;
199 virtual PeerReservationTable&
201 virtual RCLValidations&
203 virtual NodeStore::Database&
205 virtual InboundLedgers&
207 virtual InboundTransactions&
209
212
213 virtual LedgerMaster&
215 virtual LedgerCleaner&
217 virtual LedgerReplayer&
219 virtual NetworkOPs&
220 getOPs() = 0;
221 virtual OrderBookDB&
223 virtual ServerHandler&
225 virtual TransactionMaster&
227 virtual perf::PerfLog&
229
232
235
236 virtual Resource::Manager&
238 virtual PathRequests&
240 virtual SHAMapStore&
242 virtual PendingSaves&
244 virtual OpenLedger&
246 virtual OpenLedger const&
247 openLedger() const = 0;
248 virtual RelationalDatabase&
250
253
254 virtual bool
256
257 virtual beast::Journal
259
260 /* Returns the number of file descriptors the application needs */
261 virtual int
262 fdRequired() const = 0;
263
265 virtual DatabaseCon&
267
270 virtual LedgerIndex
272
273 virtual const std::optional<uint256>&
274 trapTxID() const = 0;
275};
276
281 std::unique_ptr<TimeKeeper> timeKeeper);
282
283} // namespace ripple
284
285#endif
A generic endpoint for log messages.
Definition: Journal.h:59
Subclasses can be called to write to a stream and have children.
std::string const & name() const
Returns the name of this source.
A ledger that has become irrevocable.
The amendment table stores the list of enabled and potential amendments.
virtual bool serverOkay(std::string &reason)=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 const std::optional< uint256 > & trapTxID() 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 void signalStop(std::string msg="")=0
virtual ValidatorList & validators()=0
virtual boost::asio::io_service & getIOService()=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 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:54
Manages the lifetime of inbound ledgers.
Manages the acquisition and lifetime of transaction sets.
A pool of threads to perform work.
Definition: JobQueue.h:56
Check the ledger/transaction databases to make sure they have continuity.
Definition: LedgerCleaner.h:33
Manages the lifetime of ledger replay tasks.
Holds a ledger.
Definition: Ledger.h:80
Manages the current fee schedule.
Definition: LoadFeeTrack.h:46
Manages load sources.
Definition: LoadManager.h:46
Manages partitions for logging.
Definition: Log.h:49
Remembers manifests with the highest sequence number.
Definition: Manifest.h:256
Provides server functionality for clients.
Definition: NetworkOPs.h:87
Persistency layer for NodeObject.
Definition: Database.h:50
Represents the open ledger.
Definition: OpenLedger.h:50
Manages the set of connected peers.
Definition: Overlay.h:52
Keeps track of which ledgers haven't been fully saved.
Definition: PendingSaves.h:37
A public key.
Definition: PublicKey.h:62
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:37
A secret key.
Definition: SecretKey.h:37
Map/cache combination.
Definition: TaggedCache.h:57
Manages various times used by the server.
Definition: TimeKeeper.h:32
Transaction Queue.
Definition: TxQ.h:58
Maintains current and recent ledger validations.
Definition: Validations.h:289
Validator keys and manifest as set in configuration file.
Definition: ValidatorKeys.h:37
Singleton class that maintains performance counters and optionally writes Json-formatted data to a di...
Definition: PerfLog.h:49
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
std::unique_ptr< Application > make_Application(std::unique_ptr< Config > config, std::unique_ptr< Logs > logs, std::unique_ptr< TimeKeeper > timeKeeper)
STLedgerEntry SLE
Definition: STLedgerEntry.h:97