Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
ObjectsAdapter.hpp
1#pragma once
2
3#include "data/Types.hpp"
4#include "migration/cassandra/CassandraMigrationBackend.hpp"
5#include "migration/cassandra/impl/FullTableScannerAdapterBase.hpp"
6
7#include <boost/asio/spawn.hpp>
8#include <xrpl/basics/base_uint.h>
9#include <xrpl/protocol/STLedgerEntry.h>
10#include <xrpl/protocol/STObject.h>
11
12#include <cstdint>
13#include <functional>
14#include <memory>
15#include <optional>
16#include <tuple>
17#include <utility>
18
19namespace migration::cassandra::impl {
20
25 using Row = std::tuple<ripple::uint256, std::uint32_t, data::Blob>;
26 static constexpr char const* kPARTITION_KEY = "key";
27 static constexpr char const* kTABLE_NAME = "objects";
28};
29
34class ObjectsAdapter : public impl::FullTableScannerAdapterBase<TableObjectsDesc> {
35public:
36 using OnStateRead = std::function<void(std::uint32_t, std::optional<ripple::SLE>)>;
37
45 std::shared_ptr<CassandraMigrationBackend> backend,
46 OnStateRead onStateRead
47 )
49 , onStateRead_{std::move(onStateRead)}
50 {
51 }
52
58 void
59 onRowRead(TableObjectsDesc::Row const& row) override;
60
61private:
62 OnStateRead onStateRead_;
63};
64
65} // namespace migration::cassandra::impl
ObjectsAdapter(std::shared_ptr< CassandraMigrationBackend > backend, OnStateRead onStateRead)
Construct a new Objects Adapter object.
Definition ObjectsAdapter.hpp:44
void onRowRead(TableObjectsDesc::Row const &row) override
Called when a row is read.
Definition ObjectsAdapter.cpp:12
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 objects table. It has to be a TableSpec.
Definition ObjectsAdapter.hpp:24