mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-06 15:03:06 +00:00
compaction_strategy: introduce make_sstable_set()
Allow compaction_strategy to create a container for sstables that is optimized for the strategy. Most compaction_strategies return bag_sstable_set; leveled compaction returns the specialized partitioned_sstable_set.
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#pragma once
|
||||
|
||||
class column_family;
|
||||
class schema;
|
||||
using schema_ptr = lw_shared_ptr<const schema>;
|
||||
|
||||
namespace sstables {
|
||||
|
||||
@@ -35,6 +37,7 @@ enum class compaction_strategy_type {
|
||||
|
||||
class compaction_strategy_impl;
|
||||
class sstable;
|
||||
class sstable_set;
|
||||
struct compaction_descriptor;
|
||||
|
||||
class compaction_strategy {
|
||||
@@ -90,6 +93,8 @@ public:
|
||||
sstring name() const {
|
||||
return name(type());
|
||||
}
|
||||
|
||||
sstable_set make_sstable_set(schema_ptr schema) const;
|
||||
};
|
||||
|
||||
// Creates a compaction_strategy object from one of the strategies available.
|
||||
|
||||
@@ -214,6 +214,9 @@ public:
|
||||
virtual bool parallel_compaction() const {
|
||||
return true;
|
||||
}
|
||||
virtual std::unique_ptr<sstable_set_impl> make_sstable_set(schema_ptr schema) const {
|
||||
return std::make_unique<bag_sstable_set>();
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
@@ -567,6 +570,9 @@ public:
|
||||
virtual compaction_strategy_type type() const {
|
||||
return compaction_strategy_type::leveled;
|
||||
}
|
||||
virtual std::unique_ptr<sstable_set_impl> make_sstable_set(schema_ptr schema) const override {
|
||||
return std::make_unique<partitioned_sstable_set>(std::move(schema));
|
||||
}
|
||||
};
|
||||
|
||||
compaction_descriptor leveled_compaction_strategy::get_sstables_for_compaction(column_family& cfs, std::vector<sstables::shared_sstable> candidates) {
|
||||
@@ -605,6 +611,13 @@ bool compaction_strategy::parallel_compaction() const {
|
||||
return _compaction_strategy_impl->parallel_compaction();
|
||||
}
|
||||
|
||||
sstable_set
|
||||
compaction_strategy::make_sstable_set(schema_ptr schema) const {
|
||||
return sstable_set(
|
||||
_compaction_strategy_impl->make_sstable_set(std::move(schema)),
|
||||
make_lw_shared<sstable_list>());
|
||||
}
|
||||
|
||||
compaction_strategy make_compaction_strategy(compaction_strategy_type strategy, const std::map<sstring, sstring>& options) {
|
||||
::shared_ptr<compaction_strategy_impl> impl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user