Files
scylladb/compaction/compaction_strategy_state.hh
Avi Kivity f3eade2f62 treewide: relicense to ScyllaDB-Source-Available-1.0
Drop the AGPL license in favor of a source-available license.
See the blog post [1] for details.

[1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
2024-12-18 17:45:13 +02:00

40 lines
950 B
C++

/*
* Copyright (C) 2023-present ScyllaDB
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#pragma once
#include "time_window_compaction_strategy.hh"
#include "leveled_compaction_strategy.hh"
#include <utility>
#include <variant>
namespace compaction {
class compaction_strategy_state {
public:
struct default_empty_state {};
using states_variant = std::variant<default_empty_state, sstables::leveled_compaction_strategy_state, sstables::time_window_compaction_strategy_state>;
private:
states_variant _state;
public:
explicit compaction_strategy_state(states_variant state) : _state(std::move(state)) {
}
template <typename StateType>
requires requires (StateType st) {
{ states_variant{} = st };
}
StateType& get() noexcept {
return std::get<StateType>(_state);
}
static compaction_strategy_state make(const sstables::compaction_strategy& cs);
};
}