rippled
Loading...
Searching...
No Matches
SQLiteDatabase.cpp
1#include <xrpld/app/ledger/LedgerMaster.h>
2#include <xrpld/app/ledger/TransactionMaster.h>
3#include <xrpld/app/misc/detail/AccountTxPaging.h>
4#include <xrpld/app/rdb/backend/SQLiteDatabase.h>
5#include <xrpld/app/rdb/backend/detail/Node.h>
6#include <xrpld/core/DatabaseCon.h>
7#include <xrpld/core/SociDB.h>
8
9#include <xrpl/basics/StringUtilities.h>
10
11namespace ripple {
12
14{
15public:
17 Application& app,
18 Config const& config,
19 JobQueue& jobQueue)
20 : app_(app)
21 , useTxTables_(config.useTxTables())
22 , j_(app_.journal("SQLiteDatabaseImp"))
23 {
24 DatabaseCon::Setup const setup = setup_DatabaseCon(config, j_);
25 if (!makeLedgerDBs(
26 config,
27 setup,
29 {
30 std::string_view constexpr error =
31 "Failed to create ledger databases";
32
33 JLOG(j_.fatal()) << error;
34 Throw<std::runtime_error>(error.data());
35 }
36 }
37
39 getMinLedgerSeq() override;
40
43
46
48 getMaxLedgerSeq() override;
49
50 void
51 deleteTransactionByLedgerSeq(LedgerIndex ledgerSeq) override;
52
53 void
54 deleteBeforeLedgerSeq(LedgerIndex ledgerSeq) override;
55
56 void
58
59 void
61
63 getTransactionCount() override;
64
67
69 getLedgerCountMinMax() override;
70
71 bool
74 bool current) override;
75
77 getLedgerInfoByIndex(LedgerIndex ledgerSeq) override;
78
80 getNewestLedgerInfo() override;
81
83 getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) override;
84
86 getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) override;
87
89 getLedgerInfoByHash(uint256 const& ledgerHash) override;
90
92 getHashByIndex(LedgerIndex ledgerIndex) override;
93
95 getHashesByIndex(LedgerIndex ledgerIndex) override;
96
98 getHashesByIndex(LedgerIndex minSeq, LedgerIndex maxSeq) override;
99
101 getTxHistory(LedgerIndex startIndex) override;
102
104 getOldestAccountTxs(AccountTxOptions const& options) override;
105
107 getNewestAccountTxs(AccountTxOptions const& options) override;
108
110 getOldestAccountTxsB(AccountTxOptions const& options) override;
111
113 getNewestAccountTxsB(AccountTxOptions const& options) override;
114
116 oldestAccountTxPage(AccountTxPageOptions const& options) override;
117
119 newestAccountTxPage(AccountTxPageOptions const& options) override;
120
122 oldestAccountTxPageB(AccountTxPageOptions const& options) override;
123
125 newestAccountTxPageB(AccountTxPageOptions const& options) override;
126
129 uint256 const& id,
131 error_code_i& ec) override;
132
133 bool
134 ledgerDbHasSpace(Config const& config) override;
135
136 bool
137 transactionDbHasSpace(Config const& config) override;
138
140 getKBUsedAll() override;
141
143 getKBUsedLedger() override;
144
146 getKBUsedTransaction() override;
147
148 void
149 closeLedgerDB() override;
150
151 void
152 closeTransactionDB() override;
153
154private:
156 bool const useTxTables_;
159
168 bool
170 Config const& config,
171 DatabaseCon::Setup const& setup,
172 DatabaseCon::CheckpointerSetup const& checkpointerSetup);
173
178 bool
180 {
181 return static_cast<bool>(lgrdb_);
182 }
183
189 bool
191 {
192 return static_cast<bool>(txdb_);
193 }
194
200 auto
202 {
203 return lgrdb_->checkoutDb();
204 }
205
211 auto
213 {
214 return txdb_->checkoutDb();
215 }
216};
217
218bool
220 Config const& config,
221 DatabaseCon::Setup const& setup,
222 DatabaseCon::CheckpointerSetup const& checkpointerSetup)
223{
224 auto [lgr, tx, res] =
225 detail::makeLedgerDBs(config, setup, checkpointerSetup, j_);
226 txdb_ = std::move(tx);
227 lgrdb_ = std::move(lgr);
228 return res;
229}
230
233{
234 /* if databases exists, use it */
235 if (existsLedger())
236 {
237 auto db = checkoutLedger();
239 }
240
241 /* else return empty value */
242 return {};
243}
244
247{
248 if (!useTxTables_)
249 return {};
250
251 if (existsTransaction())
252 {
253 auto db = checkoutTransaction();
255 }
256
257 return {};
258}
259
262{
263 if (!useTxTables_)
264 return {};
265
266 if (existsTransaction())
267 {
268 auto db = checkoutTransaction();
271 }
272
273 return {};
274}
275
278{
279 if (existsLedger())
280 {
281 auto db = checkoutLedger();
283 }
284
285 return {};
286}
287
288void
290{
291 if (!useTxTables_)
292 return;
293
294 if (existsTransaction())
295 {
296 auto db = checkoutTransaction();
298 *db, detail::TableType::Transactions, ledgerSeq);
299 return;
300 }
301}
302
303void
305{
306 if (existsLedger())
307 {
308 auto db = checkoutLedger();
310 *db, detail::TableType::Ledgers, ledgerSeq);
311 return;
312 }
313}
314
315void
317{
318 if (!useTxTables_)
319 return;
320
321 if (existsTransaction())
322 {
323 auto db = checkoutTransaction();
325 *db, detail::TableType::Transactions, ledgerSeq);
326 return;
327 }
328}
329
330void
332 LedgerIndex ledgerSeq)
333{
334 if (!useTxTables_)
335 return;
336
337 if (existsTransaction())
338 {
339 auto db = checkoutTransaction();
342 return;
343 }
344}
345
348{
349 if (!useTxTables_)
350 return 0;
351
352 if (existsTransaction())
353 {
354 auto db = checkoutTransaction();
356 }
357
358 return 0;
359}
360
363{
364 if (!useTxTables_)
365 return 0;
366
367 if (existsTransaction())
368 {
369 auto db = checkoutTransaction();
371 }
372
373 return 0;
374}
375
378{
379 if (existsLedger())
380 {
381 auto db = checkoutLedger();
383 }
384
385 return {0, 0, 0};
386}
387
388bool
390 std::shared_ptr<Ledger const> const& ledger,
391 bool current)
392{
393 if (existsLedger())
394 {
396 *lgrdb_, *txdb_, app_, ledger, current))
397 return false;
398 }
399
400 return true;
401}
402
405{
406 if (existsLedger())
407 {
408 auto db = checkoutLedger();
409 auto const res = detail::getLedgerInfoByIndex(*db, ledgerSeq, j_);
410
411 if (res.has_value())
412 return res;
413 }
414
415 return {};
416}
417
420{
421 if (existsLedger())
422 {
423 auto db = checkoutLedger();
424 auto const res = detail::getNewestLedgerInfo(*db, j_);
425
426 if (res.has_value())
427 return res;
428 }
429
430 return {};
431}
432
435{
436 if (existsLedger())
437 {
438 auto db = checkoutLedger();
439 auto const res =
440 detail::getLimitedOldestLedgerInfo(*db, ledgerFirstIndex, j_);
441
442 if (res.has_value())
443 return res;
444 }
445
446 return {};
447}
448
451{
452 if (existsLedger())
453 {
454 auto db = checkoutLedger();
455 auto const res =
456 detail::getLimitedNewestLedgerInfo(*db, ledgerFirstIndex, j_);
457
458 if (res.has_value())
459 return res;
460 }
461
462 return {};
463}
464
467{
468 if (existsLedger())
469 {
470 auto db = checkoutLedger();
471 auto const res = detail::getLedgerInfoByHash(*db, ledgerHash, j_);
472
473 if (res.has_value())
474 return res;
475 }
476
477 return {};
478}
479
482{
483 if (existsLedger())
484 {
485 auto db = checkoutLedger();
486 auto const res = detail::getHashByIndex(*db, ledgerIndex);
487
488 if (res.isNonZero())
489 return res;
490 }
491
492 return uint256();
493}
494
497{
498 if (existsLedger())
499 {
500 auto db = checkoutLedger();
501 auto const res = detail::getHashesByIndex(*db, ledgerIndex, j_);
502
503 if (res.has_value())
504 return res;
505 }
506
507 return {};
508}
509
512{
513 if (existsLedger())
514 {
515 auto db = checkoutLedger();
516 auto const res = detail::getHashesByIndex(*db, minSeq, maxSeq, j_);
517
518 if (!res.empty())
519 return res;
520 }
521
522 return {};
523}
524
527{
528 if (!useTxTables_)
529 return {};
530
531 if (existsTransaction())
532 {
533 auto db = checkoutTransaction();
534 auto const res = detail::getTxHistory(*db, app_, startIndex, 20).first;
535
536 if (!res.empty())
537 return res;
538 }
539
540 return {};
541}
542
545{
546 if (!useTxTables_)
547 return {};
548
550
551 if (existsTransaction())
552 {
553 auto db = checkoutTransaction();
554 return detail::getOldestAccountTxs(*db, app_, ledgerMaster, options, j_)
555 .first;
556 }
557
558 return {};
559}
560
563{
564 if (!useTxTables_)
565 return {};
566
568
569 if (existsTransaction())
570 {
571 auto db = checkoutTransaction();
572 return detail::getNewestAccountTxs(*db, app_, ledgerMaster, options, j_)
573 .first;
574 }
575
576 return {};
577}
578
581{
582 if (!useTxTables_)
583 return {};
584
585 if (existsTransaction())
586 {
587 auto db = checkoutTransaction();
588 return detail::getOldestAccountTxsB(*db, app_, options, j_).first;
589 }
590
591 return {};
592}
593
596{
597 if (!useTxTables_)
598 return {};
599
600 if (existsTransaction())
601 {
602 auto db = checkoutTransaction();
603 return detail::getNewestAccountTxsB(*db, app_, options, j_).first;
604 }
605
606 return {};
607}
608
613{
614 if (!useTxTables_)
615 return {};
616
617 static std::uint32_t const page_length(200);
618 auto onUnsavedLedger =
619 std::bind(saveLedgerAsync, std::ref(app_), std::placeholders::_1);
620 AccountTxs ret;
621 Application& app = app_;
622 auto onTransaction = [&ret, &app](
623 std::uint32_t ledger_index,
624 std::string const& status,
625 Blob&& rawTxn,
626 Blob&& rawMeta) {
627 convertBlobsToTxResult(ret, ledger_index, status, rawTxn, rawMeta, app);
628 };
629
630 if (existsTransaction())
631 {
632 auto db = checkoutTransaction();
633 auto newmarker =
635 *db, onUnsavedLedger, onTransaction, options, page_length)
636 .first;
637 return {ret, newmarker};
638 }
639
640 return {};
641}
642
647{
648 if (!useTxTables_)
649 return {};
650
651 static std::uint32_t const page_length(200);
652 auto onUnsavedLedger =
653 std::bind(saveLedgerAsync, std::ref(app_), std::placeholders::_1);
654 AccountTxs ret;
655 Application& app = app_;
656 auto onTransaction = [&ret, &app](
657 std::uint32_t ledger_index,
658 std::string const& status,
659 Blob&& rawTxn,
660 Blob&& rawMeta) {
661 convertBlobsToTxResult(ret, ledger_index, status, rawTxn, rawMeta, app);
662 };
663
664 if (existsTransaction())
665 {
666 auto db = checkoutTransaction();
667 auto newmarker =
669 *db, onUnsavedLedger, onTransaction, options, page_length)
670 .first;
671 return {ret, newmarker};
672 }
673
674 return {};
675}
676
681{
682 if (!useTxTables_)
683 return {};
684
685 static std::uint32_t const page_length(500);
686 auto onUnsavedLedger =
687 std::bind(saveLedgerAsync, std::ref(app_), std::placeholders::_1);
688 MetaTxsList ret;
689 auto onTransaction = [&ret](
690 std::uint32_t ledgerIndex,
691 std::string const& status,
692 Blob&& rawTxn,
693 Blob&& rawMeta) {
694 ret.emplace_back(std::move(rawTxn), std::move(rawMeta), ledgerIndex);
695 };
696
697 if (existsTransaction())
698 {
699 auto db = checkoutTransaction();
700 auto newmarker =
702 *db, onUnsavedLedger, onTransaction, options, page_length)
703 .first;
704 return {ret, newmarker};
705 }
706
707 return {};
708}
709
714{
715 if (!useTxTables_)
716 return {};
717
718 static std::uint32_t const page_length(500);
719 auto onUnsavedLedger =
720 std::bind(saveLedgerAsync, std::ref(app_), std::placeholders::_1);
721 MetaTxsList ret;
722 auto onTransaction = [&ret](
723 std::uint32_t ledgerIndex,
724 std::string const& status,
725 Blob&& rawTxn,
726 Blob&& rawMeta) {
727 ret.emplace_back(std::move(rawTxn), std::move(rawMeta), ledgerIndex);
728 };
729
730 if (existsTransaction())
731 {
732 auto db = checkoutTransaction();
733 auto newmarker =
735 *db, onUnsavedLedger, onTransaction, options, page_length)
736 .first;
737 return {ret, newmarker};
738 }
739
740 return {};
741}
742
745 uint256 const& id,
747 error_code_i& ec)
748{
749 if (!useTxTables_)
750 return TxSearched::unknown;
751
752 if (existsTransaction())
753 {
754 auto db = checkoutTransaction();
755 return detail::getTransaction(*db, app_, id, range, ec);
756 }
757
758 return TxSearched::unknown;
759}
760
761bool
763{
764 if (existsLedger())
765 {
766 auto db = checkoutLedger();
767 return detail::dbHasSpace(*db, config, j_);
768 }
769
770 return true;
771}
772
773bool
775{
776 if (!useTxTables_)
777 return true;
778
779 if (existsTransaction())
780 {
781 auto db = checkoutTransaction();
782 return detail::dbHasSpace(*db, config, j_);
783 }
784
785 return true;
786}
787
790{
791 if (existsLedger())
792 {
793 return ripple::getKBUsedAll(lgrdb_->getSession());
794 }
795
796 return 0;
797}
798
801{
802 if (existsLedger())
803 {
804 return ripple::getKBUsedDB(lgrdb_->getSession());
805 }
806
807 return 0;
808}
809
812{
813 if (!useTxTables_)
814 return 0;
815
816 if (existsTransaction())
817 {
818 return ripple::getKBUsedDB(txdb_->getSession());
819 }
820
821 return 0;
822}
823
824void
829
830void
835
837getSQLiteDatabase(Application& app, Config const& config, JobQueue& jobQueue)
838{
839 return std::make_unique<SQLiteDatabaseImp>(app, config, jobQueue);
840}
841
842} // namespace ripple
T bind(T... args)
A generic endpoint for log messages.
Definition Journal.h:41
Stream fatal() const
Definition Journal.h:333
virtual LedgerMaster & getLedgerMaster()=0
virtual Logs & logs()=0
A pool of threads to perform work.
Definition JobQueue.h:39
std::vector< txnMetaLedgerType > MetaTxsList
std::vector< AccountTx > AccountTxs
bool transactionDbHasSpace(Config const &config) override
transactionDbHasSpace Checks if the transaction database has available space.
AccountTxs getOldestAccountTxs(AccountTxOptions const &options) override
getOldestAccountTxs Returns the oldest transactions for the account that matches the given criteria s...
std::optional< LedgerInfo > getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) override
getLimitedOldestLedgerInfo Returns the info of the oldest ledger whose sequence number is greater tha...
std::unique_ptr< DatabaseCon > txdb_
std::uint32_t getKBUsedLedger() override
getKBUsedLedger Returns the amount of space space used by the ledger database.
void deleteTransactionByLedgerSeq(LedgerIndex ledgerSeq) override
deleteTransactionByLedgerSeq Deletes transactions from the ledger with the given sequence.
std::optional< LedgerInfo > getNewestLedgerInfo() override
getNewestLedgerInfo Returns the info of the newest saved ledger.
std::pair< AccountTxs, std::optional< AccountTxMarker > > oldestAccountTxPage(AccountTxPageOptions const &options) override
oldestAccountTxPage Returns the oldest transactions for the account that matches the given criteria s...
std::optional< LedgerIndex > getMaxLedgerSeq() override
getMaxLedgerSeq Returns the maximum ledger sequence in the Ledgers table.
std::unique_ptr< DatabaseCon > lgrdb_
std::uint32_t getKBUsedTransaction() override
getKBUsedTransaction Returns the amount of space used by the transaction database.
auto checkoutLedger()
checkoutTransaction Checks out and returns node store ledger database.
bool saveValidatedLedger(std::shared_ptr< Ledger const > const &ledger, bool current) override
saveValidatedLedger Saves a ledger into the database.
bool ledgerDbHasSpace(Config const &config) override
ledgerDbHasSpace Checks if the ledger database has available space.
std::size_t getTransactionCount() override
getTransactionCount Returns the number of transactions.
MetaTxsList getOldestAccountTxsB(AccountTxOptions const &options) override
getOldestAccountTxsB Returns the oldest transactions in binary form for the account that matches the ...
auto checkoutTransaction()
checkoutTransaction Checks out and returns the node store transaction database.
std::optional< LedgerIndex > getAccountTransactionsMinLedgerSeq() override
getAccountTransactionsMinLedgerSeq Returns the minimum ledger sequence stored in the AccountTransacti...
std::optional< LedgerInfo > getLedgerInfoByHash(uint256 const &ledgerHash) override
getLedgerInfoByHash Returns the info of the ledger with given hash.
void deleteBeforeLedgerSeq(LedgerIndex ledgerSeq) override
deleteBeforeLedgerSeq Deletes all ledgers with a sequence number less than or equal to the given ledg...
std::size_t getAccountTransactionCount() override
getAccountTransactionCount Returns the number of account transactions.
bool existsTransaction()
existsTransaction Checks if the node store transaction database exists.
std::pair< AccountTxs, std::optional< AccountTxMarker > > newestAccountTxPage(AccountTxPageOptions const &options) override
newestAccountTxPage Returns the newest transactions for the account that matches the given criteria s...
std::optional< LedgerIndex > getMinLedgerSeq() override
getMinLedgerSeq Returns the minimum ledger sequence in the Ledgers table.
std::optional< LedgerInfo > getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) override
getLimitedNewestLedgerInfo Returns the info of the newest ledger whose sequence number is greater tha...
std::optional< LedgerHashPair > getHashesByIndex(LedgerIndex ledgerIndex) override
getHashesByIndex Returns the hashes of the ledger and its parent as specified by the ledgerIndex.
std::vector< std::shared_ptr< Transaction > > getTxHistory(LedgerIndex startIndex) override
getTxHistory Returns the 20 most recent transactions starting from the given number.
void deleteAccountTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) override
deleteAccountTransactionsBeforeLedgerSeq Deletes all account transactions with a sequence number less...
void closeTransactionDB() override
Closes the transaction database.
RelationalDatabase::CountMinMax getLedgerCountMinMax() override
getLedgerCountMinMax Returns the minimum ledger sequence, maximum ledger sequence and total number of...
std::pair< MetaTxsList, std::optional< AccountTxMarker > > newestAccountTxPageB(AccountTxPageOptions const &options) override
newestAccountTxPageB Returns the newest transactions in binary form for the account that matches the ...
bool makeLedgerDBs(Config const &config, DatabaseCon::Setup const &setup, DatabaseCon::CheckpointerSetup const &checkpointerSetup)
makeLedgerDBs Opens ledger and transaction databases for the node store, and stores their descriptors...
std::variant< AccountTx, TxSearched > getTransaction(uint256 const &id, std::optional< ClosedInterval< std::uint32_t > > const &range, error_code_i &ec) override
uint256 getHashByIndex(LedgerIndex ledgerIndex) override
getHashByIndex Returns the hash of the ledger with the given sequence.
void closeLedgerDB() override
Closes the ledger database.
void deleteTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) override
deleteTransactionsBeforeLedgerSeq Deletes all transactions with a sequence number less than or equal ...
MetaTxsList getNewestAccountTxsB(AccountTxOptions const &options) override
getNewestAccountTxsB Returns the newest transactions in binary form for the account that matches the ...
bool existsLedger()
existsLedger Checks if the node store ledger database exists.
std::optional< LedgerIndex > getTransactionsMinLedgerSeq() override
getTransactionsMinLedgerSeq Returns the minimum ledger sequence stored in the Transactions table.
std::uint32_t getKBUsedAll() override
getKBUsedAll Returns the amount of space used by all databases.
AccountTxs getNewestAccountTxs(AccountTxOptions const &options) override
getNewestAccountTxs Returns the newest transactions for the account that matches the given criteria s...
std::optional< LedgerInfo > getLedgerInfoByIndex(LedgerIndex ledgerSeq) override
getLedgerInfoByIndex Returns a ledger by its sequence.
std::pair< MetaTxsList, std::optional< AccountTxMarker > > oldestAccountTxPageB(AccountTxPageOptions const &options) override
oldestAccountTxPageB Returns the oldest transactions in binary form for the account that matches the ...
SQLiteDatabaseImp(Application &app, Config const &config, JobQueue &jobQueue)
T emplace_back(T... args)
T is_same_v
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
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
DatabaseCon::Setup setup_DatabaseCon(Config const &c, std::optional< beast::Journal > j=std::nullopt)
std::uint32_t getKBUsedAll(soci::session &s)
Definition SociDB.cpp:114
base_uint< 256 > uint256
Definition base_uint.h:539
void saveLedgerAsync(Application &app, std::uint32_t seq)
std::uint32_t getKBUsedDB(soci::session &s)
Definition SociDB.cpp:123
@ current
This was a new validation and was added.
std::unique_ptr< RelationalDatabase > getSQLiteDatabase(Application &app, Config const &config, JobQueue &jobQueue)
boost::icl::closed_interval< T > ClosedInterval
A closed interval over the domain T.
Definition RangeSet.h:26
void convertBlobsToTxResult(RelationalDatabase::AccountTxs &to, std::uint32_t ledger_index, std::string const &status, Blob const &rawTxn, Blob const &rawMeta, Application &app)
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
Definition RangeSet.h:35
@ ledgerMaster
ledger master data for signing
T ref(T... args)