sstables: Delete duplicated code

For some reason date_tiered_compaction_strategy had its own identical
copy of get_value.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20200819211509.106594-1-espindola@scylladb.com>
This commit is contained in:
Rafael Ávila de Espíndola
2020-08-19 14:15:09 -07:00
committed by Avi Kivity
parent f7c5c48df6
commit 5fcfbd76a9
2 changed files with 3 additions and 10 deletions

View File

@@ -915,15 +915,15 @@ date_tiered_manifest::create_sst_and_min_timestamp_pairs(const std::vector<sstab
date_tiered_compaction_strategy_options::date_tiered_compaction_strategy_options(const std::map<sstring, sstring>& options) {
using namespace cql3::statements;
auto tmp_value = get_value(options, TIMESTAMP_RESOLUTION_KEY);
auto tmp_value = sstables::compaction_strategy_impl::get_value(options, TIMESTAMP_RESOLUTION_KEY);
auto target_unit = tmp_value ? tmp_value.value() : DEFAULT_TIMESTAMP_RESOLUTION;
tmp_value = get_value(options, MAX_SSTABLE_AGE_KEY);
tmp_value = sstables::compaction_strategy_impl::get_value(options, MAX_SSTABLE_AGE_KEY);
auto fractional_days = property_definitions::to_double(MAX_SSTABLE_AGE_KEY, tmp_value, DEFAULT_MAX_SSTABLE_AGE_DAYS);
int64_t max_sstable_age_in_hours = std::lround(fractional_days * 24);
max_sstable_age = duration_conversor::convert(target_unit, std::chrono::hours(max_sstable_age_in_hours));
tmp_value = get_value(options, BASE_TIME_KEY);
tmp_value = sstables::compaction_strategy_impl::get_value(options, BASE_TIME_KEY);
auto base_time_seconds = property_definitions::to_long(BASE_TIME_KEY, tmp_value, DEFAULT_BASE_TIME_SECONDS);
base_time = duration_conversor::convert(target_unit, std::chrono::seconds(base_time_seconds));
}

View File

@@ -97,13 +97,6 @@ public:
date_tiered_compaction_strategy_options();
private:
static std::optional<sstring> get_value(const std::map<sstring, sstring>& options, const sstring& name) {
auto it = options.find(name);
if (it == options.end()) {
return std::nullopt;
}
return it->second;
}
friend class date_tiered_manifest;
};