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

@@ -21,6 +21,7 @@
#include "data/cassandra/impl/ManagedObject.hpp"
#include "data/cassandra/impl/Tuple.hpp"
#include "util/UnsupportedType.hpp"
#include <cassandra.h>
#include <xrpl/basics/base_uint.h>
@@ -41,9 +42,6 @@
namespace data::cassandra::impl {
template <typename>
static constexpr bool unsupported_v = false;
template <typename Type>
inline Type
extractColumn(CassRow const* row, std::size_t idx)
@@ -103,7 +101,7 @@ extractColumn(CassRow const* row, std::size_t idx)
output = static_cast<DecayedType>(out);
} else {
// type not supported for extraction
static_assert(unsupported_v<DecayedType>);
static_assert(util::Unsupported<DecayedType>);
}
return output;

View File

@@ -23,6 +23,7 @@
#include "data/cassandra/impl/Collection.hpp"
#include "data/cassandra/impl/ManagedObject.hpp"
#include "data/cassandra/impl/Tuple.hpp"
#include "util/UnsupportedType.hpp"
#include <cassandra.h>
#include <fmt/core.h>
@@ -44,9 +45,6 @@ namespace data::cassandra::impl {
class Statement : public ManagedObject<CassStatement> {
static constexpr auto deleter = [](CassStatement* ptr) { cass_statement_free(ptr); };
template <typename>
static constexpr bool unsupported_v = false;
public:
/**
* @brief Construct a new statement with optionally provided arguments.
@@ -141,7 +139,7 @@ public:
throwErrorIfNeeded(rc, "Bind int64");
} else {
// type not supported for binding
static_assert(unsupported_v<DecayedType>);
static_assert(util::Unsupported<DecayedType>);
}
}
};

View File

@@ -20,6 +20,7 @@
#pragma once
#include "data/cassandra/impl/ManagedObject.hpp"
#include "util/UnsupportedType.hpp"
#include <cassandra.h>
#include <xrpl/basics/base_uint.h>
@@ -38,9 +39,6 @@ namespace data::cassandra::impl {
class Tuple : public ManagedObject<CassTuple> {
static constexpr auto deleter = [](CassTuple* ptr) { cass_tuple_free(ptr); };
template <typename>
static constexpr bool unsupported_v = false;
public:
/* implicit */ Tuple(CassTuple* ptr);
@@ -91,15 +89,12 @@ public:
throwErrorIfNeeded(rc, "Bind ripple::uint256");
} else {
// type not supported for binding
static_assert(unsupported_v<DecayedType>);
static_assert(util::Unsupported<DecayedType>);
}
}
};
class TupleIterator : public ManagedObject<CassIterator> {
template <typename>
static constexpr bool unsupported_v = false;
public:
/* implicit */ TupleIterator(CassIterator* ptr);
@@ -141,7 +136,7 @@ private:
output = static_cast<DecayedType>(out);
} else {
// type not supported for extraction
static_assert(unsupported_v<DecayedType>);
static_assert(util::Unsupported<DecayedType>);
}
return output;