/* * Copyright (C) 2016 ScyllaDB */ /* * This file is part of Scylla. * * Scylla is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Scylla is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Scylla. If not, see . */ #pragma once #include "sstables.hh" #include "query-request.hh" // for partition_range; FIXME: move it out of there #include #include namespace sstables { class sstable_set_impl; class incremental_selector_impl; class sstable_set { std::unique_ptr _impl; // used to support column_family::get_sstable(), which wants to return an sstable_list // that has a reference somewhere lw_shared_ptr _all; public: ~sstable_set(); sstable_set(std::unique_ptr impl, lw_shared_ptr all); sstable_set(const sstable_set&); sstable_set(sstable_set&&) noexcept; sstable_set& operator=(const sstable_set&); sstable_set& operator=(sstable_set&&) noexcept; std::vector select(const dht::partition_range& range) const; lw_shared_ptr all() const { return _all; } void insert(shared_sstable sst); void erase(shared_sstable sst); // Used to incrementally select sstables from sstable set using tokens. // sstable set must be alive and cannot be modified while incremental // selector is used. class incremental_selector { std::unique_ptr _impl; mutable stdx::optional _current_token_range; mutable std::vector _current_sstables; public: ~incremental_selector(); incremental_selector(std::unique_ptr impl); incremental_selector(incremental_selector&&) noexcept; const std::vector& select(const dht::token& t) const; }; incremental_selector make_incremental_selector() const; }; }