nonforwardable reader: refactor, extract reset_partition
No observable behaviour changes, just refactor the code.
This commit is contained in:
@@ -422,19 +422,22 @@ flat_mutation_reader_v2 make_nonforwardable(flat_mutation_reader_v2 r, bool sing
|
||||
return _underlying.fast_forward_to(position_range::all_clustered_rows());
|
||||
}
|
||||
push_mutation_fragment(*_schema, _permit, partition_end());
|
||||
_partition_is_open = false;
|
||||
reset_partition();
|
||||
}
|
||||
if (_single_partition) {
|
||||
_end_of_stream = true;
|
||||
return make_ready_future<>();
|
||||
}
|
||||
return _underlying.next_partition().then([this] {
|
||||
_static_row_done = false;
|
||||
return _underlying.fill_buffer().then([this] {
|
||||
_end_of_stream = is_end_end_of_underlying_stream();
|
||||
});
|
||||
});
|
||||
}
|
||||
void reset_partition() {
|
||||
_partition_is_open = false;
|
||||
_static_row_done = false;
|
||||
}
|
||||
public:
|
||||
reader(flat_mutation_reader_v2 r, bool single_partition)
|
||||
: impl(r.schema(), r.permit())
|
||||
@@ -461,8 +464,7 @@ flat_mutation_reader_v2 make_nonforwardable(flat_mutation_reader_v2 r, bool sing
|
||||
clear_buffer_to_next_partition();
|
||||
auto maybe_next_partition = make_ready_future<>();;
|
||||
if (is_buffer_empty()) {
|
||||
_partition_is_open = false;
|
||||
_static_row_done = false;
|
||||
reset_partition();
|
||||
maybe_next_partition = _underlying.next_partition();
|
||||
}
|
||||
return maybe_next_partition.then([this] {
|
||||
@@ -472,8 +474,7 @@ flat_mutation_reader_v2 make_nonforwardable(flat_mutation_reader_v2 r, bool sing
|
||||
virtual future<> fast_forward_to(const dht::partition_range& pr) override {
|
||||
_end_of_stream = false;
|
||||
clear_buffer();
|
||||
_partition_is_open = false;
|
||||
_static_row_done = false;
|
||||
reset_partition();
|
||||
return _underlying.fast_forward_to(pr);
|
||||
}
|
||||
virtual future<> close() noexcept override {
|
||||
|
||||
Reference in New Issue
Block a user