Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
data::BackendInterface Class Referenceabstract

The interface to the database used by Clio. More...

#include <BackendInterface.hpp>

Inheritance diagram for data::BackendInterface:
Collaboration diagram for data::BackendInterface:

Public Member Functions

LedgerCache const & cache () const
 
LedgerCachecache ()
 
void setCorruptionDetector (etl::CorruptionDetector< LedgerCache > detector)
 Sets the corruption detector.
 
virtual std::optional< ripple::LedgerHeader > fetchLedgerBySequence (std::uint32_t sequence, boost::asio::yield_context yield) const =0
 Fetches a specific ledger by sequence number.
 
virtual std::optional< ripple::LedgerHeader > fetchLedgerByHash (ripple::uint256 const &hash, boost::asio::yield_context yield) const =0
 Fetches a specific ledger by hash.
 
virtual std::optional< std::uint32_t > fetchLatestLedgerSequence (boost::asio::yield_context yield) const =0
 Fetches the latest ledger sequence.
 
std::optional< LedgerRangefetchLedgerRange () const
 Fetch the current ledger range.
 
virtual std::vector< ripple::uint256 > fetchAccountRoots (std::uint32_t number, std::uint32_t pageSize, std::uint32_t seq, boost::asio::yield_context yield) const =0
 Fetch the specified number of account root object indexes by page, the accounts need to exist for seq.
 
void updateRange (uint32_t newMax)
 Updates the range of sequences that are stored in the DB.
 
void setRange (uint32_t min, uint32_t max, bool force=false)
 Sets the range of sequences that are stored in the DB.
 
std::optional< ripple::Fees > fetchFees (std::uint32_t seq, boost::asio::yield_context yield) const
 Fetch the fees from a specific ledger sequence.
 
virtual std::optional< TransactionAndMetadatafetchTransaction (ripple::uint256 const &hash, boost::asio::yield_context yield) const =0
 Fetches a specific transaction.
 
virtual std::vector< TransactionAndMetadatafetchTransactions (std::vector< ripple::uint256 > const &hashes, boost::asio::yield_context yield) const =0
 Fetches multiple transactions.
 
virtual TransactionsAndCursor fetchAccountTransactions (ripple::AccountID const &account, std::uint32_t limit, bool forward, std::optional< TransactionsCursor > const &cursor, boost::asio::yield_context yield) const =0
 Fetches all transactions for a specific account.
 
virtual std::vector< TransactionAndMetadatafetchAllTransactionsInLedger (std::uint32_t ledgerSequence, boost::asio::yield_context yield) const =0
 Fetches all transactions from a specific ledger.
 
virtual std::vector< ripple::uint256 > fetchAllTransactionHashesInLedger (std::uint32_t ledgerSequence, boost::asio::yield_context yield) const =0
 Fetches all transaction hashes from a specific ledger.
 
