rippled
Loading...
Searching...
No Matches
Node.h
1#pragma once
2
3#include <xrpld/app/ledger/Ledger.h>
4#include <xrpld/core/Config.h>
5
6#include <xrpl/rdb/RelationalDatabase.h>
7
8namespace xrpl {
9namespace detail {
10
11/* Need to change TableTypeCount if TableType is modified. */
13constexpr int TableTypeCount = 3;
14
21
33 Config const& config,
34 DatabaseCon::Setup const& setup,
35 DatabaseCon::CheckpointerSetup const& checkpointerSetup,
37
45getMinLedgerSeq(soci::session& session, TableType type);
46
54getMaxLedgerSeq(soci::session& session, TableType type);
55
63void
64deleteByLedgerSeq(soci::session& session, TableType type, LedgerIndex ledgerSeq);
65
73void
74deleteBeforeLedgerSeq(soci::session& session, TableType type, LedgerIndex ledgerSeq);
75
83getRows(soci::session& session, TableType type);
84
94getRowsMinMax(soci::session& session, TableType type);
95
105bool
107 DatabaseCon& ldgDB,
108 std::unique_ptr<DatabaseCon> const& txnDB,
109 Application& app,
110 std::shared_ptr<Ledger const> const& ledger,
111 bool current);
112
121getLedgerInfoByIndex(soci::session& session, LedgerIndex ledgerSeq, beast::Journal j);
122
130getNewestLedgerInfo(soci::session& session, beast::Journal j);
131
141getLimitedOldestLedgerInfo(soci::session& session, LedgerIndex ledgerFirstIndex, beast::Journal j);
142
152getLimitedNewestLedgerInfo(soci::session& session, LedgerIndex ledgerFirstIndex, beast::Journal j);
153
162getLedgerInfoByHash(soci::session& session, uint256 const& ledgerHash, beast::Journal j);
163
171getHashByIndex(soci::session& session, LedgerIndex ledgerIndex);
172
183getHashesByIndex(soci::session& session, LedgerIndex ledgerIndex, beast::Journal j);
184
197getHashesByIndex(soci::session& session, LedgerIndex minSeq, LedgerIndex maxSeq, beast::Journal j);
198
211getTxHistory(soci::session& session, Application& app, LedgerIndex startIndex, int quantity);
212
234 soci::session& session,
235 Application& app,
239
261 soci::session& session,
262 Application& app,
266
288 soci::session& session,
289 Application& app,
292
314 soci::session& session,
315 Application& app,
318
339 soci::session& session,
340 std::function<void(std::uint32_t)> const& onUnsavedLedger,
341 std::function<void(std::uint32_t, std::string const&, Blob&&, Blob&&)> const& onTransaction,
343 std::uint32_t page_length);
344
365 soci::session& session,
366 std::function<void(std::uint32_t)> const& onUnsavedLedger,
367 std::function<void(std::uint32_t, std::string const&, Blob&&, Blob&&)> const& onTransaction,
369 std::uint32_t page_length);
370
389 soci::session& session,
390 Application& app,
391 uint256 const& id,
393 error_code_i& ec);
394
402bool
403dbHasSpace(soci::session& session, Config const& config, beast::Journal j);
404
405} // namespace detail
406} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:40
std::optional< LedgerHeader > getLedgerInfoByHash(soci::session &session, uint256 const &ledgerHash, beast::Journal j)
getLedgerInfoByHash Returns info of ledger with given hash.
Definition Node.cpp:449
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:158
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:126
std::optional< LedgerIndex > getMinLedgerSeq(soci::session &session, TableType type)
getMinLedgerSeq Returns minimum ledger sequence in given table.
Definition Node.cpp:100
std::optional< LedgerIndex > getMaxLedgerSeq(soci::session &session, TableType type)
getMaxLedgerSeq Returns maximum ledger sequence in given table.
Definition Node.cpp:110
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:775
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:550
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:857
std::optional< LedgerHeader > getNewestLedgerInfo(soci::session &session, beast::Journal j)
getNewestLedgerInfo Returns info of newest saved ledger.
Definition Node.cpp:425
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:433
std::variant< RelationalDatabase::AccountTx, TxSearched > getTransaction(soci::session &session, Application &app, uint256 const &id, std::optional< ClosedInterval< uint32_t > > const &range, error_code_i &ec)
getTransaction Returns transaction with given hash.
Definition Node.cpp:1061
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:49
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:144
std::size_t getRows(soci::session &session, TableType type)
getRows Returns number of rows in given table.
Definition Node.cpp:132
std::optional< LedgerHeader > getLedgerInfoByIndex(soci::session &session, LedgerIndex ledgerSeq, beast::Journal j)
getLedgerInfoByIndex Returns ledger by its sequence.
Definition Node.cpp:417
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:867
uint256 getHashByIndex(soci::session &session, LedgerIndex ledgerIndex)
getHashByIndex Returns hash of ledger with given sequence.
Definition Node.cpp:457
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:120
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:764
bool dbHasSpace(soci::session &session, Config const &config, beast::Journal j)
dbHasSpace Checks if given database has available space.
Definition Node.cpp:1136
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:441
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 page_length)
oldestAccountTxPage Searches oldest transactions for given account which match given criteria startin...
Definition Node.cpp:1039
constexpr int TableTypeCount
Definition Node.h:13
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 page_length)
newestAccountTxPage Searches newest transactions for given account which match given criteria startin...
Definition Node.cpp:1050
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:486
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
Definition RangeSet.h:34
@ current
This was a new validation and was added.
boost::icl::closed_interval< T > ClosedInterval
A closed interval over the domain T.
Definition RangeSet.h:25
@ ledgerMaster
ledger master data for signing
error_code_i
Definition ErrorCodes.h:20
std::unique_ptr< DatabaseCon > transactionDb
Definition Node.h:18
std::unique_ptr< DatabaseCon > ledgerDb
Definition Node.h:17