Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
migration::cassandra::CassandraMigrationBackend Class Reference

The backend for the migration. It is a subclass of the CassandraBackend and provides the migration specific functionalities. More...

#include <CassandraMigrationBackend.hpp>

Inheritance diagram for migration::cassandra::CassandraMigrationBackend:
Collaboration diagram for migration::cassandra::CassandraMigrationBackend:

Public Member Functions

 CassandraMigrationBackend (data::cassandra::SettingsProvider settingsProvider, data::LedgerCacheInterface &cache)
 Construct a new Cassandra Migration Backend object. The backend is not readonly.
 
template<impl::TableSpec TableDesc>
void migrateInTokenRange (std::int64_t const start, std::int64_t const end, auto const &callback, boost::asio::yield_context yield)
 Scan a table in a token range and call the callback for each row.
 
- Public Member Functions inherited from data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >
 BasicCassandraBackend (SettingsProviderType settingsProvider, data::LedgerCacheInterface &cache, bool readOnly)
 Create a new cassandra/scylla backend instance.
 
 BasicCassandraBackend (BasicCassandraBackend &&)=delete
 
TransactionsAndCursor fetchAccountTransactions (ripple::AccountID const &account, std::uint32_t const limit, bool forward, std::optional< TransactionsCursor > const &cursorIn, boost::asio::yield_context yield) const override
 Fetches all transactions for a specific account.
 
void waitForWritesToFinish () override
 Wait for all pending writes to finish.
 
bool doFinishWrites () override
 The implementation should wait for all pending writes to finish.
 
void writeLedger (ripple::LedgerHeader const &ledgerHeader, std::string &&blob) override
 Writes to a specific ledger.
 
std::optional< std::uint32_t > fetchLatestLedgerSequence (boost::asio::yield_context yield) const override
 Fetches the latest ledger sequence.
 
std::optional< ripple::LedgerHeader > fetchLedgerBySequence (std::uint32_t const sequence, boost::asio::yield_context yield) const override
 Fetches a specific ledger by sequence number.
 
std::optional< ripple::LedgerHeader > fetchLedgerByHash (ripple::uint256 const &hash, boost::asio::yield_context yield) const override
 Fetches a specific ledger by hash.
 
std::optional< LedgerRangehardFetchLedgerRange (boost::asio::yield_context yield) const override
 Fetches the ledger range from DB.
 
std::vector< TransactionAndMetadatafetchAllTransactionsInLedger (std::uint32_t const ledgerSequence, boost::asio::yield_context yield) const override
 Fetches all transactions from a specific ledger.
 
std::vector< ripple::uint256 > fetchAllTransactionHashesInLedger (std::uint32_t const ledgerSequence, boost::asio::yield_context yield) const override
 Fetches all transaction hashes from a specific ledger.
 
std::optional< NFTfetchNFT (ripple::uint256 const &tokenID, std::uint32_t const ledgerSequence, boost::asio::yield_context yield) const override
 Fetches a specific NFT.
 
TransactionsAndCursor fetchNFTTransactions (ripple::uint256 const &tokenID, std::uint32_t const limit, bool const forward, std::optional< TransactionsCursor > const &cursorIn, boost::asio::yield_context yield) const override
 Fetches all transactions for a specific NFT.
 
NFTsAndCursor fetchNFTsByIssuer (ripple::AccountID const &issuer, std::optional< std::uint32_t > const &taxon, std::uint32_t const ledgerSequence, std::uint32_t const limit, std::optional< ripple::uint256 > const &cursorIn, boost::asio::yield_context yield) const override
 Fetches all NFTs issued by a given address.
 
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 override
 Fetches all holders' balances for a MPTIssuanceID.
 
std::optional< Blob > doFetchLedgerObject (ripple::uint256 const &key, std::uint32_t const sequence, boost::asio::yield_context yield) const override
 The database-specific implementation for fetching a ledger object.
 
std::optional< std::uint32_t > doFetchLedgerObjectSeq (ripple::uint256 const &key, std::uint32_t const sequence, boost::asio::yield_context yield) const override
 The database-specific implementation for fetching a ledger object sequence.
 
std::optional< TransactionAndMetadatafetchTransaction (ripple::uint256 const &hash, boost::asio::yield_context yield) const override
 Fetches a specific transaction.
 
std::optional< ripple::uint256 > doFetchSuccessorKey (ripple::uint256 key, std::uint32_t const ledgerSequence, boost::asio::yield_context yield) const override
 Database-specific implementation of fetching the successor key.
 
std::vector< TransactionAndMetadatafetchTransactions (std::vector< ripple::uint256 > const &hashes, boost::asio::yield_context yield) const override
 Fetches multiple transactions.
 
std::vector< Blob > doFetchLedgerObjects (std::vector< ripple::uint256 > const &keys, std::uint32_t const sequence, boost::asio::yield_context yield) const override
 The database-specific implementation for fetching ledger objects.
 
