rippled
Loading...
Searching...
No Matches
Node.h
1#ifndef XRPL_APP_RDB_BACKEND_DETAIL_NODE_H_INCLUDED
2#define XRPL_APP_RDB_BACKEND_DETAIL_NODE_H_INCLUDED
3
4#include <xrpld/app/ledger/Ledger.h>
5#include <xrpld/app/rdb/RelationalDatabase.h>
6#include <xrpld/core/Config.h>
7
8namespace ripple {
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
65 soci::session& session,
66 TableType type,
67 LedgerIndex ledgerSeq);
68
76void
78 soci::session& session,
79 TableType type,
80 LedgerIndex ledgerSeq);
81
89getRows(soci::session& session, TableType type);
90
100getRowsMinMax(soci::session& session, TableType type);
101
111bool
113 DatabaseCon& ldgDB,
114 DatabaseCon& txnDB,
115 Application& app,
116 std::shared_ptr<Ledger const> const& ledger,
117 bool current);
118
128 soci::session& session,
129 LedgerIndex ledgerSeq,
131
139getNewestLedgerInfo(soci::session& session, beast::Journal j);
140
151 soci::session& session,
152 LedgerIndex ledgerFirstIndex,
154
165 soci::session& session,
166 LedgerIndex ledgerFirstIndex,
168
178 soci::session& session,
179 uint256 const& ledgerHash,
181
189getHashByIndex(soci::session& session, LedgerIndex ledgerIndex);
190
202 soci::session& session,
203 LedgerIndex ledgerIndex,
205
219 soci::session& session,
220 LedgerIndex minSeq,
221 LedgerIndex maxSeq,
223
237 soci::session& session,
238 Application& app,
239 LedgerIndex startIndex,
240 int quantity);
241
263 soci::session& session,
264 Application& app,
268
290 soci::session& session,
291 Application& app,
295
317 soci::session& session,
318 Application& app,
321
343 soci::session& session,
344 Application& app,
347
368 soci::session& session,
369 std::function<void(std::uint32_t)> const& onUnsavedLedger,
371 void(std::uint32_t, std::string const&, Blob&&, Blob&&)> const&
372 onTransaction,
374 std::uint32_t page_length);
375
396 soci::session& session,
397 std::function<void(std::uint32_t)> const& onUnsavedLedger,
399 void(std::uint32_t, std::string const&, Blob&&, Blob&&)> const&
400 onTransaction,
402 std::uint32_t page_length);
403
422 soci::session& session,
423 Application& app,
424 uint256 const& id,
426 error_code_i& ec);
427
435bool
436dbHasSpace(soci::session& session, Config const& config, beast::Journal j);
437
438} // namespace detail
439} // namespace ripple
440
441#endif
A generic endpoint for log messages.
Definition Journal.h:41
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:157
uint256 getHashByIndex(soci::session &session, LedgerIndex ledgerIndex)
getHashByIndex Returns hash of ledger with given sequence.
Definition Node.cpp:506
std::optional< LedgerInfo > getLimitedNewestLedgerInfo(soci::session &session, LedgerIndex ledgerFirstIndex, beast::Journal j)
getLimitedNewestLedgerInfo Returns info of newest ledger from ledgers with sequences greather or equa...
Definition Node.cpp:483
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:1162
std::optional< LedgerInfo > getNewestLedgerInfo(soci::session &session, beast::Journal j)
getNewestLedgerInfo Returns info of newest saved ledger.
Definition Node.cpp:463
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:1148
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:51
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:128
std::size_t getRows(soci::session &session, TableType type)
getRows Returns number of rows in given table.
Definition Node.cpp:145
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:135
bool saveValidatedLedger(DatabaseCon &ldgDB, DatabaseCon &txnDB, Application &app, std::shared_ptr< Ledger const > const &ledger, bool current)
saveValidatedLedger Saves ledger into database.
Definition Node.cpp:172
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:855
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:612
constexpr int TableTypeCount
Definition Node.h:13
std::optional< LedgerInfo > getLimitedOldestLedgerInfo(soci::session &session, LedgerIndex ledgerFirstIndex, beast::Journal j)
getLimitedOldestLedgerInfo Returns info of oldest ledger from ledgers with sequences greather or equa...
Definition Node.cpp:471
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:955
std::optional< LedgerInfo > getLedgerInfoByIndex(soci::session &session, LedgerIndex ledgerSeq, beast::Journal j)
getLedgerInfoByIndex Returns ledger by its sequence.
Definition Node.cpp:452
bool dbHasSpace(soci::session &session, Config const &config, beast::Journal j)
dbHasSpace Checks if given database has available space.
Definition Node.cpp:1257
std::optional< LedgerInfo > getLedgerInfoByHash(soci::session &session, uint256 const &ledgerHash, beast::Journal j)
getLedgerInfoByHash Returns info of ledger with given hash.
Definition Node.cpp:495
std::optional< LedgerIndex > getMinLedgerSeq(soci::session &session, TableType type)
getMinLedgerSeq Returns minimum ledger sequence in given table.
Definition Node.cpp:108
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:866
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:965
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:536
std::optional< LedgerIndex > getMaxLedgerSeq(soci::session &session, TableType type)
getMaxLedgerSeq Returns maximum ledger sequence in given table.
Definition Node.cpp:118
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:1176
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
@ 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:26
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
Definition RangeSet.h:35
@ ledgerMaster
ledger master data for signing
std::unique_ptr< DatabaseCon > ledgerDb
Definition Node.h:17
std::unique_ptr< DatabaseCon > transactionDb
Definition Node.h:18