xrpld
Loading...
Searching...
No Matches
Application.h
1#pragma once
2
3#include <xrpld/core/Config.h>
4
5#include <xrpl/basics/Blob.h>
6#include <xrpl/basics/SHAMapHash.h>
7#include <xrpl/basics/TaggedCache.h>
8#include <xrpl/basics/base_uint.h>
9#include <xrpl/beast/utility/PropertyStream.h>
10#include <xrpl/core/ServiceRegistry.h>
11#include <xrpl/protocol/Protocol.h>
12
13#include <boost/asio.hpp>
14#include <boost/program_options.hpp>
15
16#include <chrono>
17#include <cstddef>
18#include <cstdint>
19#include <memory>
20#include <mutex>
21#include <optional>
22#include <string>
23#include <utility>
24
25namespace xrpl {
26
27namespace perf {
28class PerfLog;
29} // namespace perf
30
31// VFALCO TODO Fix forward declares required for header dependency loops
32class AmendmentTable;
33
34template <
35 class Key,
36 class T,
37 bool IsKeyCache,
38 class SharedWeakUnionPointer,
39 class SharedPointerType,
40 class Hash,
41 class KeyEqual,
42 class Mutex>
43class TaggedCache;
44class STLedgerEntry;
45using SLE = STLedgerEntry;
47
49class Family;
50class HashRouter;
51class Logs;
52class LoadFeeTrack;
53class JobQueue;
54class InboundLedgers;
56class AcceptedLedger;
57class Ledger;
58class LedgerMaster;
59class LedgerCleaner;
60class LedgerReplayer;
61class LoadManager;
62class ManifestCache;
63class ValidatorKeys;
64class NetworkOPs;
65class OpenLedger;
66class OrderBookDB;
67class Overlay;
69class PendingSaves;
70class PublicKey;
71class ServerHandler;
72class SecretKey;
73class STLedgerEntry;
74class TimeKeeper;
76class TxQ;
77
78class ValidatorList;
79class ValidatorSite;
80class Cluster;
81
83class DatabaseCon;
84class SHAMapStore;
85
87
88template <class Adaptor>
89class Validations;
92
94{
95public:
96 /* VFALCO NOTE
97
98 The master mutex protects:
99
100 - The open ledger
101 - Server global state
102 * What the last closed ledger is
103 * State of the consensus engine
104
105 other things
106 */
108 virtual MutexType&
110
111public:
112 Application();
113
114 virtual bool
115 setup(boost::program_options::variables_map const& options) = 0;
116
117 virtual void
118 start(bool withTimers) = 0;
119 virtual void
120 run() = 0;
121 virtual void
122 signalStop(std::string const& msg) = 0;
123 [[nodiscard]] virtual bool
124 checkSigs() const = 0;
125 virtual void
126 checkSigs(bool) = 0;
127
128 //
129 // ---
130 //
131
135 [[nodiscard]] virtual std::uint64_t
136 instanceID() const = 0;
137
138 virtual Config&
139 config() = 0;
140
143
144 [[nodiscard]] virtual std::optional<PublicKey const>
146
149
150 virtual bool
152
153 /* Returns the number of file descriptors the application needs */
154 [[nodiscard]] virtual int
155 fdRequired() const = 0;
156
161 virtual LedgerIndex
163
167 [[nodiscard]] virtual size_t
169};
170
175 std::unique_ptr<TimeKeeper> timeKeeper);
176
177} // namespace xrpl
Subclasses can be called to write to a stream and have children.
A ledger that has become irrevocable.
The amendment table stores the list of enabled and potential amendments.
virtual size_t getNumberOfThreads() const =0
Returns the number of io_context (I/O worker) threads used by the application.
virtual bool setup(boost::program_options::variables_map const &options)=0
virtual std::chrono::milliseconds getIOLatency()=0
std::recursive_mutex MutexType
virtual Config & config()=0
virtual std::uint64_t instanceID() const =0
Returns a 64-bit instance identifier, generated at startup.
virtual bool checkSigs() const =0
virtual int fdRequired() const =0
virtual LedgerIndex getMaxDisallowedLedger()=0
Ensure that a newly-started validator does not sign proposals older than the last ledger it persisted...
virtual void signalStop(std::string const &msg)=0
virtual void run()=0
virtual std::optional< PublicKey const > getValidationPublicKey() const =0
virtual bool serverOkay(std::string &reason)=0
virtual void checkSigs(bool)=0
virtual MutexType & getMasterMutex()=0
virtual void start(bool withTimers)=0
virtual std::pair< PublicKey, SecretKey > const & nodeIdentity()=0
Provides the beast::insight::Collector service.
Routing table for objects identified by hash.
Definition HashRouter.h:89
Manages the lifetime of inbound ledgers.
Manages the acquisition and lifetime of transaction sets.
A pool of threads to perform work.
Definition JobQueue.h:60
Check the ledger/transaction databases to make sure they have continuity.
Tracks the current ledger and any ledgers in the process of closing.
Manages the lifetime of ledger replay tasks.
Manages the current fee schedule.
Manages load sources.
Definition LoadManager.h:28
Manages partitions for logging.
Definition Log.h:23
Remembers manifests with the highest sequence number.
Definition Manifest.h:374
Provides server functionality for clients.
Definition NetworkOPs.h:82
Represents the open ledger.
Definition OpenLedger.h:43
Tracks order books in the ledger.
Definition OrderBookDB.h:30
Manages the set of connected peers.
Definition Overlay.h:38
Keeps track of which ledgers haven't been fully saved.
A public key.
Definition PublicKey.h:53
Generic validations adaptor class for RCL.
class to create database, launch online delete thread, and related SQLite database
Definition SHAMapStore.h:25
A serialized ledger entry, commonly abbreviated "SLE".
A secret key.
Definition SecretKey.h:24
Map/cache combination.
Definition TaggedCache.h:67
Manages various times used by the server.
Definition TimeKeeper.h:15
Transaction Queue.
Definition TxQ.h:59
Maintains current and recent ledger validations.
Validator keys and manifest as set in configuration file.
Singleton class that maintains performance counters and optionally writes Json-formatted data to a di...
Definition PerfLog.h:33
Dummy class for unit tests.
Definition Workers.h:14
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
std::uint32_t LedgerIndex
A ledger index.
Definition Protocol.h:382
TaggedCache< UInt256, SLE const > CachedSLEs
STLedgerEntry SLE
Validations< RCLValidationsAdaptor > RCLValidations
Alias for RCL-specific instantiation of generic Validations.
std::unique_ptr< Application > makeApplication(std::unique_ptr< Config > config, std::unique_ptr< Logs > logs, std::unique_ptr< TimeKeeper > timeKeeper)
TaggedCache< SHAMapHash, Blob > NodeCache