config: Make object storage config updateable_value_source

Now its plain updateable_value, but without the ..._source object the
updateable_value is just a no-op value holder. In order for the
observers to operate there must be the value source, updating it would
update the attached updateable values _and_ notify the observers.

In order for the config to be the u.v._source, config entries should be
comparable to each other, thus the <=> operator for it

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
Pavel Emelyanov
2023-09-28 10:12:40 +03:00
parent 9eb96a03f0
commit 210b01a5ce
5 changed files with 9 additions and 5 deletions

View File

@@ -467,7 +467,7 @@ public:
const db::extensions& extensions() const;
utils::updateable_value<std::unordered_map<sstring, s3::endpoint_config>> object_storage_config;
utils::updateable_value_source<std::unordered_map<sstring, s3::endpoint_config>> object_storage_config;
named_value<std::vector<error_injection_at_startup>> error_injections_at_startup;

View File

@@ -217,7 +217,7 @@ static future<> read_object_storage_config(db::config& db_cfg) {
}
}
db_cfg.object_storage_config = std::move(cfg);
db_cfg.object_storage_config.set(std::move(cfg));
}
static future<>

View File

@@ -743,7 +743,7 @@ future<> test_schema_digest_does_not_change_with_disabled_features(sstring data_
db_cfg.experimental_features({experimental_features_t::feature::UDF, experimental_features_t::feature::KEYSPACE_STORAGE_OPTIONS}, db::config::config_source::CommandLine);
std::unordered_map<sstring, s3::endpoint_config> so_config;
so_config["localhost"] = s3::endpoint_config{};
db_cfg.object_storage_config = std::move(so_config);
db_cfg.object_storage_config.set(std::move(so_config));
if (regenerate) {
db_cfg.data_file_directories({data_dir}, db::config::config_source::CommandLine);
} else {

View File

@@ -177,7 +177,7 @@ std::unordered_map<sstring, s3::endpoint_config> make_storage_options_config(con
std::unique_ptr<db::config> make_db_config(sstring temp_dir, const data_dictionary::storage_options so) {
auto cfg = std::make_unique<db::config>();
cfg->data_file_directories.set({ temp_dir });
cfg->object_storage_config = make_storage_options_config(so);
cfg->object_storage_config.set(make_storage_options_config(so));
return cfg;
}
@@ -229,7 +229,7 @@ future<> test_env::do_with_async(noncopyable_function<void (test_env&)> func, te
auto wrap = std::make_shared<test_env_with_cql>(std::move(func), std::move(cfg));
auto db_cfg = make_shared<db::config>();
db_cfg->experimental_features({db::experimental_features_t::feature::KEYSPACE_STORAGE_OPTIONS});
db_cfg->object_storage_config = make_storage_options_config(wrap->cfg.storage);
db_cfg->object_storage_config.set(make_storage_options_config(wrap->cfg.storage));
return do_with_cql_env_thread([wrap = std::move(wrap)] (auto& cql_env) mutable {
test_env env(std::move(wrap->cfg), &cql_env.get_sstorage_manager().local());
auto close_env = defer([&] { env.stop().get(); });

View File

@@ -25,9 +25,13 @@ struct endpoint_config {
// the security token, only for session credentials
std::string session_token;
std::string region;
std::strong_ordering operator<=> (const aws_config& o) const = default;
};
std::optional<aws_config> aws;
std::strong_ordering operator<=> (const endpoint_config& o) const = default;
};
using endpoint_config_ptr = seastar::lw_shared_ptr<endpoint_config>;