rippled
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
ripple::RelationalDBInterface Class Referenceabstract
Inheritance diagram for ripple::RelationalDBInterface:
Inheritance graph
[legend]

Classes

struct  AccountTransactionsData
 Struct used to keep track of what to write to transactions and account_transactions tables in Postgres. More...
 
struct  AccountTxArgs
 
struct  AccountTxMarker
 
struct  AccountTxOptions
 
struct  AccountTxPageOptions
 
struct  AccountTxResult
 
struct  CountMinMax
 

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

virtual ~RelationalDBInterface ()=default
 
virtual std::optional< LedgerIndexgetMinLedgerSeq ()=0
 getMinLedgerSeq Returns minimum ledger sequence in Ledgers table. More...
 
virtual std::optional< LedgerIndexgetMaxLedgerSeq ()=0
 getMaxLedgerSeq Returns maximum ledger sequence in Ledgers table. More...
 
virtual std::optional< LedgerInfogetLedgerInfoByIndex (LedgerIndex ledgerSeq)=0
 getLedgerInfoByIndex Returns ledger by its sequence. More...
 
virtual std::optional< LedgerInfogetNewestLedgerInfo ()=0
 getNewestLedgerInfo Returns info of newest saved ledger. More...
 
virtual std::optional< LedgerInfogetLedgerInfoByHash (uint256 const &ledgerHash)=0
 getLedgerInfoByHash Returns info of ledger with given hash. More...
 
virtual uint256 getHashByIndex (LedgerIndex ledgerIndex)=0
 getHashByIndex Returns hash of ledger with given sequence. More...
 
virtual std::optional< LedgerHashPairgetHashesByIndex (LedgerIndex ledgerIndex)=0
 getHashesByIndex Returns hash of the ledger and hash of parent ledger for the ledger of given sequence. More...
 
virtual std::map< LedgerIndex, LedgerHashPairgetHashesByIndex (LedgerIndex minSeq, LedgerIndex maxSeq)=0
 getHashesByIndex Returns hash of the ledger and hash of parent ledger for all ledgers with sequences from given minimum limit to given maximum limit. More...
 
virtual std::vector< std::shared_ptr< Transaction > > getTxHistory (LedgerIndex startIndex)=0
 getTxHistory Returns most recent 20 transactions starting from given number or entry. More...
 
virtual bool ledgerDbHasSpace (Config const &config)=0
 ledgerDbHasSpace Checks if ledger database has available space. More...
 
virtual bool transactionDbHasSpace (Config const &config)=0
 transactionDbHasSpace Checks if transaction database has available space. More...
 

Static Public Member Functions

static std::unique_ptr< RelationalDBInterfaceinit (Application &app, Config const &config, JobQueue &jobQueue)
 init Creates and returns appropriate interface based on config. More...
 

Detailed Description

Definition at line 48 of file RelationalDBInterface.h.

Member Typedef Documentation

◆ AccountTx

Definition at line 85 of file RelationalDBInterface.h.

◆ AccountTxs

Definition at line 86 of file RelationalDBInterface.h.

◆ txnMetaLedgerType

Definition at line 87 of file RelationalDBInterface.h.

◆ MetaTxsList

Definition at line 88 of file RelationalDBInterface.h.

◆ LedgerSequence

Definition at line 90 of file RelationalDBInterface.h.

◆ LedgerHash

Definition at line 91 of file RelationalDBInterface.h.

◆ LedgerShortcut

Definition at line 92 of file RelationalDBInterface.h.

◆ LedgerSpecifier

Definition at line 94 of file RelationalDBInterface.h.

Constructor & Destructor Documentation

◆ ~RelationalDBInterface()

virtual ripple::RelationalDBInterface::~RelationalDBInterface ( )
virtualdefault

Member Function Documentation

◆ init()

std::unique_ptr< RelationalDBInterface > ripple::RelationalDBInterface::init ( Application app,
Config const &  config,
JobQueue jobQueue 
)
static

init Creates and returns appropriate interface based on config.

Parameters
appApplication object.
configConfig object.
jobQueueJobQueue object.
Returns
Unique pointer to the interface.

Definition at line 40 of file RelationalDBInterface.cpp.

◆ getMinLedgerSeq()

virtual std::optional<LedgerIndex> ripple::RelationalDBInterface::getMinLedgerSeq ( )
pure virtual

getMinLedgerSeq Returns minimum ledger sequence in Ledgers table.

Returns
Ledger sequence or none if no ledgers exist.

