feat(configuration): bounded schemas, provenance/redaction, and async transactional ReloadController

This commit is contained in:
faumaray committed 2026-11-26 16:30:30 +03:00
1 parent a24e086e47
commit 1dc51d5c43
14 files changed
+3351

No files matched your search

@@ -0,0 +1,72 @@
#include <Void/Configuration/ReloadController.hpp>
#include <algorithm>
#include <set>
namespace Void::Configuration::detail
{
bool AsyncReloadGate::try_lock() noexcept
{
std::lock_guard lk{mu_};
if (locked_) {
return false;
}
locked_ = true;
return true;
}
bool AsyncReloadGate::enqueue_or_acquire(Void::Async::Executor* exec,
std::coroutine_handle<> h) noexcept
{
std::lock_guard lk{mu_};
if (!locked_) {
locked_ = true;
return false; // do not suspend
}
waiters_.push_back(Waiter{exec, h});
return true;
}
void AsyncReloadGate::release() noexcept
{
Waiter next{};
bool has_next = false;
{
std::lock_guard lk{mu_};
if (!waiters_.empty()) {
next = waiters_.front();
waiters_.pop_front();
has_next = true;
} else {
locked_ = false;
}
}
if (has_next && next.h) {
if (next.exec != nullptr) {
next.exec->post_completion(next.h);
} else {
next.h.resume();
}
}
}
std::vector<std::string> diff_merged_keys(const MergedConfig& old_cfg,
const MergedConfig& new_cfg)
{
std::set<std::string> out;
for (const auto& [k, ne] : new_cfg.entries) {
const auto it = old_cfg.entries.find(k);
if (it == old_cfg.entries.end() || it->second.state != ne.state ||
it->second.value != ne.value) {
out.insert(k);
}
}
for (const auto& [k, oe] : old_cfg.entries) {
if (!new_cfg.entries.contains(k) &&
oe.state != ValueState::Missing) {
out.insert(k);
}
}
return std::vector<std::string>{out.begin(), out.end()};
}
} // namespace Void::Configuration::detail
+4
View File
@@ -0,0 +1,4 @@
void_add_module(ConfigurationAsync
INTERNAL_DEPS Configuration SystemAsync Async Time Functional LogState
EXTRA_HEADERS Void/Configuration/ReloadController.hpp
)