Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
TransactionsAdapter.hpp
1#pragma once
2
3#include "migration/cassandra/CassandraMigrationBackend.hpp"
4#include "migration/cassandra/impl/FullTableScannerAdapterBase.hpp"
5
6#include <boost/asio/spawn.hpp>
7#include <xrpl/basics/Blob.h>
8#include <xrpl/basics/base_uint.h>
9#include <xrpl/protocol/STTx.h>
10#include <xrpl/protocol/TxMeta.h>
11
12#include <cstdint>
13#include <functional>
14#include <memory>
15#include <tuple>
16#include <utility>
17
18namespace migration::cassandra::impl {
19
24 // hash, date, ledger_seq, metadata, transaction
25 using Row = std::tuple<xrpl::uint256, std::uint64_t, std::uint32_t, xrpl::Blob, xrpl::Blob>;
26 static constexpr char const* kPartitionKey = "hash";
27 static constexpr char const* kTableName = "transactions";
28};
29
34class TransactionsAdapter : public impl::FullTableScannerAdapterBase<TableTransactionsDesc> {
35public:
36 using OnTransactionRead = std::function<void(xrpl::STTx, xrpl::TxMeta)>;
37
45 std::shared_ptr<CassandraMigrationBackend> backend,
46 OnTransactionRead onTxRead
47 )
49 , onTransactionRead_{std::move(onTxRead)}
50 {
51 }
52
58 void
59 onRowRead(TableTransactionsDesc::Row const& row) override;
60
61private:
62 OnTransactionRead onTransactionRead_;
63};
64
65} // namespace migration::cassandra::impl
TransactionsAdapter(std::shared_ptr< CassandraMigrationBackend > backend, OnTransactionRead onTxRead)
Construct a new Transactions Adapter object.
Definition TransactionsAdapter.hpp:44
void onRowRead(TableTransactionsDesc::Row const &row) override
The callback when a row is read.
Definition TransactionsAdapter.cpp:10
The base class for the full table scanner adapter. It is responsible for reading the rows from the fu...
Definition FullTableScannerAdapterBase.hpp:21
FullTableScannerAdapterBase(std::shared_ptr< CassandraMigrationBackend > backend)
Definition FullTableScannerAdapterBase.hpp:38
The description of the transactions table. It has to be a TableSpec.
Definition TransactionsAdapter.hpp:23