readers/nonforwardable: convert to v2

It has a single user, the row cache, which for now has to
upgrade/downgrade around the nonforwardable reader, but this will go
away in the next patches when the row cache readers are converted to v2
proper.
This commit is contained in:
Botond Dénes
2022-04-06 11:29:02 +03:00
parent 46481264e9
commit 7626beb729
3 changed files with 9 additions and 9 deletions

View File

@@ -537,9 +537,9 @@ flat_mutation_reader_v2 make_reversing_reader(flat_mutation_reader_v2 original,
return make_flat_mutation_reader_v2<partition_reversing_mutation_reader>(std::move(original), max_size, std::move(slice));
}
flat_mutation_reader make_nonforwardable(flat_mutation_reader r, bool single_partition) {
class reader : public flat_mutation_reader::impl {
flat_mutation_reader _underlying;
flat_mutation_reader_v2 make_nonforwardable(flat_mutation_reader_v2 r, bool single_partition) {
class reader : public flat_mutation_reader_v2::impl {
flat_mutation_reader_v2 _underlying;
bool _single_partition;
bool _static_row_done = false;
bool is_end_end_of_underlying_stream() const {
@@ -563,7 +563,7 @@ flat_mutation_reader make_nonforwardable(flat_mutation_reader r, bool single_par
});
}
public:
reader(flat_mutation_reader r, bool single_partition)
reader(flat_mutation_reader_v2 r, bool single_partition)
: impl(r.schema(), r.permit())
, _underlying(std::move(r))
, _single_partition(single_partition)
@@ -600,7 +600,7 @@ flat_mutation_reader make_nonforwardable(flat_mutation_reader r, bool single_par
return _underlying.close();
}
};
return make_flat_mutation_reader<reader>(std::move(r), single_partition);
return make_flat_mutation_reader_v2<reader>(std::move(r), single_partition);
}
template<typename Generator>

View File

@@ -8,7 +8,6 @@
#pragma once
class flat_mutation_reader;
flat_mutation_reader make_nonforwardable(flat_mutation_reader, bool);
class flat_mutation_reader_v2;
flat_mutation_reader_v2 make_nonforwardable(flat_mutation_reader_v2, bool);

View File

@@ -23,6 +23,7 @@
#include "readers/empty.hh"
#include "readers/forwardable_v2.hh"
#include "readers/nonforwardable.hh"
#include "readers/conversion.hh"
namespace cache {
@@ -351,7 +352,7 @@ future<> read_context::create_underlying() {
static flat_mutation_reader read_directly_from_underlying(read_context& reader) {
flat_mutation_reader res = make_delegating_reader(reader.underlying().underlying());
res.upgrade_schema(reader.schema());
return make_nonforwardable(std::move(res), true);
return downgrade_to_v1(make_nonforwardable(upgrade_to_v2(std::move(res)), true));
}
// Reader which populates the cache using data from the delegate.