refactor: remove old config (#2097)

fixes #1805

---------

Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
Co-authored-by: Maria Shodunke <maria-robobug@users.noreply.github.com>
Co-authored-by: Sergey Kuznetsov <skuznetsov@ripple.com>
This commit is contained in:
Peter Chen
2025-05-15 11:53:47 -04:00
committed by GitHub
parent 8cbbf6689d
commit cdb5882688
151 changed files with 385 additions and 1444 deletions

View File

@@ -21,7 +21,7 @@
#include "migration/MigrationApplication.hpp"
#include "util/build/Build.hpp"
#include "util/newconfig/ConfigDescription.hpp"
#include "util/config/ConfigDescription.hpp"
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>

View File

@@ -37,8 +37,8 @@
#include "rpc/WorkQueue.hpp"
#include "rpc/common/impl/HandlerProvider.hpp"
#include "util/build/Build.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/prometheus/Prometheus.hpp"
#include "web/AdminVerificationStrategy.hpp"
#include "web/RPCServerHandler.hpp"

View File

@@ -21,7 +21,7 @@
#include "app/Stopper.hpp"
#include "util/SignalsHandler.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
namespace app {

View File

@@ -19,8 +19,8 @@
#pragma once
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ConfigFileJson.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ConfigFileJson.hpp"
#include <cstdlib>
#include <iostream>

View File

@@ -23,8 +23,8 @@
#include "data/CassandraBackend.hpp"
#include "data/LedgerCacheInterface.hpp"
#include "data/cassandra/SettingsProvider.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>

View File

@@ -22,7 +22,7 @@
#include "data/cassandra/Types.hpp"
#include "data/cassandra/impl/Cluster.hpp"
#include "util/Constants.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <cerrno>
#include <chrono>

View File

@@ -21,7 +21,7 @@
#include "data/cassandra/Types.hpp"
#include "data/cassandra/impl/Cluster.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <cstdint>
#include <optional>

View File

@@ -19,7 +19,7 @@
#include "etl/CacheLoaderSettings.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <boost/algorithm/string/predicate.hpp>

View File

@@ -19,7 +19,7 @@
#pragma once
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <cstddef>

View File

@@ -26,8 +26,8 @@
#include "feed/SubscriptionManagerInterface.hpp"
#include "util/Assert.hpp"
#include "util/Constants.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include <boost/asio/io_context.hpp>
#include <xrpl/beast/core/CurrentThreadName.h>

View File

@@ -31,10 +31,10 @@
#include "util/Profiler.hpp"
#include "util/Random.hpp"
#include "util/ResponseExpirationCache.hpp"
#include "util/config/ArrayView.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ObjectView.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ArrayView.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/prometheus/Label.hpp"
#include "util/prometheus/Prometheus.hpp"

View File

@@ -30,8 +30,8 @@
#include "util/Assert.hpp"
#include "util/Mutex.hpp"
#include "util/ResponseExpirationCache.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/prometheus/Counter.hpp"
#include <boost/asio.hpp>

View File

@@ -26,7 +26,7 @@
#include "etl/impl/SourceImpl.hpp"
#include "etl/impl/SubscriptionSource.hpp"
#include "feed/SubscriptionManagerInterface.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <boost/asio/io_context.hpp>

View File

@@ -23,7 +23,7 @@
#include "etl/NetworkValidatedLedgersInterface.hpp"
#include "feed/SubscriptionManagerInterface.hpp"
#include "rpc/Errors.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <boost/asio/io_context.hpp>
#include <boost/asio/spawn.hpp>

View File

@@ -49,9 +49,8 @@
#include "util/Assert.hpp"
#include "util/Profiler.hpp"
#include "util/async/context/BasicExecutionContext.hpp"
#include "util/config/Config.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include <boost/json/object.hpp>
#include <fmt/core.h>

View File

@@ -32,10 +32,10 @@
#include "util/Profiler.hpp"
#include "util/Random.hpp"
#include "util/ResponseExpirationCache.hpp"
#include "util/config/ArrayView.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ObjectView.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ArrayView.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/prometheus/Label.hpp"
#include "util/prometheus/Prometheus.hpp"

View File

@@ -30,8 +30,8 @@
#include "util/Assert.hpp"
#include "util/Mutex.hpp"
#include "util/ResponseExpirationCache.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/prometheus/Counter.hpp"
#include <boost/asio.hpp>

View File

@@ -25,7 +25,7 @@
#include "etlng/impl/GrpcSource.hpp"
#include "etlng/impl/SourceImpl.hpp"
#include "feed/SubscriptionManagerInterface.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <boost/asio/io_context.hpp>

View File

@@ -24,7 +24,7 @@
#include "etlng/InitialLoadObserverInterface.hpp"
#include "feed/SubscriptionManagerInterface.hpp"
#include "rpc/Errors.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <boost/asio/io_context.hpp>
#include <boost/asio/spawn.hpp>

View File

@@ -31,8 +31,8 @@
#include "feed/impl/TransactionFeed.hpp"
#include "util/async/AnyExecutionContext.hpp"
#include "util/async/context/BasicExecutionContext.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include <boost/asio/executor_work_guard.hpp>
#include <boost/asio/io_context.hpp>

View File

@@ -23,8 +23,8 @@
#include "migration/MigrationApplication.hpp"
#include "rpc/common/impl/HandlerProvider.hpp"
#include "util/TerminationHandler.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include <cstdlib>
#include <exception>

View File

@@ -22,8 +22,8 @@
#include "migration/MigratiorStatus.hpp"
#include "migration/impl/MigrationManagerFactory.hpp"
#include "util/OverloadSet.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/prometheus/Prometheus.hpp"
#include <cstdlib>

View File

@@ -21,7 +21,7 @@
#include "data/LedgerCache.hpp"
#include "migration/MigrationManagerInterface.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <memory>
#include <string>

View File

@@ -24,8 +24,8 @@
#include "migration/MigratiorStatus.hpp"
#include "migration/cassandra/CassandraMigrationManager.hpp"
#include "util/Assert.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>

View File

@@ -21,7 +21,7 @@
#include "migration/MigrationManagerInterface.hpp"
#include "migration/impl/MigrationInspectorBase.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <memory>
#include <string>

View File

@@ -24,8 +24,8 @@
#include "migration/MigrationManagerInterface.hpp"
#include "migration/cassandra/CassandraMigrationBackend.hpp"
#include "migration/cassandra/CassandraMigrationManager.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include <boost/algorithm/string/predicate.hpp>

View File

@@ -21,7 +21,7 @@
#include "data/LedgerCacheInterface.hpp"
#include "migration/MigrationManagerInterface.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <expected>
#include <memory>

View File

@@ -24,8 +24,8 @@
#include "migration/impl/Spec.hpp"
#include "util/Assert.hpp"
#include "util/Concepts.hpp"
#include "util/config/ObjectView.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ObjectView.hpp"
#include <algorithm>
#include <array>

View File

@@ -20,7 +20,7 @@
#pragma once
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <boost/asio/spawn.hpp>

View File

@@ -20,8 +20,8 @@
#pragma once
#include "util/Mutex.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/prometheus/Counter.hpp"
#include "util/prometheus/Gauge.hpp"

View File

@@ -19,8 +19,8 @@
#include "rpc/common/impl/APIVersionParser.hpp"
#include "util/config/ObjectView.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ObjectView.hpp"
#include <boost/json/object.hpp>
#include <fmt/core.h>

View File

@@ -20,8 +20,8 @@
#pragma once
#include "rpc/common/APIVersion.hpp"
#include "util/config/ObjectView.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ObjectView.hpp"
#include <boost/json/object.hpp>

View File

@@ -61,7 +61,7 @@
#include "rpc/handlers/Tx.hpp"
#include "rpc/handlers/Unsubscribe.hpp"
#include "rpc/handlers/VersionHandler.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <memory>
#include <optional>

View File

@@ -22,7 +22,7 @@
#include "rpc/common/APIVersion.hpp"
#include "rpc/common/Types.hpp"
#include "rpc/common/impl/APIVersionParser.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <boost/json/conversion.hpp>
#include <boost/json/value.hpp>

View File

@@ -4,7 +4,6 @@ target_sources(
clio_util
PRIVATE Assert.cpp
build/Build.cpp
config/Config.cpp
CoroutineGroup.cpp
log/Logger.cpp
prometheus/Http.cpp
@@ -30,14 +29,14 @@ target_sources(
TimeUtils.cpp
TxUtils.cpp
LedgerUtils.cpp
newconfig/Array.cpp
newconfig/ArrayView.cpp
newconfig/ConfigConstraints.cpp
newconfig/ConfigDefinition.cpp
newconfig/ConfigFileJson.cpp
newconfig/ObjectView.cpp
newconfig/Types.cpp
newconfig/ValueView.cpp
config/Array.cpp
config/ArrayView.cpp
config/ConfigConstraints.cpp
config/ConfigDefinition.cpp
config/ConfigFileJson.cpp
config/ObjectView.cpp
config/Types.cpp
config/ValueView.cpp
)
# This must be above the target_link_libraries call otherwise backtrace doesn't work

View File

@@ -20,8 +20,8 @@
#include "util/SignalsHandler.hpp"
#include "util/Assert.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include <chrono>
#include <csignal>

View File

@@ -20,8 +20,8 @@
#pragma once
#include "util/async/context/BasicExecutionContext.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include <boost/asio/executor_work_guard.hpp>
#include <boost/asio/io_context.hpp>

View File

@@ -20,7 +20,7 @@
#pragma once
#include "util/Assert.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <boost/algorithm/string/predicate.hpp>
#include <boost/json.hpp>

View File

@@ -17,12 +17,12 @@
*/
//==============================================================================
#include "util/newconfig/Array.hpp"
#include "util/config/Array.hpp"
#include "util/Assert.hpp"
#include "util/newconfig/ConfigValue.hpp"
#include "util/newconfig/Error.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/ConfigValue.hpp"
#include "util/config/Error.hpp"
#include "util/config/Types.hpp"
#include <cstddef>
#include <optional>

View File

@@ -19,9 +19,9 @@
#pragma once
#include "util/newconfig/ConfigValue.hpp"
#include "util/newconfig/Error.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/ConfigValue.hpp"
#include "util/config/Error.hpp"
#include "util/config/Types.hpp"
#include <cstddef>
#include <optional>

View File

@@ -17,14 +17,14 @@
*/
//==============================================================================
#include "util/newconfig/ArrayView.hpp"
#include "util/config/ArrayView.hpp"
#include "util/Assert.hpp"
#include "util/newconfig/Array.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ConfigValue.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/newconfig/ValueView.hpp"
#include "util/config/Array.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ConfigValue.hpp"
#include "util/config/ObjectView.hpp"
#include "util/config/ValueView.hpp"
#include <cstddef>
#include <string_view>

View File

@@ -20,9 +20,9 @@
#pragma once
#include "util/Assert.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/newconfig/ValueView.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ObjectView.hpp"
#include "util/config/ValueView.hpp"
#include <cstddef>
#include <functional>

View File

@@ -1,210 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of clio: https://github.com/XRPLF/clio
Copyright (c) 2022, the clio developers.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#include "util/config/Config.hpp"
#include "util/Assert.hpp"
#include "util/Constants.hpp"
#include "util/config/impl/Helpers.hpp"
#include "util/log/Logger.hpp"
#include <boost/json/object.hpp>
#include <boost/json/parse.hpp>
#include <boost/json/parse_options.hpp>
#include <boost/json/value.hpp>
#include <algorithm>
#include <chrono>
#include <cmath>
#include <exception>
#include <filesystem>
#include <fstream>
#include <functional>
#include <ios>
#include <iterator>
#include <optional>
#include <sstream>
#include <stdexcept>
#include <string>
#include <string_view>
#include <utility>
namespace util {
// Note: `store_(store)` MUST use `()` instead of `{}` otherwise gcc
// picks `initializer_list` constructor and anything passed becomes an
// array :-D
Config::Config(boost::json::value store) : store_(std::move(store))
{
}
Config::operator bool() const noexcept
{
return not store_.is_null();
}
bool
Config::contains(KeyType key) const
{
return lookup(key).has_value();
}
std::optional<boost::json::value>
Config::lookup(KeyType key) const
{
if (store_.is_null())
return std::nullopt;
std::reference_wrapper<boost::json::value const> cur = std::cref(store_);
auto hasBrokenPath = false;
auto tokenized = impl::Tokenizer<KeyType, kSEPARATOR>{key};
std::string subkey{};
auto maybeSection = tokenized.next();
while (maybeSection.has_value()) {
auto section = maybeSection.value();
subkey += section;
if (not hasBrokenPath) {
if (not cur.get().is_object())
throw impl::StoreException("Not an object at '" + subkey + "'");
if (not cur.get().as_object().contains(section)) {
hasBrokenPath = true;
} else {
cur = std::cref(cur.get().as_object().at(section));
}
}
subkey += kSEPARATOR;
maybeSection = tokenized.next();
}
if (hasBrokenPath)
return std::nullopt;
return std::make_optional(cur);
}
std::optional<Config::ArrayType>
Config::maybeArray(KeyType key) const
{
try {
auto maybeArr = lookup(key);
if (maybeArr && maybeArr->is_array()) {
auto& arr = maybeArr->as_array();
ArrayType out;
out.reserve(arr.size());
std::ranges::transform(arr, std::back_inserter(out), [](auto&& element) {
return Config{std::forward<decltype(element)>(element)};
});
return std::make_optional<ArrayType>(std::move(out));
}
} catch (impl::StoreException const&) { // NOLINT(bugprone-empty-catch)
// ignore store error, but rethrow key errors
}
return std::nullopt;
}
Config::ArrayType
Config::array(KeyType key) const
{
if (auto maybeArr = maybeArray(key); maybeArr)
return maybeArr.value();
throw std::logic_error("No array found at '" + key + "'");
}
Config::ArrayType
Config::arrayOr(KeyType key, ArrayType fallback) const
{
if (auto maybeArr = maybeArray(key); maybeArr)
return maybeArr.value();
return fallback;
}
Config::ArrayType
Config::arrayOrThrow(KeyType key, std::string_view err) const
{
try {
return maybeArray(key).value();
} catch (std::exception const&) {
throw std::runtime_error(std::string{err});
}
}
Config
Config::section(KeyType key) const
{
auto maybeElement = lookup(key);
if (maybeElement && maybeElement->is_object())
return Config{std::move(*maybeElement)};
throw std::logic_error("No section found at '" + key + "'");
}
Config
Config::sectionOr(KeyType key, boost::json::object fallback) const
{
auto maybeElement = lookup(key);
if (maybeElement && maybeElement->is_object())
return Config{std::move(*maybeElement)};
return Config{std::move(fallback)};
}
Config::ArrayType
Config::array() const
{
if (not store_.is_array())
throw std::logic_error("_self_ is not an array");
ArrayType out;
auto const& arr = store_.as_array();
out.reserve(arr.size());
std::ranges::transform(arr, std::back_inserter(out), [](auto const& element) { return Config{element}; });
return out;
}
std::chrono::milliseconds
Config::toMilliseconds(float value)
{
ASSERT(value >= 0.0f, "Floating point value of seconds must be non-negative, got: {}", value);
return std::chrono::milliseconds{std::lroundf(value * static_cast<float>(util::kMILLISECONDS_PER_SECOND))};
}
Config
ConfigReader::open(std::filesystem::path path)
{
try {
std::ifstream const in(path, std::ios::in | std::ios::binary);
if (in) {
std::stringstream contents;
contents << in.rdbuf();
auto opts = boost::json::parse_options{};
opts.allow_comments = true;
return Config{boost::json::parse(contents.str(), {}, opts)};
}
} catch (std::exception const& e) {
LOG(util::LogService::error()) << "Could not read configuration file from '" << path.string()
<< "': " << e.what();
}
return Config{};
}
} // namespace util

View File

@@ -1,429 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of clio: https://github.com/XRPLF/clio
Copyright (c) 2022, the clio developers.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#pragma once
#include "util/config/impl/Helpers.hpp"
#include <boost/json.hpp>
#include <boost/json/kind.hpp>
#include <boost/json/object.hpp>
#include <boost/json/value.hpp>
#include <chrono>
#include <cstdint>
#include <exception>
#include <filesystem>
#include <functional>
#include <optional>
#include <stdexcept>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
namespace util {
/**
* @brief Convenience wrapper to query a JSON configuration file.
*
* Any custom data type can be supported by implementing the right `tag_invoke`
* for `boost::json::value_to`.
*/
class Config final {
boost::json::value store_;
static constexpr char kSEPARATOR = '.';
public:
using KeyType = std::string;
using ArrayType = std::vector<Config>;
using WriteCursorType = std::pair<std::optional<std::reference_wrapper<boost::json::value>>, KeyType>;
/**
* @brief Construct a new Config object.
* @param store boost::json::value that backs this instance
*/
explicit Config(boost::json::value store = {});
//
// Querying the store
//
/**
* @brief Checks whether underlying store is not null.
*
* @return true If the store is null
* @return false If the store is not null
*/
operator bool() const noexcept;
/**
* @brief Checks whether something exists under given key.
*
* @param key The key to check
* @return true If something exists under key
* @return false If nothing exists under key
* @throws std::logic_error If the key is of invalid format
*/
[[nodiscard]] bool
contains(KeyType key) const;
//
// Key value access
//
/**
* @brief Interface for fetching values by key that returns std::optional.
*
* Will attempt to fetch the value under the desired key. If the value
* exists and can be represented by the desired type Result then it will be
* returned wrapped in an optional. If the value exists but the conversion
* to Result is not possible - a runtime_error will be thrown. If the value
* does not exist under the specified key - std::nullopt is returned.
*
* @tparam Result The desired return type
* @param key The key to check
* @return Optional value of desired type
* @throws std::logic_error Thrown if conversion to Result is not possible
* or key is of invalid format
*/
template <typename Result>
[[nodiscard]] std::optional<Result>
maybeValue(KeyType key) const
{
auto maybeElement = lookup(key);
if (maybeElement)
return std::make_optional<Result>(checkedAs<Result>(key, *maybeElement));
return std::nullopt;
}
/**
* @brief Interface for fetching values by key.
*
* Will attempt to fetch the value under the desired key. If the value
* exists and can be represented by the desired type Result then it will be
* returned. If the value exists but the conversion
* to Result is not possible OR the value does not exist - a logic_error
* will be thrown.
*
* @tparam Result The desired return type
* @param key The key to check
* @return Value of desired type
* @throws std::logic_error Thrown if conversion to Result is not
* possible, value does not exist under specified key path or the key is of
* invalid format
*/
template <typename Result>
[[nodiscard]] Result
value(KeyType key) const
{
return maybeValue<Result>(key).value();
}
/**
* @brief Interface for fetching values by key with fallback.
*
* Will attempt to fetch the value under the desired key. If the value
* exists and can be represented by the desired type Result then it will be
* returned. If the value exists but the conversion
* to Result is not possible - a logic_error will be thrown. If the value
* does not exist under the specified key - user specified fallback is
* returned.
*
* @tparam Result The desired return type
* @param key The key to check
* @param fallback The fallback value
* @return Value of desired type
* @throws std::logic_error Thrown if conversion to Result is not possible
* or the key is of invalid format
*/
template <typename Result>
[[nodiscard]] Result
valueOr(KeyType key, Result fallback) const
{
try {
return maybeValue<Result>(key).value_or(fallback);
} catch (impl::StoreException const&) {
return fallback;
}
}
/**
* @brief Interface for fetching values by key with custom error handling.
*
* Will attempt to fetch the value under the desired key. If the value
* exists and can be represented by the desired type Result then it will be
* returned. If the value exists but the conversion
* to Result is not possible OR the value does not exist - a runtime_error
* will be thrown with the user specified message.
*
* @tparam Result The desired return type
* @param key The key to check
* @param err The custom error message
* @return Value of desired type
* @throws std::runtime_error Thrown if conversion to Result is not possible
* or value does not exist under key
*/
template <typename Result>
[[nodiscard]] Result
valueOrThrow(KeyType key, std::string_view err) const
{
try {
return maybeValue<Result>(key).value();
} catch (std::exception const&) {
throw std::runtime_error(std::string{err});
}
}
/**
* @brief Interface for fetching an array by key that returns std::optional.
*
* Will attempt to fetch an array under the desired key. If the array
* exists then it will be
* returned wrapped in an optional. If the array does not exist under the
* specified key - std::nullopt is returned.
*
* @param key The key to check
* @return Optional array
* @throws std::logic_error Thrown if the key is of invalid format
*/
[[nodiscard]] std::optional<ArrayType>
maybeArray(KeyType key) const;
/**
* @brief Interface for fetching an array by key.
*
* Will attempt to fetch an array under the desired key. If the array
* exists then it will be
* returned. If the array does not exist under the
* specified key an std::logic_error is thrown.
*
* @param key The key to check
* @return The array
* @throws std::logic_error Thrown if there is no array under the desired
* key or the key is of invalid format
*/
[[nodiscard]] ArrayType
array(KeyType key) const;
/**
* @brief Interface for fetching an array by key with fallback.
*
* Will attempt to fetch an array under the desired key. If the array
* exists then it will be returned.
* If the array does not exist or another type is stored under the desired
* key - user specified fallback is returned.
*
* @param key The key to check
* @param fallback The fallback array
* @return The array
* @throws std::logic_error Thrown if the key is of invalid format
*/
[[nodiscard]] ArrayType
arrayOr(KeyType key, ArrayType fallback) const;
/**
* @brief Interface for fetching an array by key with custom error handling.
*
* Will attempt to fetch an array under the desired key. If the array
* exists then it will be returned.
* If the array does not exist or another type is stored under the desired
* key - std::runtime_error is thrown with the user specified error message.
*
* @param key The key to check
* @param err The custom error message
* @return The array
* @throws std::runtime_error Thrown if there is no array under the desired
* key
*/
[[nodiscard]] ArrayType
arrayOrThrow(KeyType key, std::string_view err) const;
/**
* @brief Interface for fetching a sub section by key.
*
* Will attempt to fetch an entire section under the desired key and return
* it as a Config instance. If the section does not exist or another type is
* stored under the desired key - std::logic_error is thrown.
*
* @param key The key to check
* @return Section represented as a separate instance of Config
* @throws std::logic_error Thrown if there is no section under the
* desired key or the key is of invalid format
*/
[[nodiscard]] Config
section(KeyType key) const;
/**
* @brief Interface for fetching a sub section by key with a fallback object.
*
* Will attempt to fetch an entire section under the desired key and return
* it as a Config instance. If the section does not exist or another type is
* stored under the desired key - fallback object is used instead.
*
* @param key The key to check
* @param fallback The fallback object
* @return Section represented as a separate instance of Config
*/
[[nodiscard]] Config
sectionOr(KeyType key, boost::json::object fallback) const;
//
// Direct self-value access
//
/**
* @brief Interface for reading the value directly referred to by the
* instance. Wraps as std::optional.
*
* See @ref maybeValue(KeyType) const for how this works.
* @return Optional value
*/
template <typename Result>
[[nodiscard]] std::optional<Result>
maybeValue() const
{
if (store_.is_null())
return std::nullopt;
return std::make_optional<Result>(checkedAs<Result>("_self_", store_));
}
/**
* @brief Interface for reading the value directly referred to by the
* instance.
*
* See @ref value(KeyType) const for how this works.
* @return The value
*/
template <typename Result>
[[nodiscard]] Result
value() const
{
return maybeValue<Result>().value();
}
/**
* @brief Interface for reading the value directly referred to by the
* instance with user-specified fallback.
*
* See @ref valueOr(KeyType, Result) const for how this works.
* @param fallback The fallback value
* @return The value
*/
template <typename Result>
[[nodiscard]] Result
valueOr(Result fallback) const
{
return maybeValue<Result>().valueOr(fallback);
}
/**
* @brief Interface for reading the value directly referred to by the
* instance with user-specified error message.
*
* See @ref valueOrThrow(KeyType, std::string_view) const for how this
* works.
* @param err The custom error message
* @return The value
*/
template <typename Result>
[[nodiscard]] Result
valueOrThrow(std::string_view err) const
{
try {
return maybeValue<Result>().value();
} catch (std::exception const&) {
throw std::runtime_error(std::string{err});
}
}
/**
* @brief Interface for reading the array directly referred to by the
* instance.
*
* See @ref array(KeyType) const for how this works.
* @return The array
*/
[[nodiscard]] ArrayType
array() const;
/**
* @brief Method to convert a float seconds value to milliseconds.
*
* @param value The value to convert
* @return The value in milliseconds
*/
static std::chrono::milliseconds
toMilliseconds(float value);
private:
template <typename Return>
[[nodiscard]] Return
checkedAs(KeyType key, boost::json::value const& value) const
{
using boost::json::value_to;
auto errorIf = [&key, &value](bool condition) {
if (condition) {
throw std::runtime_error(
"Type for key '" + key + "' is '" + std::string{to_string(value.kind())} +
"' in JSON but requested '" + impl::typeName<Return>() + "'"
);
}
};
if constexpr (std::is_same_v<Return, bool>) {
errorIf(not value.is_bool());
} else if constexpr (std::is_same_v<Return, std::string>) {
errorIf(not value.is_string());
} else if constexpr (std::is_same_v<Return, double> or std::is_same_v<Return, float>) {
errorIf(not value.is_number());
} else if constexpr (std::is_convertible_v<Return, uint64_t> || std::is_convertible_v<Return, int64_t>) {
errorIf(not value.is_int64() && not value.is_uint64());
}
return value_to<Return>(value);
}
std::optional<boost::json::value>
lookup(KeyType key) const;
WriteCursorType
lookupForWrite(KeyType key);
};
/**
* @brief Simple configuration file reader.
*
* Reads the JSON file under specified path and creates a @ref Config object
* from its contents.
*/
class ConfigReader final {
public:
/**
* @brief Read in a configuration file
*
* @param path The path to the configuration file
* @return The configuration object
*/
static Config
open(std::filesystem::path path);
};
} // namespace util

View File

@@ -17,11 +17,11 @@
*/
//==============================================================================
#include "util/newconfig/ConfigConstraints.hpp"
#include "util/config/ConfigConstraints.hpp"
#include "rpc/RPCCenter.hpp"
#include "util/newconfig/Error.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/Error.hpp"
#include "util/config/Types.hpp"
#include <boost/asio/ip/address.hpp>

View File

@@ -20,9 +20,9 @@
#pragma once
#include "rpc/common/APIVersion.hpp"
#include "util/config/Error.hpp"
#include "util/config/Types.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/Error.hpp"
#include "util/newconfig/Types.hpp"
#include <fmt/core.h>
#include <fmt/format.h>

View File

@@ -17,20 +17,20 @@
*/
//==============================================================================
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/Assert.hpp"
#include "util/Constants.hpp"
#include "util/OverloadSet.hpp"
#include "util/newconfig/Array.hpp"
#include "util/newconfig/ArrayView.hpp"
#include "util/newconfig/ConfigConstraints.hpp"
#include "util/newconfig/ConfigFileInterface.hpp"
#include "util/newconfig/ConfigValue.hpp"
#include "util/newconfig/Error.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/newconfig/Types.hpp"
#include "util/newconfig/ValueView.hpp"
#include "util/config/Array.hpp"
#include "util/config/ArrayView.hpp"
#include "util/config/ConfigConstraints.hpp"
#include "util/config/ConfigFileInterface.hpp"
#include "util/config/ConfigValue.hpp"
#include "util/config/Error.hpp"
#include "util/config/ObjectView.hpp"
#include "util/config/Types.hpp"
#include "util/config/ValueView.hpp"
#include <fmt/core.h>

View File

@@ -21,14 +21,14 @@
#include "rpc/common/APIVersion.hpp"
#include "util/Assert.hpp"
#include "util/newconfig/Array.hpp"
#include "util/newconfig/ConfigConstraints.hpp"
#include "util/newconfig/ConfigFileInterface.hpp"
#include "util/newconfig/ConfigValue.hpp"
#include "util/newconfig/Error.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/newconfig/Types.hpp"
#include "util/newconfig/ValueView.hpp"
#include "util/config/Array.hpp"
#include "util/config/ConfigConstraints.hpp"
#include "util/config/ConfigFileInterface.hpp"
#include "util/config/ConfigValue.hpp"
#include "util/config/Error.hpp"
#include "util/config/ObjectView.hpp"
#include "util/config/Types.hpp"
#include "util/config/ValueView.hpp"
#include <algorithm>
#include <chrono>

View File

@@ -20,8 +20,8 @@
#pragma once
#include "util/Assert.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/Error.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/Error.hpp"
#include <fmt/core.h>

View File

@@ -19,7 +19,7 @@
#pragma once
#include "util/newconfig/Types.hpp"
#include "util/config/Types.hpp"
#include <optional>
#include <string_view>

View File

@@ -17,12 +17,12 @@
*/
//==============================================================================
#include "util/newconfig/ConfigFileJson.hpp"
#include "util/config/ConfigFileJson.hpp"
#include "util/Assert.hpp"
#include "util/newconfig/Array.hpp"
#include "util/newconfig/Error.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/Array.hpp"
#include "util/config/Error.hpp"
#include "util/config/Types.hpp"
#include <boost/json/array.hpp>
#include <boost/json/object.hpp>

View File

@@ -19,9 +19,9 @@
#pragma once
#include "util/newconfig/ConfigFileInterface.hpp"
#include "util/newconfig/Error.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/ConfigFileInterface.hpp"
#include "util/config/Error.hpp"
#include "util/config/Types.hpp"
#include <boost/json/object.hpp>

View File

@@ -19,8 +19,8 @@
#pragma once
#include "util/newconfig/ConfigFileInterface.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/ConfigFileInterface.hpp"
#include "util/config/Types.hpp"
#include <boost/filesystem/path.hpp>

View File

@@ -21,9 +21,9 @@
#include "util/Assert.hpp"
#include "util/OverloadSet.hpp"
#include "util/newconfig/ConfigConstraints.hpp"
#include "util/newconfig/Error.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/ConfigConstraints.hpp"
#include "util/config/Error.hpp"
#include "util/config/Types.hpp"
#include <fmt/core.h>

View File

@@ -17,12 +17,12 @@
*/
//==============================================================================
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include "util/Assert.hpp"
#include "util/newconfig/ArrayView.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ValueView.hpp"
#include "util/config/ArrayView.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ValueView.hpp"
#include <fmt/core.h>

View File

@@ -19,7 +19,7 @@
#pragma once
#include "util/newconfig/ValueView.hpp"
#include "util/config/ValueView.hpp"
#include <cstddef>
#include <functional>

View File

@@ -17,7 +17,7 @@
*/
//==============================================================================
#include "util/newconfig/Types.hpp"
#include "util/config/Types.hpp"
#include <cstdint>
#include <ostream>

View File

@@ -17,11 +17,11 @@
*/
//==============================================================================
#include "util/newconfig/ValueView.hpp"
#include "util/config/ValueView.hpp"
#include "util/Assert.hpp"
#include "util/newconfig/ConfigValue.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/ConfigValue.hpp"
#include "util/config/Types.hpp"
#include <cstdint>
#include <string>

View File

@@ -20,9 +20,9 @@
#pragma once
#include "util/Assert.hpp"
#include "util/newconfig/ConfigConstraints.hpp"
#include "util/newconfig/ConfigValue.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/ConfigConstraints.hpp"
#include "util/config/ConfigValue.hpp"
#include "util/config/Types.hpp"
#include <fmt/core.h>

View File

@@ -1,170 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of clio: https://github.com/XRPLF/clio
Copyright (c) 2022, the clio developers.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#pragma once
#include <cstdint>
#include <optional>
#include <queue>
#include <stdexcept>
#include <string>
#include <typeinfo>
namespace util::impl {
/**
* @brief Thrown when a KeyPath related error occurs
*/
struct KeyException : public ::std::logic_error {
KeyException(::std::string msg) : ::std::logic_error{msg}
{
}
};
/**
* @brief Thrown when a Store (config's storage) related error occurs.
*/
struct StoreException : public ::std::logic_error {
StoreException(::std::string msg) : ::std::logic_error{msg}
{
}
};
/**
* @brief Simple string tokenizer. Used by @ref Config.
*
* @tparam KeyType The type of key to use
* @tparam Separator The separator character
*/
template <typename KeyType, char Separator>
class Tokenizer final {
using opt_key_t = std::optional<KeyType>;
KeyType key_;
KeyType token_{};
std::queue<KeyType> tokens_{};
public:
explicit Tokenizer(KeyType key) : key_{key}
{
if (key.empty())
throw KeyException("Empty key");
for (auto const& c : key) {
if (c == Separator) {
saveToken();
} else {
token_ += c;
}
}
saveToken();
}
[[nodiscard]] opt_key_t
next()
{
if (tokens_.empty())
return std::nullopt;
auto token = tokens_.front();
tokens_.pop();
return std::make_optional(std::move(token));
}
private:
void
saveToken()
{
if (token_.empty())
throw KeyException("Empty token in key '" + key_ + "'.");
tokens_.push(std::move(token_));
token_ = {};
}
};
template <typename T>
static constexpr char const*
typeName()
{
return typeid(T).name();
}
template <>
constexpr char const*
typeName<uint64_t>()
{
return "uint64_t";
}
template <>
constexpr char const*
typeName<int64_t>()
{
return "int64_t";
}
template <>
constexpr char const*
typeName<uint32_t>()
{
return "uint32_t";
}
template <>
constexpr char const*
typeName<int32_t>()
{
return "int32_t";
}
template <>
constexpr char const*
typeName<bool>()
{
return "bool";
}
template <>
constexpr char const*
typeName<std::string>()
{
return "std::string";
}
template <>
constexpr char const*
typeName<char const*>()
{
return "const char*";
}
template <>
constexpr char const*
typeName<double>()
{
return "double";
}
template <>
constexpr char const*
typeName<float>()
{
return "float";
}
}; // namespace util::impl

View File

@@ -22,9 +22,9 @@
#include "util/Assert.hpp"
#include "util/BytesConverter.hpp"
#include "util/SourceLocation.hpp"
#include "util/newconfig/ArrayView.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ArrayView.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ObjectView.hpp"
#include <boost/algorithm/string/predicate.hpp>
#include <boost/date_time/posix_time/posix_time_duration.hpp>

View File

@@ -276,7 +276,7 @@ public:
LogService() = delete;
/**
* @brief Global log core initialization from a @ref Config
* @brief Global log core initialization from a @ref config::ClioConfigDefinition
*
* @param config The configuration to use
* @return Void on success, error message on failure

View File

@@ -20,7 +20,7 @@
#include "util/prometheus/Prometheus.hpp"
#include "util/Assert.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/prometheus/Bool.hpp"
#include "util/prometheus/Counter.hpp"
#include "util/prometheus/Gauge.hpp"

View File

@@ -20,7 +20,7 @@
#include "web/AdminVerificationStrategy.hpp"
#include "util/JsonUtils.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <boost/beast/http/field.hpp>
#include <xrpl/basics/base_uint.h>

View File

@@ -19,7 +19,7 @@
#pragma once
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <boost/beast/http.hpp>
#include <boost/beast/http/message.hpp>

View File

@@ -29,8 +29,8 @@
#include "util/JsonUtils.hpp"
#include "util/Profiler.hpp"
#include "util/Taggable.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "web/dosguard/DOSGuardInterface.hpp"
#include "web/impl/ErrorHandling.hpp"
#include "web/interface/ConnectionBase.hpp"

View File

@@ -20,10 +20,10 @@
#include "web/dosguard/DOSGuard.hpp"
#include "util/Assert.hpp"
#include "util/config/ArrayView.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ValueView.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ArrayView.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ValueView.hpp"
#include "web/dosguard/WeightsInterface.hpp"
#include "web/dosguard/WhitelistHandlerInterface.hpp"

View File

@@ -20,8 +20,8 @@
#pragma once
#include "util/Mutex.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "web/dosguard/DOSGuardInterface.hpp"
#include "web/dosguard/WeightsInterface.hpp"
#include "web/dosguard/WhitelistHandlerInterface.hpp"

View File

@@ -19,7 +19,7 @@
#include "web/dosguard/IntervalSweepHandler.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "web/dosguard/DOSGuardInterface.hpp"
#include <boost/asio/io_context.hpp>

View File

@@ -20,7 +20,7 @@
#pragma once
#include "util/Repeat.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <boost/asio/io_context.hpp>

View File

@@ -21,8 +21,8 @@
#include "rpc/JS.hpp"
#include "util/Assert.hpp"
#include "util/newconfig/ArrayView.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ArrayView.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <boost/json/object.hpp>
#include <xrpl/protocol/jss.h>

View File

@@ -20,7 +20,7 @@
#pragma once
#include "util/StringHash.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "web/dosguard/WeightsInterface.hpp"
#include <boost/json/object.hpp>

View File

@@ -19,9 +19,9 @@
#pragma once
#include "util/newconfig/ArrayView.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ValueView.hpp"
#include "util/config/ArrayView.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ValueView.hpp"
#include "web/Resolver.hpp"
#include "web/dosguard/WhitelistHandlerInterface.hpp"

View File

@@ -21,9 +21,9 @@
#include "util/Assert.hpp"
#include "util/Taggable.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ObjectView.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "web/ng/Connection.hpp"
#include "web/ng/MessageHandler.hpp"
#include "web/ng/ProcessingPolicy.hpp"

View File

@@ -20,8 +20,8 @@
#pragma once
#include "util/Taggable.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/log/Logger.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "web/ng/Connection.hpp"
#include "web/ng/MessageHandler.hpp"
#include "web/ng/ProcessingPolicy.hpp"

View File

@@ -19,7 +19,7 @@
#include "web/ng/impl/ServerSslContext.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <boost/asio/buffer.hpp>
#include <boost/asio/ssl/context.hpp>

View File

@@ -19,7 +19,7 @@
#pragma once
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <boost/asio/ssl/context.hpp>

View File

@@ -18,7 +18,7 @@
//==============================================================================
#include "util/MockMigrationBackend.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <memory>

View File

@@ -23,7 +23,7 @@
#include "data/DBHelpers.hpp"
#include "data/LedgerCache.hpp"
#include "data/Types.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <boost/asio/spawn.hpp>
#include <boost/json/object.hpp>

View File

@@ -22,7 +22,7 @@
#include "data/BackendInterface.hpp"
#include "util/LoggerFixtures.hpp"
#include "util/MockBackend.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <gmock/gmock.h>

View File

@@ -21,7 +21,7 @@
#include "util/LoggerFixtures.hpp"
#include "util/MockMigrationBackend.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/config/ConfigDefinition.hpp"
#include <gmock/gmock.h>

View File

@@ -21,9 +21,9 @@
#include "util/Assert.hpp"
#include "util/Concepts.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ConfigValue.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ConfigValue.hpp"
#include "util/config/Types.hpp"
#include "util/prometheus/Bool.hpp"
#include "util/prometheus/Counter.hpp"
#include "util/prometheus/Gauge.hpp"

View File

@@ -23,7 +23,7 @@
#include "etl/Source.hpp"
#include "feed/SubscriptionManagerInterface.hpp"
#include "rpc/Errors.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <boost/asio/io_context.hpp>
#include <boost/asio/spawn.hpp>

View File

@@ -23,7 +23,7 @@
#include "etlng/Source.hpp"
#include "feed/SubscriptionManagerInterface.hpp"
#include "rpc/Errors.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <boost/asio/io_context.hpp>
#include <boost/asio/spawn.hpp>

View File

@@ -20,9 +20,9 @@
#pragma once
#include "util/Taggable.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ConfigValue.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ConfigValue.hpp"
#include "util/config/Types.hpp"
#include "web/SubscriptionContextInterface.hpp"
#include "web/interface/ConnectionBase.hpp"

View File

@@ -19,11 +19,11 @@
#pragma once
#include "util/newconfig/Array.hpp"
#include "util/newconfig/ConfigConstraints.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ConfigValue.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/Array.hpp"
#include "util/config/ConfigConstraints.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ConfigValue.hpp"
#include "util/config/Types.hpp"
#include <gtest/gtest.h>

View File

@@ -22,11 +22,11 @@
#include "data/cassandra/Handle.hpp"
#include "util/AsioContextTestFixture.hpp"
#include "util/MockPrometheus.hpp"
#include "util/newconfig/ConfigConstraints.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ConfigFileJson.hpp"
#include "util/newconfig/ConfigValue.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/ConfigConstraints.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ConfigFileJson.hpp"
#include "util/config/ConfigValue.hpp"
#include "util/config/Types.hpp"
#include <TestGlobals.hpp>
#include <boost/json/parse.hpp>

View File

@@ -34,9 +34,9 @@
#include "util/MockPrometheus.hpp"
#include "util/Random.hpp"
#include "util/StringUtils.hpp"
#include "util/newconfig/ConfigValue.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/ConfigValue.hpp"
#include "util/config/ObjectView.hpp"
#include "util/config/Types.hpp"
#include <TestGlobals.hpp>
#include <boost/asio/impl/spawn.hpp>

View File

@@ -35,10 +35,10 @@
#include "util/CassandraDBHelper.hpp"
#include "util/LoggerFixtures.hpp"
#include "util/MockPrometheus.hpp"
#include "util/newconfig/ConfigConstraints.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ConfigValue.hpp"
#include "util/newconfig/Types.hpp"
#include "util/config/ConfigConstraints.hpp"
#include "util/config/ConfigDefinition.hpp"
#include "util/config/ConfigValue.hpp"
#include "util/config/Types.hpp"
#include <TestGlobals.hpp>
#include <gtest/gtest.h>

View File

@@ -19,7 +19,7 @@
#include "migration/cassandra/ExampleDropTableMigrator.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <memory>

View File

@@ -20,7 +20,7 @@
#pragma once
#include "migration/cassandra/CassandraMigrationTestBackend.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <memory>

View File

@@ -22,7 +22,7 @@
#include "data/BackendInterface.hpp"
#include "data/DBHelpers.hpp"
#include "util/Assert.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <boost/asio/spawn.hpp>

View File

@@ -20,7 +20,7 @@
#pragma once
#include "migration/cassandra/CassandraMigrationTestBackend.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <memory>

View File

@@ -21,7 +21,7 @@
#include "migration/cassandra/impl/ObjectsAdapter.hpp"
#include "migration/cassandra/impl/Types.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <xrpl/basics/base_uint.h>
#include <xrpl/protocol/LedgerFormats.h>

View File

@@ -20,7 +20,7 @@
#pragma once
#include "migration/cassandra/CassandraMigrationTestBackend.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <xrpl/protocol/STLedgerEntry.h>
#include <xrpl/protocol/STObject.h>

View File

@@ -23,7 +23,7 @@
#include "migration/cassandra/impl/TransactionsAdapter.hpp"
#include "migration/cassandra/impl/Types.hpp"
#include "util/Mutex.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <xrpl/basics/base_uint.h>
#include <xrpl/protocol/STBase.h>

View File

@@ -20,7 +20,7 @@
#pragma once
#include "migration/cassandra/CassandraMigrationTestBackend.hpp"
#include "util/newconfig/ObjectView.hpp"
#include "util/config/ObjectView.hpp"
#include <cstdint>
#include <memory>

View File

@@ -3,7 +3,6 @@ add_executable(clio_tests)
target_sources(
clio_tests
PRIVATE # Common
ConfigTests.cpp
app/CliArgsTests.cpp
app/StopperTests.cpp
app/VerifyConfigTests.cpp
@@ -195,15 +194,14 @@ target_sources(
web/RPCServerHandlerTests.cpp
web/ServerTests.cpp
web/SubscriptionContextTests.cpp
# New Config
util/newconfig/ArrayTests.cpp
util/newconfig/ArrayViewTests.cpp
util/newconfig/ClioConfigDefinitionTests.cpp
util/newconfig/ConfigConstraintsTests.cpp
util/newconfig/ConfigValueTests.cpp
util/newconfig/ObjectViewTests.cpp
util/newconfig/ConfigFileJsonTests.cpp
util/newconfig/ValueViewTests.cpp
# Config
util/config/ArrayTests.cpp
util/config/ArrayViewTests.cpp
util/config/ClioConfigDefinitionTests.cpp
util/config/ConfigValueTests.cpp
util/config/ObjectViewTests.cpp
util/config/ConfigFileJsonTests.cpp
util/config/ValueViewTests.cpp
)
# See https://github.com/google/googletest/issues/3475

Some files were not shown because too many files have changed in this diff Show More