Files
clio/src/migration/impl/Spec.hpp
Alex Kremer 4e85398aed chore: Remove more copyrights from code (#3012)
More copyrights detected following #2975
2026-03-24 15:33:12 +00:00

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