diff --git a/src/v/config/bounded_property.h b/src/v/config/bounded_property.h index 83a0f2eb2ed5f..5bb1d2b13196e 100644 --- a/src/v/config/bounded_property.h +++ b/src/v/config/bounded_property.h @@ -215,9 +215,12 @@ class bounded_property : public property { , _bounds(bounds) , _example(generate_example()) {} + using property::set_value; + void set_value(std::any v) override { property::update_value(std::any_cast(std::move(v))); } + bool set_value(YAML::Node n) override { auto val = std::move(n.as()); return clamp_and_update(val); diff --git a/src/v/config/property.h b/src/v/config/property.h index b0898c575f83e..3ef63b37cca25 100644 --- a/src/v/config/property.h +++ b/src/v/config/property.h @@ -161,6 +161,14 @@ class property : public base_property { update_value(std::any_cast(std::move(v))); } + template + requires std::constructible_from + void set_value(U&& v) { + // needs to go through virtual inheritance chain, since this class is + // not final + set_value(std::make_any(std::forward(v))); + } + bool set_value(YAML::Node n) override { return update_value(std::move(n.as())); } @@ -865,9 +873,14 @@ class retention_duration_property final : public property> { public: using property::property; + using property::set_value; + void set_value(std::any v) final { - update_value(std::any_cast(std::move(v))); + update_value( + std::any_cast>(std::move(v)) + .value_or(-1ms)); } + bool set_value(YAML::Node n) final { return update_value(n.as()); }