Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Toggle main menu visibility
Loading...
Searching...
No Matches
FullTableScannerAdapterBase.hpp
1
#pragma once
2
3
#include "migration/cassandra/CassandraMigrationBackend.hpp"
4
#include "migration/cassandra/impl/FullTableScanner.hpp"
5
6
#include <boost/asio/spawn.hpp>
7
8
#include <memory>
9
#include <utility>
10
11
namespace
migration::cassandra::impl {
12
20
template
<TableSpec TableDesc>
21
struct
FullTableScannerAdapterBase
{
22
static_assert
(
TableSpec<TableDesc>
);
23
24
protected
:
28
std::shared_ptr<CassandraMigrationBackend>
backend_
;
29
30
public
:
31
virtual
~FullTableScannerAdapterBase
() =
default
;
32
38
FullTableScannerAdapterBase
(std::shared_ptr<CassandraMigrationBackend> backend)
39
:
backend_
(std::move(backend))
40
{
41
}
42
50
void
51
readByTokenRange
(
TokenRange
const
& range, boost::asio::yield_context yield)
52
{
53
backend_
->migrateInTokenRange<TableDesc>(
54
range.start, range.end, [
this
](
auto
const
& row) {
onRowRead
(row); }, yield
55
);
56
}
57
64
virtual
void
65
onRowRead
(TableDesc::Row
const
& row) = 0;
66
};
67
}
// namespace migration::cassandra::impl
migration::cassandra::impl::TableSpec
Definition
Spec.hpp:12
migration::cassandra::impl::FullTableScannerAdapterBase::readByTokenRange
void readByTokenRange(TokenRange const &range, boost::asio::yield_context yield)
Read the row in the given token range from database, this is the adapt function for the FullTableScan...
Definition
FullTableScannerAdapterBase.hpp:51
migration::cassandra::impl::FullTableScannerAdapterBase::FullTableScannerAdapterBase
FullTableScannerAdapterBase(std::shared_ptr< CassandraMigrationBackend > backend)
Construct a new Full Table Scanner Adapter Base object.
Definition
FullTableScannerAdapterBase.hpp:38
migration::cassandra::impl::FullTableScannerAdapterBase::backend_
std::shared_ptr< CassandraMigrationBackend > backend_
The backend to use.
Definition
FullTableScannerAdapterBase.hpp:28
migration::cassandra::impl::FullTableScannerAdapterBase::onRowRead
virtual void onRowRead(TableDesc::Row const &row)=0
Called when a row is read. The derived class should implement this function to convert the database b...
migration::cassandra::impl::TokenRange
The token range used to split the full table scan into multiple ranges.
Definition
FullTableScanner.hpp:23
src
migration
cassandra
impl
FullTableScannerAdapterBase.hpp
Generated by
1.17.0