refactor: Clio Config (#1544)

Implementation of new config definition + methods + UT

Steps that still need to be implemented: 
- Make ClioConfigDefinition and it's method to be as constexpr as
possible
- Getting User Config file and populating the values in ConfigDefinition
while checking for constraints on user values
- Replacing all the places where we fetch config values (by using
config.valueOr/MaybeValue) to instead get it from Config Definition
- Generate markdown file using Clio Config Description
This commit is contained in:
Peter Chen
2024-08-06 11:07:25 -04:00
committed by GitHub
parent 5abf912b5a
commit 2bd7ac346c
27 changed files with 2421 additions and 20 deletions

View File

@@ -23,6 +23,7 @@
#include "rpc/common/Checkers.hpp"
#include "rpc/common/Concepts.hpp"
#include "rpc/common/Types.hpp"
#include "util/UnsupportedType.hpp"
#include <boost/json/array.hpp>
#include <boost/json/value.hpp>
@@ -36,9 +37,6 @@
namespace rpc::impl {
template <typename>
static constexpr bool unsupported_v = false;
using FieldSpecProcessor = std::function<MaybeError(boost::json::value&)>;
static FieldSpecProcessor const EMPTY_FIELD_PROCESSOR = [](boost::json::value&) -> MaybeError { return {}; };
@@ -64,7 +62,7 @@ makeFieldProcessor(std::string const& key, Processors&&... procs)
if (auto const res = req->modify(j, key); not res)
firstFailure = res.error();
} else {
static_assert(unsupported_v<decltype(*req)>);
static_assert(util::Unsupported<decltype(*req)>);
}
}(),
...