feat(configuration): bounded schemas, provenance/redaction, and async transactional ReloadController
This commit is contained in:
1 parent
a24e086e47
commit
1dc51d5c43
14 files changed
+3351
No files matched your search
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 4.0)
|
||||
project(VoidConfigurationAsyncOnlyConsumer LANGUAGES CXX)
|
||||
|
||||
find_package(Void CONFIG REQUIRED COMPONENTS ConfigurationAsync)
|
||||
|
||||
add_executable(void_configuration_async_only_consumer main.cpp)
|
||||
target_link_libraries(void_configuration_async_only_consumer PRIVATE Void::ConfigurationAsync)
|
||||
target_compile_features(void_configuration_async_only_consumer PRIVATE cxx_std_26)
|
||||
|
||||
enable_testing()
|
||||
add_test(NAME ConfigurationAsyncOnlyConsumer COMMAND void_configuration_async_only_consumer)
|
||||
@@ -0,0 +1,20 @@
|
||||
#include <Void/Async/Executor.hpp>
|
||||
#include <Void/Configuration/ReloadController.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
struct AsyncCfg {
|
||||
std::string mode{"ok"};
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
Void::Async::ManualExecutor exec;
|
||||
Void::Configuration::SourceSet ss;
|
||||
ss.add_defaults_map("d", {{"mode", "fast"}});
|
||||
auto schema = Void::Configuration::Schema<AsyncCfg>::from_reflection();
|
||||
auto ctrl = Void::Configuration::ReloadController<AsyncCfg>::create(
|
||||
schema, std::move(ss), {.executor = &exec});
|
||||
if (!ctrl) return 1;
|
||||
return (*ctrl)->current().values->mode == "fast" ? 0 : 2;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 4.0)
|
||||
project(VoidConfigurationOnlyConsumer LANGUAGES CXX)
|
||||
|
||||
find_package(Void CONFIG REQUIRED COMPONENTS Configuration)
|
||||
|
||||
add_executable(void_configuration_only_consumer main.cpp)
|
||||
target_link_libraries(void_configuration_only_consumer PRIVATE Void::Configuration)
|
||||
target_compile_features(void_configuration_only_consumer PRIVATE cxx_std_26)
|
||||
|
||||
enable_testing()
|
||||
add_test(NAME ConfigurationOnlyConsumer COMMAND void_configuration_only_consumer)
|
||||
@@ -0,0 +1,21 @@
|
||||
#include <Void/Configuration/Bind.hpp>
|
||||
#include <Void/Configuration/Config.hpp>
|
||||
#include <Void/Configuration/Schema.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
struct MinimalCfg {
|
||||
[[= Void::Configuration::Required{}]] std::string name;
|
||||
[[= Void::Configuration::IntRange{1, 100}]] int workers{4};
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
Void::Configuration::SourceSet ss;
|
||||
ss.add_defaults_map("def", {{"name", "svc"}, {"workers", "8"}});
|
||||
auto schema = Void::Configuration::Schema<MinimalCfg>::from_reflection();
|
||||
auto merged = Void::Configuration::load_sources(ss, schema.limits());
|
||||
if (!merged) return 1;
|
||||
auto val = Void::Configuration::validate<MinimalCfg>(*merged, schema);
|
||||
return val && val->value.name == "svc" && val->value.workers == 8 ? 0 : 2;
|
||||
}
|
||||
@@ -262,6 +262,26 @@ if(_has_plugin)
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_SQLite3=TRUE)
|
||||
endif()
|
||||
|
||||
has_modules(_has_configuration Configuration Core Functional System Data Time LogState)
|
||||
if(_has_configuration)
|
||||
run_consumer(ConfigurationOnly "${install_prefix}" "ConfigurationOnly"
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_Boost=TRUE
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_LibArchive=TRUE
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=TRUE
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=TRUE
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_SQLite3=TRUE)
|
||||
endif()
|
||||
|
||||
has_modules(_has_configuration_async ConfigurationAsync Configuration SystemAsync Async Time Functional LogState)
|
||||
if(_has_configuration_async)
|
||||
run_consumer(ConfigurationAsyncOnly "${install_prefix}" "ConfigurationAsyncOnly"
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_Boost=TRUE
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_LibArchive=TRUE
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=TRUE
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=TRUE
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_SQLite3=TRUE)
|
||||
endif()
|
||||
|
||||
# Foundation consumer with Core-formatting bridge and zero external packages.
|
||||
has_modules(_has_foundation Math Text Time Functional Binary FunctionalCoreFormatting Memory Core)
|
||||
if(_has_foundation)
|
||||
|
||||
Reference in new issue
Block a user