rippled
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
xrpl::SQLiteDatabase Class Referencefinalabstract

#include <SQLiteDatabase.h>

Inheritance diagram for xrpl::SQLiteDatabase:
Inheritance graph
[legend]
Collaboration diagram for xrpl::SQLiteDatabase:
Collaboration graph
[legend]

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 LedgerSpecifier = std::variant< LedgerRange, LedgerShortcut, LedgerSequence, LedgerHash >
 

Public Member Functions

std::optional< LedgerIndexgetMinLedgerSeq () override
 getMinLedgerSeq Returns the minimum ledger sequence in the Ledgers table.
 
std::optional< LedgerIndexgetMaxLedgerSeq () override
 getMaxLedgerSeq Returns the maximum ledger sequence in the Ledgers table.
 
std::optional< LedgerHeadergetLedgerInfoByIndex (LedgerIndex ledgerSeq) override
 getLedgerInfoByIndex Returns a ledger by its sequence.
 
std::optional< LedgerHeadergetNewestLedgerInfo () override
 getNewestLedgerInfo Returns the info of the newest saved ledger.
 
std::optional< LedgerHeadergetLedgerInfoByHash (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< LedgerHashPairgetHashesByIndex (LedgerIndex ledgerIndex) override
 getHashesByIndex Returns the hashes of the ledger and its parent as specified by the ledgerIndex.
 
std::map< LedgerIndex, LedgerHashPairgetHashesByIndex (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.
 
std::optional< LedgerIndexgetTransactionsMinLedgerSeq () override
 getTransactionsMinLedgerSeq Returns the minimum ledger sequence stored in the Transactions table.
 
std::optional< LedgerIndexgetAccountTransactionsMinLedgerSeq () override
 getAccountTransactionsMinLedgerSeq Returns the minimum ledger sequence stored in the AccountTransactions 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.
 
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< LedgerHeadergetLimitedOldestLedgerInfo (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< LedgerHeadergetLimitedNewestLedgerInfo (LedgerIndex ledgerFirstIndex) override
 getLimitedNewestLedgerInfo Returns the info of the newest ledger whose sequence number is greater than or equal to the given sequence 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, TxSearchedgetTransaction (uint256 const &id, std::optional< ClosedInterval< std::uint32_t > > const &range, error_code_i &ec) override
 getTransaction Returns the transaction with the given hash.
 
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.
 
 SQLiteDatabase (ServiceRegistry &registry, Config const &config, JobQueue &jobQueue)
 
 SQLiteDatabase (SQLiteDatabase const &)=delete
 
 SQLiteDatabase (SQLiteDatabase &&rhs) noexcept
 
SQLiteDatabaseoperator= (SQLiteDatabase const &)=delete
 
SQLiteDatabaseoperator= (SQLiteDatabase &&)=delete
 
bool ledgerDbHasSpace (Config const &config)
 ledgerDbHasSpace Checks if the ledger database has available space.
 
bool transactionDbHasSpace (Config const &config)
 transactionDbHasSpace Checks if the transaction database has available space.
 
virtual std::variant< AccountTx, TxSearchedgetTransaction (uint256 const &id, std::optional< ClosedInterval< uint32_t > > const &range, error_code_i &ec)=0
 getTransaction Returns the transaction with the given hash.
 

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

ServiceRegistryregistry_
 
bool useTxTables_
 
beast::Journal j_
 
std::unique_ptr< DatabaseConledgerDb_
 
std::unique_ptr< DatabaseContxdb_
 

Detailed Description

Definition at line 17 of file SQLiteDatabase.h.

Member Typedef Documentation

◆ AccountTx

Definition at line 69 of file RelationalDatabase.h.

◆ AccountTxs

Definition at line 70 of file RelationalDatabase.h.

◆ txnMetaLedgerType

Definition at line 71 of file RelationalDatabase.h.

◆ MetaTxsList

Definition at line 72 of file RelationalDatabase.h.

◆ LedgerSequence

using xrpl::RelationalDatabase::LedgerSequence = uint32_t
inherited

Definition at line 74 of file RelationalDatabase.h.

◆ LedgerHash

Definition at line 75 of file RelationalDatabase.h.

◆ LedgerSpecifier

Definition at line 76 of file RelationalDatabase.h.

Constructor & Destructor Documentation

◆ SQLiteDatabase() [1/3]

xrpl::SQLiteDatabase::SQLiteDatabase ( ServiceRegistry registry,
Config const &  config,
JobQueue jobQueue 
)

Definition at line 584 of file SQLiteDatabase.cpp.

◆ SQLiteDatabase() [2/3]

xrpl::SQLiteDatabase::SQLiteDatabase ( SQLiteDatabase const &  )
delete

◆ SQLiteDatabase() [3/3]

xrpl::SQLiteDatabase::SQLiteDatabase ( SQLiteDatabase &&  rhs)
noexcept

Definition at line 502 of file SQLiteDatabase.cpp.

Member Function Documentation

◆ getMinLedgerSeq()

std::optional< LedgerIndex > xrpl::SQLiteDatabase::getMinLedgerSeq ( )
overridevirtual

getMinLedgerSeq Returns the minimum ledger sequence in the Ledgers table.

Returns
Ledger sequence or no value if no ledgers exist.

Implements xrpl::RelationalDatabase.

Definition at line 26 of file SQLiteDatabase.cpp.

◆ getMaxLedgerSeq()

std::optional< LedgerIndex > xrpl::SQLiteDatabase::getMaxLedgerSeq ( )
overridevirtual

getMaxLedgerSeq Returns the maximum ledger sequence in the Ledgers table.

Returns
Ledger sequence or none if no ledgers exist.

Implements xrpl::RelationalDatabase.

Definition at line 70 of file SQLiteDatabase.cpp.

◆ getLedgerInfoByIndex()

std::optional< LedgerHeader > xrpl::SQLiteDatabase::getLedgerInfoByIndex ( LedgerIndex  ledgerSeq)
overridevirtual

getLedgerInfoByIndex Returns a ledger by its sequence.

Parameters
ledgerSeqLedger sequence.
Returns
The ledger if found, otherwise no value.

Implements xrpl::RelationalDatabase.

Definition at line 189 of file SQLiteDatabase.cpp.

◆ getNewestLedgerInfo()

std::optional< LedgerHeader > xrpl::SQLiteDatabase::getNewestLedgerInfo ( )
overridevirtual

getNewestLedgerInfo Returns the info of the newest saved ledger.

Returns
Ledger info if found, otherwise no value.

Implements xrpl::RelationalDatabase.

Definition at line 204 of file SQLiteDatabase.cpp.

◆ getLedgerInfoByHash()

std::optional< LedgerHeader > xrpl::SQLiteDatabase::getLedgerInfoByHash ( uint256 const &  ledgerHash)
overridevirtual

getLedgerInfoByHash Returns the info of the ledger with given hash.

Parameters
ledgerHashHash of the ledger.
Returns
Ledger if found, otherwise no value.

Implements xrpl::RelationalDatabase.

Definition at line 249 of file SQLiteDatabase.cpp.

◆ getHashByIndex()

uint256 xrpl::SQLiteDatabase::getHashByIndex ( LedgerIndex  ledgerIndex)
overridevirtual

getHashByIndex Returns the hash of the ledger with the given sequence.

Parameters
ledgerIndexLedger sequence.
Returns
Hash of the ledger.

Implements xrpl::RelationalDatabase.

Definition at line 264 of file SQLiteDatabase.cpp.

◆ getHashesByIndex() [1/2]

std::optional< LedgerHashPair > xrpl::SQLiteDatabase::getHashesByIndex ( LedgerIndex  ledgerIndex)
overridevirtual

getHashesByIndex Returns the hashes of the ledger and its parent as specified by the ledgerIndex.

Parameters
ledgerIndexLedger sequence.
Returns
Struct LedgerHashPair which contains hashes of the ledger and its parent.

Implements xrpl::RelationalDatabase.

Definition at line 279 of file SQLiteDatabase.cpp.

◆ getHashesByIndex() [2/2]

std::map< LedgerIndex, LedgerHashPair > xrpl::SQLiteDatabase::getHashesByIndex ( LedgerIndex  minSeq,
LedgerIndex  maxSeq 
)
overridevirtual

getHashesByIndex Returns hashes of each ledger and its parent for all ledgers within the provided range.

Parameters
minSeqMinimum ledger sequence.
maxSeqMaximum ledger sequence.
Returns
Container that maps the sequence number of a found ledger to the struct LedgerHashPair which contains the hashes of the ledger and its parent.

Implements xrpl::RelationalDatabase.

Definition at line 294 of file SQLiteDatabase.cpp.

◆ getTxHistory()

std::vector< std::shared_ptr< Transaction > > xrpl::SQLiteDatabase::getTxHistory ( LedgerIndex  startIndex)
overridevirtual

getTxHistory Returns the 20 most recent transactions starting from the given number.

Parameters
startIndexFirst number of returned entry.
Returns
Vector of shared pointers to transactions sorted in descending order by ledger sequence.

Implements xrpl::RelationalDatabase.

Definition at line 309 of file SQLiteDatabase.cpp.

◆ getTransactionsMinLedgerSeq()

std::optional< LedgerIndex > xrpl::SQLiteDatabase::getTransactionsMinLedgerSeq ( )
overridevirtual

getTransactionsMinLedgerSeq Returns the minimum ledger sequence stored in the Transactions table.

Returns
Ledger sequence or no value if no ledgers exist.

Implements xrpl::RelationalDatabase.

Definition at line 40 of file SQLiteDatabase.cpp.

◆ getAccountTransactionsMinLedgerSeq()

std::optional< LedgerIndex > xrpl::SQLiteDatabase::getAccountTransactionsMinLedgerSeq ( )
overridevirtual

getAccountTransactionsMinLedgerSeq Returns the minimum ledger sequence stored in the AccountTransactions table.

Returns
Ledger sequence or no value if no ledgers exist.

Implements xrpl::RelationalDatabase.

Definition at line 55 of file SQLiteDatabase.cpp.

◆ deleteTransactionByLedgerSeq()

void xrpl::SQLiteDatabase::deleteTransactionByLedgerSeq ( LedgerIndex  ledgerSeq)
overridevirtual

deleteTransactionByLedgerSeq Deletes transactions from the ledger with the given sequence.

Parameters
ledgerSeqLedger sequence.

Implements xrpl::RelationalDatabase.

Definition at line 82 of file SQLiteDatabase.cpp.

◆ deleteBeforeLedgerSeq()

void xrpl::SQLiteDatabase::deleteBeforeLedgerSeq ( LedgerIndex  ledgerSeq)
overridevirtual

deleteBeforeLedgerSeq Deletes all ledgers with a sequence number less than or equal to the given ledger sequence.

Parameters
ledgerSeqLedger sequence.

Implements xrpl::RelationalDatabase.

Definition at line 96 of file SQLiteDatabase.cpp.

◆ deleteTransactionsBeforeLedgerSeq()

void xrpl::SQLiteDatabase::deleteTransactionsBeforeLedgerSeq ( LedgerIndex  ledgerSeq)
overridevirtual

deleteTransactionsBeforeLedgerSeq Deletes all transactions with a sequence number less than or equal to the given ledger sequence.

Parameters
ledgerSeqLedger sequence.

Implements xrpl::RelationalDatabase.

Definition at line 107 of file SQLiteDatabase.cpp.

◆ deleteAccountTransactionsBeforeLedgerSeq()

void xrpl::SQLiteDatabase::deleteAccountTransactionsBeforeLedgerSeq ( LedgerIndex  ledgerSeq)
overridevirtual

deleteAccountTransactionsBeforeLedgerSeq Deletes all account transactions with a sequence number less than or equal to the given ledger sequence.

Parameters
ledgerSeqLedger sequence.

Implements xrpl::RelationalDatabase.

Definition at line 121 of file SQLiteDatabase.cpp.

◆ getTransactionCount()

std::size_t xrpl::SQLiteDatabase::getTransactionCount ( )
overridevirtual

getTransactionCount Returns the number of transactions.

Returns
Number of transactions.

Implements xrpl::RelationalDatabase.

Definition at line 135 of file SQLiteDatabase.cpp.

◆ getAccountTransactionCount()

std::size_t xrpl::SQLiteDatabase::getAccountTransactionCount ( )
overridevirtual

getAccountTransactionCount Returns the number of account transactions.

Returns
Number of account transactions.

Implements xrpl::RelationalDatabase.

Definition at line 150 of file SQLiteDatabase.cpp.

◆ getLedgerCountMinMax()

RelationalDatabase::CountMinMax xrpl::SQLiteDatabase::getLedgerCountMinMax ( )
overridevirtual

getLedgerCountMinMax Returns the minimum ledger sequence, maximum ledger sequence and total number of saved ledgers.

Returns
Struct CountMinMax which contains the minimum sequence, maximum sequence and number of ledgers.

Implements xrpl::RelationalDatabase.

Definition at line 165 of file SQLiteDatabase.cpp.

◆ saveValidatedLedger()

bool xrpl::SQLiteDatabase::saveValidatedLedger ( std::shared_ptr< Ledger const > const &  ledger,
bool  current 
)
overridevirtual

saveValidatedLedger Saves a ledger into the database.

Parameters
ledgerThe ledger.
currentTrue if the ledger is current.
Returns
True if saving was successful.

Implements xrpl::RelationalDatabase.

Definition at line 177 of file SQLiteDatabase.cpp.

◆ getLimitedOldestLedgerInfo()

std::optional< LedgerHeader > xrpl::SQLiteDatabase::getLimitedOldestLedgerInfo ( LedgerIndex  ledgerFirstIndex)
overridevirtual

getLimitedOldestLedgerInfo Returns the info of the oldest ledger whose sequence number is greater than or equal to the given sequence number.

Parameters
ledgerFirstIndexMinimum ledger sequence.
Returns
Ledger info if found, otherwise no value.

Implements xrpl::RelationalDatabase.

Definition at line 219 of file SQLiteDatabase.cpp.

◆ getLimitedNewestLedgerInfo()

std::optional< LedgerHeader > xrpl::SQLiteDatabase::getLimitedNewestLedgerInfo ( LedgerIndex  ledgerFirstIndex)
overridevirtual

getLimitedNewestLedgerInfo Returns the info of the newest ledger whose sequence number is greater than or equal to the given sequence number.

Parameters
ledgerFirstIndexMinimum ledger sequence.
Returns
Ledger info if found, otherwise no value.

Implements xrpl::RelationalDatabase.

Definition at line 234 of file SQLiteDatabase.cpp.

◆ getOldestAccountTxs()

RelationalDatabase::AccountTxs xrpl::SQLiteDatabase::getOldestAccountTxs ( AccountTxOptions const &  options)
overridevirtual

getOldestAccountTxs Returns the oldest transactions for the account that matches the given criteria starting from the provided offset.

Parameters
optionsStruct 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.
Returns
Vector of pairs of found transactions and their metadata sorted in ascending order by account sequence.

Implements xrpl::RelationalDatabase.

Definition at line 327 of file SQLiteDatabase.cpp.

◆ getNewestAccountTxs()

RelationalDatabase::AccountTxs xrpl::SQLiteDatabase::getNewestAccountTxs ( AccountTxOptions const &  options)
overridevirtual

getNewestAccountTxs Returns the newest transactions for the account that matches the given criteria starting from the provided offset.

Parameters
optionsStruct 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.
Returns
Vector of pairs of found transactions and their metadata sorted in descending order by account sequence.

Implements xrpl::RelationalDatabase.

Definition at line 344 of file SQLiteDatabase.cpp.

◆ getOldestAccountTxsB()

RelationalDatabase::MetaTxsList xrpl::SQLiteDatabase::getOldestAccountTxsB ( AccountTxOptions const &  options)
overridevirtual

getOldestAccountTxsB Returns the oldest transactions in binary form for the account that matches the given criteria starting from the provided offset.

Parameters
optionsStruct 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.
Returns
Vector of tuples of found transactions, their metadata and account sequences sorted in ascending order by account sequence.

Implements xrpl::RelationalDatabase.

Definition at line 361 of file SQLiteDatabase.cpp.

◆ getNewestAccountTxsB()

RelationalDatabase::MetaTxsList xrpl::SQLiteDatabase::getNewestAccountTxsB ( AccountTxOptions const &  options)
overridevirtual

getNewestAccountTxsB Returns the newest transactions in binary form for the account that matches the given criteria starting from the provided offset.

Parameters
optionsStruct 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.
Returns
Vector of tuples of found transactions, their metadata and account sequences sorted in descending order by account sequence.

Implements xrpl::RelationalDatabase.

Definition at line 376 of file SQLiteDatabase.cpp.

◆ oldestAccountTxPage()

std::pair< RelationalDatabase::AccountTxs, std::optional< RelationalDatabase::AccountTxMarker > > xrpl::SQLiteDatabase::oldestAccountTxPage ( AccountTxPageOptions const &  options)
overridevirtual

oldestAccountTxPage Returns the oldest transactions for the account that matches the given criteria starting from the provided marker.

Parameters
optionsStruct 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.
Returns
Vector of pairs of found transactions and their metadata sorted in ascending order by account sequence and a marker for the next search if the search was not finished.

Implements xrpl::RelationalDatabase.

Definition at line 391 of file SQLiteDatabase.cpp.

◆ newestAccountTxPage()

std::pair< RelationalDatabase::AccountTxs, std::optional< RelationalDatabase::AccountTxMarker > > xrpl::SQLiteDatabase::newestAccountTxPage ( AccountTxPageOptions const &  options)
overridevirtual

newestAccountTxPage Returns the newest transactions for the account that matches the given criteria starting from the provided marker.

Parameters
optionsStruct 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.
Returns
Vector of pairs of found transactions and their metadata sorted in descending order by account sequence and a marker for the next search if the search was not finished.

Implements xrpl::RelationalDatabase.

Definition at line 415 of file SQLiteDatabase.cpp.

◆ oldestAccountTxPageB()

std::pair< RelationalDatabase::MetaTxsList, std::optional< RelationalDatabase::AccountTxMarker > > xrpl::SQLiteDatabase::oldestAccountTxPageB ( AccountTxPageOptions const &  options)
overridevirtual

oldestAccountTxPageB Returns the oldest transactions in binary form for the account that matches the given criteria starting from the provided marker.

Parameters
optionsStruct 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.
Returns
Vector of tuples of found transactions, their metadata and account sequences sorted in ascending order by account sequence and a marker for the next search if the search was not finished.

Implements xrpl::RelationalDatabase.

Definition at line 439 of file SQLiteDatabase.cpp.

◆ newestAccountTxPageB()

std::pair< RelationalDatabase::MetaTxsList, std::optional< RelationalDatabase::AccountTxMarker > > xrpl::SQLiteDatabase::newestAccountTxPageB ( AccountTxPageOptions const &  options)
overridevirtual

newestAccountTxPageB Returns the newest transactions in binary form for the account that matches the given criteria starting from the provided marker.

Parameters
optionsStruct 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.
Returns
Vector of tuples of found transactions, their metadata and account sequences sorted in descending order by account sequence and a marker for the next search if the search was not finished.

Implements xrpl::RelationalDatabase.

Definition at line 462 of file SQLiteDatabase.cpp.

◆ getTransaction() [1/2]

std::variant< RelationalDatabase::AccountTx, TxSearched > xrpl::SQLiteDatabase::getTransaction ( uint256 const &  id,
std::optional< ClosedInterval< std::uint32_t > > const &  range,
error_code_i ec 
)
override

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.

Parameters
idHash of the transaction.
rangeRange of ledgers to check, if present.
ecDefault error code value.
Returns
Transaction and its metadata if found, otherwise TxSearched::all if a range is provided and all ledgers from the range are present in the database, TxSearched::some if a range is provided and not all ledgers are present, TxSearched::unknown if the range is not provided or a deserializing error occurred. In the last case the error code is returned via the ec parameter, in other cases the default error code is not changed.

Definition at line 485 of file SQLiteDatabase.cpp.

◆ getKBUsedAll()

std::uint32_t xrpl::SQLiteDatabase::getKBUsedAll ( )
overridevirtual

getKBUsedAll Returns the amount of space used by all databases.

Returns
Space in kilobytes.

Implements xrpl::RelationalDatabase.

Definition at line 537 of file SQLiteDatabase.cpp.

◆ getKBUsedLedger()

std::uint32_t xrpl::SQLiteDatabase::getKBUsedLedger ( )
overridevirtual

getKBUsedLedger Returns the amount of space space used by the ledger database.

Returns
Space in kilobytes.

Implements xrpl::RelationalDatabase.

Definition at line 548 of file SQLiteDatabase.cpp.

◆ getKBUsedTransaction()

std::uint32_t xrpl::SQLiteDatabase::getKBUsedTransaction ( )
overridevirtual

getKBUsedTransaction Returns the amount of space used by the transaction database.

Returns
Space in kilobytes.

Implements xrpl::RelationalDatabase.

Definition at line 559 of file SQLiteDatabase.cpp.

◆ closeLedgerDB()

void xrpl::SQLiteDatabase::closeLedgerDB ( )
overridevirtual

Closes the ledger database.

Implements xrpl::RelationalDatabase.

Definition at line 573 of file SQLiteDatabase.cpp.

◆ closeTransactionDB()

void xrpl::SQLiteDatabase::closeTransactionDB ( )
overridevirtual

Closes the transaction database.

Implements xrpl::RelationalDatabase.

Definition at line 579 of file SQLiteDatabase.cpp.

◆ operator=() [1/2]

SQLiteDatabase & xrpl::SQLiteDatabase::operator= ( SQLiteDatabase const &  )
delete

◆ operator=() [2/2]

SQLiteDatabase & xrpl::SQLiteDatabase::operator= ( SQLiteDatabase &&  )
delete

◆ ledgerDbHasSpace()

bool xrpl::SQLiteDatabase::ledgerDbHasSpace ( Config const &  config)

ledgerDbHasSpace Checks if the ledger database has available space.

Parameters
configConfig object.
Returns
True if space is available.

Definition at line 510 of file SQLiteDatabase.cpp.

◆ transactionDbHasSpace()

bool xrpl::SQLiteDatabase::transactionDbHasSpace ( Config const &  config)

transactionDbHasSpace Checks if the transaction database has available space.

Parameters
configConfig object.
Returns
True if space is available.

Definition at line 522 of file SQLiteDatabase.cpp.

◆ makeLedgerDBs()

bool xrpl::SQLiteDatabase::makeLedgerDBs ( Config const &  config,
DatabaseCon::Setup const &  setup,
DatabaseCon::CheckpointerSetup const &  checkpointerSetup 
)
private

makeLedgerDBs Opens ledger and transaction databases for the node store, and stores their descriptors in private member variables.

Parameters
configConfig object.
setupPath to the databases and other opening parameters.
checkpointerSetupCheckpointer parameters.
Returns
True if node databases opened successfully.

Definition at line 14 of file SQLiteDatabase.cpp.

◆ existsLedger()

bool xrpl::SQLiteDatabase::existsLedger ( )
private

existsLedger Checks if the node store ledger database exists.

Returns
True if the node store ledger database exists.

Definition at line 430 of file SQLiteDatabase.h.

◆ existsTransaction()

bool xrpl::SQLiteDatabase::existsTransaction ( )
private

existsTransaction Checks if the node store transaction database exists.

Returns
True if the node store transaction database exists.

Definition at line 441 of file SQLiteDatabase.h.

◆ checkoutLedger()

auto xrpl::SQLiteDatabase::checkoutLedger ( )
private

checkoutTransaction Checks out and returns node store ledger database.

Returns
Session to the node store ledger database.

Definition at line 452 of file SQLiteDatabase.h.

◆ checkoutTransaction()

auto xrpl::SQLiteDatabase::checkoutTransaction ( )
private

checkoutTransaction Checks out and returns the node store transaction database.

Returns
Session to the node store transaction database.

Definition at line 463 of file SQLiteDatabase.h.

◆ getTransaction() [2/2]

virtual std::variant< AccountTx, TxSearched > xrpl::RelationalDatabase::getTransaction ( uint256 const &  id,
std::optional< ClosedInterval< uint32_t > > const &  range,
error_code_i ec 
)
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.

Parameters
idHash of the transaction.
rangeRange of ledgers to check, if present.
ecDefault error code value.
Returns
Transaction and its metadata if found, otherwise TxSearched::all if a range is provided and all ledgers from the range are present in the database, TxSearched::some if a range is provided and not all ledgers are present, TxSearched::unknown if the range is not provided or a deserializing error occurred. In the last case the error code is returned via the ec parameter, in other cases the default error code is not changed.

Member Data Documentation

◆ registry_

ServiceRegistry& xrpl::SQLiteDatabase::registry_
private

Definition at line 406 of file SQLiteDatabase.h.

◆ useTxTables_

bool xrpl::SQLiteDatabase::useTxTables_
private

Definition at line 407 of file SQLiteDatabase.h.

◆ j_

beast::Journal xrpl::SQLiteDatabase::j_
private

Definition at line 408 of file SQLiteDatabase.h.

◆ ledgerDb_

std::unique_ptr<DatabaseCon> xrpl::SQLiteDatabase::ledgerDb_
private

Definition at line 409 of file SQLiteDatabase.h.

◆ txdb_

std::unique_ptr<DatabaseCon> xrpl::SQLiteDatabase::txdb_
private

Definition at line 409 of file SQLiteDatabase.h.