virtual std::optional< NFTfetchNFT (ripple::uint256 const &tokenID, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const =0
 Fetches a specific NFT.
 
virtual TransactionsAndCursor fetchNFTTransactions (ripple::uint256 const &tokenID, std::uint32_t limit, bool forward, std::optional< TransactionsCursor > const &cursorIn, boost::asio::yield_context yield) const =0
 Fetches all transactions for a specific NFT.
 
virtual NFTsAndCursor fetchNFTsByIssuer (ripple::AccountID const &issuer, std::optional< std::uint32_t > const &taxon, std::uint32_t ledgerSequence, std::uint32_t limit, std::optional< ripple::uint256 > const &cursorIn, boost::asio::yield_context yield) const =0
 Fetches all NFTs issued by a given address.
 
virtual MPTHoldersAndCursor fetchMPTHolders (ripple::uint192 const &mptID, std::uint32_t const limit, std::optional< ripple::AccountID > const &cursorIn, std::uint32_t const ledgerSequence, boost::asio::yield_context yield) const =0
 Fetches all holders' balances for a MPTIssuanceID.
 
std::optional< Blob > fetchLedgerObject (ripple::uint256 const &key, std::uint32_t sequence, boost::asio::yield_context yield) const
 Fetches a specific ledger object.
 
std::optional< std::uint32_t > fetchLedgerObjectSeq (ripple::uint256 const &key, std::uint32_t sequence, boost::asio::yield_context yield) const
 Fetches a specific ledger object sequence.
 
std::vector< Blob > fetchLedgerObjects (std::vector< ripple::uint256 > const &keys, std::uint32_t sequence, boost::asio::yield_context yield) const
 Fetches all ledger objects by their keys.
 
virtual std::optional< Blob > doFetchLedgerObject (ripple::uint256 const &key, std::uint32_t sequence, boost::asio::yield_context yield) const =0
 The database-specific implementation for fetching a ledger object.
 
virtual std::optional< std::uint32_t > doFetchLedgerObjectSeq (ripple::uint256 const &key, std::uint32_t sequence, boost::asio::yield_context yield) const =0
 The database-specific implementation for fetching a ledger object sequence.
 
virtual std::vector< Blob > doFetchLedgerObjects (std::vector< ripple::uint256 > const &keys, std::uint32_t sequence, boost::asio::yield_context yield) const =0
 The database-specific implementation for fetching ledger objects.
 
virtual std::vector< LedgerObjectfetchLedgerDiff (std::uint32_t ledgerSequence, boost::asio::yield_context yield) const =0
 Returns the difference between ledgers.
 
LedgerPage fetchLedgerPage (std::optional< ripple::uint256 > const &cursor, std::uint32_t ledgerSequence, std::uint32_t limit, bool outOfOrder, boost::asio::yield_context yield)
 Fetches a page of ledger objects, ordered by key/index.
 
std::optional< LedgerObjectfetchSuccessorObject (ripple::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const
 Fetches the successor object.
 
std::optional< ripple::uint256 > fetchSuccessorKey (ripple::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const
 Fetches the successor key.
 
virtual std::optional< ripple::uint256 > doFetchSuccessorKey (ripple::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const =0
 Database-specific implementation of fetching the successor key.
 
BookOffersPage fetchBookOffers (ripple::uint256 const &book, std::uint32_t ledgerSequence, std::uint32_t limit, boost::asio::yield_context yield) const
 Fetches book offers.
 
virtual std::optional< std::string > fetchMigratorStatus (std::string const &migratorName, boost::asio::yield_context yield) const =0
 Fetches the status of migrator by name.
 
std::optional< LedgerRangehardFetchLedgerRange () const
 Synchronously fetches the ledger range from DB.
 
virtual std::optional< LedgerRangehardFetchLedgerRange (boost::asio::yield_context yield) const =0
 Fetches the ledger range from DB.
 
std::optional< LedgerRangehardFetchLedgerRangeNoThrow () const
 Fetches the ledger range from DB retrying until no DatabaseTimeout is thrown.
 
virtual void writeLedger (ripple::LedgerHeader const &ledgerHeader, std::string &&blob)=0
 Writes to a specific ledger.
 
virtual void writeLedgerObject (std::string &&key, std::uint32_t seq, std::string &&blob)
 Writes a new ledger object.
 
virtual void writeTransaction (std::string &&hash, std::uint32_t seq, std::uint32_t date, std::string &&transaction, std::string &&metadata)=0
 Writes a new transaction.
 
virtual void writeNFTs (std::vector< NFTsData > const &data)=0
 Writes NFTs to the database.
 
virtual void writeAccountTransactions (std::vector< AccountTransactionsData > data)=0
 Write a new set of account transactions.
 
virtual void writeNFTTransactions (std::vector< NFTTransactionsData > const &data)=0
 Write NFTs transactions.
 
virtual void writeMPTHolders (std::vector< MPTHolderData > const &data)=0
 Write accounts that started holding onto a MPT.
 
virtual void writeSuccessor (std::string &&key, std::uint32_t seq, std::string &&successor)=0
 Write a new successor.
 
virtual void startWrites () const =0
 Starts a write transaction with the DB. No-op for cassandra.
 
bool finishWrites (std::uint32_t ledgerSequence)
 Tells database we finished writing all data for a specific ledger.
 
virtual void waitForWritesToFinish ()=0
 Wait for all pending writes to finish.
 
virtual void writeMigratorStatus (std::string const &migratorName, std::string const &status)=0
 Mark the migration status of a migrator as Migrated in the database.
 
virtual bool isTooBusy () const =0
 
virtual boost::json::object stats () const =0
 

Protected Attributes

std::shared_mutex rngMtx_
 
std::optional< LedgerRangerange_
 
LedgerCache cache_
 
std::optional< etl::CorruptionDetector< LedgerCache > > corruptionDetector_
 

Detailed Description

The interface to the database used by Clio.

Member Function Documentation

◆ cache() [1/2]

LedgerCache & data::BackendInterface::cache ( )
inline
Returns
Mutable cache

◆ cache() [2/2]

LedgerCache const & data::BackendInterface::cache ( ) const
inline
Returns
Immutable cache

◆ doFetchLedgerObject()

virtual std::optional< Blob > data::BackendInterface::doFetchLedgerObject ( ripple::uint256 const & key,
std::uint32_t sequence,
boost::asio::yield_context yield ) const
pure virtual

The database-specific implementation for fetching a ledger object.

Parameters
keyThe key to fetch for
sequenceThe ledger sequence to fetch for
yieldThe coroutine context
Returns
The object as a Blob on success; nullopt otherwise

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ doFetchLedgerObjects()

virtual std::vector< Blob > data::BackendInterface::doFetchLedgerObjects ( std::vector< ripple::uint256 > const & keys,
std::uint32_t sequence,
boost::asio::yield_context yield ) const
pure virtual

The database-specific implementation for fetching ledger objects.

Parameters
keysThe keys to fetch for
sequenceThe ledger sequence to fetch for
yieldThe coroutine context
Returns
A vector of Blobs representing each fetched object

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ doFetchLedgerObjectSeq()

virtual std::optional< std::uint32_t > data::BackendInterface::doFetchLedgerObjectSeq ( ripple::uint256 const & key,
std::uint32_t sequence,
boost::asio::yield_context yield ) const
pure virtual

The database-specific implementation for fetching a ledger object sequence.

Parameters
keyThe key to fetch for
sequenceThe ledger sequence to fetch for
yieldThe coroutine context
Returns
The sequence in unit32_t on success; nullopt otherwise

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ doFetchSuccessorKey()

virtual std::optional< ripple::uint256 > data::BackendInterface::doFetchSuccessorKey ( ripple::uint256 key,
std::uint32_t ledgerSequence,
boost::asio::yield_context yield ) const
pure virtual

Database-specific implementation of fetching the successor key.

Parameters
keyThe key to fetch for
ledgerSequenceThe ledger sequence to fetch for
yieldThe coroutine context
Returns
The sucessor on success; nullopt otherwise

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchAccountRoots()

virtual std::vector< ripple::uint256 > data::BackendInterface::fetchAccountRoots ( std::uint32_t number,
std::uint32_t pageSize,
std::uint32_t seq,
boost::asio::yield_context yield ) const
pure virtual

Fetch the specified number of account root object indexes by page, the accounts need to exist for seq.

Parameters
numberThe number of accounts to fetch
pageSizeThe maximum number of accounts per page
seqThe accounts need to exist for this sequence
yieldThe coroutine context
Returns
A vector of ripple::uint256 representing the account roots

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchAccountTransactions()

virtual TransactionsAndCursor data::BackendInterface::fetchAccountTransactions ( ripple::AccountID const & account,
std::uint32_t limit,
bool forward,
std::optional< TransactionsCursor > const & cursor,
boost::asio::yield_context yield ) const
pure virtual

Fetches all transactions for a specific account.

Parameters
accountThe account to fetch transactions for
limitThe maximum number of transactions per result page
forwardWhether to fetch the page forwards or backwards from the given cursor
cursorThe cursor to resume fetching from
yieldThe coroutine context
Returns
Results and a cursor to resume from

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchAllTransactionHashesInLedger()

virtual std::vector< ripple::uint256 > data::BackendInterface::fetchAllTransactionHashesInLedger ( std::uint32_t ledgerSequence,
boost::asio::yield_context yield ) const
pure virtual

Fetches all transaction hashes from a specific ledger.

Parameters
ledgerSequenceThe ledger sequence to fetch for
yieldThe coroutine context
Returns
Hashes as ripple::uint256 in a vector

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchAllTransactionsInLedger()

virtual std::vector< TransactionAndMetadata > data::BackendInterface::fetchAllTransactionsInLedger ( std::uint32_t ledgerSequence,
boost::asio::yield_context yield ) const
pure virtual

Fetches all transactions from a specific ledger.

Parameters
ledgerSequenceThe ledger sequence to fetch for
yieldThe coroutine context
Returns
Results as a vector of TransactionAndMetadata

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchBookOffers()

BookOffersPage data::BackendInterface::fetchBookOffers ( ripple::uint256 const & book,
std::uint32_t ledgerSequence,
std::uint32_t limit,
boost::asio::yield_context yield ) const

Fetches book offers.

Parameters
bookUnsigned 256-bit integer.
ledgerSequenceThe ledger sequence to fetch for
limitPagaing limit as to how many transactions returned per page.
yieldThe coroutine context
Returns
The book offers page

◆ fetchFees()

std::optional< ripple::Fees > data::BackendInterface::fetchFees ( std::uint32_t seq,
boost::asio::yield_context yield ) const

Fetch the fees from a specific ledger sequence.

Parameters
seqThe sequence to fetch for
yieldThe coroutine context
Returns
Fees if fees are found; nullopt otherwise

◆ fetchLatestLedgerSequence()

virtual std::optional< std::uint32_t > data::BackendInterface::fetchLatestLedgerSequence ( boost::asio::yield_context yield) const
pure virtual

Fetches the latest ledger sequence.

Parameters
yieldThe coroutine context
Returns
Latest sequence wrapped in an optional if found; nullopt otherwise

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchLedgerByHash()

virtual std::optional< ripple::LedgerHeader > data::BackendInterface::fetchLedgerByHash ( ripple::uint256 const & hash,
boost::asio::yield_context yield ) const
pure virtual

Fetches a specific ledger by hash.

Parameters
hashThe hash to fetch for
yieldThe coroutine context
Returns
The ripple::LedgerHeader if found; nullopt otherwise

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchLedgerBySequence()

virtual std::optional< ripple::LedgerHeader > data::BackendInterface::fetchLedgerBySequence ( std::uint32_t sequence,
boost::asio::yield_context yield ) const
pure virtual

Fetches a specific ledger by sequence number.

Parameters
sequenceThe sequence number to fetch for
yieldThe coroutine context
Returns
The ripple::LedgerHeader if found; nullopt otherwise

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchLedgerDiff()

virtual std::vector< LedgerObject > data::BackendInterface::fetchLedgerDiff ( std::uint32_t ledgerSequence,
boost::asio::yield_context yield ) const
pure virtual

Returns the difference between ledgers.

Parameters
ledgerSequenceThe ledger sequence to fetch for
yieldThe coroutine context
Returns
A vector of LedgerObject representing the diff

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchLedgerObject()

std::optional< Blob > data::BackendInterface::fetchLedgerObject ( ripple::uint256 const & key,
std::uint32_t sequence,
boost::asio::yield_context yield ) const

Fetches a specific ledger object.

Currently the real fetch happens in doFetchLedgerObject and fetchLedgerObject attempts to fetch from Cache first and only calls out to the real DB if a cache miss ocurred.

Parameters
keyThe key of the object
sequenceThe ledger sequence to fetch for
yieldThe coroutine context
Returns
The object as a Blob on success; nullopt otherwise

◆ fetchLedgerObjects()

std::vector< Blob > data::BackendInterface::fetchLedgerObjects ( std::vector< ripple::uint256 > const & keys,
std::uint32_t sequence,
boost::asio::yield_context yield ) const

Fetches all ledger objects by their keys.

Currently the real fetch happens in doFetchLedgerObjects and fetchLedgerObjects attempts to fetch from Cache first and only calls out to the real DB for each of the keys that was not found in the cache.

Parameters
keysA vector with the keys of the objects to fetch
sequenceThe ledger sequence to fetch for
yieldThe coroutine context
Returns
A vector of ledger objects as Blobs

◆ fetchLedgerObjectSeq()

std::optional< std::uint32_t > data::BackendInterface::fetchLedgerObjectSeq ( ripple::uint256 const & key,
std::uint32_t sequence,
boost::asio::yield_context yield ) const

Fetches a specific ledger object sequence.

Currently the real fetch happens in doFetchLedgerObjectSeq

Parameters
keyThe key of the object
sequenceThe ledger sequence to fetch for
yieldThe coroutine context
Returns
The sequence in unit32_t on success; nullopt otherwise

◆ fetchLedgerPage()

LedgerPage data::BackendInterface::fetchLedgerPage ( std::optional< ripple::uint256 > const & cursor,
std::uint32_t ledgerSequence,
std::uint32_t limit,
bool outOfOrder,
boost::asio::yield_context yield )

Fetches a page of ledger objects, ordered by key/index.

Parameters
cursorThe cursor to resume fetching from
ledgerSequenceThe ledger sequence to fetch for
limitThe maximum number of transactions per result page
outOfOrderIf set to true max available sequence is used instead of ledgerSequence
yieldThe coroutine context
Returns
The ledger page

◆ fetchLedgerRange()

std::optional< LedgerRange > data::BackendInterface::fetchLedgerRange ( ) const

Fetch the current ledger range.

Returns
The current ledger range if populated; nullopt otherwise

◆ fetchMigratorStatus()

virtual std::optional< std::string > data::BackendInterface::fetchMigratorStatus ( std::string const & migratorName,
boost::asio::yield_context yield ) const
pure virtual

Fetches the status of migrator by name.

Parameters
migratorNameThe name of the migrator
yieldThe coroutine context
Returns
The status of the migrator if found; nullopt otherwise

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchMPTHolders()

virtual MPTHoldersAndCursor data::BackendInterface::fetchMPTHolders ( ripple::uint192 const & mptID,
std::uint32_t const limit,
std::optional< ripple::AccountID > const & cursorIn,
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield ) const
pure virtual

Fetches all holders' balances for a MPTIssuanceID.

Parameters
mptIDMPTIssuanceID you wish you query.
limitPaging limit.
cursorInOptional cursor to allow us to pick up from where we last left off.
ledgerSequenceThe ledger sequence to fetch for
yieldCurrently executing coroutine.
Returns
std::vector<Blob> of MPToken balances and an optional marker

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchNFT()

virtual std::optional< NFT > data::BackendInterface::fetchNFT ( ripple::uint256 const & tokenID,
std::uint32_t ledgerSequence,
boost::asio::yield_context yield ) const
pure virtual

Fetches a specific NFT.

Parameters
tokenIDThe ID of the NFT
ledgerSequenceThe ledger sequence to fetch for
yieldThe coroutine context
Returns
NFT object on success; nullopt otherwise

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchNFTsByIssuer()

virtual NFTsAndCursor data::BackendInterface::fetchNFTsByIssuer ( ripple::AccountID const & issuer,
std::optional< std::uint32_t > const & taxon,
std::uint32_t ledgerSequence,
std::uint32_t limit,
std::optional< ripple::uint256 > const & cursorIn,
boost::asio::yield_context yield ) const
pure virtual

Fetches all NFTs issued by a given address.

Parameters
issuerAccountID of issuer you wish you query.
taxonOptional taxon of NFTs by which you wish to filter.
ledgerSequenceThe ledger sequence to fetch for
limitPaging limit.
cursorInOptional cursor to allow us to pick up from where we last left off.
yieldCurrently executing coroutine.
Returns
NFTs issued by this account, or this issuer/taxon combination if taxon is passed and an optional marker

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchNFTTransactions()

virtual TransactionsAndCursor data::BackendInterface::fetchNFTTransactions ( ripple::uint256 const & tokenID,
std::uint32_t limit,
bool forward,
std::optional< TransactionsCursor > const & cursorIn,
boost::asio::yield_context yield ) const
pure virtual

Fetches all transactions for a specific NFT.

Parameters
tokenIDThe ID of the NFT
limitThe maximum number of transactions per result page
forwardWhether to fetch the page forwards or backwards from the given cursor
cursorInThe cursor to resume fetching from
yieldThe coroutine context
Returns
Results and a cursor to resume from

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchSuccessorKey()

std::optional< ripple::uint256 > data::BackendInterface::fetchSuccessorKey ( ripple::uint256 key,
std::uint32_t ledgerSequence,
boost::asio::yield_context yield ) const

Fetches the successor key.

Thea real fetch happens in doFetchSuccessorKey. This function will attempt to lookup the successor in the cache first and only if it's not found in the cache will it fetch from the actual DB.

Parameters
keyThe key to fetch for
ledgerSequenceThe ledger sequence to fetch for
yieldThe coroutine context
Returns
The sucessor key on success; nullopt otherwise

◆ fetchSuccessorObject()

std::optional< LedgerObject > data::BackendInterface::fetchSuccessorObject ( ripple::uint256 key,
std::uint32_t ledgerSequence,
boost::asio::yield_context yield ) const

Fetches the successor object.

Parameters
keyThe key to fetch for
ledgerSequenceThe ledger sequence to fetch for
yieldThe coroutine context
Returns
The sucessor on success; nullopt otherwise

◆ fetchTransaction()

virtual std::optional< TransactionAndMetadata > data::BackendInterface::fetchTransaction ( ripple::uint256 const & hash,
boost::asio::yield_context yield ) const
pure virtual

Fetches a specific transaction.

Parameters
hashThe hash of the transaction to fetch
yieldThe coroutine context
Returns
TransactionAndMetadata if transaction is found; nullopt otherwise

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ fetchTransactions()

virtual std::vector< TransactionAndMetadata > data::BackendInterface::fetchTransactions ( std::vector< ripple::uint256 > const & hashes,
boost::asio::yield_context yield ) const
pure virtual

Fetches multiple transactions.

Parameters
hashesA vector of hashes to fetch transactions for
yieldThe coroutine context
Returns
A vector of TransactionAndMetadata matching the given hashes

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ finishWrites()

bool data::BackendInterface::finishWrites ( std::uint32_t ledgerSequence)

Tells database we finished writing all data for a specific ledger.

Uses doFinishWrites to synchronize with the pending writes.

Parameters
ledgerSequenceThe ledger sequence to finish writing for
Returns
true on success; false otherwise

◆ hardFetchLedgerRange() [1/2]

std::optional< LedgerRange > data::BackendInterface::hardFetchLedgerRange ( ) const

Synchronously fetches the ledger range from DB.

This function just wraps hardFetchLedgerRange(boost::asio::yield_context) using synchronous(FnType&&).

Returns
The ledger range if available; nullopt otherwise

◆ hardFetchLedgerRange() [2/2]

virtual std::optional< LedgerRange > data::BackendInterface::hardFetchLedgerRange ( boost::asio::yield_context yield) const
pure virtual

Fetches the ledger range from DB.

Parameters
yieldThe coroutine context
Returns
The ledger range if available; nullopt otherwise

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ hardFetchLedgerRangeNoThrow()

std::optional< LedgerRange > data::BackendInterface::hardFetchLedgerRangeNoThrow ( ) const

Fetches the ledger range from DB retrying until no DatabaseTimeout is thrown.

Returns
The ledger range if available; nullopt otherwise

◆ isTooBusy()

virtual bool data::BackendInterface::isTooBusy ( ) const
pure virtual
Returns
true if database is overwhelmed; false otherwise

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ setCorruptionDetector()

void data::BackendInterface::setCorruptionDetector ( etl::CorruptionDetector< LedgerCache > detector)
inline

Sets the corruption detector.

Parameters
detectorThe corruption detector to set

◆ setRange()

void data::BackendInterface::setRange ( uint32_t min,
uint32_t max,
bool force = false )

Sets the range of sequences that are stored in the DB.

Parameters
minThe new minimum sequence available
maxThe new maximum sequence available
forceIf set to true, the range will be set even if it's already set

◆ startWrites()

virtual void data::BackendInterface::startWrites ( ) const
pure virtual

Starts a write transaction with the DB. No-op for cassandra.

Note: Can potentially be deprecated and removed.

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ stats()

virtual boost::json::object data::BackendInterface::stats ( ) const
pure virtual
Returns
A JSON object containing backend usage statistics

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ updateRange()

void data::BackendInterface::updateRange ( uint32_t newMax)

Updates the range of sequences that are stored in the DB.

Parameters
newMaxThe new maximum sequence available

◆ waitForWritesToFinish()

virtual void data::BackendInterface::waitForWritesToFinish ( )
pure virtual

Wait for all pending writes to finish.

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ writeAccountTransactions()

virtual void data::BackendInterface::writeAccountTransactions ( std::vector< AccountTransactionsData > data)
pure virtual

Write a new set of account transactions.

Parameters
dataA vector of AccountTransactionsData objects representing the account transactions

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ writeLedger()

virtual void data::BackendInterface::writeLedger ( ripple::LedgerHeader const & ledgerHeader,
std::string && blob )
pure virtual

Writes to a specific ledger.

Parameters
ledgerHeaderLedger header.
blobr-value string serialization of ledger header.

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ writeLedgerObject()

void data::BackendInterface::writeLedgerObject ( std::string && key,
std::uint32_t seq,
std::string && blob )
virtual

Writes a new ledger object.

Parameters
keyThe key to write the ledger object under
seqThe ledger sequence to write for
blobThe data to write

◆ writeMigratorStatus()

virtual void data::BackendInterface::writeMigratorStatus ( std::string const & migratorName,
std::string const & status )
pure virtual

Mark the migration status of a migrator as Migrated in the database.

Parameters
migratorNameThe name of the migrator
statusThe status to set

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ writeMPTHolders()

virtual void data::BackendInterface::writeMPTHolders ( std::vector< MPTHolderData > const & data)
pure virtual

Write accounts that started holding onto a MPT.

Parameters
dataA vector of MPT ID and account pairs

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ writeNFTs()

virtual void data::BackendInterface::writeNFTs ( std::vector< NFTsData > const & data)
pure virtual

Writes NFTs to the database.

Parameters
dataA vector of NFTsData objects representing the NFTs

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ writeNFTTransactions()

virtual void data::BackendInterface::writeNFTTransactions ( std::vector< NFTTransactionsData > const & data)
pure virtual

Write NFTs transactions.

Parameters
dataA vector of NFTTransactionsData objects

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ writeSuccessor()

virtual void data::BackendInterface::writeSuccessor ( std::string && key,
std::uint32_t seq,
std::string && successor )
pure virtual

Write a new successor.

Parameters
keyKey of the object that the passed successor will be the successor for
seqThe ledger sequence to write for
successorThe successor data to write

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.

◆ writeTransaction()

virtual void data::BackendInterface::writeTransaction ( std::string && hash,
std::uint32_t seq,
std::uint32_t date,
std::string && transaction,
std::string && metadata )
pure virtual

Writes a new transaction.

Parameters
hashThe hash of the transaction
seqThe ledger sequence to write for
dateThe timestamp of the entry
transactionThe transaction data to write
metadataThe metadata to write

Implemented in data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >.


The documentation for this class was generated from the following files: