mirror of
https://github.com/XRPLF/clio.git
synced 2026-08-21 04:30:52 +00:00
38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include "util/config/ObjectView.hpp"
|
|
|
|
#include <boost/asio/spawn.hpp>
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
namespace migration::impl {
|
|
|
|
/**
|
|
* @brief The migrator specification concept
|
|
*/
|
|
template <typename T, typename Backend>
|
|
concept MigratorSpec =
|
|
requires(std::shared_ptr<Backend> const& backend, util::config::ObjectView const& cfg) {
|
|
// Check that 'kNAME' exists and is a string
|
|
{ T::kNAME } -> std::convertible_to<std::string>;
|
|
|
|
// Check that 'kDESCRIPTION' exists and is a string
|
|
{ T::kDESCRIPTION } -> std::convertible_to<std::string>;
|
|
|
|
// Check that the migrator specifies the backend type it supports
|
|
typename T::Backend;
|
|
|
|
// Check that 'runMigration' exists and is callable
|
|
{ T::runMigration(backend, cfg) } -> std::same_as<void>;
|
|
};
|
|
|
|
/**
|
|
* @brief used by variadic template to check all migrators are MigratorSpec
|
|
*/
|
|
template <typename... Types>
|
|
concept AllMigratorSpec = (MigratorSpec<Types, typename Types::Backend> && ...);
|
|
|
|
} // namespace migration::impl
|