std::vector< ripple::uint256 > fetchAccountRoots (std::uint32_t number, std::uint32_t pageSize, std::uint32_t seq, boost::asio::yield_context yield) const override
 Fetch the specified number of account root object indexes by page, the accounts need to exist for seq.
 
std::vector< LedgerObjectfetchLedgerDiff (std::uint32_t const ledgerSequence, boost::asio::yield_context yield) const override
 Returns the difference between ledgers.
 
std::optional< std::string > fetchMigratorStatus (std::string const &migratorName, boost::asio::yield_context yield) const override
 Fetches the status of migrator by name.
 
std::expected< std::vector< std::pair< boost::uuids::uuid, std::string > >, std::string > fetchClioNodesData (boost::asio::yield_context yield) const override
 Fetches the data of all nodes in the cluster.
 
void doWriteLedgerObject (std::string &&key, std::uint32_t const seq, std::string &&blob) override
 Writes a ledger object to the database.
 
void writeSuccessor (std::string &&key, std::uint32_t const seq, std::string &&successor) override
 Write a new successor.
 
void writeAccountTransactions (std::vector< AccountTransactionsData > data) override
 Write a new set of account transactions.
 
void writeAccountTransaction (AccountTransactionsData record) override
 Write a new account transaction.
 
void writeNFTTransactions (std::vector< NFTTransactionsData > const &data) override
 Write NFTs transactions.
 
void writeTransaction (std::string &&hash, std::uint32_t const seq, std::uint32_t const date, std::string &&transaction, std::string &&metadata) override
 Writes a new transaction.
 
void writeNFTs (std::vector< NFTsData > const &data) override
 Writes NFTs to the database.
 
void writeMPTHolders (std::vector< MPTHolderData > const &data) override
 Write accounts that started holding onto a MPT.
 
void startWrites () const override
 Starts a write transaction with the DB. No-op for cassandra.
 
void writeMigratorStatus (std::string const &migratorName, std::string const &status) override
 Mark the migration status of a migrator as Migrated in the database.
 
void writeNodeMessage (boost::uuids::uuid const &uuid, std::string message) override
 Write a node message. Used by ClusterCommunicationService.
 
bool isTooBusy () const override
 
boost::json::object stats () const override
 
- Public Member Functions inherited from data::BackendInterface
 BackendInterface (LedgerCacheInterface &cache)
 Construct a new backend interface instance.
 
LedgerCacheInterface const & cache () const
 
LedgerCacheInterfacecache ()
 
void setCorruptionDetector (etl::CorruptionDetector detector)
 Sets the corruption detector.
 
std::optional< LedgerRangefetchLedgerRange () const
 Fetch the current ledger range.
 
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.
 
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.
 
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.
 
BookOffersPage fetchBookOffers (ripple::uint256 const &book, std::uint32_t ledgerSequence, std::uint32_t limit, boost::asio::yield_context yield) const
 Fetches book offers.
 
std::optional< LedgerRangehardFetchLedgerRange () const
 Synchronously fetches the ledger range from DB.
 
std::optional< LedgerRangehardFetchLedgerRangeNoThrow () const
 Fetches the ledger range from DB retrying until no DatabaseTimeout is thrown.
 
virtual void writeLedgerObject (std::string &&key, std::uint32_t seq, std::string &&blob)
 Writes a new ledger object.
 
bool finishWrites (std::uint32_t ledgerSequence)
 Tells database we finished writing all data for a specific ledger.
 

Additional Inherited Members

- Protected Attributes inherited from data::cassandra::BasicCassandraBackend< SettingsProviderType, ExecutionStrategyType >
Handle handle_
 
ExecutionStrategyType executor_
 
- Protected Attributes inherited from data::BackendInterface
std::shared_mutex rngMtx_
 
std::optional< LedgerRangerange_
 
std::reference_wrapper< LedgerCacheInterfacecache_
 
std::optional< etl::CorruptionDetectorcorruptionDetector_
 

Detailed Description

The backend for the migration. It is a subclass of the CassandraBackend and provides the migration specific functionalities.

Constructor & Destructor Documentation

◆ CassandraMigrationBackend()

migration::cassandra::CassandraMigrationBackend::CassandraMigrationBackend ( data::cassandra::SettingsProvider settingsProvider,
data::LedgerCacheInterface & cache )
inlineexplicit

Construct a new Cassandra Migration Backend object. The backend is not readonly.

Parameters
settingsProviderThe settings provider
cacheThe ledger cache to use

Member Function Documentation

◆ migrateInTokenRange()

template<impl::TableSpec TableDesc>
void migration::cassandra::CassandraMigrationBackend::migrateInTokenRange ( std::int64_t const start,
std::int64_t const end,
auto const & callback,
boost::asio::yield_context yield )
inline

Scan a table in a token range and call the callback for each row.

Template Parameters
TableDescThe table description of the table to scan
Parameters
startThe start token
endThe end token
callbackThe callback to call for each row
yieldThe boost asio yield context

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