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 xrpl {
12
14{
15public:
16 SQLiteDatabaseImp(Application& app, Config const& config, JobQueue& jobQueue)
17 : app_(app), useTxTables_(config.useTxTables()), j_(app_.journal("SQLiteDatabaseImp"))
18 {
19 DatabaseCon::Setup const setup = setup_DatabaseCon(config, j_);
20 if (!makeLedgerDBs(config, setup, DatabaseCon::CheckpointerSetup{&jobQueue, &app_.logs()}))
21 {
22 std::string_view constexpr error = "Failed to create ledger databases";
23
24 JLOG(j_.fatal()) << error;
25 Throw<std::runtime_error>(error.data());
26 }
27 }
28
30 getMinLedgerSeq() override;
31
34
37
39 getMaxLedgerSeq() override;
40
41 void
42 deleteTransactionByLedgerSeq(LedgerIndex ledgerSeq) override;
43
44 void
45 deleteBeforeLedgerSeq(LedgerIndex ledgerSeq) override;
46
47 void
49
50 void
52
54 getTransactionCount() override;
55
58
60 getLedgerCountMinMax() override;
61
62 bool
63 saveValidatedLedger(std::shared_ptr<Ledger const> const& ledger, bool current) override;
64
66 getLedgerInfoByIndex(LedgerIndex ledgerSeq) override;
67
69 getNewestLedgerInfo() override;
70
72 getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) override;
73
75 getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) override;
76
78 getLedgerInfoByHash(uint256 const& ledgerHash) override;
79
81 getHashByIndex(LedgerIndex ledgerIndex) override;
82
84 getHashesByIndex(LedgerIndex ledgerIndex) override;
85
87 getHashesByIndex(LedgerIndex minSeq, LedgerIndex maxSeq) override;
88
90 getTxHistory(LedgerIndex startIndex) override;
91
93 getOldestAccountTxs(AccountTxOptions const& options) override;
94
96 getNewestAccountTxs(AccountTxOptions const& options) override;
97
99 getOldestAccountTxsB(AccountTxOptions const& options) override;
100
102 getNewestAccountTxsB(AccountTxOptions const& options) override;
103
105 oldestAccountTxPage(AccountTxPageOptions const& options) override;
106
108 newestAccountTxPage(AccountTxPageOptions const& options) override;
109
111 oldestAccountTxPageB(AccountTxPageOptions const& options) override;
112
114 newestAccountTxPageB(AccountTxPageOptions const& options) override;
115
118 override;
119
120 bool
121 ledgerDbHasSpace(Config const& config) override;
122
123 bool
124 transactionDbHasSpace(Config const& config) override;
125
127 getKBUsedAll() override;
128
130 getKBUsedLedger() override;
131
133 getKBUsedTransaction() override;
134
135 void
136 closeLedgerDB() override;
137
138 void
139 closeTransactionDB() override;
140
141private:
143 bool const useTxTables_;
146
155 bool
157 Config const& config,
158 DatabaseCon::Setup const& setup,
159 DatabaseCon::CheckpointerSetup const& checkpointerSetup);
160
165 bool
167 {
168 return static_cast<bool>(ledgerDb_);
169 }
170
176 bool
178 {
179 return static_cast<bool>(txdb_);
180 }
181
187 auto
189 {
190 return ledgerDb_->checkoutDb();
191 }
192
198 auto
200 {
201 return txdb_->checkoutDb();
202 }
203};
204
205bool
207 Config const& config,
208 DatabaseCon::Setup const& setup,
209 DatabaseCon::CheckpointerSetup const& checkpointerSetup)
210{
211 auto [lgr, tx, res] = detail::makeLedgerDBs(config, setup, checkpointerSetup, j_);
212 txdb_ = std::move(tx);
213 ledgerDb_ = std::move(lgr);
214 return res;
215}
216
219{
220 /* if databases exists, use it */
221 if (existsLedger())
222 {
223 auto db = checkoutLedger();
225 }
226
227 /* else return empty value */
228 return {};
229}
230
233{
234 if (!useTxTables_)
235 return {};
236
237 if (existsTransaction())
238 {
239 auto db = checkoutTransaction();
241 }
242
243 return {};
244}
245
248{
249 if (!useTxTables_)
250 return {};
251
252 if (existsTransaction())
253 {
254 auto db = checkoutTransaction();
256 }
257
258 return {};
259}
260
263{
264 if (existsLedger())
265 {
266 auto db = checkoutLedger();
268 }
269
270 return {};
271}
272
273void
275{
276 if (!useTxTables_)
277 return;
278
279 if (existsTransaction())
280 {
281 auto db = checkoutTransaction();
283 return;
284 }
285}
286
287void
289{
290 if (existsLedger())
291 {
292 auto db = checkoutLedger();
294 return;
295 }
296}
297
298void
300{
301 if (!useTxTables_)
302 return;
303
304 if (existsTransaction())
305 {
306 auto db = checkoutTransaction();
308 return;
309 }
310}
311
312void
314{
315 if (!useTxTables_)
316 return;
317
318 if (existsTransaction())
319 {
320 auto db = checkoutTransaction();
322 return;
323 }
324}
325
328{
329 if (!useTxTables_)
330 return 0;
331
332 if (existsTransaction())
333 {
334 auto db = checkoutTransaction();
336 }
337
338 return 0;
339}
340
343{
344 if (!useTxTables_)
345 return 0;
346
347 if (existsTransaction())
348 {
349 auto db = checkoutTransaction();
351 }
352
353 return 0;
354}
355
358{
359 if (existsLedger())
360 {
361 auto db = checkoutLedger();
363 }
364
365 return {0, 0, 0};
366}
367
368bool
370{
371 if (existsLedger())
372 {
374 return false;
375 }
376
377 return true;
378}
379
382{
383 if (existsLedger())
384 {
385 auto db = checkoutLedger();
386 auto const res = detail::getLedgerInfoByIndex(*db, ledgerSeq, j_);
387
388 if (res.has_value())
389 return res;
390 }
391
392 return {};
393}
394
397{
398 if (existsLedger())
399 {
400 auto db = checkoutLedger();
401 auto const res = detail::getNewestLedgerInfo(*db, j_);
402
403 if (res.has_value())
404 return res;
405 }
406
407 return {};
408}
409
412{
413 if (existsLedger())
414 {
415 auto db = checkoutLedger();
416 auto const res = detail::getLimitedOldestLedgerInfo(*db, ledgerFirstIndex, j_);
417
418 if (res.has_value())
419 return res;
420 }
421
422 return {};
423}
424
427{
428 if (existsLedger())
429 {
430 auto db = checkoutLedger();
431 auto const res = detail::getLimitedNewestLedgerInfo(*db, ledgerFirstIndex, j_);
432
433 if (res.has_value())
434 return res;
435 }
436
437 return {};
438}
439
442{
443 if (existsLedger())
444 {
445 auto db = checkoutLedger();
446 auto const res = detail::getLedgerInfoByHash(*db, ledgerHash, j_);
447
448 if (res.has_value())
449 return res;
450 }
451
452 return {};
453}
454
457{
458 if (existsLedger())
459 {
460 auto db = checkoutLedger();
461 auto const res = detail::getHashByIndex(*db, ledgerIndex);
462
463 if (res.isNonZero())
464 return res;
465 }
466
467 return uint256();
468}
469
472{
473 if (existsLedger())
474 {
475 auto db = checkoutLedger();
476 auto const res = detail::getHashesByIndex(*db, ledgerIndex, j_);
477
478 if (res.has_value())
479 return res;
480 }
481
482 return {};
483}
484
487{
488 if (existsLedger())
489 {
490 auto db = checkoutLedger();
491 auto const res = detail::getHashesByIndex(*db, minSeq, maxSeq, j_);
492
493 if (!res.empty())
494 return res;
495 }
496
497 return {};
498}
499
502{
503 if (!useTxTables_)
504 return {};
505
506 if (existsTransaction())
507 {
508 auto db = checkoutTransaction();
509 auto const res = detail::getTxHistory(*db, app_, startIndex, 20).first;
510
511 if (!res.empty())
512 return res;
513 }
514
515 return {};
516}
517
520{
521 if (!useTxTables_)
522 return {};
523
525
526 if (existsTransaction())
527 {
528 auto db = checkoutTransaction();
529 return detail::getOldestAccountTxs(*db, app_, ledgerMaster, options, j_).first;
530 }
531
532 return {};
533}
534
537{
538 if (!useTxTables_)
539 return {};
540
542
543 if (existsTransaction())
544 {
545 auto db = checkoutTransaction();
546 return detail::getNewestAccountTxs(*db, app_, ledgerMaster, options, j_).first;
547 }
548
549 return {};
550}
551
554{
555 if (!useTxTables_)
556 return {};
557
558 if (existsTransaction())
559 {
560 auto db = checkoutTransaction();
561 return detail::getOldestAccountTxsB(*db, app_, options, j_).first;
562 }
563
564 return {};
565}
566
569{
570 if (!useTxTables_)
571 return {};
572
573 if (existsTransaction())
574 {
575 auto db = checkoutTransaction();
576 return detail::getNewestAccountTxsB(*db, app_, options, j_).first;
577 }
578
579 return {};
580}
581
584{
585 if (!useTxTables_)
586 return {};
587
588 static std::uint32_t const page_length(200);
589 auto onUnsavedLedger = std::bind(saveLedgerAsync, std::ref(app_), std::placeholders::_1);
590 AccountTxs ret;
591 Application& app = app_;
592 auto onTransaction = [&ret, &app](
593 std::uint32_t ledger_index, std::string const& status, Blob&& rawTxn, Blob&& rawMeta) {
594 convertBlobsToTxResult(ret, ledger_index, status, rawTxn, rawMeta, app);
595 };
596
597 if (existsTransaction())
598 {
599 auto db = checkoutTransaction();
600 auto newmarker = detail::oldestAccountTxPage(*db, onUnsavedLedger, onTransaction, options, page_length).first;
601 return {ret, newmarker};
602 }
603
604 return {};
605}
606
609{
610 if (!useTxTables_)
611 return {};
612
613 static std::uint32_t const page_length(200);
614 auto onUnsavedLedger = std::bind(saveLedgerAsync, std::ref(app_), std::placeholders::_1);
615 AccountTxs ret;
616 Application& app = app_;
617 auto onTransaction = [&ret, &app](
618 std::uint32_t ledger_index, std::string const& status, Blob&& rawTxn, Blob&& rawMeta) {
619 convertBlobsToTxResult(ret, ledger_index, status, rawTxn, rawMeta, app);
620 };
621
622 if (existsTransaction())
623 {
624 auto db = checkoutTransaction();
625 auto newmarker = detail::newestAccountTxPage(*db, onUnsavedLedger, onTransaction, options, page_length).first;
626 return {ret, newmarker};
627 }
628
629 return {};
630}
631
634{
635 if (!useTxTables_)
636 return {};
637
638 static std::uint32_t const page_length(500);
639 auto onUnsavedLedger = std::bind(saveLedgerAsync, std::ref(app_), std::placeholders::_1);
640 MetaTxsList ret;
641 auto onTransaction = [&ret](std::uint32_t ledgerIndex, std::string const& status, Blob&& rawTxn, Blob&& rawMeta) {
642 ret.emplace_back(std::move(rawTxn), std::move(rawMeta), ledgerIndex);
643 };
644
645 if (existsTransaction())
646 {
647 auto db = checkoutTransaction();
648 auto newmarker = detail::oldestAccountTxPage(*db, onUnsavedLedger, onTransaction, options, page_length).first;
649 return {ret, newmarker};
650 }
651
652 return {};
653}
654
657{
658 if (!useTxTables_)
659 return {};
660
661 static std::uint32_t const page_length(500);
662 auto onUnsavedLedger = std::bind(saveLedgerAsync, std::ref(app_), std::placeholders::_1);
663 MetaTxsList ret;
664 auto onTransaction = [&ret](std::uint32_t ledgerIndex, std::string const& status, Blob&& rawTxn, Blob&& rawMeta) {
665 ret.emplace_back(std::move(rawTxn), std::move(rawMeta), ledgerIndex);
666 };
667
668 if (existsTransaction())
669 {
670 auto db = checkoutTransaction();
671 auto newmarker = detail::newestAccountTxPage(*db, onUnsavedLedger, onTransaction, options, page_length).first;
672 return {ret, newmarker};
673 }
674
675 return {};
676}
677
680 uint256 const& id,
682 error_code_i& ec)
683{
684 if (!useTxTables_)
685 return TxSearched::unknown;
686
687 if (existsTransaction())
688 {
689 auto db = checkoutTransaction();
690 return detail::getTransaction(*db, app_, id, range, ec);
691 }
692
693 return TxSearched::unknown;
694}
695
696bool
698{
699 if (existsLedger())
700 {
701 auto db = checkoutLedger();
702 return detail::dbHasSpace(*db, config, j_);
703 }
704
705 return true;
706}
707
708bool
710{
711 if (!useTxTables_)
712 return true;
713
714 if (existsTransaction())
715 {
716 auto db = checkoutTransaction();
717 return detail::dbHasSpace(*db, config, j_);
718 }
719
720 return true;
721}
722
725{
726 if (existsLedger())
727 {
728 return xrpl::getKBUsedAll(ledgerDb_->getSession());
729 }
730
731 return 0;
732}
733
736{
737 if (existsLedger())
738 {
739 return xrpl::getKBUsedDB(ledgerDb_->getSession());
740 }
741
742 return 0;
743}
744
747{
748 if (!useTxTables_)
749 return 0;
750
751 if (existsTransaction())
752 {
753 return xrpl::getKBUsedDB(txdb_->getSession());
754 }
755
756 return 0;
757}
758
759void
764
765void
770
772getSQLiteDatabase(Application& app, Config const& config, JobQueue& jobQueue)
773{
774 return std::make_unique<SQLiteDatabaseImp>(app, config, jobQueue);
775}
776
777} // namespace xrpl
T bind(T... args)
A generic endpoint for log messages.
Definition Journal.h:41
Stream fatal() const
Definition Journal.h:325
virtual LedgerMaster & getLedgerMaster()=0
virtual Logs & logs()=0
A pool of threads to perform work.
Definition JobQueue.h:38
std::vector< AccountTx > AccountTxs
std::vector< txnMetaLedgerType > MetaTxsList
void deleteTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) override
deleteTransactionsBeforeLedgerSeq Deletes all transactions with a sequence number less than or equal ...
std::optional< LedgerHeader > getLedgerInfoByIndex(LedgerIndex ledgerSeq) override
getLedgerInfoByIndex Returns a ledger by its sequence.
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::vector< std::shared_ptr< Transaction > > getTxHistory(LedgerIndex startIndex) override
getTxHistory Returns the 20 most recent transactions starting from the given number.
std::unique_ptr< DatabaseCon > txdb_
auto checkoutTransaction()
checkoutTransaction Checks out and returns the node store transaction database.
std::optional< LedgerIndex > getMaxLedgerSeq() override
getMaxLedgerSeq Returns the maximum ledger sequence in the Ledgers table.
std::optional< LedgerHeader > getLedgerInfoByHash(uint256 const &ledgerHash) override
getLedgerInfoByHash Returns the info of the ledger with given hash.
std::optional< LedgerIndex > getAccountTransactionsMinLedgerSeq() override
getAccountTransactionsMinLedgerSeq Returns the minimum ledger sequence stored in the AccountTransacti...
void deleteTransactionByLedgerSeq(LedgerIndex ledgerSeq) override
deleteTransactionByLedgerSeq Deletes transactions from the ledger with the given sequence.
MetaTxsList getOldestAccountTxsB(AccountTxOptions const &options) override
getOldestAccountTxsB Returns the oldest transactions in binary form for the account that matches the ...
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...
MetaTxsList getNewestAccountTxsB(AccountTxOptions const &options) override
getNewestAccountTxsB Returns the newest transactions in binary form for the account that matches the ...
std::optional< LedgerHeader > getNewestLedgerInfo() override
getNewestLedgerInfo Returns the info of the newest saved ledger.
uint256 getHashByIndex(LedgerIndex ledgerIndex) override
getHashByIndex Returns the hash of the ledger with the given sequence.
std::variant< AccountTx, TxSearched > getTransaction(uint256 const &id, std::optional< ClosedInterval< std::uint32_t > > const &range, error_code_i &ec) override
void closeTransactionDB() override
Closes 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.
void deleteAccountTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) override
deleteAccountTransactionsBeforeLedgerSeq Deletes all account transactions with a sequence number less...
void deleteBeforeLedgerSeq(LedgerIndex ledgerSeq) override
deleteBeforeLedgerSeq Deletes all ledgers with a sequence number less than or equal to the given ledg...
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 ...
std::uint32_t getKBUsedTransaction() override
getKBUsedTransaction Returns the amount of space used by the transaction database.
std::optional< LedgerHeader > getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) override
getLimitedOldestLedgerInfo Returns the info of the oldest ledger whose sequence number is greater tha...
bool transactionDbHasSpace(Config const &config) override
transactionDbHasSpace Checks if the transaction database has available space.
SQLiteDatabaseImp(Application &app, Config const &config, JobQueue &jobQueue)
std::size_t getAccountTransactionCount() override
getAccountTransactionCount Returns the number of account transactions.
std::size_t getTransactionCount() override
getTransactionCount Returns the number of transactions.
std::uint32_t getKBUsedLedger() override
getKBUsedLedger Returns the amount of space space used by the ledger database.
AccountTxs getNewestAccountTxs(AccountTxOptions const &options) override
getNewestAccountTxs Returns the newest transactions for the account that matches the given criteria s...
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 ...
AccountTxs getOldestAccountTxs(AccountTxOptions const &options) override
getOldestAccountTxs Returns the oldest transactions for the account that matches the given criteria s...
RelationalDatabase::CountMinMax getLedgerCountMinMax() override
getLedgerCountMinMax Returns the minimum ledger sequence, maximum ledger sequence and total number of...
bool ledgerDbHasSpace(Config const &config) override
ledgerDbHasSpace Checks if the ledger database has available space.
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< LedgerHashPair > getHashesByIndex(LedgerIndex ledgerIndex) override
getHashesByIndex Returns the hashes of the ledger and its parent as specified by the ledgerIndex.
bool existsLedger()
existsLedger Checks if the node store ledger database exists.
std::optional< LedgerIndex > getMinLedgerSeq() override
getMinLedgerSeq Returns the minimum ledger sequence in the Ledgers table.
bool existsTransaction()
existsTransaction Checks if the node store transaction database exists.
std::optional< LedgerHeader > getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) override
getLimitedNewestLedgerInfo Returns the info of the newest ledger whose sequence number is greater tha...
std::uint32_t getKBUsedAll() override
getKBUsedAll Returns the amount of space used by all databases.
void closeLedgerDB() override
Closes the ledger database.
std::unique_ptr< DatabaseCon > ledgerDb_
std::optional< LedgerIndex > getTransactionsMinLedgerSeq() override
getTransactionsMinLedgerSeq Returns the minimum ledger sequence stored in the Transactions table.
T emplace_back(T... args)
T is_same_v
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
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:6
void saveLedgerAsync(Application &app, std::uint32_t seq)
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
Definition RangeSet.h:35
std::uint32_t getKBUsedDB(soci::session &s)
Definition SociDB.cpp:112
std::uint32_t getKBUsedAll(soci::session &s)
Definition SociDB.cpp:104
void convertBlobsToTxResult(RelationalDatabase::AccountTxs &to, std::uint32_t ledger_index, std::string const &status, Blob const &rawTxn, Blob const &rawMeta, Application &app)
@ current
This was a new validation and was added.
base_uint< 256 > uint256
Definition base_uint.h:527
boost::icl::closed_interval< T > ClosedInterval
A closed interval over the domain T.
Definition RangeSet.h:26
DatabaseCon::Setup setup_DatabaseCon(Config const &c, std::optional< beast::Journal > j=std::nullopt)
std::unique_ptr< RelationalDatabase > getSQLiteDatabase(Application &app, Config const &config, JobQueue &jobQueue)
@ ledgerMaster
ledger master data for signing
error_code_i
Definition ErrorCodes.h:21
T ref(T... args)