|
rippled
|


Public Types | |
| using | AccountTx = std::pair< std::shared_ptr< Transaction >, std::shared_ptr< TxMeta > > |
| using | AccountTxs = std::vector< AccountTx > |
| using | txnMetaLedgerType = std::tuple< Blob, Blob, std::uint32_t > |
| using | MetaTxsList = std::vector< txnMetaLedgerType > |
| using | LedgerSequence = uint32_t |
| using | LedgerHash = uint256 |
| using | LedgerShortcut = RPC::LedgerShortcut |
| using | LedgerSpecifier = std::variant< LedgerRange, LedgerShortcut, LedgerSequence, LedgerHash > |
Public Member Functions | |
| SQLiteDatabaseImp (Application &app, Config const &config, JobQueue &jobQueue) | |
| std::optional< LedgerIndex > | getMinLedgerSeq () override |
| getMinLedgerSeq Returns the minimum ledger sequence in the Ledgers table. | |
| std::optional< LedgerIndex > | getTransactionsMinLedgerSeq () override |
| getTransactionsMinLedgerSeq Returns the minimum ledger sequence stored in the Transactions table. | |
| std::optional< LedgerIndex > | getAccountTransactionsMinLedgerSeq () override |
| getAccountTransactionsMinLedgerSeq Returns the minimum ledger sequence stored in the AccountTransactions table. | |
| std::optional< LedgerIndex > | getMaxLedgerSeq () override |
| getMaxLedgerSeq Returns the maximum ledger sequence in the Ledgers table. | |
| void | deleteTransactionByLedgerSeq (LedgerIndex ledgerSeq) override |
| deleteTransactionByLedgerSeq Deletes transactions from the ledger with the given sequence. | |
| void | deleteBeforeLedgerSeq (LedgerIndex ledgerSeq) override |
| deleteBeforeLedgerSeq Deletes all ledgers with a sequence number less than or equal to the given ledger sequence. | |
| void | deleteTransactionsBeforeLedgerSeq (LedgerIndex ledgerSeq) override |
| deleteTransactionsBeforeLedgerSeq Deletes all transactions with a sequence number less than or equal to the given ledger sequence. | |
| void | deleteAccountTransactionsBeforeLedgerSeq (LedgerIndex ledgerSeq) override |
| deleteAccountTransactionsBeforeLedgerSeq Deletes all account transactions with a sequence number less than or equal to the given ledger sequence. | |
| std::size_t | getTransactionCount () override |
| getTransactionCount Returns the number of transactions. | |
| std::size_t | getAccountTransactionCount () override |
| getAccountTransactionCount Returns the number of account transactions. | |
| RelationalDatabase::CountMinMax | getLedgerCountMinMax () override |
| getLedgerCountMinMax Returns the minimum ledger sequence, maximum ledger sequence and total number of saved ledgers. | |
| bool | saveValidatedLedger (std::shared_ptr< Ledger const > const &ledger, bool current) override |
| saveValidatedLedger Saves a ledger into the database. | |
| std::optional< LedgerInfo > | getLedgerInfoByIndex (LedgerIndex ledgerSeq) override |
| getLedgerInfoByIndex Returns a ledger by its sequence. | |
| std::optional< LedgerInfo > | getNewestLedgerInfo () override |
| getNewestLedgerInfo Returns the info of the newest saved ledger. | |
| std::optional< LedgerInfo > | getLimitedOldestLedgerInfo (LedgerIndex ledgerFirstIndex) override |
| getLimitedOldestLedgerInfo Returns the info of the oldest ledger whose sequence number is greater than or equal to the given sequence number. | |
| std::optional< LedgerInfo > | getLimitedNewestLedgerInfo (LedgerIndex ledgerFirstIndex) override |
| getLimitedNewestLedgerInfo Returns the info of the newest ledger whose sequence number is greater than or equal to the given sequence number. | |
| std::optional< LedgerInfo > | getLedgerInfoByHash (uint256 const &ledgerHash) override |
| getLedgerInfoByHash Returns the info of the ledger with given hash. | |
| uint256 | getHashByIndex (LedgerIndex ledgerIndex) override |
| getHashByIndex Returns the hash of the ledger with the given sequence. | |
| std::optional< LedgerHashPair > | getHashesByIndex (LedgerIndex ledgerIndex) override |
| getHashesByIndex Returns the hashes of the ledger and its parent as specified by the ledgerIndex. | |
| std::map< LedgerIndex, LedgerHashPair > | getHashesByIndex (LedgerIndex minSeq, LedgerIndex maxSeq) override |
| getHashesByIndex Returns hashes of each ledger and its parent for all ledgers within the provided range. | |
| std::vector< std::shared_ptr< Transaction > > | getTxHistory (LedgerIndex startIndex) override |
| getTxHistory Returns the 20 most recent transactions starting from the given number. | |
| AccountTxs | getOldestAccountTxs (AccountTxOptions const &options) override |
| getOldestAccountTxs Returns the oldest transactions for the account that matches the given criteria starting from the provided offset. | |
| AccountTxs | getNewestAccountTxs (AccountTxOptions const &options) override |
| getNewestAccountTxs Returns the newest transactions for the account that matches the given criteria starting from the provided offset. | |
| MetaTxsList | getOldestAccountTxsB (AccountTxOptions const &options) override |
| getOldestAccountTxsB Returns the oldest transactions in binary form for the account that matches the given criteria starting from the provided offset. | |
| MetaTxsList | getNewestAccountTxsB (AccountTxOptions const &options) override |
| getNewestAccountTxsB Returns the newest transactions in binary form for the account that matches the given criteria starting from the provided offset. | |
| std::pair< AccountTxs, std::optional< AccountTxMarker > > | oldestAccountTxPage (AccountTxPageOptions const &options) override |
| oldestAccountTxPage Returns the oldest transactions for the account that matches the given criteria starting from the provided marker. | |
| std::pair< AccountTxs, std::optional< AccountTxMarker > > | newestAccountTxPage (AccountTxPageOptions const &options) override |
| newestAccountTxPage Returns the newest transactions for the account that matches the given criteria starting from the provided marker. | |
| 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 given criteria starting from the provided marker. | |
| 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 given criteria starting from the provided marker. | |
| std::variant< AccountTx, TxSearched > | getTransaction (uint256 const &id, std::optional< ClosedInterval< std::uint32_t > > const &range, error_code_i &ec) override |
| bool | ledgerDbHasSpace (Config const &config) override |
| ledgerDbHasSpace Checks if the ledger database has available space. | |
| bool | transactionDbHasSpace (Config const &config) override |
| transactionDbHasSpace Checks if the transaction database has available space. | |
| std::uint32_t | getKBUsedAll () override |
| getKBUsedAll Returns the amount of space used by all databases. | |
| std::uint32_t | getKBUsedLedger () override |
| getKBUsedLedger Returns the amount of space space used by the ledger database. | |
| std::uint32_t | getKBUsedTransaction () override |
| getKBUsedTransaction Returns the amount of space used by the transaction database. | |
| void | closeLedgerDB () override |
| Closes the ledger database. | |
| void | closeTransactionDB () override |
| Closes the transaction database. | |
| virtual std::variant< AccountTx, TxSearched > | getTransaction (uint256 const &id, std::optional< ClosedInterval< uint32_t > > const &range, error_code_i &ec)=0 |
| getTransaction Returns the transaction with the given hash. | |
Static Public Member Functions | |
| static std::unique_ptr< RelationalDatabase > | init (Application &app, Config const &config, JobQueue &jobQueue) |
| init Creates and returns an appropriate RelationalDatabase instance based on configuration. | |
Private Member Functions | |
| 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 in private member variables. | |
| bool | existsLedger () |
| existsLedger Checks if the node store ledger database exists. | |
| bool | existsTransaction () |
| existsTransaction Checks if the node store transaction database exists. | |
| auto | checkoutLedger () |
| checkoutTransaction Checks out and returns node store ledger database. | |
| auto | checkoutTransaction () |
| checkoutTransaction Checks out and returns the node store transaction database. | |
Private Attributes | |
| Application & | app_ |
| bool const | useTxTables_ |
| beast::Journal | j_ |
| std::unique_ptr< DatabaseCon > | lgrdb_ |
| std::unique_ptr< DatabaseCon > | txdb_ |
Definition at line 13 of file SQLiteDatabase.cpp.
|
inherited |
Definition at line 66 of file RelationalDatabase.h.
|
inherited |
Definition at line 68 of file RelationalDatabase.h.
|
inherited |
Definition at line 69 of file RelationalDatabase.h.
|
inherited |
Definition at line 70 of file RelationalDatabase.h.
|
inherited |
Definition at line 72 of file RelationalDatabase.h.
|
inherited |
Definition at line 73 of file RelationalDatabase.h.
|
inherited |
Definition at line 74 of file RelationalDatabase.h.
|
inherited |
Definition at line 75 of file RelationalDatabase.h.
| ripple::SQLiteDatabaseImp::SQLiteDatabaseImp | ( | Application & | app, |
| Config const & | config, | ||
| JobQueue & | jobQueue | ||
| ) |
Definition at line 16 of file SQLiteDatabase.cpp.
|
overridevirtual |
getMinLedgerSeq Returns the minimum ledger sequence in the Ledgers table.
Implements ripple::RelationalDatabase.
Definition at line 232 of file SQLiteDatabase.cpp.
|
overridevirtual |
getTransactionsMinLedgerSeq Returns the minimum ledger sequence stored in the Transactions table.
Implements ripple::SQLiteDatabase.
Definition at line 246 of file SQLiteDatabase.cpp.
|
overridevirtual |
getAccountTransactionsMinLedgerSeq Returns the minimum ledger sequence stored in the AccountTransactions table.
Implements ripple::SQLiteDatabase.
Definition at line 261 of file SQLiteDatabase.cpp.
|
overridevirtual |
getMaxLedgerSeq Returns the maximum ledger sequence in the Ledgers table.
Implements ripple::RelationalDatabase.
Definition at line 277 of file SQLiteDatabase.cpp.
|
overridevirtual |
deleteTransactionByLedgerSeq Deletes transactions from the ledger with the given sequence.
| ledgerSeq | Ledger sequence. |
Implements ripple::SQLiteDatabase.
Definition at line 289 of file SQLiteDatabase.cpp.
|
overridevirtual |
deleteBeforeLedgerSeq Deletes all ledgers with a sequence number less than or equal to the given ledger sequence.
| ledgerSeq | Ledger sequence. |
Implements ripple::SQLiteDatabase.
Definition at line 304 of file SQLiteDatabase.cpp.
|
overridevirtual |
deleteTransactionsBeforeLedgerSeq Deletes all transactions with a sequence number less than or equal to the given ledger sequence.
| ledgerSeq | Ledger sequence. |
Implements ripple::SQLiteDatabase.
Definition at line 316 of file SQLiteDatabase.cpp.
|
overridevirtual |
deleteAccountTransactionsBeforeLedgerSeq Deletes all account transactions with a sequence number less than or equal to the given ledger sequence.
| ledgerSeq | Ledger sequence. |
Implements ripple::SQLiteDatabase.
Definition at line 331 of file SQLiteDatabase.cpp.
|
overridevirtual |
getTransactionCount Returns the number of transactions.
Implements ripple::SQLiteDatabase.
Definition at line 347 of file SQLiteDatabase.cpp.
|
overridevirtual |
getAccountTransactionCount Returns the number of account transactions.
Implements ripple::SQLiteDatabase.
Definition at line 362 of file SQLiteDatabase.cpp.
|
overridevirtual |
getLedgerCountMinMax Returns the minimum ledger sequence, maximum ledger sequence and total number of saved ledgers.
Implements ripple::SQLiteDatabase.
Definition at line 377 of file SQLiteDatabase.cpp.
|
overridevirtual |
saveValidatedLedger Saves a ledger into the database.
| ledger | The ledger. |
| current | True if the ledger is current. |
Implements ripple::SQLiteDatabase.
Definition at line 389 of file SQLiteDatabase.cpp.
|
overridevirtual |
getLedgerInfoByIndex Returns a ledger by its sequence.
| ledgerSeq | Ledger sequence. |
Implements ripple::RelationalDatabase.
Definition at line 404 of file SQLiteDatabase.cpp.
|
overridevirtual |
getNewestLedgerInfo Returns the info of the newest saved ledger.
Implements ripple::RelationalDatabase.
Definition at line 419 of file SQLiteDatabase.cpp.
|
overridevirtual |
getLimitedOldestLedgerInfo Returns the info of the oldest ledger whose sequence number is greater than or equal to the given sequence number.
| ledgerFirstIndex | Minimum ledger sequence. |
Implements ripple::SQLiteDatabase.
Definition at line 434 of file SQLiteDatabase.cpp.
|
overridevirtual |
getLimitedNewestLedgerInfo Returns the info of the newest ledger whose sequence number is greater than or equal to the given sequence number.
| ledgerFirstIndex | Minimum ledger sequence. |
Implements ripple::SQLiteDatabase.
Definition at line 450 of file SQLiteDatabase.cpp.
|
overridevirtual |
getLedgerInfoByHash Returns the info of the ledger with given hash.
| ledgerHash | Hash of the ledger. |
Implements ripple::RelationalDatabase.
Definition at line 466 of file SQLiteDatabase.cpp.
|
overridevirtual |
getHashByIndex Returns the hash of the ledger with the given sequence.
| ledgerIndex | Ledger sequence. |
Implements ripple::RelationalDatabase.
Definition at line 481 of file SQLiteDatabase.cpp.
|
overridevirtual |
getHashesByIndex Returns the hashes of the ledger and its parent as specified by the ledgerIndex.
| ledgerIndex | Ledger sequence. |
Implements ripple::RelationalDatabase.
Definition at line 496 of file SQLiteDatabase.cpp.
|
overridevirtual |
getHashesByIndex Returns hashes of each ledger and its parent for all ledgers within the provided range.
| minSeq | Minimum ledger sequence. |
| maxSeq | Maximum ledger sequence. |
Implements ripple::RelationalDatabase.
Definition at line 511 of file SQLiteDatabase.cpp.
|
overridevirtual |
getTxHistory Returns the 20 most recent transactions starting from the given number.
| startIndex | First number of returned entry. |
Implements ripple::RelationalDatabase.
Definition at line 526 of file SQLiteDatabase.cpp.
|
overridevirtual |
getOldestAccountTxs Returns the oldest transactions for the account that matches the given criteria starting from the provided offset.
| options | Struct AccountTxOptions which contains the criteria to match: the account, ledger search range, the offset of the first entry to return, the number of transactions to return, a flag if this number is unlimited. |
Implements ripple::SQLiteDatabase.
Definition at line 544 of file SQLiteDatabase.cpp.
|
overridevirtual |
getNewestAccountTxs Returns the newest transactions for the account that matches the given criteria starting from the provided offset.
| options | Struct AccountTxOptions which contains the criteria to match: the account, the ledger search range, the offset of the first entry to return, the number of transactions to return, a flag if this number unlimited. |
Implements ripple::SQLiteDatabase.
Definition at line 562 of file SQLiteDatabase.cpp.
|
overridevirtual |
getOldestAccountTxsB Returns the oldest transactions in binary form for the account that matches the given criteria starting from the provided offset.
| options | Struct AccountTxOptions which contains the criteria to match: the account, the ledger search range, the offset of the first entry to return, the number of transactions to return, a flag if this number unlimited. |
Implements ripple::SQLiteDatabase.
Definition at line 580 of file SQLiteDatabase.cpp.
|
overridevirtual |
getNewestAccountTxsB Returns the newest transactions in binary form for the account that matches the given criteria starting from the provided offset.
| options | Struct AccountTxOptions which contains the criteria to match: the account, the ledger search range, the offset of the first entry to return, the number of transactions to return, a flag if this number is unlimited. |
Implements ripple::SQLiteDatabase.
Definition at line 595 of file SQLiteDatabase.cpp.
|
overridevirtual |
oldestAccountTxPage Returns the oldest transactions for the account that matches the given criteria starting from the provided marker.
| options | Struct AccountTxPageOptions which contains the criteria to match: the account, the ledger search range, the marker of first returned entry, the number of transactions to return, a flag if this number is unlimited. |
Implements ripple::SQLiteDatabase.
Definition at line 612 of file SQLiteDatabase.cpp.
|
overridevirtual |
newestAccountTxPage Returns the newest transactions for the account that matches the given criteria starting from the provided marker.
| options | Struct AccountTxPageOptions which contains the criteria to match: the account, the ledger search range, the marker of the first returned entry, the number of transactions to return, a flag if this number unlimited. |
Implements ripple::SQLiteDatabase.
Definition at line 646 of file SQLiteDatabase.cpp.
|
overridevirtual |
oldestAccountTxPageB Returns the oldest transactions in binary form for the account that matches the given criteria starting from the provided marker.
| options | Struct AccountTxPageOptions which contains criteria to match: the account, the ledger search range, the marker of the first returned entry, the number of transactions to return, a flag if this number unlimited. |
Implements ripple::SQLiteDatabase.
Definition at line 680 of file SQLiteDatabase.cpp.
|
overridevirtual |
newestAccountTxPageB Returns the newest transactions in binary form for the account that matches the given criteria starting from the provided marker.
| options | Struct AccountTxPageOptions which contains the criteria to match: the account, the ledger search range, the marker of the first returned entry, the number of transactions to return, a flag if this number is unlimited. |
Implements ripple::SQLiteDatabase.
Definition at line 713 of file SQLiteDatabase.cpp.
|
override |
Definition at line 744 of file SQLiteDatabase.cpp.
|
overridevirtual |
ledgerDbHasSpace Checks if the ledger database has available space.
| config | Config object. |
Implements ripple::RelationalDatabase.
Definition at line 762 of file SQLiteDatabase.cpp.
|
overridevirtual |
transactionDbHasSpace Checks if the transaction database has available space.
| config | Config object. |
Implements ripple::RelationalDatabase.
Definition at line 774 of file SQLiteDatabase.cpp.
|
overridevirtual |
getKBUsedAll Returns the amount of space used by all databases.
Implements ripple::SQLiteDatabase.
Definition at line 789 of file SQLiteDatabase.cpp.
|
overridevirtual |
getKBUsedLedger Returns the amount of space space used by the ledger database.
Implements ripple::SQLiteDatabase.
Definition at line 800 of file SQLiteDatabase.cpp.
|
overridevirtual |
getKBUsedTransaction Returns the amount of space used by the transaction database.
Implements ripple::SQLiteDatabase.
Definition at line 811 of file SQLiteDatabase.cpp.
|
overridevirtual |
Closes the ledger database.
Implements ripple::SQLiteDatabase.
Definition at line 825 of file SQLiteDatabase.cpp.
|
overridevirtual |
Closes the transaction database.
Implements ripple::SQLiteDatabase.
Definition at line 831 of file SQLiteDatabase.cpp.
|
private |
makeLedgerDBs Opens ledger and transaction databases for the node store, and stores their descriptors in private member variables.
| config | Config object. |
| setup | Path to the databases and other opening parameters. |
| checkpointerSetup | Checkpointer parameters. |
Definition at line 219 of file SQLiteDatabase.cpp.
|
private |
existsLedger Checks if the node store ledger database exists.
Definition at line 179 of file SQLiteDatabase.cpp.
|
private |
existsTransaction Checks if the node store transaction database exists.
Definition at line 190 of file SQLiteDatabase.cpp.
|
private |
checkoutTransaction Checks out and returns node store ledger database.
Definition at line 201 of file SQLiteDatabase.cpp.
|
private |
checkoutTransaction Checks out and returns the node store transaction database.
Definition at line 212 of file SQLiteDatabase.cpp.
|
pure virtualinherited |
getTransaction Returns the transaction with the given hash.
If a range is provided but the transaction is not found, then check if all ledgers in the range are present in the database.
| id | Hash of the transaction. |
| range | Range of ledgers to check, if present. |
| ec | Default error code value. |
|
staticinherited |
init Creates and returns an appropriate RelationalDatabase instance based on configuration.
| app | Application object. |
| config | Config object. |
| jobQueue | JobQueue object. |
Definition at line 11 of file RelationalDatabase.cpp.
|
private |
Definition at line 155 of file SQLiteDatabase.cpp.
|
private |
Definition at line 156 of file SQLiteDatabase.cpp.
|
private |
Definition at line 157 of file SQLiteDatabase.cpp.
|
private |
Definition at line 158 of file SQLiteDatabase.cpp.
|
private |
Definition at line 158 of file SQLiteDatabase.cpp.