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 =
26 std::tuple<ripple::uint256, std::uint64_t, std::uint32_t, ripple::Blob, ripple::Blob>;
27 static constexpr char const* kPARTITION_KEY = "hash";
28 static constexpr char const* kTABLE_NAME = "transactions";
29};
30
35class TransactionsAdapter : public impl::FullTableScannerAdapterBase<TableTransactionsDesc> {
36public:
37 using OnTransactionRead = std::function<void(ripple::STTx, ripple::TxMeta)>;
38
46 std::shared_ptr<CassandraMigrationBackend> backend,
47 OnTransactionRead onTxRead
48 )
50 , onTransactionRead_{std::move(onTxRead)}
51 {
52 }
53
59 void
60 onRowRead(TableTransactionsDesc::Row const& row) override;
61
62private:
63 OnTransactionRead onTransactionRead_;
64};
65
66} // namespace migration::cassandra::impl
TransactionsAdapter(std::shared_ptr< CassandraMigrationBackend > backend, OnTransactionRead onTxRead)
Construct a new Transactions Adapter object.
Definition TransactionsAdapter.hpp:45
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