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/TreeNodeCache.h>
26
27#include <xrpl/basics/TaggedCache.h>
28#include <xrpl/beast/utility/PropertyStream.h>
29#include <xrpl/protocol/Protocol.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 Hash,
59 class KeyEqual,
60 class Mutex>
61class TaggedCache;
62class STLedgerEntry;
63using SLE = STLedgerEntry;
65
67class Family;
68class HashRouter;
69class Logs;
70class LoadFeeTrack;
71class JobQueue;
72class InboundLedgers;
74class AcceptedLedger;
75class Ledger;
76class LedgerMaster;
77class LedgerCleaner;
78class LedgerReplayer;
79class LoadManager;
80class ManifestCache;
81class ValidatorKeys;
82class NetworkOPs;
83class OpenLedger;
84class OrderBookDB;
85class Overlay;
86class PathRequests;
87class PendingSaves;
88class PublicKey;
89class ServerHandler;
90class SecretKey;
91class STLedgerEntry;
92class TimeKeeper;
94class TxQ;
95
96class ValidatorList;
97class ValidatorSite;
98class Cluster;
99
101class DatabaseCon;
102class SHAMapStore;
103
105
106template <class Adaptor>
107class Validations;
110
112{
113public:
114 /* VFALCO NOTE
115
116 The master mutex protects:
117
118 - The open ledger
119 - Server global state
120 * What the last closed ledger is
121 * State of the consensus engine
122
123 other things
124 */
126 virtual MutexType&
128
129public:
130 Application();
131
132 virtual ~Application() = default;
133
134 virtual bool
135 setup(boost::program_options::variables_map const& options) = 0;
136
137 virtual void
138 start(bool withTimers) = 0;
139 virtual void
140 run() = 0;
141 virtual void
142 signalStop(std::string msg = "") = 0;
143 virtual bool
144 checkSigs() const = 0;
145 virtual void
146 checkSigs(bool) = 0;
147 virtual bool
148 isStopping() const = 0;
149
150 //
151 // ---
152 //
153
155 virtual std::uint64_t
156 instanceID() const = 0;
157
158 virtual Logs&
159 logs() = 0;
160 virtual Config&
161 config() = 0;
162
163 virtual boost::asio::io_service&
165
166 virtual CollectorManager&
168 virtual Family&
170 virtual TimeKeeper&
172 virtual JobQueue&
174 virtual NodeCache&
176 virtual CachedSLEs&
178 virtual AmendmentTable&
180 virtual HashRouter&
182 virtual LoadFeeTrack&
184 virtual LoadManager&
186 virtual Overlay&
187 overlay() = 0;
188 virtual TxQ&
189 getTxQ() = 0;
190 virtual ValidatorList&
192 virtual ValidatorSite&
194 virtual ManifestCache&
196 virtual ManifestCache&
198 virtual Cluster&
199 cluster() = 0;
200 virtual PeerReservationTable&
202 virtual RCLValidations&
204 virtual NodeStore::Database&
206 virtual InboundLedgers&
208 virtual InboundTransactions&
210
213
214 virtual LedgerMaster&
216 virtual LedgerCleaner&
218 virtual LedgerReplayer&
220 virtual NetworkOPs&
221 getOPs() = 0;
222 virtual OrderBookDB&
224 virtual ServerHandler&
226 virtual TransactionMaster&
228 virtual perf::PerfLog&
230
233
236
237 virtual Resource::Manager&
239 virtual PathRequests&
241 virtual SHAMapStore&
243 virtual PendingSaves&
245 virtual OpenLedger&
247 virtual OpenLedger const&
248 openLedger() const = 0;
249 virtual RelationalDatabase&
251
254
255 virtual bool
257
258 virtual beast::Journal
260
261 /* Returns the number of file descriptors the application needs */
262 virtual int
263 fdRequired() const = 0;
264
266 virtual DatabaseCon&
268
271 virtual LedgerIndex
273
274 virtual const std::optional<uint256>&
275 trapTxID() const = 0;
276};
277
282 std::unique_ptr<TimeKeeper> timeKeeper);
283
284} // namespace ripple
285
286#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.
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:45
Manages load sources.
Definition: LoadManager.h:46
Manages partitions for logging.
Definition: Log.h:51
Remembers manifests with the highest sequence number.
Definition: Manifest.h:256
Provides server functionality for clients.
Definition: NetworkOPs.h:88
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.
Definition: PendingSaves.h:38
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:38
Map/cache combination.
Definition: TaggedCache.h:58
Manages various times used by the server.
Definition: TimeKeeper.h:32
Transaction Queue.
Definition: TxQ.h:61
Maintains current and recent ledger validations.
Definition: Validations.h:290
Validator keys and manifest as set in configuration file.
Definition: ValidatorKeys.h:38
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: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