mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-31 20:16:43 +00:00
pager: make query_result_visitor base class a template parameter
So far query_result_visitor was tied to result_set_builder. The goal is to enable result_generator to work with paged queries as well so we need to decouple them.
This commit is contained in:
@@ -136,8 +136,9 @@ public:
|
||||
* beginning. If the pager is exhausted, the result is undefined.
|
||||
*/
|
||||
::shared_ptr<const paging_state> state() const;
|
||||
|
||||
|
||||
private:
|
||||
template<typename Base>
|
||||
class query_result_visitor;
|
||||
|
||||
void handle_result(cql3::selection::result_set_builder& builder,
|
||||
|
||||
@@ -241,17 +241,15 @@ static bool has_clustering_keys(const schema& s, const query::read_command& cmd)
|
||||
});
|
||||
}
|
||||
|
||||
class query_pager::query_result_visitor : public cql3::selection::result_set_builder::visitor {
|
||||
template<typename Base>
|
||||
class query_pager::query_result_visitor : public Base {
|
||||
using visitor = Base;
|
||||
public:
|
||||
uint32_t total_rows = 0;
|
||||
std::experimental::optional<partition_key> last_pkey;
|
||||
std::experimental::optional<clustering_key> last_ckey;
|
||||
|
||||
query_result_visitor(cql3::selection::result_set_builder& builder,
|
||||
const schema& s,
|
||||
const cql3::selection::selection& selection)
|
||||
: visitor(builder, s, selection)
|
||||
{ }
|
||||
using Base::Base;
|
||||
|
||||
void accept_new_partition(uint32_t) {
|
||||
throw std::logic_error("Should not reach!");
|
||||
@@ -283,7 +281,7 @@ public:
|
||||
foreign_ptr<lw_shared_ptr<query::result>> results,
|
||||
uint32_t page_size, gc_clock::time_point now) {
|
||||
|
||||
query_result_visitor v(builder, *_schema, *_selection);
|
||||
query_result_visitor<cql3::selection::result_set_builder::visitor> v(builder, *_schema, *_selection);
|
||||
query::result_view::consume(*results, _cmd->slice, v);
|
||||
|
||||
if (_last_pkey) {
|
||||
|
||||
Reference in New Issue
Block a user