From 57ed93bf4464b3f2dc3a89b84709bb7c8fa424e4 Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Mon, 26 Oct 2020 19:33:11 +0100 Subject: [PATCH] db/virtual_table: Add a way to specify a range of partitions for virtual table queries. This change introduces a query_restrictions object into the virtual table infrastructure, for now only holding a restriction on partition ranges. That partition range is then implemented into memtable_filling_virtual_table. --- db/virtual_table.hh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/db/virtual_table.hh b/db/virtual_table.hh index 1f685c372c..167da4b95d 100644 --- a/db/virtual_table.hh +++ b/db/virtual_table.hh @@ -46,6 +46,11 @@ protected: bool this_shard_owns(const dht::decorated_key&) const; public: + class query_restrictions { + public: + virtual const dht::partition_range& partition_range() const = 0; + }; + explicit virtual_table(schema_ptr s) : _s(std::move(s)) {} const schema_ptr& schema() const { return _s; } @@ -62,7 +67,10 @@ class memtable_filling_virtual_table : public virtual_table { public: using virtual_table::virtual_table; + // Override one of these execute() overloads. + // The handler is always allowed to produce more data than implied by the query_restrictions. virtual future<> execute(std::function mutation_sink, db::timeout_clock::time_point timeout) { return make_ready_future<>(); } + virtual future<> execute(std::function mutation_sink, db::timeout_clock::time_point timeout, const query_restrictions&) { return execute(mutation_sink, timeout); } mutation_source as_mutation_source() override; };