mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-05 06:23:03 +00:00
storage_proxy: Extract get_restricted_ranges() as a free function
To make it directly testable.
This commit is contained in:
@@ -2275,6 +2275,12 @@ float storage_proxy::estimate_result_rows_per_range(lw_shared_ptr<query::read_co
|
||||
*/
|
||||
std::vector<query::partition_range>
|
||||
storage_proxy::get_restricted_ranges(keyspace& ks, const schema& s, query::partition_range range) {
|
||||
locator::token_metadata& tm = get_local_storage_service().get_token_metadata();
|
||||
return service::get_restricted_ranges(tm, s, std::move(range));
|
||||
}
|
||||
|
||||
std::vector<query::partition_range>
|
||||
get_restricted_ranges(locator::token_metadata& tm, const schema& s, query::partition_range range) {
|
||||
dht::ring_position_comparator cmp(s);
|
||||
|
||||
// special case for bounds containing exactly 1 token
|
||||
@@ -2285,8 +2291,6 @@ storage_proxy::get_restricted_ranges(keyspace& ks, const schema& s, query::parti
|
||||
return std::vector<query::partition_range>({std::move(range)});
|
||||
}
|
||||
|
||||
locator::token_metadata& tm = get_local_storage_service().get_token_metadata();
|
||||
|
||||
std::vector<query::partition_range> ranges;
|
||||
|
||||
auto add_range = [&ranges, &cmp] (query::partition_range&& r) {
|
||||
|
||||
@@ -241,4 +241,7 @@ inline shared_ptr<storage_proxy> get_local_shared_storage_proxy() {
|
||||
return _the_storage_proxy.local_shared();
|
||||
}
|
||||
|
||||
std::vector<query::partition_range> get_restricted_ranges(locator::token_metadata&,
|
||||
const schema&, query::partition_range);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user