Implemented in ripple::RelationalDBInterfacePostgresImp, and ripple::RelationalDBInterfaceSqliteImp.

◆ getMaxLedgerSeq()

virtual std::optional<LedgerIndex> ripple::RelationalDBInterface::getMaxLedgerSeq ( )
pure virtual

getMaxLedgerSeq Returns maximum ledger sequence in Ledgers table.

Returns
Ledger sequence or none if no ledgers exist.

Implemented in ripple::RelationalDBInterfaceSqliteImp, and ripple::RelationalDBInterfacePostgresImp.

◆ getLedgerInfoByIndex()

virtual std::optional<LedgerInfo> ripple::RelationalDBInterface::getLedgerInfoByIndex ( LedgerIndex  ledgerSeq)
pure virtual

getLedgerInfoByIndex Returns ledger by its sequence.

Parameters
ledgerSeqLedger sequence.
Returns
Ledger or none if ledger not found.

Implemented in ripple::RelationalDBInterfaceSqliteImp, and ripple::RelationalDBInterfacePostgresImp.

◆ getNewestLedgerInfo()

virtual std::optional<LedgerInfo> ripple::RelationalDBInterface::getNewestLedgerInfo ( )
pure virtual

getNewestLedgerInfo Returns info of newest saved ledger.

Returns
Ledger info or none if ledger not found.

Implemented in ripple::RelationalDBInterfaceSqliteImp, and ripple::RelationalDBInterfacePostgresImp.

◆ getLedgerInfoByHash()

virtual std::optional<LedgerInfo> ripple::RelationalDBInterface::getLedgerInfoByHash ( uint256 const &  ledgerHash)
pure virtual

getLedgerInfoByHash Returns info of ledger with given hash.

Parameters
ledgerHashHash of the ledger.
Returns
Ledger or none if ledger not found.

◆ getHashByIndex()

virtual uint256 ripple::RelationalDBInterface::getHashByIndex ( LedgerIndex  ledgerIndex)
pure virtual

getHashByIndex Returns hash of ledger with given sequence.

Parameters
ledgerIndexLedger sequence.
Returns
Hash of the ledger.

Implemented in ripple::RelationalDBInterfaceSqliteImp, and ripple::RelationalDBInterfacePostgresImp.

◆ getHashesByIndex() [1/2]

virtual std::optional<LedgerHashPair> ripple::RelationalDBInterface::getHashesByIndex ( LedgerIndex  ledgerIndex)
pure virtual

getHashesByIndex Returns hash of the ledger and hash of parent ledger for the ledger of given sequence.

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

Implemented in ripple::RelationalDBInterfaceSqliteImp, and ripple::RelationalDBInterfacePostgresImp.

◆ getHashesByIndex() [2/2]

virtual std::map<LedgerIndex, LedgerHashPair> ripple::RelationalDBInterface::getHashesByIndex ( LedgerIndex  minSeq,
LedgerIndex  maxSeq 
)
pure virtual

getHashesByIndex Returns hash of the ledger and hash of parent ledger for all ledgers with sequences from given minimum limit to given maximum limit.

Parameters
minSeqMinimum ledger sequence.
maxSeqMaximum ledger sequence.
Returns
Map which points sequence number of found ledger to the struct LedgerHashPair which contains ledger hash and its parent hash.

Implemented in ripple::RelationalDBInterfaceSqliteImp, and ripple::RelationalDBInterfacePostgresImp.

◆ getTxHistory()

virtual std::vector<std::shared_ptr<Transaction> > ripple::RelationalDBInterface::getTxHistory ( LedgerIndex  startIndex)
pure virtual

getTxHistory Returns most recent 20 transactions starting from given number or entry.

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

Implemented in ripple::RelationalDBInterfaceSqliteImp, and ripple::RelationalDBInterfacePostgresImp.

◆ ledgerDbHasSpace()

virtual bool ripple::RelationalDBInterface::ledgerDbHasSpace ( Config const &  config)
pure virtual

ledgerDbHasSpace Checks if ledger database has available space.

Parameters
configConfig object.
Returns
True if space is available.

Implemented in ripple::RelationalDBInterfaceSqliteImp, and ripple::RelationalDBInterfacePostgresImp.

◆ transactionDbHasSpace()

virtual bool ripple::RelationalDBInterface::transactionDbHasSpace ( Config const &  config)
pure virtual

transactionDbHasSpace Checks if transaction database has available space.

Parameters
configConfig object.
Returns
True if space is available.

Implemented in ripple::RelationalDBInterfaceSqliteImp, and ripple::RelationalDBInterfacePostgresImp.