xrpld
Loading...
Searching...
No Matches
Node.h
1#pragma once
2
3#include <xrpld/core/Config.h>
4
5#include <xrpl/ledger/Ledger.h>
6#include <xrpl/rdb/RelationalDatabase.h>
7
8namespace xrpl::detail {
9
10/* Need to change TableTypeCount if TableType is modified. */
12constexpr int kTableTypeCount = 3;
13
20
32 Config const& config,
33 DatabaseCon::Setup const& setup,
34 DatabaseCon::CheckpointerSetup const& checkpointerSetup,
36
44getMinLedgerSeq(soci::session& session, TableType type);
45
53getMaxLedgerSeq(soci::session& session, TableType type);
54
62void
63deleteByLedgerSeq(soci::session& session, TableType type, LedgerIndex ledgerSeq);
64
72void
73deleteBeforeLedgerSeq(soci::session& session, TableType type, LedgerIndex ledgerSeq);
74
82getRows(soci::session& session, TableType type);
83
93getRowsMinMax(soci::session& session, TableType type);
94
104bool
106 DatabaseCon& ldgDB,
107 std::unique_ptr<DatabaseCon> const& txnDB,
108 Application& app,
109 std::shared_ptr<Ledger const> const& ledger,
110 bool current);
111
120getLedgerInfoByIndex(soci::session& session, LedgerIndex ledgerSeq, beast::Journal j);
121
129getNewestLedgerInfo(soci::session& session, beast::Journal j);
130
140getLimitedOldestLedgerInfo(soci::session& session, LedgerIndex ledgerFirstIndex, beast::Journal j);
141
151getLimitedNewestLedgerInfo(soci::session& session, LedgerIndex ledgerFirstIndex, beast::Journal j);
152
161getLedgerInfoByHash(soci::session& session, uint256 const& ledgerHash, beast::Journal j);
162
170getHashByIndex(soci::session& session, LedgerIndex ledgerIndex);
171
182getHashesByIndex(soci::session& session, LedgerIndex ledgerIndex, beast::Journal j);
183
196getHashesByIndex(soci::session& session, LedgerIndex minSeq, LedgerIndex maxSeq, beast::Journal j);
197
210getTxHistory(soci::session& session, Application& app, LedgerIndex startIndex, int quantity);
211
233 soci::session& session,
234 Application& app,
235 LedgerMaster& ledgerMaster,
238
260 soci::session& session,
261 Application& app,
262 LedgerMaster& ledgerMaster,
265
287 soci::session& session,
288 Application& app,
291
313 soci::session& session,
314 Application& app,
317
338 soci::session& session,
339 std::function<void(std::uint32_t)> const& onUnsavedLedger,
340 std::function<void(std::uint32_t, std::string const&, Blob&&, Blob&&)> const& onTransaction,
342 std::uint32_t pageLength);
343
364 soci::session& session,
365 std::function<void(std::uint32_t)> const& onUnsavedLedger,
366 std::function<void(std::uint32_t, std::string const&, Blob&&, Blob&&)> const& onTransaction,
368 std::uint32_t pageLength);
369
388 soci::session& session,
389 Application& app,
390 uint256 const& id,
392 ErrorCodeI& ec);
393
401bool
402dbHasSpace(soci::session& session, Config const& config, beast::Journal j);
403
404} // namespace xrpl::detail
A generic endpoint for log messages.
Definition Journal.h:38
std::optional< LedgerHeader > getLedgerInfoByHash(soci::session &session, uint256 const &ledgerHash, beast::Journal j)
getLedgerInfoByHash Returns info of ledger with given hash.
Definition Node.cpp:519
std::pair< std::optional< RelationalDatabase::AccountTxMarker >, int > newestAccountTxPage(soci::session &session, std::function< void(std::uint32_t)> const &onUnsavedLedger, std::function< void(std::uint32_t, std::string const &, Blob &&, Blob &&)> const &onTransaction, RelationalDatabase::AccountTxPageOptions const &options, std::uint32_t pageLength)
newestAccountTxPage Searches newest transactions for given account which match given criteria startin...
Definition Node.cpp:1176
constexpr int kTableTypeCount
Definition Node.h:12
bool saveValidatedLedger(DatabaseCon &ldgDB, std::unique_ptr< DatabaseCon > const &txnDB, Application &app, std::shared_ptr< Ledger const > const &ledger, bool current)
saveValidatedLedger Saves ledger into database.
Definition Node.cpp:213
std::pair< std::optional< RelationalDatabase::AccountTxMarker >, int > oldestAccountTxPage(soci::session &session, std::function< void(std::uint32_t)> const &onUnsavedLedger, std::function< void(std::uint32_t, std::string const &, Blob &&, Blob &&)> const &onTransaction, RelationalDatabase::AccountTxPageOptions const &options, std::uint32_t pageLength)
oldestAccountTxPage Searches oldest transactions for given account which match given criteria startin...
Definition Node.cpp:1165
void deleteBeforeLedgerSeq(soci::session &session, TableType type, LedgerIndex ledgerSeq)
deleteBeforeLedgerSeq Deletes all entries in given table for the ledgers with given sequence and all ...
Definition Node.cpp:180
std::optional< LedgerIndex > getMinLedgerSeq(soci::session &session, TableType type)
getMinLedgerSeq Returns minimum ledger sequence in given table.
Definition Node.cpp:154
std::optional< LedgerIndex > getMaxLedgerSeq(soci::session &session, TableType type)
getMaxLedgerSeq Returns maximum ledger sequence in given table.
Definition Node.cpp:164
std::pair< RelationalDatabase::AccountTxs, int > getNewestAccountTxs(soci::session &session, Application &app, LedgerMaster &ledgerMaster, RelationalDatabase::AccountTxOptions const &options, beast::Journal j)
getNewestAccountTxs Returns newest transactions for given account which match given criteria starting...
Definition Node.cpp:879
std::pair< std::vector< std::shared_ptr< Transaction > >, int > getTxHistory(soci::session &session, Application &app, LedgerIndex startIndex, int quantity)
getTxHistory Returns given number of most recent transactions starting from given number of entry.
Definition Node.cpp:620
std::pair< std::vector< RelationalDatabase::txnMetaLedgerType >, int > getOldestAccountTxsB(soci::session &session, Application &app, RelationalDatabase::AccountTxOptions const &options, beast::Journal j)
getOldestAccountTxsB Returns oldest transactions in binary form for given account which match given c...
Definition Node.cpp:967
std::optional< LedgerHeader > getNewestLedgerInfo(soci::session &session, beast::Journal j)
getNewestLedgerInfo Returns info of newest saved ledger.
Definition Node.cpp:493
std::optional< LedgerHeader > getLimitedOldestLedgerInfo(soci::session &session, LedgerIndex ledgerFirstIndex, beast::Journal j)
getLimitedOldestLedgerInfo Returns info of oldest ledger from ledgers with sequences greater or equal...
Definition Node.cpp:501
DatabasePairValid makeLedgerDBs(Config const &config, DatabaseCon::Setup const &setup, DatabaseCon::CheckpointerSetup const &checkpointerSetup, beast::Journal j)
makeLedgerDBs Opens ledger and transactions databases.
Definition Node.cpp:98
RelationalDatabase::CountMinMax getRowsMinMax(soci::session &session, TableType type)
getRowsMinMax Returns minimum ledger sequence, maximum ledger sequence and total number of rows in gi...
Definition Node.cpp:198
std::size_t getRows(soci::session &session, TableType type)
getRows Returns number of rows in given table.
Definition Node.cpp:186
std::optional< LedgerHeader > getLedgerInfoByIndex(soci::session &session, LedgerIndex ledgerSeq, beast::Journal j)
getLedgerInfoByIndex Returns ledger by its sequence.
Definition Node.cpp:485
std::pair< std::vector< RelationalDatabase::txnMetaLedgerType >, int > getNewestAccountTxsB(soci::session &session, Application &app, RelationalDatabase::AccountTxOptions const &options, beast::Journal j)
getNewestAccountTxsB Returns newest transactions in binary form for given account which match given c...
Definition Node.cpp:977
uint256 getHashByIndex(soci::session &session, LedgerIndex ledgerIndex)
getHashByIndex Returns hash of ledger with given sequence.
Definition Node.cpp:527
void deleteByLedgerSeq(soci::session &session, TableType type, LedgerIndex ledgerSeq)
deleteByLedgerSeq Deletes all entries in given table for the ledger with given sequence.
Definition Node.cpp:174
std::pair< RelationalDatabase::AccountTxs, int > getOldestAccountTxs(soci::session &session, Application &app, LedgerMaster &ledgerMaster, RelationalDatabase::AccountTxOptions const &options, beast::Journal j)
getOldestAccountTxs Returns oldest transactions for given account which match given criteria starting...
Definition Node.cpp:868
bool dbHasSpace(soci::session &session, Config const &config, beast::Journal j)
dbHasSpace Checks if given database has available space.
Definition Node.cpp:1263
std::optional< LedgerHeader > getLimitedNewestLedgerInfo(soci::session &session, LedgerIndex ledgerFirstIndex, beast::Journal j)
getLimitedNewestLedgerInfo Returns info of newest ledger from ledgers with sequences greater or equal...
Definition Node.cpp:510
std::variant< RelationalDatabase::AccountTx, TxSearched > getTransaction(soci::session &session, Application &app, uint256 const &id, std::optional< ClosedInterval< uint32_t > > const &range, ErrorCodeI &ec)
getTransaction Returns transaction with given hash.
Definition Node.cpp:1187
std::optional< LedgerHashPair > getHashesByIndex(soci::session &session, LedgerIndex ledgerIndex, beast::Journal j)
getHashesByIndex Returns hash of the ledger and hash of parent ledger for the ledger of given sequenc...
Definition Node.cpp:556
ErrorCodeI
Definition ErrorCodes.h:22
std::uint32_t LedgerIndex
A ledger index.
Definition Protocol.h:259
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
Definition RangeSet.h:34
boost::icl::closed_interval< T > ClosedInterval
A closed interval over the domain T.
Definition RangeSet.h:25
std::vector< unsigned char > Blob
Storage for linear binary data.
Definition Blob.h:10
BaseUInt< 256 > uint256
Definition base_uint.h:562
std::unique_ptr< DatabaseCon > transactionDb
Definition Node.h:17
std::unique_ptr< DatabaseCon > ledgerDb
Definition Node.h:16