|
Clio
develop
The XRP Ledger API server.
|
Implements BackendInterface for Cassandra/ScyllaDB/Keyspace. More...
#include <CassandraBackendFamily.hpp>


Public Member Functions | |
| CassandraBackendFamily (SettingsProviderType settingsProvider, data::LedgerCacheInterface &cache, bool readOnly) | |
| Create a new cassandra/scylla backend instance. | |
| CassandraBackendFamily (CassandraBackendFamily &&)=delete | |
| Move constructor is deleted because handle_ is shared by reference with executor. | |
| TransactionsAndCursor | fetchAccountTransactions (xrpl::AccountID const &account, std::uint32_t const limit, bool forward, std::optional< TransactionsCursor > const &txnCursor, boost::asio::yield_context yield) const override |
| Fetches all transactions for a specific account. | |
| void | waitForWritesToFinish () override |
| Wait for all pending writes to finish. | |
| void | writeLedger (xrpl::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< xrpl::LedgerHeader > | fetchLedgerBySequence (std::uint32_t const sequence, boost::asio::yield_context yield) const override |
| Fetches a specific ledger by sequence number. | |
| std::optional< xrpl::LedgerHeader > | fetchLedgerByHash (xrpl::uint256 const &hash, boost::asio::yield_context yield) const override |
| Fetches a specific ledger by hash. | |
| std::optional< LedgerRange > | hardFetchLedgerRange (boost::asio::yield_context yield) const override |
| Fetches the ledger range from DB. | |
| std::vector< TransactionAndMetadata > | fetchAllTransactionsInLedger (std::uint32_t const ledgerSequence, boost::asio::yield_context yield) const override |
| Fetches all transactions from a specific ledger. | |
| std::vector< xrpl::uint256 > | fetchAllTransactionHashesInLedger (std::uint32_t const ledgerSequence, boost::asio::yield_context yield) const override |
| Fetches all transaction hashes from a specific ledger. | |
| std::optional< NFT > | fetchNFT (xrpl::uint256 const &tokenID, std::uint32_t const ledgerSequence, boost::asio::yield_context yield) const override |
| Fetches a specific NFT. | |
| TransactionsAndCursor | fetchNFTTransactions (xrpl::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. | |
| TransactionsAndCursor | fetchMPTokenIssuanceTransactions (xrpl::uint192 const &mptIssuanceID, std::uint32_t const limit, bool const forward, std::optional< TransactionsCursor > const &cursorIn, boost::asio::yield_context yield) const override |
| Fetches transactions for a particular MPTokenIssuance ID. | |
| TransactionsAndCursor | fetchAccountMPTokenIssuanceTransactions (xrpl::uint192 const &mptIssuanceID, xrpl::AccountID const &account, std::uint32_t const limit, bool const forward, std::optional< TransactionsCursor > const &cursorIn, boost::asio::yield_context yield) const override |
| Fetches transactions for a particular MPTokenIssuance ID involving a particular account. | |
| MPTHoldersAndCursor | fetchMPTHolders (xrpl::uint192 const &mptID, std::uint32_t const limit, std::optional< xrpl::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 (xrpl::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 (xrpl::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< TransactionAndMetadata > | fetchTransaction (xrpl::uint256 const &hash, boost::asio::yield_context yield) const override |
| Fetches a specific transaction. | |
| std::optional< xrpl::uint256 > | doFetchSuccessorKey (xrpl::uint256 key, std::uint32_t const ledgerSequence, boost::asio::yield_context yield) const override |
| Database-specific implementation of fetching the successor key. | |
| std::vector< TransactionAndMetadata > | fetchTransactions (std::vector< xrpl::uint256 > const &hashes, boost::asio::yield_context yield) const override |
| Fetches multiple transactions. | |
| std::vector< Blob > | doFetchLedgerObjects (std::vector< xrpl::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< LedgerObject > | fetchLedgerDiff (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 | writeMPTokenIssuanceTransactions (std::vector< MPTokenIssuanceTransactionsData > const &data) override |
| Write MPTokenIssuance transaction index rows to the mptoken_issuance_transactions table. | |
| void | writeAccountMPTokenIssuanceTransactions (std::vector< MPTokenIssuanceTransactionsData > const &data) override |
| Write MPTokenIssuance transaction index rows to the account_mptoken_issuance_transactions table. | |
| 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 |
| LedgerCacheInterface & | cache () |
| void | setCorruptionDetector (etl::CorruptionDetector detector) |
| Sets the corruption detector. | |
| std::optional< LedgerRange > | fetchLedgerRange () const |
| Fetch the current ledger range. | |
| virtual std::vector< xrpl::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 | forceUpdateRange (uint32_t newMax) |
| Updates the range of sequences that are stored in the DB without any checks. | |
| void | setRange (uint32_t min, uint32_t max, bool force=false) |
| Sets the range of sequences that are stored in the DB. | |
| std::optional< xrpl::Fees > | fetchFees (std::uint32_t seq, boost::asio::yield_context yield) const |
| Fetch the fees from a specific ledger sequence. | |
| virtual NFTsAndCursor | fetchNFTsByIssuer (xrpl::AccountID const &issuer, std::optional< std::uint32_t > const &taxon, std::uint32_t ledgerSequence, std::uint32_t limit, std::optional< xrpl::uint256 > const &cursorIn, boost::asio::yield_context yield) const =0 |
| Fetches all NFTs issued by a given address. | |
| std::optional< Blob > | fetchLedgerObject (xrpl::uint256 const &key, std::uint32_t sequence, boost::asio::yield_context yield) const |
| Fetches a specific ledger object. | |
| std::optional< std::uint32_t > | fetchLedgerObjectSeq (xrpl::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< xrpl::uint256 > const &keys, std::uint32_t sequence, boost::asio::yield_context yield) const |
| Fetches all ledger objects by their keys. | |
| LedgerPage | fetchLedgerPage (std::optional< xrpl::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< LedgerObject > | fetchSuccessorObject (xrpl::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const |
| Fetches the successor object. | |
| std::optional< xrpl::uint256 > | fetchSuccessorKey (xrpl::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const |
| Fetches the successor key. | |
| BookOffersPage | fetchBookOffers (xrpl::uint256 const &book, std::uint32_t ledgerSequence, std::uint32_t limit, boost::asio::yield_context yield) const |
| Fetches book offers. | |
| std::optional< LedgerRange > | hardFetchLedgerRange () const |
| Synchronously fetches the ledger range from DB. | |
| std::optional< LedgerRange > | hardFetchLedgerRangeNoThrow () 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. | |
Protected Member Functions | |
| bool | executeSyncUpdate (Statement statement) |
| Executes statements and tries to write to DB. | |
| TransactionsAndCursor | fetchMPTokenIssuanceTransactionsImpl (Statement const &statement, std::size_t const cursorIdx, std::size_t const limitIdx, std::uint32_t const limit, bool const forward, std::optional< TransactionsCursor > const &cursorIn, boost::asio::yield_context yield) const |
| Shared implementation of the two MPTokenIssuance transaction-index fetchers. | |
Protected Attributes | |
| util::Logger | log_ {"Backend"} |
| SettingsProviderType | settingsProvider_ |
| SchemaType | schema_ |
| std::atomic_uint32_t | ledgerSequence_ = 0u |
| Handle | handle_ |
| ExecutionStrategyType | executor_ |
| FetchLedgerCacheType | ledgerCache_ {} |
| Protected Attributes inherited from data::BackendInterface | |
| util::Logger | log_ {"Backend"} |
| std::shared_mutex | rngMtx_ |
| std::optional< LedgerRange > | range_ |
| std::reference_wrapper< LedgerCacheInterface > | cache_ |
| std::optional< etl::CorruptionDetector > | corruptionDetector_ |
Friends | |
| class | ::CacheBackendCassandraTest |
Additional Inherited Members | |
| Public Types inherited from data::BackendInterface | |
| using | ClioNodesDataFetchResult |
| Return type for fetchClioNodesData() method. | |
Implements BackendInterface for Cassandra/ScyllaDB/Keyspace.
Note: This is a safer and more correct rewrite of the original implementation of the backend.
| SettingsProviderType | The settings provider type |
| ExecutionStrategyType | The execution strategy type |
| SchemaType | The Schema type |
| FetchLedgerCacheType | The ledger header cache type |
|
inline |
Create a new cassandra/scylla backend instance.
| settingsProvider | The settings provider |
| cache | The ledger cache |
| readOnly | Whether the database should be in readonly mode |
|
inlineoverridevirtual |
The database-specific implementation for fetching a ledger object.
| key | The key to fetch for |
| sequence | The ledger sequence to fetch for |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
The database-specific implementation for fetching ledger objects.
| keys | The keys to fetch for |
| sequence | The ledger sequence to fetch for |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
The database-specific implementation for fetching a ledger object sequence.
| key | The key to fetch for |
| sequence | The ledger sequence to fetch for |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Database-specific implementation of fetching the successor key.
| key | The key to fetch for |
| ledgerSequence | The ledger sequence to fetch for |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Writes a ledger object to the database.
| key | The key of the object |
| seq | The sequence of the ledger |
| blob | The data |
Implements data::BackendInterface.
|
inlineprotected |
Executes statements and tries to write to DB.
| statement | statement to execute |
|
inlineoverridevirtual |
Fetches transactions for a particular MPTokenIssuance ID involving a particular account.
Returns one page of transactions for this issuance and account, newest-first (or oldest-first when forward is set). Each row of the account_mptoken_issuance_transactions table holds only a transaction hash and its ledger position, not the transaction itself or its type. So the query cannot filter by type. When a type filter is requested, the handler looks up each full transaction by hash and drops rows whose type does not match, the same way account_tx does.
| mptIssuanceID | The 24-byte MPTokenIssuance ID. |
| account | The account that must be affected by the transaction. |
| limit | The maximum number of transactions per result page. |
| forward | Whether to fetch the page forwards or backwards from the given cursor. |
| cursorIn | The cursor to resume fetching from. |
| yield | The coroutine context. |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Fetches all transactions for a specific account.
| account | The account to fetch transactions for |
| limit | The maximum number of transactions per result page |
| forward | Whether to fetch the page forwards or backwards from the given cursor |
| txnCursor | The cursor to resume fetching from |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Fetches all transaction hashes from a specific ledger.
| ledgerSequence | The ledger sequence to fetch for |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Fetches all transactions from a specific ledger.
| ledgerSequence | The ledger sequence to fetch for |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Fetches the data of all nodes in the cluster.
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Fetches the latest ledger sequence.
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Fetches a specific ledger by hash.
| hash | The hash to fetch for |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Fetches a specific ledger by sequence number.
| sequence | The sequence number to fetch for |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Returns the difference between ledgers.
| ledgerSequence | The ledger sequence to fetch for |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Fetches the status of migrator by name.
| migratorName | The name of the migrator |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Fetches all holders' balances for a MPTIssuanceID.
| mptID | MPTIssuanceID you wish you query. |
| limit | Paging limit. |
| cursorIn | Optional cursor to allow us to pick up from where we last left off. |
| ledgerSequence | The ledger sequence to fetch for |
| yield | Currently executing coroutine. |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Fetches transactions for a particular MPTokenIssuance ID.
Returns one page of transactions for this issuance, newest-first (or oldest-first when forward is set). Each row of the mptoken_issuance_transactions table holds only a transaction hash and its ledger position, not the transaction itself or its type. So the query cannot filter by type. When a type filter is requested, the handler looks up each full transaction by hash and drops rows whose type does not match, the same way account_tx does.
| mptIssuanceID | The 24-byte MPTokenIssuance ID. |
| limit | The maximum number of transactions per result page. |
| forward | Whether to fetch the page forwards or backwards from the given cursor. |
| cursorIn | The cursor to resume fetching from. |
| yield | The coroutine context. |
Implements data::BackendInterface.
|
inlineprotected |
Shared implementation of the two MPTokenIssuance transaction-index fetchers.
| statement | The statement already bound with the partition-key columns. |
| cursorIdx | The bind index for the seq_idx cursor tuple. |
| limitIdx | The bind index for the LIMIT. |
| limit | The maximum number of transactions per result page. |
| forward | Whether the page is fetched forwards or backwards. |
| cursorIn | The cursor to resume fetching from. |
| yield | The coroutine context. |
|
inlineoverridevirtual |
Fetches a specific NFT.
| tokenID | The ID of the NFT |
| ledgerSequence | The ledger sequence to fetch for |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Fetches all transactions for a specific NFT.
| tokenID | The ID of the NFT |
| limit | The maximum number of transactions per result page |
| forward | Whether to fetch the page forwards or backwards from the given cursor |
| cursorIn | The cursor to resume fetching from |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Fetches a specific transaction.
| hash | The hash of the transaction to fetch |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Fetches multiple transactions.
| hashes | A vector of hashes to fetch transactions for |
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Fetches the ledger range from DB.
| yield | The coroutine context |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Starts a write transaction with the DB. No-op for cassandra.
Note: Can potentially be deprecated and removed.
Implements data::BackendInterface.
|
inlineoverridevirtual |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Wait for all pending writes to finish.
Implements data::BackendInterface.
|
inlineoverridevirtual |
Write MPTokenIssuance transaction index rows to the account_mptoken_issuance_transactions table.
One row is written per affected account in each record.
| data | A vector of MPTokenIssuanceTransactionsData objects. |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Write a new account transaction.
| record | An object representing the account transaction |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Write a new set of account transactions.
| data | A vector of AccountTransactionsData objects representing the account transactions |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Writes to a specific ledger.
| ledgerHeader | Ledger header. |
| blob | r-value string serialization of ledger header. |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Mark the migration status of a migrator as Migrated in the database.
| migratorName | The name of the migrator |
| status | The status to set |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Write accounts that started holding onto a MPT.
| data | A vector of MPT ID and account pairs |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Write MPTokenIssuance transaction index rows to the mptoken_issuance_transactions table.
| data | A vector of MPTokenIssuanceTransactionsData objects. |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Writes NFTs to the database.
Implements data::BackendInterface.
|
inlineoverridevirtual |
Write NFTs transactions.
| data | A vector of NFTTransactionsData objects |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Write a node message. Used by ClusterCommunicationService.
| uuid | The UUID of the node |
| message | The message to write |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Write a new successor.
| key | Key of the object that the passed successor will be the successor for |
| seq | The ledger sequence to write for |
| successor | The successor data to write |
Implements data::BackendInterface.
|
inlineoverridevirtual |
Writes a new transaction.
| hash | The hash of the transaction |
| seq | The ledger sequence to write for |
| date | The timestamp of the entry |
| transaction | The transaction data to write |
| metadata | The metadata to write |
Implements data::BackendInterface.