mirror of
https://github.com/XRPLF/clio.git
synced 2026-07-24 07:30:25 +00:00
feat: Add storage and backend for mpt_issuance_history (#3091)
Why This is the first PR in the broader `mptoken_issuance_history` plan. It lands the additive schema/backend layer first so later PRs can safely add live ETL indexing, historical backfill, and finally the RPC handler gated on backfill completion. Keeping this step dark avoids exposing partial history while still making the stack reviewable in small pieces. Summary Adds the storage and backend primitives for MPT transaction-history filtering. - Adds Cassandra tables: - mpt_transactions - account_mpt_transactions - Adds MPTTransactionsData and backend interface methods for writing/fetching both MPT index shapes. Implements Cassandra write/fetch paths with forward/reverse pagination, raw-page cursor behavior, and case-insensitive tx_type filtering before transaction hydration. - Adds MockBackend coverage for the new pure-virtual methods. - Adds Cassandra integration tests for round-trip behavior, ordering, pagination, missing transaction blobs, sparse tx_type filtering, account fanout, and account-side filtering.
This commit is contained in:
@@ -408,6 +408,60 @@ public:
|
||||
boost::asio::yield_context yield
|
||||
) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Fetches transactions for a particular MPTokenIssuance ID.
|
||||
*
|
||||
* Returns one page of transactions for this issuance, newest-first (or oldest-first when
|
||||
* @p 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.
|
||||
*
|
||||
* @param mptIssuanceID The 24-byte MPTokenIssuance ID.
|
||||
* @param limit The maximum number of transactions per result page.
|
||||
* @param forward Whether to fetch the page forwards or backwards from the given cursor.
|
||||
* @param cursorIn The cursor to resume fetching from.
|
||||
* @param yield The coroutine context.
|
||||
* @return Results and a cursor to resume from.
|
||||
*/
|
||||
virtual TransactionsAndCursor
|
||||
fetchMPTokenIssuanceTransactions(
|
||||
ripple::uint192 const& mptIssuanceID,
|
||||
std::uint32_t limit,
|
||||
bool forward,
|
||||
std::optional<TransactionsCursor> const& cursorIn,
|
||||
boost::asio::yield_context yield
|
||||
) const = 0;
|
||||
|
||||
/**
|
||||
* @brief 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 @p 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.
|
||||
*
|
||||
* @param mptIssuanceID The 24-byte MPTokenIssuance ID.
|
||||
* @param account The account that must be affected by the transaction.
|
||||
* @param limit The maximum number of transactions per result page.
|
||||
* @param forward Whether to fetch the page forwards or backwards from the given cursor.
|
||||
* @param cursorIn The cursor to resume fetching from.
|
||||
* @param yield The coroutine context.
|
||||
* @return Results and a cursor to resume from.
|
||||
*/
|
||||
virtual TransactionsAndCursor
|
||||
fetchAccountMPTokenIssuanceTransactions(
|
||||
ripple::uint192 const& mptIssuanceID,
|
||||
ripple::AccountID const& account,
|
||||
std::uint32_t limit,
|
||||
bool forward,
|
||||
std::optional<TransactionsCursor> const& cursorIn,
|
||||
boost::asio::yield_context yield
|
||||
) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Fetches a specific ledger object.
|
||||
*
|
||||
@@ -725,6 +779,28 @@ public:
|
||||
virtual void
|
||||
writeNFTTransactions(std::vector<NFTTransactionsData> const& data) = 0;
|
||||
|
||||
/**
|
||||
* @brief Write MPTokenIssuance transaction index rows to the `mptoken_issuance_transactions`
|
||||
* table.
|
||||
*
|
||||
* @param data A vector of MPTokenIssuanceTransactionsData objects.
|
||||
*/
|
||||
virtual void
|
||||
writeMPTokenIssuanceTransactions(std::vector<MPTokenIssuanceTransactionsData> const& data) = 0;
|
||||
|
||||
/**
|
||||
* @brief Write MPTokenIssuance transaction index rows to the
|
||||
* `account_mptoken_issuance_transactions` table.
|
||||
*
|
||||
* One row is written per affected account in each record.
|
||||
*
|
||||
* @param data A vector of MPTokenIssuanceTransactionsData objects.
|
||||
*/
|
||||
virtual void
|
||||
writeAccountMPTokenIssuanceTransactions(
|
||||
std::vector<MPTokenIssuanceTransactionsData> const& data
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* @brief Write accounts that started holding onto a MPT.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user